@ltm-blueverse/alpha-hub-studio 0.7.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.
Files changed (57) hide show
  1. package/README.md +22 -0
  2. package/package.json +23 -0
  3. package/static/apple-touch-icon.png +0 -0
  4. package/static/assets/DecisionWorkspace-DG6zPNls.js +1 -0
  5. package/static/assets/DiffMergeWorkspace-C8yIdDC7.js +1 -0
  6. package/static/assets/EntityResolutionTab-RBysMLhB.js +6 -0
  7. package/static/assets/GraphInspectorPanel-Bbrbhd03.js +1 -0
  8. package/static/assets/GraphWorkspace-AxTFEhNP.js +1116 -0
  9. package/static/assets/ImportExportWorkspace-BK3TofDv.js +6 -0
  10. package/static/assets/KGOverviewTab-D9EWKL_n.js +1 -0
  11. package/static/assets/LineageDiagram-XxBVa1Ij.js +27 -0
  12. package/static/assets/MarkdownContentViewer-Chx4ysCK.js +45 -0
  13. package/static/assets/MemoryWorkspace-CIjaTN_S.js +6 -0
  14. package/static/assets/OntologySummaryTab-NJ3ZrkoJ.js +1 -0
  15. package/static/assets/ReasoningWorkspace-B127Rd-S.js +19 -0
  16. package/static/assets/RegistryTab-BE2-yKLC.js +11 -0
  17. package/static/assets/SparqlWorkspace-RwPj2YK7.js +26 -0
  18. package/static/assets/TimelinePanel-DmtiXgmN.js +36 -0
  19. package/static/assets/VocabularyWorkspace-YF9waL5N.js +44 -0
  20. package/static/assets/book-open-BqEIxx1e.js +6 -0
  21. package/static/assets/chevron-right-CiEuNwKq.js +11 -0
  22. package/static/assets/circle-check-BToWKwbO.js +6 -0
  23. package/static/assets/copy-BfQXGhHP.js +6 -0
  24. package/static/assets/download-gQOgYz3q.js +6 -0
  25. package/static/assets/external-link-DqNu6T-f.js +6 -0
  26. package/static/assets/file-text-Bbz-r0FQ.js +6 -0
  27. package/static/assets/git-branch-B8yDcUSY.js +6 -0
  28. package/static/assets/graph-vendor-CUDaIrp7.js +312 -0
  29. package/static/assets/graphTheme-DNKLxzKZ.js +6 -0
  30. package/static/assets/hero-B5GXDCBc.png +0 -0
  31. package/static/assets/index-Bt8w1Tz_.css +1 -0
  32. package/static/assets/index-C00aFykz.js +9 -0
  33. package/static/assets/index-DHWWI-uw.js +1730 -0
  34. package/static/assets/index-Dli_3Iwd.js +22 -0
  35. package/static/assets/index-DtC_GayB.js +16 -0
  36. package/static/assets/index-MVDNL3vw.js +127 -0
  37. package/static/assets/info-vaffNQOD.js +6 -0
  38. package/static/assets/layers-Cct6D_wK.js +6 -0
  39. package/static/assets/loader-circle-C8NUmtFx.js +6 -0
  40. package/static/assets/neighborhoodPanelPlugin-w1yJlm0A.js +1 -0
  41. package/static/assets/pencil-DYlEC6ri.js +6 -0
  42. package/static/assets/play-G1gyOk2a.js +6 -0
  43. package/static/assets/queries-CYtdSB4H.js +1 -0
  44. package/static/assets/query-vendor-BqVbYexz.js +34 -0
  45. package/static/assets/refresh-cw-CL9OXZ89.js +6 -0
  46. package/static/assets/registryStore-MVt_NgVV.js +1 -0
  47. package/static/assets/style-BZV40eAE.css +1 -0
  48. package/static/assets/style-D8TqSrGs.js +15 -0
  49. package/static/assets/temporalOverlayPlugin-CRhLa1FU.js +1 -0
  50. package/static/assets/timeline-vendor-WyY-t3YQ.js +97 -0
  51. package/static/assets/timeline-vendor-lG7zfUUF.css +1 -0
  52. package/static/assets/trash-2-DiZNV6Gj.js +6 -0
  53. package/static/assets/x-DpqMYq96.js +6 -0
  54. package/static/favicon-32.png +0 -0
  55. package/static/favicon.svg +13 -0
  56. package/static/icons.svg +24 -0
  57. package/static/index.html +18 -0
@@ -0,0 +1,15 @@
1
+ import{r as ia,g as sa,R as aa,a as T,j as P}from"./query-vendor-BqVbYexz.js";import{r as ca}from"./index-C00aFykz.js";import{f as la}from"./index-DHWWI-uw.js";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 ua={value:()=>{}};function Gt(){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 Pt(n)}function Pt(e){this._=e}function da(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}})}Pt.prototype=Gt.prototype={constructor:Pt,on:function(e,t){var n=this._,o=da(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=fa(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]=uo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=uo(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 Pt(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 fa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function uo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ua,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var _n="http://www.w3.org/1999/xhtml";const fo={svg:"http://www.w3.org/2000/svg",xhtml:_n,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)),fo.hasOwnProperty(t)?{space:fo[t],local:e}:e}function ha(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===_n&&t.documentElement.namespaceURI===_n?t.createElement(e):t.createElementNS(n,e)}}function ga(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pr(e){var t=Kt(e);return(t.local?ga:ha)(t)}function pa(){}function Rn(e){return e==null?pa:function(){return this.querySelector(e)}}function ma(e){typeof e!="function"&&(e=Rn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function ya(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xa(){return[]}function mr(e){return e==null?xa:function(){return this.querySelectorAll(e)}}function wa(e){return function(){return ya(e.apply(this,arguments))}}function va(e){typeof e=="function"?e=wa(e):e=mr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new le(o,r)}function yr(e){return function(){return this.matches(e)}}function xr(e){return function(t){return t.matches(e)}}var ba=Array.prototype.find;function _a(e){return function(){return ba.call(this.children,e)}}function Ea(){return this.firstElementChild}function Sa(e){return this.select(e==null?Ea:_a(typeof e=="function"?e:xr(e)))}var Na=Array.prototype.filter;function Ca(){return Array.from(this.children)}function Ma(e){return function(){return Na.call(this.children,e)}}function Ia(e){return this.selectAll(e==null?Ca:Ma(typeof e=="function"?e:xr(e)))}function ka(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new le(o,this._parents)}function wr(e){return new Array(e.length)}function Aa(){return new le(this._enter||this._groups.map(wr),this._parents)}function Rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Rt.prototype={constructor:Rt,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 $a(e){return function(){return e}}function Pa(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Rt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Da(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(f[a]=p=s.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<d;++a)p=s.call(e,i[a],a,i)+"",(l=c.get(p))?(o[a]=l,l.__data__=i[a],c.delete(p)):n[a]=new Rt(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Ta(e){return e.__data__}function za(e,t){if(!arguments.length)return Array.from(this,Ta);var n=t?Da:Pa,o=this._parents,r=this._groups;typeof e!="function"&&(e=$a(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,p=Ha(e.call(u,u&&u.__data__,c,o)),g=p.length,w=a[c]=new Array(g),x=s[c]=new Array(g),m=l[c]=new Array(f);n(u,d,w,x,m,p,t);for(var _=0,h=0,y,S;_<g;++_)if(y=w[_]){for(_>=h&&(h=_+1);!(S=x[h])&&++h<g;);y._next=S||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function Ha(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ra(){return new le(this._exit||this._groups.map(wr),this._parents)}function La(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Oa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),p,g=0;g<d;++g)(p=c[g]||u[g])&&(f[g]=p);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Va(){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 Ba(e){e||(e=Fa);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],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function Fa(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ja(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Xa(){return Array.from(this)}function Ya(){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 Za(){let e=0;for(const t of this)++e;return e}function Wa(){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,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Ga(e){return function(){this.removeAttribute(e)}}function Ka(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ua(e,t){return function(){this.setAttribute(e,t)}}function Qa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ja(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ec(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function tc(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?Ka:Ga:typeof t=="function"?n.local?ec:Ja:n.local?Qa:Ua)(n,t))}function vr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nc(e){return function(){this.style.removeProperty(e)}}function oc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function rc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ic(e,t,n){return arguments.length>1?this.each((t==null?nc:typeof t=="function"?rc:oc)(e,t,n??"")):Xe(this.node(),e)}function Xe(e,t){return e.style.getPropertyValue(t)||vr(e).getComputedStyle(e,null).getPropertyValue(t)}function sc(e){return function(){delete this[e]}}function ac(e,t){return function(){this[e]=t}}function cc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lc(e,t){return arguments.length>1?this.each((t==null?sc:typeof t=="function"?cc:ac)(e,t)):this.node()[e]}function br(e){return e.trim().split(/^|\s+/)}function Ln(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=br(e.getAttribute("class")||"")}_r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Er(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Sr(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function uc(e){return function(){Er(this,e)}}function dc(e){return function(){Sr(this,e)}}function fc(e,t){return function(){(t.apply(this,arguments)?Er:Sr)(this,e)}}function hc(e,t){var n=br(e+"");if(arguments.length<2){for(var o=Ln(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?fc:t?uc:dc)(n,t))}function gc(){this.textContent=""}function pc(e){return function(){this.textContent=e}}function mc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function yc(e){return arguments.length?this.each(e==null?gc:(typeof e=="function"?mc:pc)(e)):this.node().textContent}function xc(){this.innerHTML=""}function wc(e){return function(){this.innerHTML=e}}function vc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function bc(e){return arguments.length?this.each(e==null?xc:(typeof e=="function"?vc:wc)(e)):this.node().innerHTML}function _c(){this.nextSibling&&this.parentNode.appendChild(this)}function Ec(){return this.each(_c)}function Sc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Nc(){return this.each(Sc)}function Cc(e){var t=typeof e=="function"?e:pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Mc(){return null}function Ic(e,t){var n=typeof e=="function"?e:pr(e),o=t==null?Mc:typeof t=="function"?t:Rn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function kc(){var e=this.parentNode;e&&e.removeChild(this)}function Ac(){return this.each(kc)}function $c(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dc(e){return this.select(e?Pc:$c)}function Tc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function zc(e){return function(t){e.call(this,t,this.__data__)}}function Hc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Rc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Lc(e,t,n){return function(){var o=this.__on,r,i=zc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Oc(e,t,n){var o=Hc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Lc:Rc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Nr(e,t,n){var o=vr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Vc(e,t){return function(){return Nr(this,e,t)}}function Bc(e,t){return function(){return Nr(this,e,t.apply(this,arguments))}}function Fc(e,t){return this.each((typeof t=="function"?Bc:Vc)(e,t))}function*jc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Cr=[null];function le(e,t){this._groups=e,this._parents=t}function mt(){return new le([[document.documentElement]],Cr)}function Xc(){return this}le.prototype=mt.prototype={constructor:le,select:ma,selectAll:va,selectChild:Sa,selectChildren:Ia,filter:ka,data:za,enter:Aa,exit:Ra,join:La,merge:Oa,selection:Xc,order:Va,sort:Ba,call:ja,nodes:Xa,node:Ya,size:Za,empty:Wa,each:qa,attr:tc,style:ic,property:lc,classed:hc,text:yc,html:bc,raise:Ec,lower:Nc,append:Cc,insert:Ic,remove:Ac,clone:Dc,datum:Tc,on:Oc,dispatch:Fc,[Symbol.iterator]:jc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Cr)}function Yc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Yc(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 Zc={passive:!1},at={capture:!0,passive:!1};function dn(e){e.stopImmediatePropagation()}function Fe(e){e.preventDefault(),e.stopImmediatePropagation()}function Mr(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Fe,at);"onselectstart"in t?n.on("selectstart.drag",Fe,at):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ir(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Fe,at),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 Et=e=>()=>e;function En(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}En.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Wc(e){return!e.ctrlKey&&!e.button}function qc(){return this.parentNode}function Gc(e,t){return t??{x:e.x,y:e.y}}function Kc(){return navigator.maxTouchPoints||"ontouchstart"in this}function kr(){var e=Wc,t=qc,n=Gc,o=Kc,r={},i=Gt("start","drag","end"),s=0,a,l,c,u,d=0;function f(y){y.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Zc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(y,S){if(!(u||!e.call(this,y,S))){var b=h(this,t.call(this,y,S),y,S,"mouse");b&&(ce(y.view).on("mousemove.drag",g,at).on("mouseup.drag",w,at),Mr(y.view),dn(y),c=!1,a=y.clientX,l=y.clientY,b("start",y))}}function g(y){if(Fe(y),!c){var S=y.clientX-a,b=y.clientY-l;c=S*S+b*b>d}r.mouse("drag",y)}function w(y){ce(y.view).on("mousemove.drag mouseup.drag",null),Ir(y.view,c),Fe(y),r.mouse("end",y)}function x(y,S){if(e.call(this,y,S)){var b=y.changedTouches,C=t.call(this,y,S),A=b.length,$,V;for($=0;$<A;++$)(V=h(this,C,y,S,b[$].identifier,b[$]))&&(dn(y),V("start",y,b[$]))}}function m(y){var S=y.changedTouches,b=S.length,C,A;for(C=0;C<b;++C)(A=r[S[C].identifier])&&(Fe(y),A("drag",y,S[C]))}function _(y){var S=y.changedTouches,b=S.length,C,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<b;++C)(A=r[S[C].identifier])&&(dn(y),A("end",y,S[C]))}function h(y,S,b,C,A,$){var V=i.copy(),k=de($||b,S),z,O,v;if((v=n.call(y,new En("beforestart",{sourceEvent:b,target:f,identifier:A,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:V}),C))!=null)return z=v.x-k[0]||0,O=v.y-k[1]||0,function N(E,I,M){var D=k,H;switch(E){case"start":r[A]=N,H=s++;break;case"end":delete r[A],--s;case"drag":k=de(M||I,S),H=s;break}V.call(E,y,new En(E,{sourceEvent:I,subject:v,target:f,identifier:A,active:H,x:k[0]+z,y:k[1]+O,dx:k[0]-D[0],dy:k[1]-D[1],dispatch:V}),C)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Et(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:Et(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:Et(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:Et(!!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 On(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ar(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function yt(){}var ct=.7,Lt=1/ct,je="\\s*([+-]?\\d+)\\s*",lt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uc=/^#([0-9a-f]{3,8})$/,Qc=new RegExp(`^rgb\\(${je},${je},${je}\\)$`),Jc=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),el=new RegExp(`^rgba\\(${je},${je},${je},${lt}\\)$`),tl=new RegExp(`^rgba\\(${ye},${ye},${ye},${lt}\\)$`),nl=new RegExp(`^hsl\\(${lt},${ye},${ye}\\)$`),ol=new RegExp(`^hsla\\(${lt},${ye},${ye},${lt}\\)$`),ho={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};On(yt,Te,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:go,formatHex:go,formatHex8:rl,formatHsl:il,formatRgb:po,toString:po});function go(){return this.rgb().formatHex()}function rl(){return this.rgb().formatHex8()}function il(){return $r(this).formatHsl()}function po(){return this.rgb().formatRgb()}function Te(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Uc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?mo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?St(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?St(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=Qc.exec(e))?new ae(t[1],t[2],t[3],1):(t=Jc.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=el.exec(e))?St(t[1],t[2],t[3],t[4]):(t=tl.exec(e))?St(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nl.exec(e))?wo(t[1],t[2]/100,t[3]/100,1):(t=ol.exec(e))?wo(t[1],t[2]/100,t[3]/100,t[4]):ho.hasOwnProperty(e)?mo(ho[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function mo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function St(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function sl(e){return e instanceof yt||(e=Te(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Sn(e,t,n,o){return arguments.length===1?sl(e):new ae(e,t,n,o??1)}function ae(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}On(ae,Sn,Ar(yt,{brighter(e){return e=e==null?Lt:Math.pow(Lt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ct:Math.pow(ct,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Pe(this.r),Pe(this.g),Pe(this.b),Ot(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:yo,formatHex:yo,formatHex8:al,formatRgb:xo,toString:xo}));function yo(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}`}function al(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}${$e((isNaN(this.opacity)?1:this.opacity)*255)}`}function xo(){const e=Ot(this.opacity);return`${e===1?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${e===1?")":`, ${e})`}`}function Ot(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $e(e){return e=Pe(e),(e<16?"0":"")+e.toString(16)}function wo(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 $r(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof yt||(e=Te(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,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new fe(s,a,l,e.opacity)}function cl(e,t,n,o){return arguments.length===1?$r(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}On(fe,cl,Ar(yt,{brighter(e){return e=e==null?Lt:Math.pow(Lt,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ct:Math.pow(ct,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 ae(fn(e>=240?e-240:e+120,r,o),fn(e,r,o),fn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(vo(this.h),Nt(this.s),Nt(this.l),Ot(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=Ot(this.opacity);return`${e===1?"hsl(":"hsla("}${vo(this.h)}, ${Nt(this.s)*100}%, ${Nt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vo(e){return e=(e||0)%360,e<0?e+360:e}function Nt(e){return Math.max(0,Math.min(1,e||0))}function fn(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 Vn=e=>()=>e;function ll(e,t){return function(n){return e+n*t}}function ul(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 dl(e){return(e=+e)==1?Pr:function(t,n){return n-t?ul(t,n,e):Vn(isNaN(t)?n:t)}}function Pr(e,t){var n=t-e;return n?ll(e,n):Vn(isNaN(e)?t:e)}const Vt=(function e(t){var n=dl(t);function o(r,i){var s=n((r=Sn(r)).r,(i=Sn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=Pr(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function fl(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 hl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gl(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]=it(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function pl(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 ml(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]=it(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Nn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hn=new RegExp(Nn.source,"g");function yl(e){return function(){return e}}function xl(e){return function(t){return e(t)+""}}function Dr(e,t){var n=Nn.lastIndex=hn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Nn.exec(e))&&(r=hn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:me(o,r)})),n=hn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?xl(l[0].x):yl(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function it(e,t){var n=typeof t,o;return t==null||n==="boolean"?Vn(t):(n==="number"?me:n==="string"?(o=Te(t))?(t=o,Vt):Dr:t instanceof Te?Vt:t instanceof Date?pl:hl(t)?fl:Array.isArray(t)?gl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ml:me)(e,t)}var bo=180/Math.PI,Cn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tr(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*bo,skewX:Math.atan(l)*bo,scaleX:s,scaleY:a}}var Ct;function wl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Cn:Tr(t.a,t.b,t.c,t.d,t.e,t.f)}function vl(e){return e==null||(Ct||(Ct=document.createElementNS("http://www.w3.org/2000/svg","g")),Ct.setAttribute("transform",e),!(e=Ct.transform.baseVal.consolidate()))?Cn:(e=e.matrix,Tr(e.a,e.b,e.c,e.d,e.e,e.f))}function zr(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,p,g){if(c!==d||u!==f){var w=p.push("translate(",null,t,null,n);g.push({i:w-4,x:me(c,d)},{i:w-2,x:me(u,f)})}else(d||f)&&p.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:me(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:me(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,p,g){if(c!==d||u!==f){var w=p.push(r(p)+"scale(",null,",",null,")");g.push({i:w-4,x:me(c,d)},{i:w-2,x:me(u,f)})}else(d!==1||f!==1)&&p.push(r(p)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(p){for(var g=-1,w=f.length,x;++g<w;)d[(x=f[g]).i]=x.x(p);return d.join("")}}}var bl=zr(wl,"px, ","px)","deg)"),_l=zr(vl,", ",")",")"),El=1e-12;function _o(e){return((e=Math.exp(e))+1/e)/2}function Sl(e){return((e=Math.exp(e))-1/e)/2}function Nl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Dt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],p=u-a,g=d-l,w=p*p+g*g,x,m;if(w<El)m=Math.log(f/c)/t,x=function(C){return[a+C*p,l+C*g,c*Math.exp(t*C*m)]};else{var _=Math.sqrt(w),h=(f*f-c*c+o*w)/(2*c*n*_),y=(f*f-c*c-o*w)/(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,x=function(C){var A=C*m,$=_o(S),V=c/(n*_)*($*Nl(t*A+S)-Sl(S));return[a+V*p,l+V*g,c*$/_o(t*A+S)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Ye=0,ot=0,tt=0,Hr=1e3,Bt,rt,Ft=0,ze=0,Ut=0,ut=typeof performance=="object"&&performance.now?performance:Date,Rr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return ze||(Rr(Cl),ze=ut.now()+Ut)}function Cl(){ze=0}function jt(){this._call=this._time=this._next=null}jt.prototype=Lr.prototype={constructor:jt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bn():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:Bt=this,rt=this),this._call=e,this._time=n,Mn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mn())}};function Lr(e,t,n){var o=new jt;return o.restart(e,t,n),o}function Ml(){Bn(),++Ye;for(var e=Bt,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ye}function Eo(){ze=(Ft=ut.now())+Ut,Ye=ot=0;try{Ml()}finally{Ye=0,kl(),ze=0}}function Il(){var e=ut.now(),t=e-Ft;t>Hr&&(Ut-=t,Ft=e)}function kl(){for(var e,t=Bt,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:Bt=n);rt=e,Mn(o)}function Mn(e){if(!Ye){ot&&(ot=clearTimeout(ot));var t=e-ze;t>24?(e<1/0&&(ot=setTimeout(Eo,e-ut.now()-Ut)),tt&&(tt=clearInterval(tt))):(tt||(Ft=ut.now(),tt=setInterval(Il,Hr)),Ye=1,Rr(Eo))}}function So(e,t,n){var o=new jt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Al=Gt("start","end","cancel","interrupt"),$l=[],Or=0,No=1,In=2,Tt=3,Co=4,kn=5,zt=6;function Qt(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Pl(e,n,{name:t,index:o,group:r,on:Al,tween:$l,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Or})}function Fn(e,t){var n=pe(e,t);if(n.state>Or)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=pe(e,t);if(n.state>Tt)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 Pl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Lr(i,0,n.time);function i(c){n.state=No,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,p;if(n.state!==No)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Tt)return So(s);p.state===Co?(p.state=zt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=zt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(So(function(){n.state===Tt&&(n.state=Co,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=In,n.on.call("start",e,e.__data__,n.index,n.group),n.state===In){for(n.state=Tt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=p);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=kn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===kn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=zt,n.timer.stop(),delete o[t];for(var c 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>In&&o.state<kn,o.state=zt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Dl(e){return this.each(function(){Ht(this,e)})}function Tl(e,t){var n,o;return function(){var r=xe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function zl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=xe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Hl(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?Tl:zl)(n,e,t))}function jn(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return pe(r,o).value[t]}}function Vr(e,t){var n;return(typeof t=="number"?me:t instanceof Te?Vt:(n=Te(t))?(t=n,Vt):Dr)(e,t)}function Rl(e){return function(){this.removeAttribute(e)}}function Ll(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ol(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Vl(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 Bl(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Fl(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function jl(e,t){var n=Kt(e),o=n==="transform"?_l:Vr;return this.attrTween(e,typeof t=="function"?(n.local?Fl:Bl)(n,o,jn(this,"attr."+e,t)):t==null?(n.local?Ll:Rl)(n):(n.local?Vl:Ol)(n,o,t))}function Xl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Yl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Zl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Yl(e,i)),n}return r._value=t,r}function Wl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Xl(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?Zl:Wl)(o,t))}function Gl(e,t){return function(){Fn(this,e).delay=+t.apply(this,arguments)}}function Kl(e,t){return t=+t,function(){Fn(this,e).delay=t}}function Ul(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Gl:Kl)(t,e)):pe(this.node(),t).delay}function Ql(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function Jl(e,t){return t=+t,function(){xe(this,e).duration=t}}function eu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ql:Jl)(t,e)):pe(this.node(),t).duration}function tu(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function nu(e){var t=this._id;return arguments.length?this.each(tu(t,e)):pe(this.node(),t).ease}function ou(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function ru(e){if(typeof e!="function")throw new Error;return this.each(ou(this._id,e))}function iu(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function su(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,p=0;p<u;++p)(f=l[p]||c[p])&&(d[p]=f);for(;a<o;++a)s[a]=t[a];return new _e(s,this._parents,this._name,this._id)}function au(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 cu(e,t,n){var o,r,i=au(t)?Fn:xe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function lu(e,t){var n=this._id;return arguments.length<2?pe(this.node(),n).on.on(e):this.each(cu(n,e,t))}function uu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function du(){return this.on("end.remove",uu(this._id))}function fu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,Qt(c[f],t,n,f,c,pe(u,n)));return new _e(i,this._parents,t,n)}function hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=mr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),p,g=pe(u,n),w=0,x=f.length;w<x;++w)(p=f[w])&&Qt(p,t,n,w,f,g);i.push(f),s.push(u)}return new _e(i,s,t,n)}var gu=mt.prototype.constructor;function pu(){return new gu(this._groups,this._parents)}function mu(e,t){var n,o,r;return function(){var i=Xe(this,e),s=(this.style.removeProperty(e),Xe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Br(e){return function(){this.style.removeProperty(e)}}function yu(e,t,n){var o,r=n+"",i;return function(){var s=Xe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function xu(e,t,n){var o,r,i;return function(){var s=Xe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Xe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function wu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=xe(this,e),c=l.on,u=l.value[i]==null?a||(a=Br(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function vu(e,t,n){var o=(e+="")=="transform"?bl:Vr;return t==null?this.styleTween(e,mu(e,o)).on("end.style."+e,Br(e)):typeof t=="function"?this.styleTween(e,xu(e,o,jn(this,"style."+e,t))).each(wu(this._id,e)):this.styleTween(e,yu(e,o,t),n).on("end.style."+e,null)}function bu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function _u(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&bu(e,s,n)),o}return i._value=t,i}function Eu(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,_u(e,t,n??""))}function Su(e){return function(){this.textContent=e}}function Nu(e){return function(){var t=e(this);this.textContent=t??""}}function Cu(e){return this.tween("text",typeof e=="function"?Nu(jn(this,"text",e)):Su(e==null?"":e+""))}function Mu(e){return function(t){this.textContent=e.call(this,t)}}function Iu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Mu(r)),t}return o._value=e,o}function ku(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Iu(e))}function Au(){for(var e=this._name,t=this._id,n=Fr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=pe(l,t);Qt(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function $u(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Pu=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Fr(){return++Pu}var ve=mt.prototype;_e.prototype={constructor:_e,select:fu,selectAll:hu,selectChild:ve.selectChild,selectChildren:ve.selectChildren,filter:iu,merge:su,selection:pu,transition:Au,call:ve.call,nodes:ve.nodes,node:ve.node,size:ve.size,empty:ve.empty,each:ve.each,on:lu,attr:jl,attrTween:ql,style:vu,styleTween:Eu,text:Cu,textTween:ku,remove:du,tween:Hl,delay:Ul,duration:eu,ease:nu,easeVarying:ru,end:$u,[Symbol.iterator]:ve[Symbol.iterator]};function Du(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Tu={time:null,delay:0,duration:250,ease:Du};function zu(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Hu(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Fr(),(n=Tu).time=Bn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Qt(l,e,t,c,s,n||zu(l,t));return new _e(o,this._parents,e,t)}mt.prototype.interrupt=Dl;mt.prototype.transition=Hu;const Mt=e=>()=>e;function Ru(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function 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 Jt=new be(1,0,0);jr.prototype=be.prototype;function jr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Jt;return e.__zoom}function gn(e){e.stopImmediatePropagation()}function nt(e){e.preventDefault(),e.stopImmediatePropagation()}function Lu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ou(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Mo(){return this.__zoom||Jt}function Vu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Xr(){var e=Lu,t=Ou,n=Fu,o=Vu,r=Bu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Dt,c=Gt("start","zoom","end"),u,d,f,p=500,g=150,w=0,x=10;function m(v){v.property("__zoom",Mo).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",k).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,N,E,I){var M=v.selection?v.selection():v;M.property("__zoom",Mo),v!==M?S(v,N,E,I):M.interrupt().each(function(){b(this,arguments).event(I).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},m.scaleBy=function(v,N,E,I){m.scaleTo(v,function(){var M=this.__zoom.k,D=typeof N=="function"?N.apply(this,arguments):N;return M*D},E,I)},m.scaleTo=function(v,N,E,I){m.transform(v,function(){var M=t.apply(this,arguments),D=this.__zoom,H=E==null?y(M):typeof E=="function"?E.apply(this,arguments):E,L=D.invert(H),R=typeof N=="function"?N.apply(this,arguments):N;return n(h(_(D,R),H,L),M,s)},E,I)},m.translateBy=function(v,N,E,I){m.transform(v,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,I)},m.translateTo=function(v,N,E,I,M){m.transform(v,function(){var D=t.apply(this,arguments),H=this.__zoom,L=I==null?y(D):typeof I=="function"?I.apply(this,arguments):I;return n(Jt.translate(L[0],L[1]).scale(H.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof E=="function"?-E.apply(this,arguments):-E),D,s)},I,M)};function _(v,N){return N=Math.max(i[0],Math.min(i[1],N)),N===v.k?v:new be(N,v.x,v.y)}function h(v,N,E){var I=N[0]-E[0]*v.k,M=N[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,N,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,D=arguments,H=b(M,D).event(I),L=t.apply(M,D),R=E==null?y(L):typeof E=="function"?E.apply(M,D):E,j=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),F=M.__zoom,W=typeof N=="function"?N.apply(M,D):N,K=l(F.invert(R).concat(j/F.k),W.invert(R).concat(j/W.k));return function(Z){if(Z===1)Z=W;else{var B=K(Z),X=j/B[2];Z=new be(X,R[0]-B[0]*X,R[1]-B[1]*X)}H.zoom(null,Z)}})}function b(v,N,E){return!E&&v.__zooming||new C(v,N)}function C(v,N){this.that=v,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,N),this.taps=0}C.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,N){return this.mouse&&v!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var N=ce(this.that).datum();c.call(v,this.that,new Ru(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),N)}};function A(v,...N){if(!e.apply(this,arguments))return;var E=b(this,N).event(v),I=this.__zoom,M=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,o.apply(this,arguments)))),D=de(v);if(E.wheel)(E.mouse[0][0]!==D[0]||E.mouse[0][1]!==D[1])&&(E.mouse[1]=I.invert(E.mouse[0]=D)),clearTimeout(E.wheel);else{if(I.k===M)return;E.mouse=[D,I.invert(D)],Ht(this),E.start()}nt(v),E.wheel=setTimeout(H,g),E.zoom("mouse",n(h(_(I,M),E.mouse[0],E.mouse[1]),E.extent,s));function H(){E.wheel=null,E.end()}}function $(v,...N){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,I=b(this,N,!0).event(v),M=ce(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",j,!0),D=de(v,E),H=v.clientX,L=v.clientY;Mr(v.view),gn(v),I.mouse=[D,this.__zoom.invert(D)],Ht(this),I.start();function R(F){if(nt(F),!I.moved){var W=F.clientX-H,K=F.clientY-L;I.moved=W*W+K*K>w}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),Ir(F.view,I.moved),nt(F),I.event(F).end()}}function V(v,...N){if(e.apply(this,arguments)){var E=this.__zoom,I=de(v.changedTouches?v.changedTouches[0]:v,this),M=E.invert(I),D=E.k*(v.shiftKey?.5:2),H=n(h(_(E,D),I,M),t.apply(this,N),s);nt(v),a>0?ce(this).transition().duration(a).call(S,H,I,v):ce(this).call(m.transform,H,I,v)}}function k(v,...N){if(e.apply(this,arguments)){var E=v.touches,I=E.length,M=b(this,N,v.changedTouches.length===I).event(v),D,H,L,R;for(gn(v),H=0;H<I;++H)L=E[H],R=de(L,this),R=[R,this.__zoom.invert(R),L.identifier],M.touch0?!M.touch1&&M.touch0[2]!==R[2]&&(M.touch1=R,M.taps=0):(M.touch0=R,D=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(M.taps<2&&(d=R[0],u=setTimeout(function(){u=null},p)),Ht(this),M.start())}}function z(v,...N){if(this.__zooming){var E=b(this,N).event(v),I=v.changedTouches,M=I.length,D,H,L,R;for(nt(v),D=0;D<M;++D)H=I[D],L=de(H,this),E.touch0&&E.touch0[2]===H.identifier?E.touch0[0]=L:E.touch1&&E.touch1[2]===H.identifier&&(E.touch1[0]=L);if(H=E.that.__zoom,E.touch1){var j=E.touch0[0],F=E.touch0[1],W=E.touch1[0],K=E.touch1[1],Z=(Z=W[0]-j[0])*Z+(Z=W[1]-j[1])*Z,B=(B=K[0]-F[0])*B+(B=K[1]-F[1])*B;H=_(H,Math.sqrt(Z/B)),L=[(j[0]+W[0])/2,(j[1]+W[1])/2],R=[(F[0]+K[0])/2,(F[1]+K[1])/2]}else if(E.touch0)L=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(h(H,L,R),E.extent,s))}}function O(v,...N){if(this.__zooming){var E=b(this,N).event(v),I=v.changedTouches,M=I.length,D,H;for(gn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),D=0;D<M;++D)H=I[D],E.touch0&&E.touch0[2]===H.identifier?delete E.touch0:E.touch1&&E.touch1[2]===H.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&&(H=de(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<x)){var L=ce(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Mt(+v),m):o},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Mt(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Mt(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Mt([[+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?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(l=v,m):l},m.on=function(){var v=c.on.apply(c,arguments);return v===c?m:v},m.clickDistance=function(v){return arguments.length?(w=(v=+v)*v,m):Math.sqrt(w)},m.tapDistance=function(v){return arguments.length?(x=+v,m):x},m}const ue={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."},dt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Yr=["Enter"," ","Escape"],Zr={"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 Ze;(function(e){e.Strict="strict",e.Loose="loose"})(Ze||(Ze={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var ft;(function(e){e.Partial="partial",e.Full="full"})(ft||(ft={}));const Wr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Xt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xt||(Xt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const Io={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function qr(e){return e===null?null:e?"valid":"invalid"}const Gr=e=>"id"in e&&"source"in e&&"target"in e,ju=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Xn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xt=(e,t=[0,0])=>{const{width:n,height:o}=Ee(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Xu=(e,t={nodeOrigin:[0,0]})=>{if(t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),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):Xn(r)?r:t.nodeLookup.get(r.id));const a=s?Yt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return en(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return tn(n)},wt=(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=en(n,Yt(r)),o=!0)}),o?tn(n):{x:0,y:0,width:0,height:0}},Yn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...bt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(s&&!d||f)continue;const p=u.width??c.width??c.initialWidth??null,g=u.height??c.height??c.initialHeight??null,w=ht(a,qe(c)),x=(p??0)*(g??0),m=i&&w>0;(!c.internals.handleBounds||m||w>=x||c.dragging)&&l.push(c)}return l},Yu=(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 Zu(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 Wu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Zu(e,s),l=wt(a),c=Zn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function Kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ue.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(d=[[l,c],[l+p,c+g]])}else a&&Ge(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=Ge(d)?He(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ue.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(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 p=i.has(f.id),g=!p&&f.parentId&&s.find(w=>w.id===f.parentId);(p||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Yu(s,l);for(const f of l)a.has(f.id)&&!u.find(g=>g.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 We=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:We(e.x,t[0][0],t[1][0]-(n?.width??0)),y:We(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ur(e,t,n){const{width:o,height:r}=Ee(n),{x:i,y:s}=n.internals.positionAbsolute;return He(e,[[i,s],[i+o,s+r]],t)}const ko=(e,t,n)=>e<t?We(Math.abs(e-t),1,t)/t:e>n?-We(Math.abs(e-n),1,t)/t:0,Qr=(e,t,n=15,o=40)=>{const r=ko(e.x,o,t.width-o)*n,i=ko(e.y,o,t.height-o)*n;return[r,i]},en=(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)}),An=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),tn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),qe=(e,t=[0,0])=>{const{x:n,y:o}=Xn(e)?e.internals.positionAbsolute:xt(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}},Yt=(e,t=[0,0])=>{const{x:n,y:o}=Xn(e)?e.internals.positionAbsolute:xt(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)}},Jr=(e,t)=>tn(en(An(e),An(t))),ht=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Ao=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),ei=(e,t)=>{console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},vt=(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 a={x:(e-n)/r,y:(t-o)/r};return i?vt(a,s):a},Zt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Oe(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 Gu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Oe(e,n),r=Oe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Oe(e.top??e.y??0,n),r=Oe(e.bottom??e.y??0,n),i=Oe(e.left??e.x??0,t),s=Oe(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 Ku(e,t,n,o,r,i){const{x:s,y:a}=Zt(e,[t,n,o]),{x:l,y:c}=Zt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const Zn=(e,t,n,o,r,i)=>{const s=Gu(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=We(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,p=t/2-d*u,g=n/2-f*u,w=Ku(e,p,g,u,t,n),x={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:p-x.left+x.right,y:g-x.top+x.bottom,zoom:u}},gt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ge(e){return e!=null&&e!=="parent"}function Ee(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ti(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ni(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function $o(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Uu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Qu(e){return{...Zr,...e||{}}}function st(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),a=bt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?vt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Wn=e=>({width:e.offsetWidth,height:e.offsetHeight}),oi=e=>e?.getRootNode?.()||window?.document,Ju=["INPUT","SELECT","TEXTAREA"];function ri(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ju.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ii=e=>"clientX"in e,ge=(e,t)=>{const n=ii(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)}},Po=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Wn(s)}})};function si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function It(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Do({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-It(t-o,i),n];case Y.Right:return[t+It(o-t,i),n];case Y.Top:return[t,n-It(n-r,i)];case Y.Bottom:return[t,n+It(r-n,i)]}}function ai({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=Do({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=Do({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,p,g]=si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,p,g]}function ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ed({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function td({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=en(Yt(e),Yt(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 ht(s,tn(i))>0}const nd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,od=(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)),rd=(e,t,n={})=>{if(!e.source||!e.target)return ei("006",ue.error006()),t;const o=n.getEdgeId||nd;let r;return Gr(e)?r={...e}:r={...e,id:o(e)},od(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function li({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const To={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},id=({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},zo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function sd({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=To[t],l=To[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=id({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",p=d[f];let g=[],w,x;const m={x:0,y:0},_={x:0,y:0},[,,h,y]=ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??c.x+(u.x-c.x)*s,x=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,x=r.y??c.y+(u.y-c.y)*s);const A=[{x:w,y:c.y},{x:w,y:u.y}],$=[{x:c.x,y:x},{x:u.x,y:x}];a[f]===p?g=f==="x"?A:$:g=f==="x"?$:A}else{const A=[{x:c.x,y:u.y}],$=[{x:u.x,y:c.y}];if(f==="x"?g=a.x===p?$:A:g=a.y===p?A:$,t===o){const v=Math.abs(e[f]-n[f]);if(v<=i){const N=Math.min(i-1,i-v);a[f]===p?m[f]=(c[f]>e[f]?-1:1)*N:_[f]=(u[f]>n[f]?-1:1)*N}}if(t!==o){const v=f==="x"?"y":"x",N=a[f]===l[v],E=c[v]>u[v],I=c[v]<u[v];(a[f]===1&&(!N&&E||N&&I)||a[f]!==1&&(!N&&I||N&&E))&&(g=f==="x"?A:$)}const V={x:c.x+m.x,y:c.y+m.y},k={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(V.x-g[0].x),Math.abs(k.x-g[0].x)),O=Math.max(Math.abs(V.y-g[0].y),Math.abs(k.y-g[0].y));z>=O?(w=(V.x+k.x)/2,x=g[0].y):(w=g[0].x,x=(V.y+k.y)/2)}const S={x:c.x+m.x,y:c.y+m.y},b={x:u.x+_.x,y:u.y+_.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],w,x,h,y]}function ad(e,t,n,o){const r=Math.min(zo(e,t)/2,zo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function $n({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,p,g,w]=sd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});let x=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)x+=ad(d[m-1],d[m],d[m+1],s);return x+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[x,f,p,g,w]}function Ho(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function cd(e){const{sourceNode:t,targetNode:n}=e;if(!Ho(t)||!Ho(n))return null;const o=t.internals.handleBounds||Ro(t.handles),r=n.internals.handleBounds||Ro(n.handles),i=Lo(o?.source??[],e.sourceHandle),s=Lo(e.connectionMode===Ze.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ue.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=Re(t,i,a),u=Re(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Ro(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Re(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:a}=t??Ee(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function Lo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Pn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function ld(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Pn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ui=1e3,ud=10,qn={nodeOrigin:[0,0],nodeExtent:dt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},dd={...qn,checkEquality:!0};function Gn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function fd(e,t,n){const o=Gn(qn,n);for(const r of e.values())if(r.parentId)Un(r,e,t,o);else{const i=xt(r,o.nodeOrigin),s=Ge(r.extent)?r.extent:o.nodeExtent,a=He(i,s,Ee(r));r.internals.positionAbsolute=a}}function hd(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 Kn(e){return e==="manual"}function Dn(e,t,n,o={}){const r=Gn(dd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Kn(r.zIndexMode)?ui:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===d?.internals.userNode)t.set(u.id,d);else{const f=xt(u,r.nodeOrigin),p=Ge(u.extent)?u.extent:r.nodeExtent,g=He(f,p,Ee(u));d={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:hd(u,d),z:di(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(l=!1),u.parentId&&Un(d,t,n,o,i),c||=u.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function gd(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 Un(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Gn(qn,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}gd(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*ud),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!Kn(l)?ui:0,{x:f,y:p,z:g}=pd(e,u,s,a,d,l),{positionAbsolute:w}=e.internals,x=f!==w.x||p!==w.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:p}:w,z:g}})}function di(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return Kn(n)?o:o+(e.selected?t:0)}function pd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ee(e),c=xt(e,n),u=Ge(e.extent)?He(c,e.extent,l):c;let d=He({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Ur(d,l,t));const f=di(e,r,i),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Qn(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??qe(a),c=Jr(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ee(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,p=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),x=(g-u.width)*d[0],m=(w-u.height)*d[1];(f>0||p>0||x||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+x,y:a.position.y-p+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+p}})})),(u.width<s.width||u.height<s.height||f||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-x:0),height:w+(p?d[1]*p-m:0)}})}),r}function md(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const p of e.values()){const g=t.get(p.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const w=Wn(p.nodeElement),x=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(x||!g.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),h=Ge(g.extent)?g.extent:i;let{positionAbsolute:y}=g.internals;g.parentId&&g.extent==="parent"?y=Ur(y,w,t.get(g.parentId)):h&&(y=He(y,h,w));const S={...g,measured:w,internals:{...g.internals,positionAbsolute:y,handleBounds:{source:Po("source",p.nodeElement,_,d,g.id),target:Po("target",p.nodeElement,_,d,g.id)}}};t.set(g.id,S),g.parentId&&Un(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,x&&(c.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:qe(S,r)}))}}if(f.length>0){const p=Qn(f,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function yd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Oo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function fi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Oo("source",l,u,e,r,s),Oo("target",l,c,e,i,a),t.set(o.id,o)}}function hi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:hi(n,t):!1}function Vo(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 xd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!hi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function pn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function wd({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=vt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function vd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,p=!1,g=!1,w=null;function x({noDragClassName:_,handleSelector:h,domNode:y,isSelectable:S,nodeId:b,nodeClickDistance:C=0}){f=ce(y);function A({x:z,y:O}){const{nodeLookup:v,nodeExtent:N,snapGrid:E,snapToGrid:I,nodeOrigin:M,onNodeDrag:D,onSelectionDrag:H,onError:L,updateNodePositions:R}=t();i={x:z,y:O};let j=!1;const F=a.size>1,W=F&&N?An(wt(a)):null,K=F&&I?wd({dragItems:a,snapGrid:E,x:z,y:O}):null;for(const[Z,B]of a){if(!v.has(Z))continue;let X={x:z-B.distance.x,y:O-B.distance.y};I&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:vt(X,E));let Q=null;if(F&&N&&!B.extent&&W){const{positionAbsolute:G}=B.internals,ee=G.x-W.x+N[0][0],ne=G.x+B.measured.width-W.x2+N[1][0],te=G.y-W.y+N[0][1],se=G.y+B.measured.height-W.y2+N[1][1];Q=[[ee,te],[ne,se]]}const{position:U,positionAbsolute:q}=Kr({nodeId:Z,nextPosition:X,nodeLookup:v,nodeExtent:Q||N,nodeOrigin:M,onError:L});j=j||B.position.x!==U.x||B.position.y!==U.y,B.position=U,B.internals.positionAbsolute=q}if(g=g||j,!!j&&(R(a,!0),w&&(o||D||!b&&H))){const[Z,B]=pn({nodeId:b,dragItems:a,nodeLookup:v});o?.(w,a,Z,B),D?.(w,Z,B),b||H?.(w,B)}}async function $(){if(!u)return;const{transform:z,panBy:O,autoPanSpeed:v,autoPanOnNodeDrag:N}=t();if(!N){l=!1,cancelAnimationFrame(s);return}const[E,I]=Qr(c,u,v);(E!==0||I!==0)&&(i.x=(i.x??0)-E/z[2],i.y=(i.y??0)-I/z[2],await O({x:E,y:I})&&A(i)),s=requestAnimationFrame($)}function V(z){const{nodeLookup:O,multiSelectionActive:v,nodesDraggable:N,transform:E,snapGrid:I,snapToGrid:M,selectNodesOnDrag:D,onNodeDragStart:H,onSelectionDragStart:L,unselectNodesAndEdges:R}=t();d=!0,(!D||!S)&&!v&&b&&(O.get(b)?.selected||R()),S&&D&&b&&e?.(b);const j=st(z.sourceEvent,{transform:E,snapGrid:I,snapToGrid:M,containerBounds:u});if(i=j,a=xd(O,N,j,b),a.size>0&&(n||H||!b&&L)){const[F,W]=pn({nodeId:b,dragItems:a,nodeLookup:O});n?.(z.sourceEvent,a,F,W),H?.(z.sourceEvent,F,W),b||L?.(z.sourceEvent,W)}}const k=kr().clickDistance(C).on("start",z=>{const{domNode:O,nodeDragThreshold:v,transform:N,snapGrid:E,snapToGrid:I}=t();u=O?.getBoundingClientRect()||null,p=!1,g=!1,w=z.sourceEvent,v===0&&V(z),i=st(z.sourceEvent,{transform:N,snapGrid:E,snapToGrid:I,containerBounds:u}),c=ge(z.sourceEvent,u)}).on("drag",z=>{const{autoPanOnNodeDrag:O,transform:v,snapGrid:N,snapToGrid:E,nodeDragThreshold:I,nodeLookup:M}=t(),D=st(z.sourceEvent,{transform:v,snapGrid:N,snapToGrid:E,containerBounds:u});if(w=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||b&&!M.has(b))&&(p=!0),!p){if(!l&&O&&d&&(l=!0,$()),!d){const H=ge(z.sourceEvent,u),L=H.x-c.x,R=H.y-c.y;Math.sqrt(L*L+R*R)>I&&V(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&d&&(c=ge(z.sourceEvent,u),A(D))}}).on("end",z=>{if(!(!d||p)&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:O,updateNodePositions:v,onNodeDragStop:N,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),r||N||!b&&E){const[I,M]=pn({nodeId:b,dragItems:a,nodeLookup:O,dragging:!1});r?.(z.sourceEvent,a,I,M),N?.(z.sourceEvent,I,M),b||E?.(z.sourceEvent,M)}}}).filter(z=>{const O=z.target;return!z.button&&(!_||!Vo(O,`.${_}`,y))&&(!h||Vo(O,h,y))});f.call(k)}function m(){f?.on(".drag",null)}return{update:x,destroy:m}}function bd(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())ht(r,qe(i))>0&&o.push(i);return o}const _d=250;function Ed(e,t,n,o){let r=[],i=1/0;const s=bd(e,n,t+_d);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Re(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function gi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Re(s,l,l.position,!0)}:l}function pi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Sd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const mi=()=>!0;function Nd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:g,onConnect:w,onConnectEnd:x,isValidConnection:m=mi,onReconnectEnd:_,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:b,dragThreshold:C=1,handleDomNode:A}){const $=oi(e.target);let V=0,k;const{x:z,y:O}=ge(e),v=pi(i,A),N=a?.getBoundingClientRect();let E=!1;if(!N||!v)return;const I=gi(r,v,o,l,t);if(!I)return;let M=ge(e,N),D=!1,H=null,L=!1,R=null;function j(){if(!u||!N)return;const[U,q]=Qr(M,N,b);f({x:U,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:Re(W,F,Y.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:M,toHandle:null,toPosition:Io[F.position],toNode:null,pointer:M};function B(){E=!0,h(Z),g?.(e,{nodeId:r,handleId:o,handleType:v})}C===0&&B();function X(U){if(!E){const{x:se,y:Se}=ge(U),we=se-z,ke=Se-O;if(!(we*we+ke*ke>C*C))return;B()}if(!S()||!F){Q(U);return}const q=y();M=ge(U,N),k=Ed(bt(M,q,!1,[1,1]),n,l,F),D||(j(),D=!0);const G=yi(U,{handle:k,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:$,lib:c,flowId:d,nodeLookup:l});R=G.handleDomNode,H=G.connection,L=Sd(!!k,G.isValid);const ee=l.get(r),ne=ee?Re(ee,F,Y.Left,!0):Z.from,te={...Z,from:ne,isValid:L,to:G.toHandle&&L?Zt({x:G.toHandle.x,y:G.toHandle.y},q):M,toHandle:G.toHandle,toPosition:L&&G.toHandle?G.toHandle.position:Io[F.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:M};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(E){(k||R)&&H&&L&&w?.(H);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};x?.(U,ee),i&&_?.(U,ee)}p(),cancelAnimationFrame(V),D=!1,L=!1,H=null,R=null,$.removeEventListener("mousemove",X),$.removeEventListener("mouseup",Q),$.removeEventListener("touchmove",X),$.removeEventListener("touchend",Q)}}$.addEventListener("mousemove",X),$.addEventListener("mouseup",Q),$.addEventListener("touchmove",X),$.addEventListener("touchend",Q)}function yi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=mi,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:g}=ge(e),w=s.elementFromPoint(p,g),x=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=pi(void 0,x),h=x.getAttribute("data-nodeid"),y=x.getAttribute("data-handleid"),S=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!h||!_)return m;const C={source:d?h:o,sourceHandle:d?y:r,target:d?o:h,targetHandle:d?r:y};m.connection=C;const $=S&&b&&(n===Ze.Strict?d&&_==="source"||!d&&_==="target":h!==o||y!==r);m.isValid=$&&c(C),m.toHandle=gi(h,_,y,u,n,!0)}return m}const Tn={onPointerDown:Nd,isValid:yi};function Cd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:p=!1}){const g=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&gt()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,C=y[2]*Math.pow(2,b*S);t.scaleTo(C)};let w=[0,0];const x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[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]-w[0],S[1]-w[1]];w=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(p?-1:1),A={x:y[0]-b[0]*C,y:y[1]-b[1]*C},$=[[0,0],[l,c]];t.setViewportConstrained({x:A.x,y:A.y,zoom:y[2]},$,a)},_=Xr().on("start",x).on("zoom",d?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const nn=e=>({x:e.x,y:e.y,zoom:e.k}),mn=({x:e,y:t,zoom:n})=>Jt.translate(e,t).scale(n),Ve=(e,t)=>e.target.closest(`.${t}`),xi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Md=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,yn=(e,t=0,n=Md,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},wi=e=>{const t=e.ctrlKey&&gt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Id({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ve(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const x=de(u),m=wi(u),_=d*Math.pow(2,m);o.scaleTo(n,_,x,u);return}const f=u.deltaMode===1?20:1;let p=r===De.Vertical?0:u.deltaX*f,g=r===De.Horizontal?0:u.deltaY*f;!gt()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*f,g=0),o.translateBy(n,-(p/d)*i,-(g/d)*i,{internal:!0});const w=nn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function kd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Ve(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Ad({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=nn(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 $d({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&xi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,nn(i.transform))}}function Pd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&xi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=nn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Dd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,p=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Ve(d,`${c}-flow__node`)||Ve(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!g||Ve(d,a)&&g||Ve(d,l)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!p&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&w}}function Td({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Xr().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:We(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(wi);function w(k,z){return f?new Promise(O=>{d?.interpolate(z?.interpolate==="linear"?it:Dt).transform(yn(f,z?.duration,z?.ease,()=>O(!0)),k)}):Promise.resolve(!1)}function x({noWheelClassName:k,noPanClassName:z,onPaneContextMenu:O,userSelectionActive:v,panOnScroll:N,panOnDrag:E,panOnScrollMode:I,panOnScrollSpeed:M,preventScrolling:D,zoomOnPinch:H,zoomOnScroll:L,zoomOnDoubleClick:R,zoomActivationKeyPressed:j,lib:F,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:B}){v&&!c.isZoomingOrPanning&&m();const X=N&&!j&&!v;d.clickDistance(B?1/0:!he(Z)||Z<0?0:Z);const Q=X?Id({zoomPanValues:c,noWheelClassName:k,d3Selection:f,d3Zoom:d,panOnScrollMode:I,panOnScrollSpeed:M,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):kd({noWheelClassName:k,preventScrolling:D,d3ZoomHandler:p});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const q=Ad({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);const G=$d({zoomPanValues:c,panOnDrag:E,onPaneContextMenu:!!O,onPanZoom:i,onTransformChange:W});d.on("zoom",G);const ee=Pd({zoomPanValues:c,panOnDrag:E,panOnScroll:N,onPaneContextMenu:O,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=Dd({zoomActivationKeyPressed:j,panOnDrag:E,zoomOnScroll:L,panOnScroll:N,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:v,noPanClassName:z,noWheelClassName:k,lib:F,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){d.on("zoom",null)}async function _(k,z,O){const v=mn(k),N=d?.constrain()(v,z,O);return N&&await w(N),new Promise(E=>E(N))}async function h(k,z){const O=mn(k);return await w(O,z),new Promise(v=>v(O))}function y(k){if(f){const z=mn(k),O=f.property("__zoom");(O.k!==k.zoom||O.x!==k.x||O.y!==k.y)&&d?.transform(f,z,null,{sync:!0})}}function S(){const k=f?jr(f.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function b(k,z){return f?new Promise(O=>{d?.interpolate(z?.interpolate==="linear"?it:Dt).scaleTo(yn(f,z?.duration,z?.ease,()=>O(!0)),k)}):Promise.resolve(!1)}function C(k,z){return f?new Promise(O=>{d?.interpolate(z?.interpolate==="linear"?it:Dt).scaleBy(yn(f,z?.duration,z?.ease,()=>O(!0)),k)}):Promise.resolve(!1)}function A(k){d?.scaleExtent(k)}function $(k){d?.translateExtent(k)}function V(k){const z=!he(k)||k<0?0:k;d?.clickDistance(z)}return{update:x,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:S,scaleTo:b,scaleBy:C,setScaleExtent:A,setTranslateExtent:$,syncViewport:y,setClickDistance:V}}var Ke;(function(e){e.Line="line",e.Handle="handle"})(Ke||(Ke={}));function zd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Bo(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 Ne(e,t){return Math.max(0,t-e)}function Ce(e,t){return Math.max(0,e-t)}function kt(e,t,n){return Math.max(0,t-e,e-n)}function Fo(e,t){return e?!t:t}function Hd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:g}=n,{minWidth:w,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:h,y,width:S,height:b,aspectRatio:C}=e;let A=Math.floor(u?p-e.pointerX:0),$=Math.floor(d?g-e.pointerY:0);const V=S+(l?-A:A),k=b+(c?-$:$),z=-i[0]*S,O=-i[1]*b;let v=kt(V,w,x),N=kt(k,m,_);if(s){let M=0,D=0;l&&A<0?M=Ne(h+A+z,s[0][0]):!l&&A>0&&(M=Ce(h+V+z,s[1][0])),c&&$<0?D=Ne(y+$+O,s[0][1]):!c&&$>0&&(D=Ce(y+k+O,s[1][1])),v=Math.max(v,M),N=Math.max(N,D)}if(a){let M=0,D=0;l&&A>0?M=Ce(h+A,a[0][0]):!l&&A<0&&(M=Ne(h+V,a[1][0])),c&&$>0?D=Ce(y+$,a[0][1]):!c&&$<0&&(D=Ne(y+k,a[1][1])),v=Math.max(v,M),N=Math.max(N,D)}if(r){if(u){const M=kt(V/C,m,_)*C;if(v=Math.max(v,M),s){let D=0;!l&&!c||l&&!c&&f?D=Ce(y+O+V/C,s[1][1])*C:D=Ne(y+O+(l?A:-A)/C,s[0][1])*C,v=Math.max(v,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=Ne(y+V/C,a[1][1])*C:D=Ce(y+(l?A:-A)/C,a[0][1])*C,v=Math.max(v,D)}}if(d){const M=kt(k*C,w,x)/C;if(N=Math.max(N,M),s){let D=0;!l&&!c||c&&!l&&f?D=Ce(h+k*C+z,s[1][0])/C:D=Ne(h+(c?$:-$)*C+z,s[0][0])/C,N=Math.max(N,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=Ne(h+k*C,a[1][0])/C:D=Ce(h+(c?$:-$)*C,a[0][0])/C,N=Math.max(N,D)}}}$=$+($<0?N:-N),A=A+(A<0?v:-v),r&&(f?V>k*C?$=(Fo(l,c)?-A:A)/C:A=(Fo(l,c)?-$:$)*C:u?($=A/C,c=l):(A=$*C,l=c));const E=l?h+A:h,I=c?y+$:y;return{width:S+(l?-A:A),height:b+(c?-$:$),x:i[0]*A*(l?-1:1)+E,y:i[1]*$*(c?-1:1)+I}}const vi={width:0,height:0,x:0,y:0},Rd={...vi,pointerX:0,pointerY:0,aspectRatio:1};function Ld(e){return[[0,0],[e.measured.width,e.measured.height]]}function Od(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Vd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:Bo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:p,onResize:g,onResizeEnd:w,shouldResize:x}){let m={...vi},_={...Rd};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:Bo(c)};let h,y=null,S=[],b,C,A,$=!1;const V=kr().on("start",k=>{const{nodeLookup:z,transform:O,snapGrid:v,snapToGrid:N,nodeOrigin:E,paneDomNode:I}=n();if(h=z.get(t),!h)return;y=I?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:D}=st(k.sourceEvent,{transform:O,snapGrid:v,snapToGrid:N,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:D,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=z.get(h.parentId),C=b&&h.extent==="parent"?Ld(b):void 0),S=[],A=void 0;for(const[H,L]of z)if(L.parentId===t&&(S.push({id:H,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const R=Od(L,h,L.origin??E);A?A=[[Math.min(R[0][0],A[0][0]),Math.min(R[0][1],A[0][1])],[Math.max(R[1][0],A[1][0]),Math.max(R[1][1],A[1][1])]]:A=R}p?.(k,{...m})}).on("drag",k=>{const{transform:z,snapGrid:O,snapToGrid:v,nodeOrigin:N}=n(),E=st(k.sourceEvent,{transform:z,snapGrid:O,snapToGrid:v,containerBounds:y}),I=[];if(!h)return;const{x:M,y:D,width:H,height:L}=m,R={},j=h.origin??N,{width:F,height:W,x:K,y:Z}=Hd(_,s.controlDirection,E,s.boundaries,s.keepAspectRatio,j,C,A),B=F!==H,X=W!==L,Q=K!==M&&B,U=Z!==D&&X;if(!Q&&!U&&!B&&!X)return;if((Q||U||j[0]===1||j[1]===1)&&(R.x=Q?K:m.x,R.y=U?Z:m.y,m.x=R.x,m.y=R.y,S.length>0)){const ne=K-M,te=Z-D;for(const se of S)se.position={x:se.position.x-ne+j[0]*(F-H),y:se.position.y-te+j[1]*(W-L)},I.push(se)}if((B||X)&&(R.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,R.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),b&&h.expandParent){const ne=j[0]*(R.width??0);R.x&&R.x<ne&&(m.x=ne,_.x=_.x-(R.x-ne));const te=j[1]*(R.height??0);R.y&&R.y<te&&(m.y=te,_.y=_.y-(R.y-te))}const q=zd({width:m.width,prevWidth:H,height:m.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:q};x?.(k,G)!==!1&&($=!0,g?.(k,G),o(R,I))}).on("end",k=>{$&&(w?.(k,{...m}),r?.({...m}),$=!1)});i.call(V)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var xn={exports:{}},wn={},jo;function Bd(){if(jo)return wn;jo=1;/**
2
+ * @license React
3
+ * use-sync-external-store-shim/with-selector.development.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */return(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=ia(),n=ca(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;wn.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var g=i(null);if(g.current===null){var w={hasValue:!1,value:null};g.current=w}else w=g.current;g=a(function(){function m(b){if(!_){if(_=!0,h=b,b=f(b),p!==void 0&&w.hasValue){var C=w.value;if(p(C,b))return y=C}return y=b}if(C=y,o(h,b))return C;var A=f(b);return p!==void 0&&p(C,A)?(h=b,C):(h=b,y=A)}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,p]);var x=r(c,g[0],g[1]);return s(function(){w.hasValue=!0,w.value=x},[x]),l(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),wn}var Xo;function Fd(){return Xo||(Xo=1,xn.exports=Bd()),xn.exports}var jd=Fd();const Xd=sa(jd),Yd={},Yo=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const p=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,p))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Yd?"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()}},c=t=e(o,r,l);return l},Zd=e=>e?Yo(e):Yo,{useDebugValue:Wd}=aa,{useSyncExternalStoreWithSelector:qd}=Xd,Gd=e=>e;function bi(e,t=Gd,n){const o=qd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wd(o),o}const Zo=(e,t)=>{const n=Zd(e),o=(r,i=t)=>bi(n,r,i);return Object.assign(o,n),o},Kd=(e,t)=>e?Zo(e,t):Zo;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}la();const on=T.createContext(null),Ud=on.Provider,_i=ue.error001();function J(e,t){const n=T.useContext(on);if(n===null)throw new Error(_i);return bi(n,e,t)}function re(){const e=T.useContext(on);if(e===null)throw new Error(_i);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Wo={display:"none"},Qd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ei="react-flow__node-desc",Si="react-flow__edge-desc",Jd="react-flow__aria-live",ef=e=>e.ariaLiveMessage,tf=e=>e.ariaLabelConfig;function nf({rfId:e}){const t=J(ef);return P.jsx("div",{id:`${Jd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Qd,children:t})}function of({rfId:e,disableKeyboardA11y:t}){const n=J(tf);return P.jsxs(P.Fragment,{children:[P.jsx("div",{id:`${Ei}-${e}`,style:Wo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),P.jsx("div",{id:`${Si}-${e}`,style:Wo,children:n["edge.a11yDescription.default"]}),!t&&P.jsx(nf,{rfId:e})]})}const rn=T.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return P.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});rn.displayName="Panel";function rf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:P.jsx(rn,{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:P.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const sf=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}},At=e=>e.id;function af(e,t){return oe(e.selectedNodes.map(At),t.selectedNodes.map(At))&&oe(e.selectedEdges.map(At),t.selectedEdges.map(At))}function cf({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(sf,af);return T.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const lf=e=>!!e.onSelectionChangeHandlers;function uf({onSelectionChange:e}){const t=J(lf);return e||t?P.jsx(cf,{onSelectionChange:e}):null}const zn=typeof window<"u"?T.useLayoutEffect:T.useEffect,Ni=[0,0],df={x:0,y:0,zoom:1},ff=["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"],qo=[...ff,"rfId"],hf=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}),Go={translateExtent:dt,nodeOrigin:Ni,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function gf(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(hf,oe),c=re();zn(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Go,a()}),[]);const u=T.useRef(Go);return zn(()=>{for(const d of qo){const f=e[d],p=u.current[d];f!==p&&(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"?c.setState({ariaLabelConfig:Qu(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},qo.map(d=>e[d])),null}function Ko(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function pf(e){const[t,n]=T.useState(e==="system"?null:e);return T.useEffect(()=>{if(e!=="system"){n(e);return}const o=Ko(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Ko()?.matches?"dark":"light"}const Uo=typeof document<"u"?document:null;function pt(e=null,t={target:Uo,actInsideInputWithModifier:!0}){const[n,o]=T.useState(!1),r=T.useRef(!1),i=T.useRef(new Set([])),[s,a]=T.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
10
+ `).replace(`
11
+
12
+ `,`
13
+ +`).split(`
14
+ `)),u=c.reduce((d,f)=>d.concat(...f),[]);return[c,u]}return[[],[]]},[e]);return T.useEffect(()=>{const l=t?.target??Uo,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!c)&&ri(p))return!1;const w=Jo(p.code,a);if(i.current.add(p[w]),Qo(s,i.current,!1)){const x=p.composedPath?.()?.[0]||p.target,m=x?.nodeName==="BUTTON"||x?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&p.preventDefault(),o(!0)}},d=p=>{const g=Jo(p.code,a);Qo(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(p[g]),p.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 Qo(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function Jo(e,t){return t.includes(e)?"code":"key"}const mf=()=>{const e=re();return T.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,n):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:a}=e.getState(),l=Zn(t,o,r,i,s,n?.padding??.1);return a?(await a.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:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return bt(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Zt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Ci(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 a={...i};for(const l of s)yf(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function yf(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 Mi(e,t){return Ci(e,t)}function Ii(e,t){return Ci(e,t)}function Ae(e,t){return{id:e,type:"select",selected:t}}function Be(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(Ae(i.id,s)))}return o}function er({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),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===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 tr(e){return{id:e.id,type:"remove"}}const nr=e=>ju(e),xf=e=>Gr(e);function ki(e){return T.forwardRef(e)}function or(e){const[t,n]=T.useState(BigInt(0)),[o]=T.useState(()=>wf(()=>n(r=>r+BigInt(1))));return zn(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function wf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Ai=T.createContext(null);function vf({children:e}){const t=re(),n=T.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;let x=er({items:w,lookup:f});for(const m of g.values())x=m(x);u&&c(w),x.length>0?d?.(x):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:_,setNodes:h}=t.getState();m&&h(_)})},[]),o=or(n),r=T.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState();let p=l;for(const g of a)p=typeof g=="function"?g(p):g;u?c(p):d&&d(er({items:p,lookup:f}))},[]),i=or(r),s=T.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return P.jsx(Ai.Provider,{value:s,children:e})}function bf(){const e=T.useContext(Ai);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const _f=e=>!!e.panZoom;function Jn(){const e=mf(),t=re(),n=bf(),o=J(_f),r=T.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{const{nodeLookup:f,nodeOrigin:p}=t.getState(),g=nr(d)?d:f.get(d.id),w=g.parentId?ni(g.position,g.measured,g.parentId,f,p):g.position,x={...g,position:w,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return qe(x)},c=(d,f,p={replace:!1})=>{s(g=>g.map(w=>{if(w.id===d){const x=typeof f=="function"?f(w):f;return p.replace&&nr(x)?x:{...w,...x}}return w}))},u=(d,f,p={replace:!1})=>{a(g=>g.map(w=>{if(w.id===d){const x=typeof f=="function"?f(w):f;return p.replace&&xf(x)?x:{...w,...x}}return w}))};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:a,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(p=>[...p,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(p=>[...p,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:p}=t.getState(),[g,w,x]=p;return{nodes:d.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:g,y:w,zoom:x}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:p,edges:g,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:h,onBeforeDelete:y}=t.getState(),{nodes:S,edges:b}=await qu({nodesToRemove:d,edgesToRemove:f,nodes:p,edges:g,onBeforeDelete:y}),C=b.length>0,A=S.length>0;if(C){const $=b.map(tr);x?.(b),_($)}if(A){const $=S.map(tr);w?.(S),m($)}return(A||C)&&h?.({nodes:S,edges:b}),{deletedNodes:S,deletedEdges:b}},getIntersectingNodes:(d,f=!0,p)=>{const g=Ao(d),w=g?d:l(d),x=p!==void 0;return w?(p||t.getState().nodes).filter(m=>{const _=t.getState().nodeLookup.get(m.id);if(_&&!g&&(m.id===d.id||!_.internals.positionAbsolute))return!1;const h=qe(x?m:_),y=ht(h,w);return f&&y>0||y>=h.width*h.height||y>=w.width*w.height}):[]},isNodeIntersecting:(d,f,p=!0)=>{const w=Ao(d)?d:l(d);if(!w)return!1;const x=ht(w,f);return p&&x>0||x>=f.width*f.height||x>=w.width*w.height},updateNode:c,updateNodeData:(d,f,p={replace:!1})=>{c(d,g=>{const w=typeof f=="function"?f(g):f;return p.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},p)},updateEdge:u,updateEdgeData:(d,f,p={replace:!1})=>{u(d,g=>{const w=typeof f=="function"?f(g):f;return p.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},p)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:p}=t.getState();return Xu(d,{nodeLookup:f,nodeOrigin:p})},getHandleConnections:({type:d,id:f,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{const f=t.getState().fitViewResolver??Uu();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(p=>[...p]),f.promise}}},[]);return T.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const rr=e=>e.selected,Ef=typeof window<"u"?window:void 0;function Sf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=Jn(),r=pt(e,{actInsideInputWithModifier:!1}),i=pt(t,{target:Ef});T.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(rr),edges:s.filter(rr)}),n.setState({nodesSelectionActive:!1})}},[r]),T.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Nf(e){const t=re();T.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Wn(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ue.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 sn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Cf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Mf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=De.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:g,noWheelClassName:w,noPanClassName:x,onViewportChange:m,isControlledViewport:_,paneClickDistance:h,selectionOnDrag:y}){const S=re(),b=T.useRef(null),{userSelectionActive:C,lib:A,connectionInProgress:$}=J(Cf,oe),V=pt(f),k=T.useRef();Nf(b);const z=T.useCallback(O=>{m?.({x:O[0],y:O[1],zoom:O[2]}),_||S.setState({transform:O})},[m,_]);return T.useEffect(()=>{if(b.current){k.current=Td({domNode:b.current,minZoom:u,maxZoom:d,translateExtent:c,viewport:l,onDraggingChange:E=>S.setState(I=>I.paneDragging===E?I:{paneDragging:E}),onPanZoomStart:(E,I)=>{const{onViewportChangeStart:M,onMoveStart:D}=S.getState();D?.(E,I),M?.(I)},onPanZoom:(E,I)=>{const{onViewportChange:M,onMove:D}=S.getState();D?.(E,I),M?.(I)},onPanZoomEnd:(E,I)=>{const{onViewportChangeEnd:M,onMoveEnd:D}=S.getState();D?.(E,I),M?.(I)}});const{x:O,y:v,zoom:N}=k.current.getViewport();return S.setState({panZoom:k.current,transform:[O,v,N],domNode:b.current.closest(".react-flow")}),()=>{k.current?.destroy()}}},[]),T.useEffect(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:V,preventScrolling:p,noPanClassName:x,userSelectionActive:C,noWheelClassName:w,lib:A,onTransformChange:z,connectionInProgress:$,selectionOnDrag:y,paneClickDistance:h})},[e,t,n,o,r,i,s,a,V,p,x,C,w,A,z,$,y,h]),P.jsx("div",{className:"react-flow__renderer",ref:b,style:sn,children:g})}const If=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function kf(){const{userSelectionActive:e,userSelectionRect:t}=J(If,oe);return e&&t?P.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 vn=(e,t)=>n=>{n.target===t.current&&e?.(n)},Af=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function $f({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ft.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:p,children:g}){const w=re(),{userSelectionActive:x,elementsSelectable:m,dragging:_,connectionInProgress:h}=J(Af,oe),y=m&&(e||x),S=T.useRef(null),b=T.useRef(),C=T.useRef(new Set),A=T.useRef(new Set),$=T.useRef(!1),V=M=>{if($.current||h){$.current=!1;return}l?.(M),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},k=M=>{if(Array.isArray(o)&&o?.includes(2)){M.preventDefault();return}c?.(M)},z=u?M=>u(M):void 0,O=M=>{$.current&&(M.stopPropagation(),$.current=!1)},v=M=>{const{domNode:D}=w.getState();if(b.current=D?.getBoundingClientRect(),!b.current)return;const H=M.target===S.current;if(!H&&!!M.target.closest(".nokey")||!e||!(i&&H||t)||M.button!==0||!M.isPrimary)return;M.target?.setPointerCapture?.(M.pointerId),$.current=!1;const{x:j,y:F}=ge(M.nativeEvent,b.current);w.setState({userSelectionRect:{width:0,height:0,startX:j,startY:F,x:j,y:F}}),H||(M.stopPropagation(),M.preventDefault())},N=M=>{const{userSelectionRect:D,transform:H,nodeLookup:L,edgeLookup:R,connectionLookup:j,triggerNodeChanges:F,triggerEdgeChanges:W,defaultEdgeOptions:K,resetSelectedElements:Z}=w.getState();if(!b.current||!D)return;const{x:B,y:X}=ge(M.nativeEvent,b.current),{startX:Q,startY:U}=D;if(!$.current){const te=t?0:r;if(Math.hypot(B-Q,X-U)<=te)return;Z(),s?.(M)}$.current=!0;const q={startX:Q,startY:U,x:B<Q?B:Q,y:X<U?X:U,width:Math.abs(B-Q),height:Math.abs(X-U)},G=C.current,ee=A.current;C.current=new Set(Yn(L,q,H,n===ft.Partial,!0).map(te=>te.id)),A.current=new Set;const ne=K?.selectable??!0;for(const te of C.current){const se=j.get(te);if(se)for(const{edgeId:Se}of se.values()){const we=R.get(Se);we&&(we.selectable??ne)&&A.current.add(Se)}}if(!$o(G,C.current)){const te=Be(L,C.current,!0);F(te)}if(!$o(ee,A.current)){const te=Be(R,A.current);W(te)}w.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},E=M=>{M.button===0&&(M.target?.releasePointerCapture?.(M.pointerId),!x&&M.target===S.current&&w.getState().userSelectionRect&&V?.(M),w.setState({userSelectionActive:!1,userSelectionRect:null}),$.current&&(a?.(M),w.setState({nodesSelectionActive:C.current.size>0})))},I=o===!0||Array.isArray(o)&&o.includes(0);return P.jsxs("div",{className:ie(["react-flow__pane",{draggable:I,dragging:_,selection:e}]),onClick:y?void 0:vn(V,S),onContextMenu:vn(k,S),onWheel:vn(z,S),onPointerEnter:y?void 0:d,onPointerMove:y?N:f,onPointerUp:y?E:void 0,onPointerDownCapture:y?v:void 0,onClickCapture:y?O:void 0,onPointerLeave:p,ref:S,style:sn,children:[g,P.jsx(kf,{})]})}function Hn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ue.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function $i({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=re(),[l,c]=T.useState(!1),u=T.useRef();return T.useEffect(()=>{u.current=vd({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{Hn({id:d,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),T.useEffect(()=>{if(!(t||!e.current||!u.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,s]),l}const Pf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Pi(){const e=re();return T.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),d=new Map,f=Pf(s),p=r?i[0]:5,g=r?i[1]:5,w=n.direction.x*p*n.factor,x=n.direction.y*g*n.factor;for(const[,m]of c){if(!f(m))continue;let _={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+x};r&&(_=vt(_,i));const{position:h,positionAbsolute:y}=Kr({nodeId:m.id,nextPosition:_,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});m.position=h,m.internals.positionAbsolute=y,d.set(m.id,m)}l(d)},[])}const eo=T.createContext(null),Df=eo.Provider;eo.Consumer;const Di=()=>T.useContext(eo),Tf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===Ze.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Hf({type:e="source",position:t=Y.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:d,...f},p){const g=s||null,w=e==="target",x=re(),m=Di(),{connectOnClick:_,noPanClassName:h,rfId:y}=J(Tf,oe),{connectingFrom:S,connectingTo:b,clickConnecting:C,isPossibleEndHandle:A,connectionInProcess:$,clickConnectionInProcess:V,valid:k}=J(zf(m,g,e),oe);m||x.getState().onError?.("010",ue.error010());const z=N=>{const{defaultEdgeOptions:E,onConnect:I,hasDefaultEdges:M}=x.getState(),D={...E,...N};if(M){const{edges:H,setEdges:L}=x.getState();L(rd(D,H))}I?.(D),a?.(D)},O=N=>{if(!m)return;const E=ii(N.nativeEvent);if(r&&(E&&N.button===0||!E)){const I=x.getState();Tn.onPointerDown(N.nativeEvent,{handleDomNode:N.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:w,handleId:g,nodeId:m,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...M)=>x.getState().onConnectEnd?.(...M),updateConnection:I.updateConnection,onConnect:z,isValidConnection:n||((...M)=>x.getState().isValidConnection?.(...M)??!0),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}E?u?.(N):d?.(N)},v=N=>{const{onClickConnectStart:E,onClickConnectEnd:I,connectionClickStartHandle:M,connectionMode:D,isValidConnection:H,lib:L,rfId:R,nodeLookup:j,connection:F}=x.getState();if(!m||!M&&!r)return;if(!M){E?.(N.nativeEvent,{nodeId:m,handleId:g,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:m,type:e,id:g}});return}const W=oi(N.target),K=n||H,{connection:Z,isValid:B}=Tn.isValid(N.nativeEvent,{handle:{nodeId:m,id:g,type:e},connectionMode:D,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:K,flowId:R,doc:W,lib:L,nodeLookup:j});B&&Z&&z(Z);const X=structuredClone(F);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,I?.(N,X),x.setState({connectionClickStartHandle:null})};return P.jsx("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":t,"data-id":`${y}-${m}-${g}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,c,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:i,clickconnecting:C,connectingfrom:S,connectingto:b,valid:k,connectionindicator:o&&(!$||A)&&($||V?i:r)}]),onMouseDown:O,onTouchStart:O,onClick:_?v:void 0,ref:p,...f,children:l})}const Wt=T.memo(ki(Hf));function Rf({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return P.jsxs(P.Fragment,{children:[e?.label,P.jsx(Wt,{type:"source",position:n,isConnectable:t})]})}function Lf({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:o=Y.Bottom}){return P.jsxs(P.Fragment,{children:[P.jsx(Wt,{type:"target",position:n,isConnectable:t}),e?.label,P.jsx(Wt,{type:"source",position:o,isConnectable:t})]})}function Of(){return null}function Vf({data:e,isConnectable:t,targetPosition:n=Y.Top}){return P.jsxs(P.Fragment,{children:[P.jsx(Wt,{type:"target",position:n,isConnectable:t}),e?.label]})}const qt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ir={input:Rf,default:Lf,output:Vf,group:Of};function Bf(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 Ff=e=>{const{width:t,height:n,x:o,y:r}=wt(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:a}=J(Ff,oe),l=Pi(),c=T.useRef(null);T.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]);const u=!a&&r!==null&&i!==null;if($i({nodeRef:c,disabled:!u}),!u)return null;const d=e?p=>{const g=o.getState().nodes.filter(w=>w.selected);e(p,g)}:void 0,f=p=>{Object.prototype.hasOwnProperty.call(qt,p.key)&&(p.preventDefault(),l({direction:qt[p.key],factor:p.shiftKey?4:1}))};return P.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:P.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:i}})})}const sr=typeof window<"u"?window:void 0,Xf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ti({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:y,panOnScrollSpeed:S,panOnScrollMode:b,zoomOnDoubleClick:C,panOnDrag:A,defaultViewport:$,translateExtent:V,minZoom:k,maxZoom:z,preventScrolling:O,onSelectionContextMenu:v,noWheelClassName:N,noPanClassName:E,disableKeyboardA11y:I,onViewportChange:M,isControlledViewport:D}){const{nodesSelectionActive:H,userSelectionActive:L}=J(Xf,oe),R=pt(c,{target:sr}),j=pt(w,{target:sr}),F=j||A,W=j||y,K=u&&F!==!0,Z=R||L||K;return Sf({deleteKeyCode:l,multiSelectionKeyCode:g}),P.jsx(Mf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:W,panOnScrollSpeed:S,panOnScrollMode:b,zoomOnDoubleClick:C,panOnDrag:!R&&F,defaultViewport:$,translateExtent:V,minZoom:k,maxZoom:z,zoomActivationKeyCode:x,preventScrolling:O,noWheelClassName:N,noPanClassName:E,onViewportChange:M,isControlledViewport:D,paneClickDistance:a,selectionOnDrag:K,children:P.jsxs($f,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:F,isSelecting:!!Z,selectionMode:d,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:K,children:[e,H&&P.jsx(jf,{onSelectionContextMenu:v,noPanClassName:E,disableKeyboardA11y:I})]})})}Ti.displayName="FlowRenderer";const Yf=T.memo(Ti),Zf=e=>t=>e?Yn(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 Wf(e){return J(T.useCallback(Zf(e),[e]),oe)}const qf=e=>e.updateNodeInternals;function Gf(){const e=J(qf),[t]=T.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 T.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Kf({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),i=T.useRef(null),s=T.useRef(null),a=T.useRef(e.sourcePosition),l=T.useRef(e.targetPosition),c=T.useRef(t),u=n&&!!e.internals.handleBounds;return T.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]),T.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),T.useEffect(()=>{if(i.current){const d=c.current!==t,f=a.current!==e.sourcePosition,p=l.current!==e.targetPosition;(d||f||p)&&(c.current=t,a.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 Uf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:g,rfId:w,nodeTypes:x,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",C=x?.[b]||ir[b];C===void 0&&(_?.("003",ue.error003(b)),b="default",C=x?.default||ir.default);const A=!!(h.draggable||a&&typeof h.draggable>"u"),$=!!(h.selectable||l&&typeof h.selectable>"u"),V=!!(h.connectable||c&&typeof h.connectable>"u"),k=!!(h.focusable||u&&typeof h.focusable>"u"),z=re(),O=ti(h),v=Kf({node:h,nodeType:b,hasDimensions:O,resizeObserver:d}),N=$i({nodeRef:v,disabled:h.hidden||!A,noDragClassName:f,handleSelector:h.dragHandle,nodeId:e,isSelectable:$,nodeClickDistance:m}),E=Pi();if(h.hidden)return null;const I=Ee(h),M=Bf(h),D=$||A||t||n||o||r,H=n?B=>n(B,{...y.userNode}):void 0,L=o?B=>o(B,{...y.userNode}):void 0,R=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}=z.getState();$&&(!X||!A||Q>0)&&Hn({id:e,store:z,nodeRef:v}),t&&t(B,{...y.userNode})},K=B=>{if(!(ri(B.nativeEvent)||g)){if(Yr.includes(B.key)&&$){const X=B.key==="Escape";Hn({id:e,store:z,unselect:X,nodeRef:v})}else if(A&&h.selected&&Object.prototype.hasOwnProperty.call(qt,B.key)){B.preventDefault();const{ariaLabelConfig:X}=z.getState();z.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),E({direction:qt[B.key],factor:B.shiftKey?4:1})}}},Z=()=>{if(g||!v.current?.matches(":focus-visible"))return;const{transform:B,width:X,height:Q,autoPanOnNodeFocus:U,setCenter:q}=z.getState();if(!U)return;Yn(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 P.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${b}`,{[p]:A},h.className,{selected:h.selected,selectable:$,parent:S,draggable:A,dragging:N}]),ref:v,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:O?"visible":"hidden",...h.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:L,onMouseLeave:R,onContextMenu:j,onClick:W,onDoubleClick:F,onKeyDown:k?K:void 0,tabIndex:k?0:void 0,onFocus:k?Z:void 0,role:h.ariaRole??(k?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Ei}-${w}`,"aria-label":h.ariaLabel,...h.domAttributes,children:P.jsx(Df,{value:e,children:P.jsx(C,{id:e,data:h.data,type:b,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:h.selected??!1,selectable:$,draggable:A,deletable:h.deletable??!0,isConnectable:V,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:N,dragHandle:h.dragHandle,zIndex:y.z,parentId:h.parentId,...I})})})}var Qf=T.memo(Uf);const Jf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function zi(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(Jf,oe),s=Wf(e.onlyRenderVisibleElements),a=Gf();return P.jsx("div",{className:"react-flow__nodes",style:sn,children:s.map(l=>P.jsx(Qf,{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:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}zi.displayName="NodeRenderer";const eh=T.memo(zi);function th(e){return J(T.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&&td({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const nh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return P.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},oh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return P.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ar={[Xt.Arrow]:nh,[Xt.ArrowClosed]:oh};function rh(e){const t=re();return T.useMemo(()=>Object.prototype.hasOwnProperty.call(ar,e)?ar[e]:(t.getState().onError?.("009",ue.error009(e)),null),[e])}const ih=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=rh(t);return l?P.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:P.jsx(l,{color:n,strokeWidth:s})}):null},Hi=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=T.useMemo(()=>ld(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?P.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:P.jsx("defs",{children:r.map(i=>P.jsx(ih,{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};Hi.displayName="MarkerDefinitions";var sh=T.memo(Hi);function Ri({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[d,f]=T.useState({x:1,y:0,width:0,height:0}),p=ie(["react-flow__edge-textwrapper",c]),g=T.useRef(null);return T.useEffect(()=>{if(g.current){const w=g.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?P.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?"visible":"hidden",...u,children:[r&&P.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:a,ry:a}),P.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:o,children:n}),l]}):null}Ri.displayName="EdgeText";const ah=T.memo(Ri);function an({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return P.jsxs(P.Fragment,{children:[P.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),c?P.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&he(t)&&he(n)?P.jsx(ah,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function cr({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 Li({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top}){const[s,a]=cr({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=cr({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,p]=si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,u,d,f,p]}function Oi(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:m})=>{const[_,h,y]=Li({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),S=e.isInternal?void 0:t;return P.jsx(an,{id:S,path:_,labelX:h,labelY:y,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:m})})}const ch=Oi({isInternal:!1}),Vi=Oi({isInternal:!0});ch.displayName="SimpleBezierEdge";Vi.displayName="SimpleBezierEdgeInternal";function Bi(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Y.Bottom,targetPosition:g=Y.Top,markerEnd:w,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[h,y,S]=$n({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),b=e.isInternal?void 0:t;return P.jsx(an,{id:b,path:h,labelX:y,labelY:S,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:w,markerStart:x,interactionWidth:_})})}const Fi=Bi({isInternal:!1}),ji=Bi({isInternal:!0});Fi.displayName="SmoothStepEdge";ji.displayName="SmoothStepEdgeInternal";function Xi(e){return T.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return P.jsx(Fi,{...n,id:o,pathOptions:T.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const lh=Xi({isInternal:!1}),Yi=Xi({isInternal:!0});lh.displayName="StepEdge";Yi.displayName="StepEdgeInternal";function Zi(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:g,interactionWidth:w})=>{const[x,m,_]=li({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=e.isInternal?void 0:t;return P.jsx(an,{id:h,path:x,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:g,interactionWidth:w})})}const uh=Zi({isInternal:!1}),Wi=Zi({isInternal:!0});uh.displayName="StraightEdge";Wi.displayName="StraightEdgeInternal";function qi(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Y.Bottom,targetPosition:a=Y.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[h,y,S]=ai({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m?.curvature}),b=e.isInternal?void 0:t;return P.jsx(an,{id:b,path:h,labelX:y,labelY:S,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:w,markerStart:x,interactionWidth:_})})}const dh=qi({isInternal:!1}),Gi=qi({isInternal:!0});dh.displayName="BezierEdge";Gi.displayName="BezierEdgeInternal";const lr={default:Gi,straight:Wi,step:Yi,smoothstep:ji,simplebezier:Vi},ur={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},fh=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,hh=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,dr="react-flow__edgeupdater";function fr({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return P.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([dr,`${dr}-${a}`]),cx:fh(t,o,e),cy:hh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function gh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){const g=re(),w=(y,S)=>{if(y.button!==0)return;const{autoPanOnConnect:b,domNode:C,connectionMode:A,connectionRadius:$,lib:V,onConnectStart:k,cancelConnection:z,nodeLookup:O,rfId:v,panBy:N,updateConnection:E}=g.getState(),I=S.type==="target",M=(L,R)=>{f(!1),d?.(L,n,S.type,R)},D=L=>c?.(n,L),H=(L,R)=>{f(!0),u?.(y,n,S.type),k?.(L,R)};Tn.onPointerDown(y.nativeEvent,{autoPanOnConnect:b,connectionMode:A,connectionRadius:$,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:O,isTarget:I,edgeUpdaterType:S.type,lib:V,flowId:v,cancelConnection:z,panBy:N,isValidConnection:(...L)=>g.getState().isValidConnection?.(...L)??!0,onConnect:D,onConnectStart:H,onConnectEnd:(...L)=>g.getState().onConnectEnd?.(...L),onReconnectEnd:M,updateConnection:E,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},x=y=>w(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=y=>w(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>p(!0),h=()=>p(!1);return P.jsxs(P.Fragment,{children:[(e===!0||e==="source")&&P.jsx(fr,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:x,onMouseEnter:_,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&P.jsx(fr,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:_,onMouseOut:h,type:"target"})]})}function ph({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:g,edgeTypes:w,noPanClassName:x,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=w?.[S]||lr[S];b===void 0&&(m?.("011",ue.error011(S)),S="default",b=w?.default||lr.default);const C=!!(h.focusable||t&&typeof h.focusable>"u"),A=typeof d<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),$=!!(h.selectable||o&&typeof h.selectable>"u"),V=T.useRef(null),[k,z]=T.useState(!1),[O,v]=T.useState(!1),N=re(),{zIndex:E,sourceX:I,sourceY:M,targetX:D,targetY:H,sourcePosition:L,targetPosition:R}=J(T.useCallback(q=>{const G=q.nodeLookup.get(h.source),ee=q.nodeLookup.get(h.target);if(!G||!ee)return{zIndex:h.zIndex,...ur};const ne=cd({id:e,sourceNode:G,targetNode:ee,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:q.connectionMode,onError:m});return{zIndex:ed({selected:h.selected,zIndex:h.zIndex,sourceNode:G,targetNode:ee,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ne||ur}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),oe),j=T.useMemo(()=>h.markerStart?`url('#${Pn(h.markerStart,g)}')`:void 0,[h.markerStart,g]),F=T.useMemo(()=>h.markerEnd?`url('#${Pn(h.markerEnd,g)}')`:void 0,[h.markerEnd,g]);if(h.hidden||I===null||M===null||D===null||H===null)return null;const W=q=>{const{addSelectedEdges:G,unselectNodesAndEdges:ee,multiSelectionActive:ne}=N.getState();$&&(N.setState({nodesSelectionActive:!1}),h.selected&&ne?(ee({nodes:[],edges:[h]}),V.current?.blur()):G([e])),r&&r(q,h)},K=i?q=>{i(q,{...h})}:void 0,Z=s?q=>{s(q,{...h})}:void 0,B=a?q=>{a(q,{...h})}:void 0,X=l?q=>{l(q,{...h})}:void 0,Q=c?q=>{c(q,{...h})}:void 0,U=q=>{if(!_&&Yr.includes(q.key)&&$){const{unselectNodesAndEdges:G,addSelectedEdges:ee}=N.getState();q.key==="Escape"?(V.current?.blur(),G({edges:[h]})):ee([e])}};return P.jsx("svg",{style:{zIndex:E},children:P.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${S}`,h.className,x,{selected:h.selected,animated:h.animated,inactive:!$&&!r,updating:k,selectable:$}]),onClick:W,onDoubleClick:K,onContextMenu:Z,onMouseEnter:B,onMouseMove:X,onMouseLeave:Q,onKeyDown:C?U:void 0,tabIndex:C?0:void 0,role:h.ariaRole??(C?"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":C?`${Si}-${g}`:void 0,ref:V,...h.domAttributes,children:[!O&&P.jsx(b,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:$,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:D,targetY:H,sourcePosition:L,targetPosition:R,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&&P.jsx(gh,{edge:h,isReconnectable:A,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:I,sourceY:M,targetX:D,targetY:H,sourcePosition:L,targetPosition:R,setUpdateHover:z,setReconnecting:v})]})})}var mh=T.memo(ph);const yh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ki({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,onError:h}=J(yh,oe),y=th(t);return P.jsxs("div",{className:"react-flow__edges",children:[P.jsx(sh,{defaultColor:e,rfId:n}),y.map(S=>P.jsx(mh,{id:S,edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:w},S))]})}Ki.displayName="EdgeRenderer";const xh=T.memo(Ki),wh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vh({children:e}){const t=J(wh);return P.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function bh(e){const t=Jn(),n=T.useRef(!1);T.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const _h=e=>e.panZoom?.syncViewport;function Eh(e){const t=J(_h),n=re();return T.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sh(e){return e.connection.inProgress?{...e.connection,to:bt(e.connection.to,e.transform)}:{...e.connection}}function Nh(e){return Sh}function Ch(e){const t=Nh();return J(t,oe)}const Mh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ih({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=J(Mh,oe);return!(i&&r&&l)?null:P.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:P.jsx("g",{className:ie(["react-flow__connection",qr(a)]),children:P.jsx(Ui,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Ui=({style:e,type:t=Me.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:d,toPosition:f,pointer:p}=Ch();if(!r)return;if(n)return P.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:qr(o),toNode:u,toHandle:d,pointer:p});let g="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case Me.Bezier:[g]=ai(w);break;case Me.SimpleBezier:[g]=Li(w);break;case Me.Step:[g]=$n({...w,borderRadius:0});break;case Me.SmoothStep:[g]=$n(w);break;default:[g]=li(w)}return P.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ui.displayName="ConnectionLine";const kh={};function hr(e=kh){const t=T.useRef(e),n=re();T.useEffect(()=>{{const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",ue.error002());break}t.current=e}},[e])}function Ah(){const e=re(),t=T.useRef(!1);T.useEffect(()=>{if(!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",ue.error013("react")),t.current=!0}},[])}function Qi({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:C,deleteKeyCode:A,onlyRenderVisibleElements:$,elementsSelectable:V,defaultViewport:k,translateExtent:z,minZoom:O,maxZoom:v,preventScrolling:N,defaultMarkerColor:E,zoomOnScroll:I,zoomOnPinch:M,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:j,onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:Z,onPaneScroll:B,onPaneContextMenu:X,paneClickDistance:Q,nodeClickDistance:U,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:se,onReconnectStart:Se,onReconnectEnd:we,noDragClassName:ke,noWheelClassName:Ue,noPanClassName:Qe,disableKeyboardA11y:Je,nodeExtent:cn,rfId:_t,viewport:Le,onViewportChange:et}){return hr(e),hr(t),Ah(),bh(n),Eh(Le),P.jsx(Yf,{onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:Z,onPaneContextMenu:X,onPaneScroll:B,paneClickDistance:Q,deleteKeyCode:A,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:C,elementsSelectable:V,zoomOnScroll:I,zoomOnPinch:M,zoomOnDoubleClick:R,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:L,panOnDrag:j,defaultViewport:k,translateExtent:z,minZoom:O,maxZoom:v,onSelectionContextMenu:d,preventScrolling:N,noDragClassName:ke,noWheelClassName:Ue,noPanClassName:Qe,disableKeyboardA11y:Je,onViewportChange:et,isControlledViewport:!!Le,children:P.jsxs(vh,{children:[P.jsx(xh,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:se,onReconnectStart:Se,onReconnectEnd:we,onlyRenderVisibleElements:$,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:E,noPanClassName:Qe,disableKeyboardA11y:Je,rfId:_t}),P.jsx(Ih,{style:w,type:g,component:x,containerStyle:m}),P.jsx("div",{className:"react-flow__edgelabel-renderer"}),P.jsx(eh,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:U,onlyRenderVisibleElements:$,noPanClassName:Qe,noDragClassName:ke,disableKeyboardA11y:Je,nodeExtent:cn,rfId:_t}),P.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qi.displayName="GraphView";const $h=T.memo(Qi),gr=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{const p=new Map,g=new Map,w=new Map,x=new Map,m=o??t??[],_=n??e??[],h=u??[0,0],y=d??dt;fi(w,x,m);const{nodesInitialized:S}=Dn(_,p,g,{nodeOrigin:h,nodeExtent:y,zIndexMode:f});let b=[0,0,1];if(s&&r&&i){const C=wt(p,{filter:k=>!!((k.width||k.initialWidth)&&(k.height||k.initialHeight))}),{x:A,y:$,zoom:V}=Zn(C,r,i,l,c,a?.padding??.1);b=[A,$,V]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:_,nodesInitialized:S,nodeLookup:p,parentLookup:g,edges:m,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:dt,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ze.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:a,fitViewResolver:null,connection:{...Wr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ei,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Zr,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ph=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Kd((p,g)=>{async function w(){const{nodeLookup:x,panZoom:m,fitViewOptions:_,fitViewResolver:h,width:y,height:S,minZoom:b,maxZoom:C}=g();m&&(await Wu({nodes:x,width:y,height:S,panZoom:m,minZoom:b,maxZoom:C},_),h?.resolve(!0),p({fitViewResolver:null}))}return{...gr({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:x=>{const{nodeLookup:m,parentLookup:_,nodeOrigin:h,elevateNodesOnSelect:y,fitViewQueued:S,zIndexMode:b,nodesSelectionActive:C}=g(),{nodesInitialized:A,hasSelectedNodes:$}=Dn(x,m,_,{nodeOrigin:h,nodeExtent:d,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:b}),V=C&&$;S&&A?(w(),p({nodes:x,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:V})):p({nodes:x,nodesInitialized:A,nodesSelectionActive:V})},setEdges:x=>{const{connectionLookup:m,edgeLookup:_}=g();fi(m,_,x),p({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){const{setNodes:_}=g();_(x),p({hasDefaultNodes:!0})}if(m){const{setEdges:_}=g();_(m),p({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:m,nodeLookup:_,parentLookup:h,domNode:y,nodeOrigin:S,nodeExtent:b,debug:C,fitViewQueued:A,zIndexMode:$}=g(),{changes:V,updatedInternals:k}=md(x,_,h,y,S,b,$);k&&(fd(_,h,{nodeOrigin:S,nodeExtent:b,zIndexMode:$}),A?(w(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),V?.length>0&&(C&&console.log("React Flow: trigger node changes",V),m?.(V)))},updateNodePositions:(x,m=!1)=>{const _=[];let h=[];const{nodeLookup:y,triggerNodeChanges:S,connection:b,updateConnection:C,onNodesChangeMiddlewareMap:A}=g();for(const[$,V]of x){const k=y.get($),z=!!(k?.expandParent&&k?.parentId&&V?.position),O={id:$,type:"position",position:z?{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=Re(k,b.fromHandle,Y.Left,!0);C({...b,from:v})}z&&k.parentId&&_.push({id:$,parentId:k.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),h.push(O)}if(_.length>0){const{parentLookup:$,nodeOrigin:V}=g(),k=Qn(_,y,$,V);h.push(...k)}for(const $ of A.values())h=$(h);S(h)},triggerNodeChanges:x=>{const{onNodesChange:m,setNodes:_,nodes:h,hasDefaultNodes:y,debug:S}=g();if(x?.length){if(y){const b=Mi(x,h);_(b)}S&&console.log("React Flow: trigger node changes",x),m?.(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:m,setEdges:_,edges:h,hasDefaultEdges:y,debug:S}=g();if(x?.length){if(y){const b=Ii(x,h);_(b)}S&&console.log("React Flow: trigger edge changes",x),m?.(x)}},addSelectedNodes:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(m){const b=x.map(C=>Ae(C,!0));y(b);return}y(Be(h,new Set([...x]),!0)),S(Be(_))},addSelectedEdges:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(m){const b=x.map(C=>Ae(C,!0));S(b);return}S(Be(_,new Set([...x]))),y(Be(h,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{const{edges:_,nodes:h,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:b}=g(),C=x||h,A=m||_,$=[];for(const k of C){if(!k.selected)continue;const z=y.get(k.id);z&&(z.selected=!1),$.push(Ae(k.id,!1))}const V=[];for(const k of A)k.selected&&V.push(Ae(k.id,!1));S($),b(V)},setMinZoom:x=>{const{panZoom:m,maxZoom:_}=g();m?.setScaleExtent([x,_]),p({minZoom:x})},setMaxZoom:x=>{const{panZoom:m,minZoom:_}=g();m?.setScaleExtent([_,x]),p({maxZoom:x})},setTranslateExtent:x=>{g().panZoom?.setTranslateExtent(x),p({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:m,triggerNodeChanges:_,triggerEdgeChanges:h,elementsSelectable:y}=g();if(!y)return;const S=m.reduce((C,A)=>A.selected?[...C,Ae(A.id,!1)]:C,[]),b=x.reduce((C,A)=>A.selected?[...C,Ae(A.id,!1)]:C,[]);_(S),h(b)},setNodeExtent:x=>{const{nodes:m,nodeLookup:_,parentLookup:h,nodeOrigin:y,elevateNodesOnSelect:S,nodeExtent:b,zIndexMode:C}=g();x[0][0]===b[0][0]&&x[0][1]===b[0][1]&&x[1][0]===b[1][0]&&x[1][1]===b[1][1]||(Dn(m,_,h,{nodeOrigin:y,nodeExtent:x,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:C}),p({nodeExtent:x}))},panBy:x=>{const{transform:m,width:_,height:h,panZoom:y,translateExtent:S}=g();return yd({delta:x,panZoom:y,transform:m,translateExtent:S,width:_,height:h})},setCenter:async(x,m,_)=>{const{width:h,height:y,maxZoom:S,panZoom:b}=g();if(!b)return Promise.resolve(!1);const C=typeof _?.zoom<"u"?_.zoom:S;return await b.setViewport({x:h/2-x*C,y:y/2-m*C,zoom:C},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Wr}})},updateConnection:x=>{p({connection:x})},reset:()=>p({...gr()})}},Object.is);function Dh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){const[g]=T.useState(()=>Ph({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return P.jsx(Ud,{value:g,children:P.jsx(vf,{children:p})})}function Th({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return T.useContext(on)?P.jsx(P.Fragment,{children:e}):P.jsx(Dh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}const zh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Hh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:b,onNodeDragStart:C,onNodeDrag:A,onNodeDragStop:$,onNodesDelete:V,onEdgesDelete:k,onDelete:z,onSelectionChange:O,onSelectionDragStart:v,onSelectionDrag:N,onSelectionDragStop:E,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:D,onBeforeDelete:H,connectionMode:L,connectionLineType:R=Me.Bezier,connectionLineStyle:j,connectionLineComponent:F,connectionLineContainerStyle:W,deleteKeyCode:K="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:B=!1,selectionMode:X=ft.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:U=gt()?"Meta":"Control",zoomActivationKeyCode:q=gt()?"Meta":"Control",snapToGrid:G,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:se,autoPanOnNodeFocus:Se,nodesConnectable:we,nodesFocusable:ke,nodeOrigin:Ue=Ni,edgesFocusable:Qe,edgesReconnectable:Je,elementsSelectable:cn=!0,defaultViewport:_t=df,minZoom:Le=.5,maxZoom:et=2,translateExtent:to=dt,preventScrolling:ns=!0,nodeExtent:ln,defaultMarkerColor:os="#b1b1b7",zoomOnScroll:rs=!0,zoomOnPinch:is=!0,panOnScroll:ss=!1,panOnScrollSpeed:as=.5,panOnScrollMode:cs=De.Free,zoomOnDoubleClick:ls=!0,panOnDrag:us=!0,onPaneClick:ds,onPaneMouseEnter:fs,onPaneMouseMove:hs,onPaneMouseLeave:gs,onPaneScroll:ps,onPaneContextMenu:ms,paneClickDistance:ys=1,nodeClickDistance:xs=0,children:ws,onReconnect:vs,onReconnectStart:bs,onReconnectEnd:_s,onEdgeContextMenu:Es,onEdgeDoubleClick:Ss,onEdgeMouseEnter:Ns,onEdgeMouseMove:Cs,onEdgeMouseLeave:Ms,reconnectRadius:Is=10,onNodesChange:ks,onEdgesChange:As,noDragClassName:$s="nodrag",noWheelClassName:Ps="nowheel",noPanClassName:no="nopan",fitView:oo,fitViewOptions:ro,connectOnClick:Ds,attributionPosition:Ts,proOptions:zs,defaultEdgeOptions:Hs,elevateNodesOnSelect:Rs=!0,elevateEdgesOnSelect:Ls=!1,disableKeyboardA11y:io=!1,autoPanOnConnect:Os,autoPanOnNodeDrag:Vs,autoPanSpeed:Bs,connectionRadius:Fs,isValidConnection:js,onError:Xs,style:Ys,id:so,nodeDragThreshold:Zs,connectionDragThreshold:Ws,viewport:qs,onViewportChange:Gs,width:Ks,height:Us,colorMode:Qs="light",debug:Js,onScroll:ao,ariaLabelConfig:ea,zIndexMode:co="basic",...ta},na){const un=so||"1",oa=pf(Qs),ra=T.useCallback(lo=>{lo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ao?.(lo)},[ao]);return P.jsx("div",{"data-testid":"rf__wrapper",...ta,onScroll:ra,style:{...Ys,...zh},ref:na,className:ie(["react-flow",r,oa]),id:so,role:"application",children:P.jsxs(Th,{nodes:e,edges:t,width:Ks,height:Us,fitView:oo,fitViewOptions:ro,minZoom:Le,maxZoom:et,nodeOrigin:Ue,nodeExtent:ln,zIndexMode:co,children:[P.jsx(gf,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:Se,nodesConnectable:we,nodesFocusable:ke,edgesFocusable:Qe,edgesReconnectable:Je,elementsSelectable:cn,elevateNodesOnSelect:Rs,elevateEdgesOnSelect:Ls,minZoom:Le,maxZoom:et,nodeExtent:ln,onNodesChange:ks,onEdgesChange:As,snapToGrid:G,snapGrid:ee,connectionMode:L,translateExtent:to,connectOnClick:Ds,defaultEdgeOptions:Hs,fitView:oo,fitViewOptions:ro,onNodesDelete:V,onEdgesDelete:k,onDelete:z,onNodeDragStart:C,onNodeDrag:A,onNodeDragStop:$,onSelectionDrag:N,onSelectionDragStart:v,onSelectionDragStop:E,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:no,nodeOrigin:Ue,rfId:un,autoPanOnConnect:Os,autoPanOnNodeDrag:Vs,autoPanSpeed:Bs,onError:Xs,connectionRadius:Fs,isValidConnection:js,selectNodesOnDrag:te,nodeDragThreshold:Zs,connectionDragThreshold:Ws,onBeforeDelete:H,debug:Js,ariaLabelConfig:ea,zIndexMode:co}),P.jsx($h,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:b,nodeTypes:i,edgeTypes:s,connectionLineType:R,connectionLineStyle:j,connectionLineComponent:F,connectionLineContainerStyle:W,selectionKeyCode:Z,selectionOnDrag:B,selectionMode:X,deleteKeyCode:K,multiSelectionKeyCode:U,panActivationKeyCode:Q,zoomActivationKeyCode:q,onlyRenderVisibleElements:ne,defaultViewport:_t,translateExtent:to,minZoom:Le,maxZoom:et,preventScrolling:ns,zoomOnScroll:rs,zoomOnPinch:is,zoomOnDoubleClick:ls,panOnScroll:ss,panOnScrollSpeed:as,panOnScrollMode:cs,panOnDrag:us,onPaneClick:ds,onPaneMouseEnter:fs,onPaneMouseMove:hs,onPaneMouseLeave:gs,onPaneScroll:ps,onPaneContextMenu:ms,paneClickDistance:ys,nodeClickDistance:xs,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:D,onReconnect:vs,onReconnectStart:bs,onReconnectEnd:_s,onEdgeContextMenu:Es,onEdgeDoubleClick:Ss,onEdgeMouseEnter:Ns,onEdgeMouseMove:Cs,onEdgeMouseLeave:Ms,reconnectRadius:Is,defaultMarkerColor:os,noDragClassName:$s,noWheelClassName:Ps,noPanClassName:no,rfId:un,disableKeyboardA11y:io,nodeExtent:ln,viewport:qs,onViewportChange:Gs}),P.jsx(uf,{onSelectionChange:O}),ws,P.jsx(rf,{proOptions:zs,position:Ts}),P.jsx(of,{rfId:un,disableKeyboardA11y:io})]})})}var dg=ki(Hh);function fg(e){const[t,n]=T.useState(e),o=T.useCallback(r=>n(i=>Mi(r,i)),[]);return[t,n,o]}function hg(e){const[t,n]=T.useState(e),o=T.useCallback(r=>n(i=>Ii(r,i)),[]);return[t,n,o]}function Rh({dimensions:e,lineWidth:t,variant:n,className:o}){return P.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 Lh({radius:e,className:t}){return P.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Ie;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ie||(Ie={}));const Oh={[Ie.Dots]:1,[Ie.Lines]:1,[Ie.Cross]:6},Vh=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ji({id:e,variant:t=Ie.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){const d=T.useRef(null),{transform:f,patternId:p}=J(Vh,oe),g=o||Oh[t],w=t===Ie.Dots,x=t===Ie.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*f[2]||1,m[1]*f[2]||1],h=g*f[2],y=Array.isArray(i)?i:[i,i],S=x?[h,h]:_,b=[y[0]*f[2]||1+S[0]/2,y[1]*f[2]||1+S[1]/2],C=`${p}${e||""}`;return P.jsxs("svg",{className:ie(["react-flow__background",c]),style:{...l,...sn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[P.jsx("pattern",{id:C,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:w?P.jsx(Lh,{radius:h/2,className:u}):P.jsx(Rh,{dimensions:S,lineWidth:r,variant:t,className:u})}),P.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}Ji.displayName="Background";const gg=T.memo(Ji);function Bh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:P.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Fh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:P.jsx("path",{d:"M0 0h32v4.2H0z"})})}function jh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:P.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 Xh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.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 Yh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.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 P.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const Zh=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function es({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":p}){const g=re(),{isInteractive:w,minZoomReached:x,maxZoomReached:m,ariaLabelConfig:_}=J(Zh,oe),{zoomIn:h,zoomOut:y,fitView:S}=Jn(),b=()=>{h(),i?.()},C=()=>{y(),s?.()},A=()=>{S(r),a?.()},$=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)},V=f==="horizontal"?"horizontal":"vertical";return P.jsxs(rn,{className:ie(["react-flow__controls",V,c]),position:d,style:e,"data-testid":"rf__controls","aria-label":p??_["controls.ariaLabel"],children:[t&&P.jsxs(P.Fragment,{children:[P.jsx($t,{onClick:b,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:P.jsx(Bh,{})}),P.jsx($t,{onClick:C,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:x,children:P.jsx(Fh,{})})]}),n&&P.jsx($t,{className:"react-flow__controls-fitview",onClick:A,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:P.jsx(jh,{})}),o&&P.jsx($t,{className:"react-flow__controls-interactive",onClick:$,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:w?P.jsx(Yh,{}):P.jsx(Xh,{})}),u]})}es.displayName="Controls";const pg=T.memo(es);function Wh({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){const{background:g,backgroundColor:w}=i||{},x=s||g||w;return P.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:d,onClick:p?m=>p(m,e):void 0})}const qh=T.memo(Wh),Gh=e=>e.nodes.map(t=>t.id),bn=e=>e instanceof Function?e:()=>e;function Kh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=qh,onClick:s}){const a=J(Gh,oe),l=bn(t),c=bn(e),u=bn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return P.jsx(P.Fragment,{children:a.map(f=>P.jsx(Qh,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},f))})}function Uh({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:u,y:d,width:f,height:p}=J(g=>{const w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:m,y:_}=w.internals.positionAbsolute,{width:h,height:y}=Ee(x);return{node:x,x:m,y:_,width:h,height:y}},oe);return!c||c.hidden||!ti(c)?null:P.jsx(a,{x:u,y:d,width:f,height:p,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const Qh=T.memo(Uh);var Jh=T.memo(Kh);const eg=200,tg=150,ng=e=>!e.hidden,og=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?Jr(wt(e.nodeLookup,{filter:ng}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rg="react-flow__minimap-desc";function ts({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:p,onNodeClick:g,pannable:w=!1,zoomable:x=!1,ariaLabel:m,inversePan:_,zoomStep:h=1,offsetScale:y=5}){const S=re(),b=T.useRef(null),{boundingRect:C,viewBB:A,rfId:$,panZoom:V,translateExtent:k,flowWidth:z,flowHeight:O,ariaLabelConfig:v}=J(og,oe),N=e?.width??eg,E=e?.height??tg,I=C.width/N,M=C.height/E,D=Math.max(I,M),H=D*N,L=D*E,R=y*D,j=C.x-(H-C.width)/2-R,F=C.y-(L-C.height)/2-R,W=H+R*2,K=L+R*2,Z=`${rg}-${$}`,B=T.useRef(0),X=T.useRef();B.current=D,T.useEffect(()=>{if(b.current&&V)return X.current=Cd({domNode:b.current,panZoom:V,getTransform:()=>S.getState().transform,getViewScale:()=>B.current}),()=>{X.current?.destroy()}},[V]),T.useEffect(()=>{X.current?.update({translateExtent:k,width:z,height:O,inversePan:_,pannable:w,zoomStep:h,zoomable:x})},[w,x,_,h,k,z,O]);const Q=p?G=>{const[ee,ne]=X.current?.pointer(G)||[0,0];p(G,{x:ee,y:ne})}:void 0,U=g?T.useCallback((G,ee)=>{const ne=S.getState().nodeLookup.get(ee).internals.userNode;g(G,ne)},[]):void 0,q=m??v["minimap.ariaLabel"];return P.jsx(rn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*D: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:P.jsxs("svg",{width:N,height:E,viewBox:`${j} ${F} ${W} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:b,onClick:Q,children:[q&&P.jsx("title",{id:Z,children:q}),P.jsx(Jh,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),P.jsx("path",{className:"react-flow__minimap-mask",d:`M${j-R},${F-R}h${W+R*2}v${K+R*2}h${-W-R*2}z
15
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ts.displayName="MiniMap";const mg=T.memo(ts),ig=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sg={[Ke.Line]:"right",[Ke.Handle]:"bottom-right"};function ag({nodeId:e,position:t,variant:n=Ke.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:g,onResizeStart:w,onResize:x,onResizeEnd:m}){const _=Di(),h=typeof e=="string"?e:_,y=re(),S=T.useRef(null),b=n===Ke.Handle,C=J(T.useCallback(ig(b&&p),[b,p]),oe),A=T.useRef(null),$=t??sg[n];T.useEffect(()=>{if(!(!S.current||!h))return A.current||(A.current=Vd({domNode:S.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:k,transform:z,snapGrid:O,snapToGrid:v,nodeOrigin:N,domNode:E}=y.getState();return{nodeLookup:k,transform:z,snapGrid:O,snapToGrid:v,nodeOrigin:N,paneDomNode:E}},onChange:(k,z)=>{const{triggerNodeChanges:O,nodeLookup:v,parentLookup:N,nodeOrigin:E}=y.getState(),I=[],M={x:k.x,y:k.y},D=v.get(h);if(D&&D.expandParent&&D.parentId){const H=D.origin??E,L=k.width??D.measured.width??0,R=k.height??D.measured.height??0,j={id:D.id,parentId:D.parentId,rect:{width:L,height:R,...ni({x:k.x??D.position.x,y:k.y??D.position.y},{width:L,height:R},D.parentId,v,H)}},F=Qn([j],v,N,E);I.push(...F),M.x=k.x?Math.max(H[0]*L,k.x):void 0,M.y=k.y?Math.max(H[1]*R,k.y):void 0}if(M.x!==void 0&&M.y!==void 0){const H={id:h,type:"position",position:{...M}};I.push(H)}if(k.width!==void 0&&k.height!==void 0){const L={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:k.width,height:k.height}};I.push(L)}for(const H of z){const L={...H,type:"position"};I.push(L)}O(I)},onEnd:({width:k,height:z})=>{const O={id:h,type:"dimensions",resizing:!1,dimensions:{width:k,height:z}};y.getState().triggerNodeChanges([O])}})),A.current.update({controlPosition:$,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:w,onResize:x,onResizeEnd:m,shouldResize:g}),()=>{A.current?.destroy()}},[$,a,l,c,u,d,w,x,m,g]);const V=$.split("-");return P.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...V,n,o]),ref:S,style:{...r,scale:C,...s&&{[b?"backgroundColor":"borderColor"]:s}},children:i})}T.memo(ag);export{gg as B,pg as C,Wt as H,Xt as M,Y as P,hg as a,rd as b,mg as c,dg as i,fg as u};
@@ -0,0 +1 @@
1
+ import{j as e}from"./index-DHWWI-uw.js";import"./query-vendor-BqVbYexz.js";const a="temporal-panel";function s(r){return r?`${r.getFullYear()}/${String(r.getMonth()+1).padStart(2,"0")}`:"No time selected"}const d={id:"temporal-overlay",mount:()=>{},unmount:()=>{},onStateChange:()=>{},toolbarItems:r=>[{id:"temporal-toggle",label:"Temporal",title:"Toggle temporal context panel",active:r.isPanelOpen(a),order:40,onClick:()=>r.dispatchAction({type:"togglePanel",panelId:a})}],renderOverlay:r=>{const n=r.getTemporalState();if(!n?.currentTime)return null;const i=s(n.currentTime);return{id:"temporal-overlay-chip",layer:1,order:10,element:e.jsxDEV("div",{style:{position:"absolute",left:140,bottom:26,display:"inline-flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:999,border:"1px solid rgba(255, 107, 129, 0.18)",background:"linear-gradient(135deg, rgba(6, 15, 27, 0.88), rgba(11, 22, 39, 0.76))",boxShadow:"0 12px 30px rgba(0, 0, 0, 0.28)",color:"#ffdfe4",fontSize:11,letterSpacing:"0.05em",textTransform:"uppercase",pointerEvents:"none"},children:[e.jsxDEV("span",{style:{color:"#7fc6ff",fontWeight:700},children:"Temporal"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:54,columnNumber:11},void 0),e.jsxDEV("span",{children:i},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:58,columnNumber:11},void 0),typeof n.activeNodeCount=="number"?e.jsxDEV("span",{style:{color:"#c99aa3"},children:[n.activeNodeCount.toLocaleString()," active"]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:59,columnNumber:59},void 0):null]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:36,columnNumber:16},void 0)}},renderPanel:r=>{if(!r.isPanelOpen(a))return null;const n=r.getTemporalState();return{id:a,title:"Temporal Context",placement:"bottom",order:30,defaultOpen:!1,preferredWidth:320,preferredHeight:220,content:e.jsxDEV("div",{style:p,children:[e.jsxDEV("div",{style:c,children:"Current scrubber state"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:79,columnNumber:11},void 0),e.jsxDEV("div",{style:l,children:[e.jsxDEV("span",{style:o,children:"Current"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:81,columnNumber:13},void 0),e.jsxDEV("span",{style:t,children:s(n?.currentTime??null)},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:82,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:80,columnNumber:11},void 0),e.jsxDEV("div",{style:l,children:[e.jsxDEV("span",{style:o,children:"Bounds"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:85,columnNumber:13},void 0),e.jsxDEV("span",{style:t,children:[n?.minDate??"1970"," → ",n?.maxDate??"now"]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:86,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:84,columnNumber:11},void 0),e.jsxDEV("div",{style:l,children:[e.jsxDEV("span",{style:o,children:"Active nodes"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:91,columnNumber:13},void 0),e.jsxDEV("span",{style:t,children:typeof n?.activeNodeCount=="number"?n.activeNodeCount.toLocaleString():"All"},void 0,!1,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:92,columnNumber:13},void 0)]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:90,columnNumber:11},void 0)]},void 0,!0,{fileName:"/Users/deepjoy/Documents/Alpha Semantic Hub/Alpha Semantic Hub Logo and Icon/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx",lineNumber:78,columnNumber:16},void 0)}}},p={display:"flex",flexDirection:"column",gap:10},c={color:"#c99aa3",fontSize:11,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase"},l={display:"flex",justifyContent:"space-between",gap:16,padding:"8px 10px",borderRadius:12,border:"1px solid rgba(255,255,255,0.06)",background:"rgba(255,255,255,0.025)"},o={color:"#c99aa3",fontSize:12},t={color:"#fff1f3",fontSize:12,fontWeight:600};export{d as temporalOverlayPlugin};