clitrigger 0.2.40 → 0.2.42

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 (46) hide show
  1. package/dist/client/assets/{AnalyticsPanel-BEadBUrW.js → AnalyticsPanel-D23MrC-n.js} +1 -1
  2. package/dist/client/assets/{FloatingComposerController-5A3GJtK4-Bu39TBbI.js → FloatingComposerController-5A3GJtK4-BFL3smk1.js} +1 -1
  3. package/dist/client/assets/{PlannerPageEditor-hJ0dPYix.js → PlannerPageEditor-DIjZzUkT.js} +3 -3
  4. package/dist/client/assets/{TaskGraph-B4r9BPki.js → TaskGraph-BZAHT_BE.js} +1 -1
  5. package/dist/client/assets/{VaultLayout-hNiaoN-E.js → VaultLayout-O60KqfI7.js} +1 -1
  6. package/dist/client/assets/index-DOl6hFR0.js +703 -0
  7. package/dist/client/assets/{index-BXyO9WJn.css → index-PHcsJJs8.css} +1 -1
  8. package/dist/client/assets/{style-Bir1QIhu.js → style-FQ6M7Rf_.js} +1 -1
  9. package/dist/client/assets/{with-selector-yYq5aOVF.js → with-selector-CVNNI2E_.js} +1 -1
  10. package/dist/client/index.html +2 -2
  11. package/dist/server/db/queries.d.ts +3 -1
  12. package/dist/server/db/queries.d.ts.map +1 -1
  13. package/dist/server/db/queries.js +6 -2
  14. package/dist/server/db/queries.js.map +1 -1
  15. package/dist/server/db/schema.d.ts.map +1 -1
  16. package/dist/server/db/schema.js +3 -0
  17. package/dist/server/db/schema.js.map +1 -1
  18. package/dist/server/lib/git-diff.d.ts +1 -1
  19. package/dist/server/lib/git-diff.d.ts.map +1 -1
  20. package/dist/server/lib/git-diff.js +35 -6
  21. package/dist/server/lib/git-diff.js.map +1 -1
  22. package/dist/server/mcp/index.d.ts.map +1 -1
  23. package/dist/server/mcp/index.js +64 -2
  24. package/dist/server/mcp/index.js.map +1 -1
  25. package/dist/server/mcp/index.test.js +9 -1
  26. package/dist/server/mcp/index.test.js.map +1 -1
  27. package/dist/server/routes/mcp.d.ts.map +1 -1
  28. package/dist/server/routes/mcp.js +10 -2
  29. package/dist/server/routes/mcp.js.map +1 -1
  30. package/dist/server/routes/projects.d.ts.map +1 -1
  31. package/dist/server/routes/projects.js +110 -0
  32. package/dist/server/routes/projects.js.map +1 -1
  33. package/dist/server/routes/sessions.d.ts.map +1 -1
  34. package/dist/server/routes/sessions.js +90 -19
  35. package/dist/server/routes/sessions.js.map +1 -1
  36. package/dist/server/services/session-manager.d.ts.map +1 -1
  37. package/dist/server/services/session-manager.js +18 -4
  38. package/dist/server/services/session-manager.js.map +1 -1
  39. package/dist/server/services/worktree-manager.d.ts +12 -0
  40. package/dist/server/services/worktree-manager.d.ts.map +1 -1
  41. package/dist/server/services/worktree-manager.js +56 -0
  42. package/dist/server/services/worktree-manager.js.map +1 -1
  43. package/electron/main.cjs +15 -22
  44. package/electron/preload.cjs +5 -6
  45. package/package.json +1 -1
  46. package/dist/client/assets/index-BBrVVMkD.js +0 -696
@@ -1,4 +1,4 @@
1
- import{aj as Es,r as D,j as T}from"./index-BBrVVMkD.js";import{a as Ct,c as Fn,b as On,d as Ss,i as Ke}from"./value-BTdN53H7.js";import{u as Ns}from"./with-selector-yYq5aOVF.js";function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Cs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ve(n)}function ve(t){this._=t}function Ms(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ve.prototype=ze.prototype={constructor:ve,on:function(t,e){var n=this._,o=Ms(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Is(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=Xn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Xn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ve(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Is(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function Xn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Cs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var on="http://www.w3.org/1999/xhtml";const Yn={svg:"http://www.w3.org/2000/svg",xhtml:on,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Yn.hasOwnProperty(e)?{space:Yn[e],local:t}:t}function As(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===on&&e.documentElement.namespaceURI===on?e.createElement(t):e.createElementNS(n,t)}}function ks(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ro(t){var e=De(t);return(e.local?ks:As)(e)}function Ps(){}function yn(t){return t==null?Ps:function(){return this.querySelector(t)}}function $s(t){typeof t!="function"&&(t=yn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=t.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ct(o,this._parents)}function Ts(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function zs(){return[]}function Vo(t){return t==null?zs:function(){return this.querySelectorAll(t)}}function Ds(t){return function(){return Ts(t.apply(this,arguments))}}function Ls(t){typeof t=="function"?t=Ds(t):t=Vo(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function Bo(t){return function(){return this.matches(t)}}function Fo(t){return function(e){return e.matches(t)}}var Hs=Array.prototype.find;function Rs(t){return function(){return Hs.call(this.children,t)}}function Vs(){return this.firstElementChild}function Bs(t){return this.select(t==null?Vs:Rs(typeof t=="function"?t:Fo(t)))}var Fs=Array.prototype.filter;function Os(){return Array.from(this.children)}function Xs(t){return function(){return Fs.call(this.children,t)}}function Ys(t){return this.selectAll(t==null?Os:Xs(typeof t=="function"?t:Fo(t)))}function js(t){typeof t!="function"&&(t=Bo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Oo(t){return new Array(t.length)}function Ws(){return new ct(this._enter||this._groups.map(Oo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Gs(t){return function(){return t}}function qs(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function Ks(t,e,n,o,r,i,s){var a,c,l=new Map,f=e.length,u=i.length,d=new Array(f),h;for(a=0;a<f;++a)(c=e[a])&&(d[a]=h=s.call(c,c.__data__,a,e)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(t,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ne(t,i[a]);for(a=0;a<f;++a)(c=e[a])&&l.get(d[a])===c&&(r[a]=c)}function Zs(t){return t.__data__}function Us(t,e){if(!arguments.length)return Array.from(this,Zs);var n=e?Ks:qs,o=this._parents,r=this._groups;typeof t!="function"&&(t=Gs(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,h=Qs(t.call(f,f&&f.__data__,l,o)),g=h.length,x=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(d);n(f,u,x,y,m,h,e);for(var _=0,p=0,w,S;_<g;++_)if(w=x[_]){for(_>=p&&(p=_+1);!(S=y[p])&&++p<g;);w._next=S||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function Qs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Js(){return new ct(this._exit||this._groups.map(Oo),this._parents)}function ta(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ea(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||f[g])&&(d[g]=h);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function na(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],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 oa(t){t||(t=ra);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(e)}return new ct(r,this._parents).order()}function ra(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ia(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function sa(){return Array.from(this)}function aa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ca(){let t=0;for(const e of this)++t;return t}function la(){return!this.node()}function ua(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function da(t){return function(){this.removeAttribute(t)}}function fa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ha(t,e){return function(){this.setAttribute(t,e)}}function ga(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ya(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?fa:da:typeof e=="function"?n.local?ma:pa:n.local?ga:ha)(n,e))}function Xo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xa(t){return function(){this.style.removeProperty(t)}}function wa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function va(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function _a(t,e,n){return arguments.length>1?this.each((e==null?xa:typeof e=="function"?va:wa)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Xo(t).getComputedStyle(t,null).getPropertyValue(e)}function ba(t){return function(){delete this[t]}}function Ea(t,e){return function(){this[t]=e}}function Sa(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Na(t,e){return arguments.length>1?this.each((e==null?ba:typeof e=="function"?Sa:Ea)(t,e)):this.node()[t]}function Yo(t){return t.trim().split(/^|\s+/)}function xn(t){return t.classList||new jo(t)}function jo(t){this._node=t,this._names=Yo(t.getAttribute("class")||"")}jo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wo(t,e){for(var n=xn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function Go(t,e){for(var n=xn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ca(t){return function(){Wo(this,t)}}function Ma(t){return function(){Go(this,t)}}function Ia(t,e){return function(){(e.apply(this,arguments)?Wo:Go)(this,t)}}function Aa(t,e){var n=Yo(t+"");if(arguments.length<2){for(var o=xn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ia:e?Ca:Ma)(n,e))}function ka(){this.textContent=""}function Pa(t){return function(){this.textContent=t}}function $a(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ta(t){return arguments.length?this.each(t==null?ka:(typeof t=="function"?$a:Pa)(t)):this.node().textContent}function za(){this.innerHTML=""}function Da(t){return function(){this.innerHTML=t}}function La(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ha(t){return arguments.length?this.each(t==null?za:(typeof t=="function"?La:Da)(t)):this.node().innerHTML}function Ra(){this.nextSibling&&this.parentNode.appendChild(this)}function Va(){return this.each(Ra)}function Ba(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fa(){return this.each(Ba)}function Oa(t){var e=typeof t=="function"?t:Ro(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Xa(){return null}function Ya(t,e){var n=typeof t=="function"?t:Ro(t),o=e==null?Xa:typeof e=="function"?e:yn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ja(){var t=this.parentNode;t&&t.removeChild(this)}function Wa(){return this.each(ja)}function Ga(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qa(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ka(t){return this.select(t?qa:Ga)}function Za(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Ua(t){return function(e){t.call(this,e,this.__data__)}}function Qa(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ja(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function tc(t,e,n){return function(){var o=this.__on,r,i=Ua(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ec(t,e,n){var o=Qa(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?tc:Ja,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function qo(t,e,n){var o=Xo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function nc(t,e){return function(){return qo(this,t,e)}}function oc(t,e){return function(){return qo(this,t,e.apply(this,arguments))}}function rc(t,e){return this.each((typeof e=="function"?oc:nc)(t,e))}function*ic(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Ko=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],Ko)}function sc(){return this}ct.prototype=se.prototype={constructor:ct,select:$s,selectAll:Ls,selectChild:Bs,selectChildren:Ys,filter:js,data:Us,enter:Ws,exit:Js,join:ta,merge:ea,selection:sc,order:na,sort:oa,call:ia,nodes:sa,node:aa,size:ca,empty:la,each:ua,attr:ya,style:_a,property:Na,classed:Aa,text:Ta,html:Ha,raise:Va,lower:Fa,append:Oa,insert:Ya,remove:Wa,clone:Ka,datum:Za,on:ec,dispatch:rc,[Symbol.iterator]:ic};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],Ko)}function ac(t){let e;for(;e=t.sourceEvent;)t=e;return t}function lt(t,e){if(t=ac(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const cc={passive:!1},Jt={capture:!0,passive:!1};function Ze(t){t.stopImmediatePropagation()}function Lt(t){t.preventDefault(),t.stopImmediatePropagation()}function Zo(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Lt,Jt);"onselectstart"in e?n.on("selectstart.drag",Lt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Uo(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Lt,Jt),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 he=t=>()=>t;function rn(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}rn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function lc(t){return!t.ctrlKey&&!t.button}function uc(){return this.parentNode}function dc(t,e){return e??{x:t.x,y:t.y}}function fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(){var t=lc,e=uc,n=dc,o=fc,r={},i=ze("start","drag","end"),s=0,a,c,l,f,u=0;function d(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,cc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,S){if(!(f||!t.call(this,w,S))){var N=p(this,e.call(this,w,S),w,S,"mouse");N&&(at(w.view).on("mousemove.drag",g,Jt).on("mouseup.drag",x,Jt),Zo(w.view),Ze(w),l=!1,a=w.clientX,c=w.clientY,N("start",w))}}function g(w){if(Lt(w),!l){var S=w.clientX-a,N=w.clientY-c;l=S*S+N*N>u}r.mouse("drag",w)}function x(w){at(w.view).on("mousemove.drag mouseup.drag",null),Uo(w.view,l),Lt(w),r.mouse("end",w)}function y(w,S){if(t.call(this,w,S)){var N=w.changedTouches,A=e.call(this,w,S),$=N.length,P,B;for(P=0;P<$;++P)(B=p(this,A,w,S,N[P].identifier,N[P]))&&(Ze(w),B("start",w,N[P]))}}function m(w){var S=w.changedTouches,N=S.length,A,$;for(A=0;A<N;++A)($=r[S[A].identifier])&&(Lt(w),$("drag",w,S[A]))}function _(w){var S=w.changedTouches,N=S.length,A,$;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<N;++A)($=r[S[A].identifier])&&(Ze(w),$("end",w,S[A]))}function p(w,S,N,A,$,P){var B=i.copy(),M=lt(P||N,S),z,V,v;if((v=n.call(w,new rn("beforestart",{sourceEvent:N,target:d,identifier:$,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:B}),A))!=null)return z=v.x-M[0]||0,V=v.y-M[1]||0,function I(b,k,C){var E=M,L;switch(b){case"start":r[$]=I,L=s++;break;case"end":delete r[$],--s;case"drag":M=lt(C||k,S),L=s;break}B.call(b,w,new rn(b,{sourceEvent:k,subject:v,target:d,identifier:$,active:L,x:M[0]+z,y:M[1]+V,dx:M[0]-E[0],dy:M[1]-E[1],dispatch:B}),A)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:he(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:he(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:he(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:he(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}var jn=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Jo(t,e,n,o,r,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*o)&&(n-=t*c,o-=e*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),t*o<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*jn,skewX:Math.atan(c)*jn,scaleX:s,scaleY:a}}var ge;function hc(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?sn:Jo(e.a,e.b,e.c,e.d,e.e,e.f)}function gc(t){return t==null||(ge||(ge=document.createElementNS("http://www.w3.org/2000/svg","g")),ge.setAttribute("transform",t),!(t=ge.transform.baseVal.consolidate()))?sn:(t=t.matrix,Jo(t.a,t.b,t.c,t.d,t.e,t.f))}function tr(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,h,g){if(l!==u||f!==d){var x=h.push("translate(",null,e,null,n);g.push({i:x-4,x:Ct(l,u)},{i:x-2,x:Ct(f,d)})}else(u||d)&&h.push("translate("+u+e+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:Ct(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:Ct(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,h,g){if(l!==u||f!==d){var x=h.push(r(h)+"scale(",null,",",null,")");g.push({i:x-4,x:Ct(l,u)},{i:x-2,x:Ct(f,d)})}else(u!==1||d!==1)&&h.push(r(h)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=t(l),f=t(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(h){for(var g=-1,x=d.length,y;++g<x;)u[(y=d[g]).i]=y.x(h);return u.join("")}}}var pc=tr(hc,"px, ","px)","deg)"),mc=tr(gc,", ",")",")"),yc=1e-12;function Wn(t){return((t=Math.exp(t))+1/t)/2}function xc(t){return((t=Math.exp(t))-1/t)/2}function wc(t){return((t=Math.exp(2*t))-1)/(t+1)}const _e=(function t(e,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],h=f-a,g=u-c,x=h*h+g*g,y,m;if(x<yc)m=Math.log(d/l)/e,y=function(A){return[a+A*h,c+A*g,l*Math.exp(e*A*m)]};else{var _=Math.sqrt(x),p=(d*d-l*l+o*x)/(2*l*n*_),w=(d*d-l*l-o*x)/(2*d*n*_),S=Math.log(Math.sqrt(p*p+1)-p),N=Math.log(Math.sqrt(w*w+1)-w);m=(N-S)/e,y=function(A){var $=A*m,P=Wn(S),B=l/(n*_)*(P*wc(e*$+S)-xc(S));return[a+B*h,c+B*g,l*P/Wn(e*$+S)]}}return y.duration=m*1e3*e/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},r})(Math.SQRT2,2,4);var Rt=0,Zt=0,qt=0,er=1e3,Ce,Ut,Me=0,At=0,Le=0,te=typeof performance=="object"&&performance.now?performance:Date,nr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wn(){return At||(nr(vc),At=te.now()+Le)}function vc(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=or.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?wn():+n)+(e==null?0:+e),!this._next&&Ut!==this&&(Ut?Ut._next=this:Ce=this,Ut=this),this._call=t,this._time=n,an()},stop:function(){this._call&&(this._call=null,this._time=1/0,an())}};function or(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function _c(){wn(),++Rt;for(var t=Ce,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Gn(){At=(Me=te.now())+Le,Rt=Zt=0;try{_c()}finally{Rt=0,Ec(),At=0}}function bc(){var t=te.now(),e=t-Me;e>er&&(Le-=e,Me=t)}function Ec(){for(var t,e=Ce,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ce=n);Ut=t,an(o)}function an(t){if(!Rt){Zt&&(Zt=clearTimeout(Zt));var e=t-At;e>24?(t<1/0&&(Zt=setTimeout(Gn,t-te.now()-Le)),qt&&(qt=clearInterval(qt))):(qt||(Me=te.now(),qt=setInterval(bc,er)),Rt=1,nr(Gn))}}function qn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Sc=ze("start","end","cancel","interrupt"),Nc=[],rr=0,Kn=1,cn=2,be=3,Zn=4,ln=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Cc(t,n,{name:e,index:o,group:r,on:Sc,tween:Nc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:rr})}function vn(t,e){var n=ft(t,e);if(n.state>rr)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=ft(t,e);if(n.state>be)throw new Error("too late; already running");return n}function ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Cc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=or(i,0,n.time);function i(l){n.state=Kn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,h;if(n.state!==Kn)return c();for(f in o)if(h=o[f],h.name===n.name){if(h.state===be)return qn(s);h.state===Zn?(h.state=Ee,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[f]):+f<e&&(h.state=Ee,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[f])}if(qn(function(){n.state===be&&(n.state=Zn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===cn){for(n.state=be,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(h=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ln,1),u=-1,d=r.length;++u<d;)r[u].call(t,f);n.state===ln&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>cn&&o.state<ln,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Mc(t){return this.each(function(){Se(this,t)})}function Ic(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Ac(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function kc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=ft(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Ic:Ac)(n,t,e))}function _n(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return ft(r,o).value[e]}}function ir(t,e){var n;return(typeof e=="number"?Ct:e instanceof Fn?On:(n=Fn(e))?(e=n,On):Ss)(t,e)}function Pc(t){return function(){this.removeAttribute(t)}}function $c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Tc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function zc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Dc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Lc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Hc(t,e){var n=De(t),o=n==="transform"?mc:ir;return this.attrTween(t,typeof e=="function"?(n.local?Lc:Dc)(n,o,_n(this,"attr."+t,e)):e==null?(n.local?$c:Pc)(n):(n.local?zc:Tc)(n,o,e))}function Rc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Vc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(t,i)),n}return r._value=e,r}function Fc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Rc(t,i)),n}return r._value=e,r}function Oc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Bc:Fc)(o,e))}function Xc(t,e){return function(){vn(this,t).delay=+e.apply(this,arguments)}}function Yc(t,e){return e=+e,function(){vn(this,t).delay=e}}function jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xc:Yc)(e,t)):ft(this.node(),e).delay}function Wc(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function Gc(t,e){return e=+e,function(){gt(this,t).duration=e}}function qc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Wc:Gc)(e,t)):ft(this.node(),e).duration}function Kc(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function Zc(t){var e=this._id;return arguments.length?this.each(Kc(e,t)):ft(this.node(),e).ease}function Uc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function Qc(t){if(typeof t!="function")throw new Error;return this.each(Uc(this._id,t))}function Jc(t){typeof t!="function"&&(t=Bo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new xt(o,this._parents,this._name,this._id)}function tl(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,h=0;h<f;++h)(d=c[h]||l[h])&&(u[h]=d);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function el(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function nl(t,e,n){var o,r,i=el(e)?vn:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function ol(t,e){var n=this._id;return arguments.length<2?ft(this.node(),n).on.on(t):this.each(nl(n,t,e))}function rl(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function il(){return this.on("end.remove",rl(this._id))}function sl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=yn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,He(l[d],e,n,d,l,ft(f,n)));return new xt(i,this._parents,e,n)}function al(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Vo(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=t.call(f,f.__data__,u,c),h,g=ft(f,n),x=0,y=d.length;x<y;++x)(h=d[x])&&He(h,e,n,x,d,g);i.push(d),s.push(f)}return new xt(i,s,e,n)}var cl=se.prototype.constructor;function ll(){return new cl(this._groups,this._parents)}function ul(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function sr(t){return function(){this.style.removeProperty(t)}}function dl(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function fl(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ht(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function hl(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=gt(this,t),l=c.on,f=c.value[i]==null?a||(a=sr(e)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function gl(t,e,n){var o=(t+="")=="transform"?pc:ir;return e==null?this.styleTween(t,ul(t,o)).on("end.style."+t,sr(t)):typeof e=="function"?this.styleTween(t,fl(t,o,_n(this,"style."+t,e))).each(hl(this._id,t)):this.styleTween(t,dl(t,o,e),n).on("end.style."+t,null)}function pl(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function ml(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&pl(t,s,n)),o}return i._value=e,i}function yl(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,ml(t,e,n??""))}function xl(t){return function(){this.textContent=t}}function wl(t){return function(){var e=t(this);this.textContent=e??""}}function vl(t){return this.tween("text",typeof t=="function"?wl(_n(this,"text",t)):xl(t==null?"":t+""))}function _l(t){return function(e){this.textContent=t.call(this,e)}}function bl(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&_l(r)),e}return o._value=t,o}function El(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bl(t))}function Sl(){for(var t=this._name,e=this._id,n=ar(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=ft(c,e);He(c,t,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xt(o,this._parents,t,n)}function Nl(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Cl=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function ar(){return++Cl}var mt=se.prototype;xt.prototype={constructor:xt,select:sl,selectAll:al,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:Jc,merge:tl,selection:ll,transition:Sl,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:ol,attr:Hc,attrTween:Oc,style:gl,styleTween:yl,text:vl,textTween:El,remove:il,tween:kc,delay:jc,duration:qc,ease:Zc,easeVarying:Qc,end:Nl,[Symbol.iterator]:mt[Symbol.iterator]};function Ml(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Il={time:null,delay:0,duration:250,ease:Ml};function Al(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function kl(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=ar(),(n=Il).time=wn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||Al(c,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Mc;se.prototype.transition=kl;const pe=t=>()=>t;function Pl(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);cr.prototype=yt.prototype;function cr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ue(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function $l(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tl(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Un(){return this.__zoom||Re}function zl(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Dl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ll(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 lr(){var t=$l,e=Tl,n=Ll,o=zl,r=Dl,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=_e,l=ze("start","zoom","end"),f,u,d,h=500,g=150,x=0,y=10;function m(v){v.property("__zoom",Un).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,I,b,k){var C=v.selection?v.selection():v;C.property("__zoom",Un),v!==C?S(v,I,b,k):C.interrupt().each(function(){N(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(v,I,b,k){m.scaleTo(v,function(){var C=this.__zoom.k,E=typeof I=="function"?I.apply(this,arguments):I;return C*E},b,k)},m.scaleTo=function(v,I,b,k){m.transform(v,function(){var C=e.apply(this,arguments),E=this.__zoom,L=b==null?w(C):typeof b=="function"?b.apply(this,arguments):b,R=E.invert(L),H=typeof I=="function"?I.apply(this,arguments):I;return n(p(_(E,H),L,R),C,s)},b,k)},m.translateBy=function(v,I,b,k){m.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof b=="function"?b.apply(this,arguments):b),e.apply(this,arguments),s)},null,k)},m.translateTo=function(v,I,b,k,C){m.transform(v,function(){var E=e.apply(this,arguments),L=this.__zoom,R=k==null?w(E):typeof k=="function"?k.apply(this,arguments):k;return n(Re.translate(R[0],R[1]).scale(L.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof b=="function"?-b.apply(this,arguments):-b),E,s)},k,C)};function _(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new yt(I,v.x,v.y)}function p(v,I,b){var k=I[0]-b[0]*v.k,C=I[1]-b[1]*v.k;return k===v.x&&C===v.y?v:new yt(v.k,k,C)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,I,b,k){v.on("start.zoom",function(){N(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(k).end()}).tween("zoom",function(){var C=this,E=arguments,L=N(C,E).event(k),R=e.apply(C,E),H=b==null?w(R):typeof b=="function"?b.apply(C,E):b,O=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),X=C.__zoom,j=typeof I=="function"?I.apply(C,E):I,K=c(X.invert(H).concat(O/X.k),j.invert(H).concat(O/j.k));return function(G){if(G===1)G=j;else{var F=K(G),W=O/F[2];G=new yt(W,H[0]-F[0]*W,H[1]-F[1]*W)}L.zoom(null,G)}})}function N(v,I,b){return!b&&v.__zooming||new A(v,I)}function A(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,I),this.taps=0}A.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,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=at(this.that).datum();l.call(v,this.that,new Pl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),I)}};function $(v,...I){if(!t.apply(this,arguments))return;var b=N(this,I).event(v),k=this.__zoom,C=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),E=lt(v);if(b.wheel)(b.mouse[0][0]!==E[0]||b.mouse[0][1]!==E[1])&&(b.mouse[1]=k.invert(b.mouse[0]=E)),clearTimeout(b.wheel);else{if(k.k===C)return;b.mouse=[E,k.invert(E)],Se(this),b.start()}Kt(v),b.wheel=setTimeout(L,g),b.zoom("mouse",n(p(_(k,C),b.mouse[0],b.mouse[1]),b.extent,s));function L(){b.wheel=null,b.end()}}function P(v,...I){if(d||!t.apply(this,arguments))return;var b=v.currentTarget,k=N(this,I,!0).event(v),C=at(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),E=lt(v,b),L=v.clientX,R=v.clientY;Zo(v.view),Ue(v),k.mouse=[E,this.__zoom.invert(E)],Se(this),k.start();function H(X){if(Kt(X),!k.moved){var j=X.clientX-L,K=X.clientY-R;k.moved=j*j+K*K>x}k.event(X).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=lt(X,b),k.mouse[1]),k.extent,s))}function O(X){C.on("mousemove.zoom mouseup.zoom",null),Uo(X.view,k.moved),Kt(X),k.event(X).end()}}function B(v,...I){if(t.apply(this,arguments)){var b=this.__zoom,k=lt(v.changedTouches?v.changedTouches[0]:v,this),C=b.invert(k),E=b.k*(v.shiftKey?.5:2),L=n(p(_(b,E),k,C),e.apply(this,I),s);Kt(v),a>0?at(this).transition().duration(a).call(S,L,k,v):at(this).call(m.transform,L,k,v)}}function M(v,...I){if(t.apply(this,arguments)){var b=v.touches,k=b.length,C=N(this,I,v.changedTouches.length===k).event(v),E,L,R,H;for(Ue(v),L=0;L<k;++L)R=b[L],H=lt(R,this),H=[H,this.__zoom.invert(H),R.identifier],C.touch0?!C.touch1&&C.touch0[2]!==H[2]&&(C.touch1=H,C.taps=0):(C.touch0=H,E=!0,C.taps=1+!!f);f&&(f=clearTimeout(f)),E&&(C.taps<2&&(u=H[0],f=setTimeout(function(){f=null},h)),Se(this),C.start())}}function z(v,...I){if(this.__zooming){var b=N(this,I).event(v),k=v.changedTouches,C=k.length,E,L,R,H;for(Kt(v),E=0;E<C;++E)L=k[E],R=lt(L,this),b.touch0&&b.touch0[2]===L.identifier?b.touch0[0]=R:b.touch1&&b.touch1[2]===L.identifier&&(b.touch1[0]=R);if(L=b.that.__zoom,b.touch1){var O=b.touch0[0],X=b.touch0[1],j=b.touch1[0],K=b.touch1[1],G=(G=j[0]-O[0])*G+(G=j[1]-O[1])*G,F=(F=K[0]-X[0])*F+(F=K[1]-X[1])*F;L=_(L,Math.sqrt(G/F)),R=[(O[0]+j[0])/2,(O[1]+j[1])/2],H=[(X[0]+K[0])/2,(X[1]+K[1])/2]}else if(b.touch0)R=b.touch0[0],H=b.touch0[1];else return;b.zoom("touch",n(p(L,R,H),b.extent,s))}}function V(v,...I){if(this.__zooming){var b=N(this,I).event(v),k=v.changedTouches,C=k.length,E,L;for(Ue(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),E=0;E<C;++E)L=k[E],b.touch0&&b.touch0[2]===L.identifier?delete b.touch0:b.touch1&&b.touch1[2]===L.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(L=lt(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<y)){var R=at(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},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?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const ht={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ur=["Enter"," ","Escape"],dr={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const fr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const Qn={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function hr(t){return t===null?null:t?"valid":"invalid"}const gr=t=>"id"in t&&"source"in t&&"target"in t,Hl=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),bn=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Rl=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):bn(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},En=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...ue(e,[n,o,r]),width:e.width/r,height:e.height/r},c=[];for(const l of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const h=f.width??l.width??l.initialWidth??null,g=f.height??l.height??l.initialHeight??null,x=oe(a,Ft(l)),y=(h??0)*(g??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},Vl=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Bl(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Fl({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Bl(t,s),c=ce(a),l=Sn(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function pr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&Ot(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Ot(u)?kt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Ol({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(x=>x.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Vl(s,c);for(const d of c)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function mr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const Jn=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,yr=(t,e,n=15,o=40)=>{const r=Jn(t.x,o,e.width-o)*n,i=Jn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),un=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=bn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=bn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},xr=(t,e)=>Be(Ve(un(t),un(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},to=t=>ut(t.width)&&ut(t.height)&&ut(t.x)&&ut(t.y),ut=t=>!isNaN(t)&&isFinite(t),Xl=(t,e)=>{},le=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),ue=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?le(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Yl(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);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 jl(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:c,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const Sn=(t,e,n,o,r,i)=>{const s=Yl(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),f=Bt(l,o,r),u=t.x+t.width/2,d=t.y+t.height/2,h=e/2-u*f,g=n/2-d*f,x=jl(t,h,g,f,e,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:f}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function wr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function vr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function eo(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Wl(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Gl(t){return{...dr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=dt(t),a=ue({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?le(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const Nn=t=>({width:t.offsetWidth,height:t.offsetHeight}),_r=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ql=["INPUT","SELECT","TEXTAREA"];function br(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:ql.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Er=t=>"clientX"in t,dt=(t,e)=>{var i,s;const n=Er(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},no=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Nn(s)}})};function Sr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,f=Math.abs(c-t),u=Math.abs(l-e);return[c,l,f,u]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function oo({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Nr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,f]=oo({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[u,d,h,g]=Sr({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${t},${e} C${a},${c} ${l},${f} ${o},${r}`,u,d,h,g]}function Cr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Kl({sourceNode:t,targetNode:e,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(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function Zl({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));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 oe(s,Be(i))>0}const Ul=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,Ql=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Jl=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||Ul;let r;return gr(t)?r={...t}:r={...t,id:o(t)},Ql(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Mr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Cr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ro={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},tu=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},io=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function eu({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=ro[e],c=ro[o],l={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=tu({source:l,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",h=u[d];let g=[],x,y;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=Cr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(x=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const $=[{x,y:l.y},{x,y:f.y}],P=[{x:l.x,y},{x:f.x,y}];a[d]===h?g=d==="x"?$:P:g=d==="x"?P:$}else{const $=[{x:l.x,y:f.y}],P=[{x:f.x,y:l.y}];if(d==="x"?g=a.x===h?P:$:g=a.y===h?$:P,e===o){const v=Math.abs(t[d]-n[d]);if(v<=i){const I=Math.min(i-1,i-v);a[d]===h?m[d]=(l[d]>t[d]?-1:1)*I:_[d]=(f[d]>n[d]?-1:1)*I}}if(e!==o){const v=d==="x"?"y":"x",I=a[d]===c[v],b=l[v]>f[v],k=l[v]<f[v];(a[d]===1&&(!I&&b||I&&k)||a[d]!==1&&(!I&&k||I&&b))&&(g=d==="x"?$:P)}const B={x:l.x+m.x,y:l.y+m.y},M={x:f.x+_.x,y:f.y+_.y},z=Math.max(Math.abs(B.x-g[0].x),Math.abs(M.x-g[0].x)),V=Math.max(Math.abs(B.y-g[0].y),Math.abs(M.y-g[0].y));z>=V?(x=(B.x+M.x)/2,y=g[0].y):(x=g[0].x,y=(B.y+M.y)/2)}const S={x:l.x+m.x,y:l.y+m.y},N={x:f.x+_.x,y:f.y+_.y};return[[t,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...N.x!==g[g.length-1].x||N.y!==g[g.length-1].y?[N]:[],n],x,y,p,w]}function nu(t,e,n,o){const r=Math.min(io(t,e)/2,io(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function dn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,h,g,x]=eu({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=nu(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,d,h,g,x]}function so(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function ou(t){var u;const{sourceNode:e,targetNode:n}=t;if(!so(e)||!so(n))return null;const o=e.internals.handleBounds||ao(e.handles),r=n.internals.handleBounds||ao(n.handles),i=co((o==null?void 0:o.source)??[],t.sourceHandle),s=co(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),f=Pt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function ao(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.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 co(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function fn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function ru(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=fn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Ir=1e3,iu=10,Cn={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},su={...Cn,checkEquality:!0};function Mn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function au(t,e,n){const o=Mn(Cn,n);for(const r of t.values())if(r.parentId)An(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function cu(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.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 In(t){return t==="manual"}function hn(t,e,n,o={}){var f,u;const r=Mn(su,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!In(r.zIndexMode)?Ir:0;let c=t.length>0,l=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(r.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=ae(d,r.nodeOrigin),x=Ot(d.extent)?d.extent:r.nodeExtent,y=kt(g,x,wt(d));h={...r.defaults,...d,measured:{width:(f=d.measured)==null?void 0:f.width,height:(u=d.measured)==null?void 0:u.height},internals:{positionAbsolute:y,handleBounds:cu(d,h),z:Ar(d,a,r.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&An(h,e,n,o,i),l||(l=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function lu(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function An(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Mn(Cn,o),l=t.parentId,f=e.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}lu(t,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*iu),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!In(c)?Ir:0,{x:d,y:h,z:g}=uu(t,f,s,a,u,c),{positionAbsolute:x}=t.internals,y=d!==x.x||h!==x.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:h}:x,z:g}})}function Ar(t,e,n){const o=ut(t.zIndex)?t.zIndex:0;return In(n)?o:o+(t.selected?e:0)}function uu(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=wt(t),l=ae(t,n),f=Ot(t.extent)?kt(l,t.extent,c):l;let u=kt({x:s+f.x,y:a+f.y},o,c);t.extent==="parent"&&(u=mr(u,c,e));const d=Ar(t,r,i),h=e.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}function kn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(c),f=xr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const f=c.internals.positionAbsolute,u=wt(c),d=c.origin??o,h=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*d[0],_=(y-u.height)*d[1];(h>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+_}}),(p=n.get(l))==null||p.forEach(w=>{t.some(S=>S.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?d[0]*h-m:0),height:y+(g?d[1]*g-_:0)}})}),r}function du(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Nn(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Ot(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=mr(w,x,e.get(g.parentId)):p&&(w=kt(w,p,x));const S={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:no("source",h.nodeElement,_,u,g.id),target:no("target",h.nodeElement,_,u,g.id)}}};e.set(g.id,S),g.parentId&&An(S,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ft(S,r)}))}}if(d.length>0){const h=kn(d,e,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function fu({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.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 lo(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function kr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;lo("source",c,f,t,r,s),lo("target",c,l,t,i,a),e.set(o.id,o)}}function Pr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Pr(n,e):!1}function uo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function hu(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Pr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of e){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function gu({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=le(i,e);return{x:s.x-i.x,y:s.y-i.y}}function pu({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,h=!1,g=!1,x=null;function y({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:S,nodeId:N,nodeClickDistance:A=0}){d=at(w);function $({x:z,y:V}){const{nodeLookup:v,nodeExtent:I,snapGrid:b,snapToGrid:k,nodeOrigin:C,onNodeDrag:E,onSelectionDrag:L,onError:R,updateNodePositions:H}=e();i={x:z,y:V};let O=!1;const X=a.size>1,j=X&&I?un(ce(a)):null,K=X&&k?gu({dragItems:a,snapGrid:b,x:z,y:V}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:z-F.distance.x,y:V-F.distance.y};k&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:le(W,b));let Q=null;if(X&&I&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+I[0][0],nt=q.x+F.measured.width-j.x2+I[1][0],tt=q.y-j.y+I[0][1],st=q.y+F.measured.height-j.y2+I[1][1];Q=[[et,tt],[nt,st]]}const{position:U,positionAbsolute:Z}=pr({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||I,nodeOrigin:C,onError:R});O=O||F.position.x!==U.x||F.position.y!==U.y,F.position=U,F.internals.positionAbsolute=Z}if(g=g||O,!!O&&(H(a,!0),x&&(o||E||!N&&L))){const[G,F]=Qe({nodeId:N,dragItems:a,nodeLookup:v});o==null||o(x,a,G,F),E==null||E(x,G,F),N||L==null||L(x,F)}}async function P(){if(!f)return;const{transform:z,panBy:V,autoPanSpeed:v,autoPanOnNodeDrag:I}=e();if(!I){c=!1,cancelAnimationFrame(s);return}const[b,k]=yr(l,f,v);(b!==0||k!==0)&&(i.x=(i.x??0)-b/z[2],i.y=(i.y??0)-k/z[2],await V({x:b,y:k})&&$(i)),s=requestAnimationFrame(P)}function B(z){var X;const{nodeLookup:V,multiSelectionActive:v,nodesDraggable:I,transform:b,snapGrid:k,snapToGrid:C,selectNodesOnDrag:E,onNodeDragStart:L,onSelectionDragStart:R,unselectNodesAndEdges:H}=e();u=!0,(!E||!S)&&!v&&N&&((X=V.get(N))!=null&&X.selected||H()),S&&E&&N&&(t==null||t(N));const O=Qt(z.sourceEvent,{transform:b,snapGrid:k,snapToGrid:C,containerBounds:f});if(i=O,a=hu(V,I,O,N),a.size>0&&(n||L||!N&&R)){const[j,K]=Qe({nodeId:N,dragItems:a,nodeLookup:V});n==null||n(z.sourceEvent,a,j,K),L==null||L(z.sourceEvent,j,K),N||R==null||R(z.sourceEvent,K)}}const M=Qo().clickDistance(A).on("start",z=>{const{domNode:V,nodeDragThreshold:v,transform:I,snapGrid:b,snapToGrid:k}=e();f=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,g=!1,x=z.sourceEvent,v===0&&B(z),i=Qt(z.sourceEvent,{transform:I,snapGrid:b,snapToGrid:k,containerBounds:f}),l=dt(z.sourceEvent,f)}).on("drag",z=>{const{autoPanOnNodeDrag:V,transform:v,snapGrid:I,snapToGrid:b,nodeDragThreshold:k,nodeLookup:C}=e(),E=Qt(z.sourceEvent,{transform:v,snapGrid:I,snapToGrid:b,containerBounds:f});if(x=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||N&&!C.has(N))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,P()),!u){const L=dt(z.sourceEvent,f),R=L.x-l.x,H=L.y-l.y;Math.sqrt(R*R+H*H)>k&&B(z)}(i.x!==E.xSnapped||i.y!==E.ySnapped)&&a&&u&&(l=dt(z.sourceEvent,f),$(E))}}).on("end",z=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:V,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:b}=e();if(g&&(v(a,!1),g=!1),r||I||!N&&b){const[k,C]=Qe({nodeId:N,dragItems:a,nodeLookup:V,dragging:!1});r==null||r(z.sourceEvent,a,k,C),I==null||I(z.sourceEvent,k,C),N||b==null||b(z.sourceEvent,C)}}}).filter(z=>{const V=z.target;return!z.button&&(!_||!uo(V,`.${_}`,w))&&(!p||uo(V,p,w))});d.call(M)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function mu(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const yu=250;function xu(t,e,n,o){var a,c;let r=[],i=1/0;const s=mu(t,n,e+yu);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:h}=Pt(l,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(r=[{...u,x:d,y:h}],i=g):g===i&&r.push({...u,x:d,y:h}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function $r(t,e,n,o,r,i=!1){var l,f,u;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Pt(s,c,c.position,!0)}:c}function Tr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wu(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const zr=()=>!0;function vu(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:m=zr,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:N,dragThreshold:A=1,handleDomNode:$}){const P=_r(t.target);let B=0,M;const{x:z,y:V}=dt(t),v=Tr(i,$),I=a==null?void 0:a.getBoundingClientRect();let b=!1;if(!I||!v)return;const k=$r(r,v,o,c,e);if(!k)return;let C=dt(t,I),E=!1,L=null,R=!1,H=null;function O(){if(!f||!I)return;const[U,Z]=yr(C,I,N);d({x:U,y:Z}),B=requestAnimationFrame(O)}const X={...k,nodeId:r,type:v,position:k.position},j=c.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,X,Y.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:j,to:C,toHandle:null,toPosition:Qn[X.position],toNode:null,pointer:C};function F(){b=!0,p(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}A===0&&F();function W(U){if(!b){const{x:st,y:vt}=dt(U),pt=st-z,Nt=vt-V;if(!(pt*pt+Nt*Nt>A*A))return;F()}if(!S()||!X){Q(U);return}const Z=w();C=dt(U,I),M=xu(ue(C,Z,!1,[1,1]),n,c,X),E||(O(),E=!0);const q=Dr(U,{handle:M,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:P,lib:l,flowId:u,nodeLookup:c});H=q.handleDomNode,L=q.connection,R=wu(!!M,q.isValid);const et=c.get(r),nt=et?Pt(et,X,Y.Left,!0):G.from,tt={...G,from:nt,isValid:R,to:q.toHandle&&R?Pe({x:q.toHandle.x,y:q.toHandle.y},Z):C,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Qn[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:C};p(tt),G=tt}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(b){(M||H)&&L&&R&&(x==null||x(L));const{inProgress:Z,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};y==null||y(U,et),i&&(_==null||_(U,et))}h(),cancelAnimationFrame(B),E=!1,R=!1,L=null,H=null,P.removeEventListener("mousemove",W),P.removeEventListener("mouseup",Q),P.removeEventListener("touchmove",W),P.removeEventListener("touchend",Q)}}P.addEventListener("mousemove",W),P.addEventListener("mouseup",Q),P.addEventListener("touchmove",W),P.addEventListener("touchend",Q)}function Dr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=zr,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=dt(t),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const _=Tr(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),N=y.classList.contains("connectableend");if(!p||!_)return m;const A={source:u?p:o,sourceHandle:u?w:r,target:u?o:p,targetHandle:u?r:w};m.connection=A;const P=S&&N&&(n===Vt.Strict?u&&_==="source"||!u&&_==="target":p!==o||w!==r);m.isValid=P&&l(A),m.toHandle=$r(p,_,w,f,n,!0)}return m}const gn={onPointerDown:vu,isValid:Dr};function _u({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),S=p.sourceEvent.ctrlKey&&re()?10:1,N=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,A=w[2]*Math.pow(2,N*S);e.scaleTo(A)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],N=[S[0]-x[0],S[1]-x[1]];x=S;const A=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-N[0]*A,y:w[1]-N[1]*A},P=[[0,0],[c,l]];e.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},P,a)},_=lr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:lt}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Lr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bu=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=bu,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Hr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Eu({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(zt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=lt(f),m=Hr(f),_=u*Math.pow(2,m);o.scaleTo(n,_,y,f);return}const d=f.deltaMode===1?20:1;let h=r===It.Vertical?0:f.deltaX*d,g=r===It.Horizontal?0:f.deltaY*d;!re()&&f.shiftKey&&r!==It.Vertical&&(h=f.deltaY*d,g=0),o.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const x=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(f,x),t.panScrollTimeout=setTimeout(()=>{l==null||l(f,x),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,x))}}function Su({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Nu({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Cu({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Lr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Mu({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Lr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Iu({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=t||e,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(zt(u,`${l}-flow__node`)||zt(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!g||zt(u,a)&&g||zt(u,c)&&(!g||r&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Au({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=lr().scaleExtent([e,n]).translateExtent(o),d=at(t).call(u);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[f.width,f.height]],o);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Hr);function x(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).transform(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function y({noWheelClassName:M,noPanClassName:z,onPaneContextMenu:V,userSelectionActive:v,panOnScroll:I,panOnDrag:b,panOnScrollMode:k,panOnScrollSpeed:C,preventScrolling:E,zoomOnPinch:L,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:X,onTransformChange:j,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=I&&!O&&!v;u.clickDistance(F?1/0:!ut(G)||G<0?0:G);const Q=W?Eu({zoomPanValues:l,noWheelClassName:M,d3Selection:d,d3Zoom:u,panOnScrollMode:k,panOnScrollSpeed:C,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Su({noWheelClassName:M,preventScrolling:E,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const Z=Nu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",Z);const q=Cu({zoomPanValues:l,panOnDrag:b,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:j});u.on("zoom",q);const et=Mu({zoomPanValues:l,panOnDrag:b,panOnScroll:I,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",et)}const U=Iu({zoomActivationKeyPressed:O,panOnDrag:b,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:v,noPanClassName:z,noWheelClassName:M,lib:X,connectionInProgress:K});u.filter(U),H?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function _(M,z,V){const v=Je(M),I=u==null?void 0:u.constrain()(v,z,V);return I&&await x(I),new Promise(b=>b(I))}async function p(M,z){const V=Je(M);return await x(V,z),new Promise(v=>v(V))}function w(M){if(d){const z=Je(M),V=d.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(d,z,null,{sync:!0}))}}function S(){const M=d?cr(d.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function N(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).scaleTo(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function A(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).scaleBy(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function $(M){u==null||u.scaleExtent(M)}function P(M){u==null||u.translateExtent(M)}function B(M){const z=!ut(M)||M<0?0:M;u==null||u.clickDistance(z)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:_,getViewport:S,scaleTo:N,scaleBy:A,setScaleExtent:$,setTranslateExtent:P,syncViewport:w,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function ku({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function fo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function ho(t,e){return t?!e:e}function Pu(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:S,height:N,aspectRatio:A}=t;let $=Math.floor(f?h-t.pointerX:0),P=Math.floor(u?g-t.pointerY:0);const B=S+(c?-$:$),M=N+(l?-P:P),z=-i[0]*S,V=-i[1]*N;let v=ye(B,x,y),I=ye(M,m,_);if(s){let C=0,E=0;c&&$<0?C=_t(p+$+z,s[0][0]):!c&&$>0&&(C=bt(p+B+z,s[1][0])),l&&P<0?E=_t(w+P+V,s[0][1]):!l&&P>0&&(E=bt(w+M+V,s[1][1])),v=Math.max(v,C),I=Math.max(I,E)}if(a){let C=0,E=0;c&&$>0?C=bt(p+$,a[0][0]):!c&&$<0&&(C=_t(p+B,a[1][0])),l&&P>0?E=bt(w+P,a[0][1]):!l&&P<0&&(E=_t(w+M,a[1][1])),v=Math.max(v,C),I=Math.max(I,E)}if(r){if(f){const C=ye(B/A,m,_)*A;if(v=Math.max(v,C),s){let E=0;!c&&!l||c&&!l&&d?E=bt(w+V+B/A,s[1][1])*A:E=_t(w+V+(c?$:-$)/A,s[0][1])*A,v=Math.max(v,E)}if(a){let E=0;!c&&!l||c&&!l&&d?E=_t(w+B/A,a[1][1])*A:E=bt(w+(c?$:-$)/A,a[0][1])*A,v=Math.max(v,E)}}if(u){const C=ye(M*A,x,y)/A;if(I=Math.max(I,C),s){let E=0;!c&&!l||l&&!c&&d?E=bt(p+M*A+z,s[1][0])/A:E=_t(p+(l?P:-P)*A+z,s[0][0])/A,I=Math.max(I,E)}if(a){let E=0;!c&&!l||l&&!c&&d?E=_t(p+M*A,a[1][0])/A:E=bt(p+(l?P:-P)*A,a[0][0])/A,I=Math.max(I,E)}}}P=P+(P<0?I:-I),$=$+($<0?v:-v),r&&(d?B>M*A?P=(ho(c,l)?-$:$)/A:$=(ho(c,l)?-P:P)*A:f?(P=$/A,l=c):($=P*A,c=l));const b=c?p+$:p,k=l?w+P:w;return{width:S+(c?-$:$),height:N+(l?-P:P),x:i[0]*$*(c?-1:1)+b,y:i[1]*P*(l?-1:1)+k}}const Rr={width:0,height:0,x:0,y:0},$u={...Rr,pointerX:0,pointerY:0,aspectRatio:1};function Tu(t){return[[0,0],[t.measured.width,t.measured.height]]}function zu(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Du({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:fo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let m={...Rr},_={...$u};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:fo(l)};let p,w=null,S=[],N,A,$,P=!1;const B=Qo().on("start",M=>{const{nodeLookup:z,transform:V,snapGrid:v,snapToGrid:I,nodeOrigin:b,paneDomNode:k}=n();if(p=z.get(e),!p)return;w=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:E}=Qt(M.sourceEvent,{transform:V,snapGrid:v,snapToGrid:I,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:C,pointerY:E,aspectRatio:m.width/m.height},N=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(N=z.get(p.parentId),A=N&&p.extent==="parent"?Tu(N):void 0),S=[],$=void 0;for(const[L,R]of z)if(R.parentId===e&&(S.push({id:L,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const H=zu(R,p,R.origin??b);$?$=[[Math.min(H[0][0],$[0][0]),Math.min(H[0][1],$[0][1])],[Math.max(H[1][0],$[1][0]),Math.max(H[1][1],$[1][1])]]:$=H}h==null||h(M,{...m})}).on("drag",M=>{const{transform:z,snapGrid:V,snapToGrid:v,nodeOrigin:I}=n(),b=Qt(M.sourceEvent,{transform:z,snapGrid:V,snapToGrid:v,containerBounds:w}),k=[];if(!p)return;const{x:C,y:E,width:L,height:R}=m,H={},O=p.origin??I,{width:X,height:j,x:K,y:G}=Pu(_,s.controlDirection,b,s.boundaries,s.keepAspectRatio,O,A,$),F=X!==L,W=j!==R,Q=K!==C&&F,U=G!==E&&W;if(!Q&&!U&&!F&&!W)return;if((Q||U||O[0]===1||O[1]===1)&&(H.x=Q?K:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,S.length>0)){const nt=K-C,tt=G-E;for(const st of S)st.position={x:st.position.x-nt+O[0]*(X-L),y:st.position.y-tt+O[1]*(j-R)},k.push(st)}if((F||W)&&(H.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=H.width,m.height=H.height),N&&p.expandParent){const nt=O[0]*(H.width??0);H.x&&H.x<nt&&(m.x=nt,_.x=_.x-(H.x-nt));const tt=O[1]*(H.height??0);H.y&&H.y<tt&&(m.y=tt,_.y=_.y-(H.y-tt))}const Z=ku({width:m.width,prevWidth:L,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:Z};(y==null?void 0:y(M,q))!==!1&&(P=!0,g==null||g(M,q),o(H,k))}).on("end",M=>{P&&(x==null||x(M,{...m}),r==null||r({...m}),P=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Lu={},go=t=>{let e;const n=new Set,o=(f,u)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const h=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(g=>g(e,h))}},r=()=>e,c={setState:o,getState:r,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Lu?"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()}},l=e=t(o,r,c);return c},Hu=t=>t?go(t):go,{useDebugValue:Ru}=Es,{useSyncExternalStoreWithSelector:Vu}=Ns,Bu=t=>t;function Vr(t,e=Bu,n){const o=Vu(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Ru(o),o}const po=(t,e)=>{const n=Hu(t),o=(r,i=e)=>Vr(n,r,i);return Object.assign(o,n),o},Fu=(t,e)=>t?po(t,e):po;function ot(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}const Oe=D.createContext(null),Ou=Oe.Provider,Br=ht.error001();function J(t,e){const n=D.useContext(Oe);if(n===null)throw new Error(Br);return Vr(n,t,e)}function rt(){const t=D.useContext(Oe);if(t===null)throw new Error(Br);return D.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const mo={display:"none"},Xu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fr="react-flow__node-desc",Or="react-flow__edge-desc",Yu="react-flow__aria-live",ju=t=>t.ariaLiveMessage,Wu=t=>t.ariaLabelConfig;function Gu({rfId:t}){const e=J(ju);return T.jsx("div",{id:`${Yu}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Xu,children:e})}function qu({rfId:t,disableKeyboardA11y:e}){const n=J(Wu);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${Fr}-${t}`,style:mo,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${Or}-${t}`,style:mo,children:n["edge.a11yDescription.default"]}),!e&&T.jsx(Gu,{rfId:t})]})}const Xe=D.forwardRef(({position:t="top-left",children:e,className:n,style:o,...r},i)=>{const s=`${t}`.split("-");return T.jsx("div",{className:it(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:e})});Xe.displayName="Panel";function Ku({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:T.jsx(Xe,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zu=t=>{const e=[],n=[];for(const[,o]of t.nodeLookup)o.selected&&e.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&n.push(o);return{selectedNodes:e,selectedEdges:n}},xe=t=>t.id;function Uu(t,e){return ot(t.selectedNodes.map(xe),e.selectedNodes.map(xe))&&ot(t.selectedEdges.map(xe),e.selectedEdges.map(xe))}function Qu({onSelectionChange:t}){const e=rt(),{selectedNodes:n,selectedEdges:o}=J(Zu,Uu);return D.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,t]),null}const Ju=t=>!!t.onSelectionChangeHandlers;function td({onSelectionChange:t}){const e=J(Ju);return t||e?T.jsx(Qu,{onSelectionChange:t}):null}const pn=typeof window<"u"?D.useLayoutEffect:D.useEffect,Xr=[0,0],ed={x:0,y:0,zoom:1},nd=["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"],yo=[...nd,"rfId"],od=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),xo={translateExtent:ee,nodeOrigin:Xr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function rd(t){const{setNodes:e,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(od,ot),l=rt();pn(()=>(c(t.defaultNodes,t.defaultEdges),()=>{f.current=xo,a()}),[]);const f=D.useRef(xo);return pn(()=>{for(const u of yo){const d=t[u],h=f.current[u];d!==h&&(typeof t[u]>"u"||(u==="nodes"?e(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:Gl(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=t},yo.map(u=>t[u])),null}function wo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function id(t){var o;const[e,n]=D.useState(t==="system"?null:t);return D.useEffect(()=>{if(t!=="system"){n(t);return}const r=wo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[t]),e!==null?e:(o=wo())!=null&&o.matches?"dark":"light"}const vo=typeof document<"u"?document:null;function ie(t=null,e={target:vo,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
1
+ import{aj as Es,r as D,j as T}from"./index-DOl6hFR0.js";import{a as Ct,c as Fn,b as On,d as Ss,i as Ke}from"./value-BTdN53H7.js";import{u as Ns}from"./with-selector-CVNNI2E_.js";function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Cs={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ve(n)}function ve(t){this._=t}function Ms(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ve.prototype=ze.prototype={constructor:ve,on:function(t,e){var n=this._,o=Ms(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Is(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=Xn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=Xn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ve(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Is(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function Xn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Cs,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var on="http://www.w3.org/1999/xhtml";const Yn={svg:"http://www.w3.org/2000/svg",xhtml:on,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Yn.hasOwnProperty(e)?{space:Yn[e],local:t}:t}function As(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===on&&e.documentElement.namespaceURI===on?e.createElement(t):e.createElementNS(n,t)}}function ks(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ro(t){var e=De(t);return(e.local?ks:As)(e)}function Ps(){}function yn(t){return t==null?Ps:function(){return this.querySelector(t)}}function $s(t){typeof t!="function"&&(t=yn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=t.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ct(o,this._parents)}function Ts(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function zs(){return[]}function Vo(t){return t==null?zs:function(){return this.querySelectorAll(t)}}function Ds(t){return function(){return Ts(t.apply(this,arguments))}}function Ls(t){typeof t=="function"?t=Ds(t):t=Vo(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(t.call(c,c.__data__,l,s)),r.push(c));return new ct(o,r)}function Bo(t){return function(){return this.matches(t)}}function Fo(t){return function(e){return e.matches(t)}}var Hs=Array.prototype.find;function Rs(t){return function(){return Hs.call(this.children,t)}}function Vs(){return this.firstElementChild}function Bs(t){return this.select(t==null?Vs:Rs(typeof t=="function"?t:Fo(t)))}var Fs=Array.prototype.filter;function Os(){return Array.from(this.children)}function Xs(t){return function(){return Fs.call(this.children,t)}}function Ys(t){return this.selectAll(t==null?Os:Xs(typeof t=="function"?t:Fo(t)))}function js(t){typeof t!="function"&&(t=Bo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new ct(o,this._parents)}function Oo(t){return new Array(t.length)}function Ws(){return new ct(this._enter||this._groups.map(Oo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Gs(t){return function(){return t}}function qs(t,e,n,o,r,i){for(var s=0,a,c=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<c;++s)(a=e[s])&&(r[s]=a)}function Ks(t,e,n,o,r,i,s){var a,c,l=new Map,f=e.length,u=i.length,d=new Array(f),h;for(a=0;a<f;++a)(c=e[a])&&(d[a]=h=s.call(c,c.__data__,a,e)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(t,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ne(t,i[a]);for(a=0;a<f;++a)(c=e[a])&&l.get(d[a])===c&&(r[a]=c)}function Zs(t){return t.__data__}function Us(t,e){if(!arguments.length)return Array.from(this,Zs);var n=e?Ks:qs,o=this._parents,r=this._groups;typeof t!="function"&&(t=Gs(t));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,h=Qs(t.call(f,f&&f.__data__,l,o)),g=h.length,x=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(d);n(f,u,x,y,m,h,e);for(var _=0,p=0,w,S;_<g;++_)if(w=x[_]){for(_>=p&&(p=_+1);!(S=y[p])&&++p<g;);w._next=S||null}}return s=new ct(s,o),s._enter=a,s._exit=c,s}function Qs(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Js(){return new ct(this._exit||this._groups.map(Oo),this._parents)}function ta(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ea(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||f[g])&&(d[g]=h);for(;c<r;++c)a[c]=n[c];return new ct(a,this._parents)}function na(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],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 oa(t){t||(t=ra);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(e)}return new ct(r,this._parents).order()}function ra(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ia(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function sa(){return Array.from(this)}function aa(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function ca(){let t=0;for(const e of this)++t;return t}function la(){return!this.node()}function ua(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function da(t){return function(){this.removeAttribute(t)}}function fa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ha(t,e){return function(){this.setAttribute(t,e)}}function ga(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ma(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ya(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?fa:da:typeof e=="function"?n.local?ma:pa:n.local?ga:ha)(n,e))}function Xo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xa(t){return function(){this.style.removeProperty(t)}}function wa(t,e,n){return function(){this.style.setProperty(t,e,n)}}function va(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function _a(t,e,n){return arguments.length>1?this.each((e==null?xa:typeof e=="function"?va:wa)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Xo(t).getComputedStyle(t,null).getPropertyValue(e)}function ba(t){return function(){delete this[t]}}function Ea(t,e){return function(){this[t]=e}}function Sa(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Na(t,e){return arguments.length>1?this.each((e==null?ba:typeof e=="function"?Sa:Ea)(t,e)):this.node()[t]}function Yo(t){return t.trim().split(/^|\s+/)}function xn(t){return t.classList||new jo(t)}function jo(t){this._node=t,this._names=Yo(t.getAttribute("class")||"")}jo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wo(t,e){for(var n=xn(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function Go(t,e){for(var n=xn(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Ca(t){return function(){Wo(this,t)}}function Ma(t){return function(){Go(this,t)}}function Ia(t,e){return function(){(e.apply(this,arguments)?Wo:Go)(this,t)}}function Aa(t,e){var n=Yo(t+"");if(arguments.length<2){for(var o=xn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ia:e?Ca:Ma)(n,e))}function ka(){this.textContent=""}function Pa(t){return function(){this.textContent=t}}function $a(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ta(t){return arguments.length?this.each(t==null?ka:(typeof t=="function"?$a:Pa)(t)):this.node().textContent}function za(){this.innerHTML=""}function Da(t){return function(){this.innerHTML=t}}function La(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ha(t){return arguments.length?this.each(t==null?za:(typeof t=="function"?La:Da)(t)):this.node().innerHTML}function Ra(){this.nextSibling&&this.parentNode.appendChild(this)}function Va(){return this.each(Ra)}function Ba(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fa(){return this.each(Ba)}function Oa(t){var e=typeof t=="function"?t:Ro(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Xa(){return null}function Ya(t,e){var n=typeof t=="function"?t:Ro(t),o=e==null?Xa:typeof e=="function"?e:yn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ja(){var t=this.parentNode;t&&t.removeChild(this)}function Wa(){return this.each(ja)}function Ga(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qa(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ka(t){return this.select(t?qa:Ga)}function Za(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Ua(t){return function(e){t.call(this,e,this.__data__)}}function Qa(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function Ja(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function tc(t,e,n){return function(){var o=this.__on,r,i=Ua(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ec(t,e,n){var o=Qa(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?tc:Ja,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function qo(t,e,n){var o=Xo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function nc(t,e){return function(){return qo(this,t,e)}}function oc(t,e){return function(){return qo(this,t,e.apply(this,arguments))}}function rc(t,e){return this.each((typeof e=="function"?oc:nc)(t,e))}function*ic(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Ko=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],Ko)}function sc(){return this}ct.prototype=se.prototype={constructor:ct,select:$s,selectAll:Ls,selectChild:Bs,selectChildren:Ys,filter:js,data:Us,enter:Ws,exit:Js,join:ta,merge:ea,selection:sc,order:na,sort:oa,call:ia,nodes:sa,node:aa,size:ca,empty:la,each:ua,attr:ya,style:_a,property:Na,classed:Aa,text:Ta,html:Ha,raise:Va,lower:Fa,append:Oa,insert:Ya,remove:Wa,clone:Ka,datum:Za,on:ec,dispatch:rc,[Symbol.iterator]:ic};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],Ko)}function ac(t){let e;for(;e=t.sourceEvent;)t=e;return t}function lt(t,e){if(t=ac(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const cc={passive:!1},Jt={capture:!0,passive:!1};function Ze(t){t.stopImmediatePropagation()}function Lt(t){t.preventDefault(),t.stopImmediatePropagation()}function Zo(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Lt,Jt);"onselectstart"in e?n.on("selectstart.drag",Lt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Uo(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Lt,Jt),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 he=t=>()=>t;function rn(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}rn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function lc(t){return!t.ctrlKey&&!t.button}function uc(){return this.parentNode}function dc(t,e){return e??{x:t.x,y:t.y}}function fc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(){var t=lc,e=uc,n=dc,o=fc,r={},i=ze("start","drag","end"),s=0,a,c,l,f,u=0;function d(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,cc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,S){if(!(f||!t.call(this,w,S))){var N=p(this,e.call(this,w,S),w,S,"mouse");N&&(at(w.view).on("mousemove.drag",g,Jt).on("mouseup.drag",x,Jt),Zo(w.view),Ze(w),l=!1,a=w.clientX,c=w.clientY,N("start",w))}}function g(w){if(Lt(w),!l){var S=w.clientX-a,N=w.clientY-c;l=S*S+N*N>u}r.mouse("drag",w)}function x(w){at(w.view).on("mousemove.drag mouseup.drag",null),Uo(w.view,l),Lt(w),r.mouse("end",w)}function y(w,S){if(t.call(this,w,S)){var N=w.changedTouches,A=e.call(this,w,S),$=N.length,P,B;for(P=0;P<$;++P)(B=p(this,A,w,S,N[P].identifier,N[P]))&&(Ze(w),B("start",w,N[P]))}}function m(w){var S=w.changedTouches,N=S.length,A,$;for(A=0;A<N;++A)($=r[S[A].identifier])&&(Lt(w),$("drag",w,S[A]))}function _(w){var S=w.changedTouches,N=S.length,A,$;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<N;++A)($=r[S[A].identifier])&&(Ze(w),$("end",w,S[A]))}function p(w,S,N,A,$,P){var B=i.copy(),M=lt(P||N,S),z,V,v;if((v=n.call(w,new rn("beforestart",{sourceEvent:N,target:d,identifier:$,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:B}),A))!=null)return z=v.x-M[0]||0,V=v.y-M[1]||0,function I(b,k,C){var E=M,L;switch(b){case"start":r[$]=I,L=s++;break;case"end":delete r[$],--s;case"drag":M=lt(C||k,S),L=s;break}B.call(b,w,new rn(b,{sourceEvent:k,subject:v,target:d,identifier:$,active:L,x:M[0]+z,y:M[1]+V,dx:M[0]-E[0],dy:M[1]-E[1],dispatch:B}),A)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:he(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:he(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:he(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:he(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}var jn=180/Math.PI,sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Jo(t,e,n,o,r,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*o)&&(n-=t*c,o-=e*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),t*o<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*jn,skewX:Math.atan(c)*jn,scaleX:s,scaleY:a}}var ge;function hc(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?sn:Jo(e.a,e.b,e.c,e.d,e.e,e.f)}function gc(t){return t==null||(ge||(ge=document.createElementNS("http://www.w3.org/2000/svg","g")),ge.setAttribute("transform",t),!(t=ge.transform.baseVal.consolidate()))?sn:(t=t.matrix,Jo(t.a,t.b,t.c,t.d,t.e,t.f))}function tr(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,h,g){if(l!==u||f!==d){var x=h.push("translate(",null,e,null,n);g.push({i:x-4,x:Ct(l,u)},{i:x-2,x:Ct(f,d)})}else(u||d)&&h.push("translate("+u+e+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:Ct(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:Ct(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,h,g){if(l!==u||f!==d){var x=h.push(r(h)+"scale(",null,",",null,")");g.push({i:x-4,x:Ct(l,u)},{i:x-2,x:Ct(f,d)})}else(u!==1||d!==1)&&h.push(r(h)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=t(l),f=t(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(h){for(var g=-1,x=d.length,y;++g<x;)u[(y=d[g]).i]=y.x(h);return u.join("")}}}var pc=tr(hc,"px, ","px)","deg)"),mc=tr(gc,", ",")",")"),yc=1e-12;function Wn(t){return((t=Math.exp(t))+1/t)/2}function xc(t){return((t=Math.exp(t))-1/t)/2}function wc(t){return((t=Math.exp(2*t))-1)/(t+1)}const _e=(function t(e,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],h=f-a,g=u-c,x=h*h+g*g,y,m;if(x<yc)m=Math.log(d/l)/e,y=function(A){return[a+A*h,c+A*g,l*Math.exp(e*A*m)]};else{var _=Math.sqrt(x),p=(d*d-l*l+o*x)/(2*l*n*_),w=(d*d-l*l-o*x)/(2*d*n*_),S=Math.log(Math.sqrt(p*p+1)-p),N=Math.log(Math.sqrt(w*w+1)-w);m=(N-S)/e,y=function(A){var $=A*m,P=Wn(S),B=l/(n*_)*(P*wc(e*$+S)-xc(S));return[a+B*h,c+B*g,l*P/Wn(e*$+S)]}}return y.duration=m*1e3*e/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},r})(Math.SQRT2,2,4);var Rt=0,Zt=0,qt=0,er=1e3,Ce,Ut,Me=0,At=0,Le=0,te=typeof performance=="object"&&performance.now?performance:Date,nr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wn(){return At||(nr(vc),At=te.now()+Le)}function vc(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=or.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?wn():+n)+(e==null?0:+e),!this._next&&Ut!==this&&(Ut?Ut._next=this:Ce=this,Ut=this),this._call=t,this._time=n,an()},stop:function(){this._call&&(this._call=null,this._time=1/0,an())}};function or(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function _c(){wn(),++Rt;for(var t=Ce,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Gn(){At=(Me=te.now())+Le,Rt=Zt=0;try{_c()}finally{Rt=0,Ec(),At=0}}function bc(){var t=te.now(),e=t-Me;e>er&&(Le-=e,Me=t)}function Ec(){for(var t,e=Ce,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ce=n);Ut=t,an(o)}function an(t){if(!Rt){Zt&&(Zt=clearTimeout(Zt));var e=t-At;e>24?(t<1/0&&(Zt=setTimeout(Gn,t-te.now()-Le)),qt&&(qt=clearInterval(qt))):(qt||(Me=te.now(),qt=setInterval(bc,er)),Rt=1,nr(Gn))}}function qn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Sc=ze("start","end","cancel","interrupt"),Nc=[],rr=0,Kn=1,cn=2,be=3,Zn=4,ln=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Cc(t,n,{name:e,index:o,group:r,on:Sc,tween:Nc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:rr})}function vn(t,e){var n=ft(t,e);if(n.state>rr)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=ft(t,e);if(n.state>be)throw new Error("too late; already running");return n}function ft(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Cc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=or(i,0,n.time);function i(l){n.state=Kn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,h;if(n.state!==Kn)return c();for(f in o)if(h=o[f],h.name===n.name){if(h.state===be)return qn(s);h.state===Zn?(h.state=Ee,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[f]):+f<e&&(h.state=Ee,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[f])}if(qn(function(){n.state===be&&(n.state=Zn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===cn){for(n.state=be,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(h=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=ln,1),u=-1,d=r.length;++u<d;)r[u].call(t,f);n.state===ln&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>cn&&o.state<ln,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Mc(t){return this.each(function(){Se(this,t)})}function Ic(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Ac(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===e){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function kc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=ft(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Ic:Ac)(n,t,e))}function _n(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return ft(r,o).value[e]}}function ir(t,e){var n;return(typeof e=="number"?Ct:e instanceof Fn?On:(n=Fn(e))?(e=n,On):Ss)(t,e)}function Pc(t){return function(){this.removeAttribute(t)}}function $c(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Tc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function zc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Dc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Lc(t,e,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a)))}}function Hc(t,e){var n=De(t),o=n==="transform"?mc:ir;return this.attrTween(t,typeof e=="function"?(n.local?Lc:Dc)(n,o,_n(this,"attr."+t,e)):e==null?(n.local?$c:Pc)(n):(n.local?zc:Tc)(n,o,e))}function Rc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Vc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(t,i)),n}return r._value=e,r}function Fc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Rc(t,i)),n}return r._value=e,r}function Oc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Bc:Fc)(o,e))}function Xc(t,e){return function(){vn(this,t).delay=+e.apply(this,arguments)}}function Yc(t,e){return e=+e,function(){vn(this,t).delay=e}}function jc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xc:Yc)(e,t)):ft(this.node(),e).delay}function Wc(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function Gc(t,e){return e=+e,function(){gt(this,t).duration=e}}function qc(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Wc:Gc)(e,t)):ft(this.node(),e).duration}function Kc(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function Zc(t){var e=this._id;return arguments.length?this.each(Kc(e,t)):ft(this.node(),e).ease}function Uc(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function Qc(t){if(typeof t!="function")throw new Error;return this.each(Uc(this._id,t))}function Jc(t){typeof t!="function"&&(t=Bo(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&t.call(c,c.__data__,l,i)&&a.push(c);return new xt(o,this._parents,this._name,this._id)}function tl(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=e[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,h=0;h<f;++h)(d=c[h]||l[h])&&(u[h]=d);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function el(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function nl(t,e,n){var o,r,i=el(e)?vn:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function ol(t,e){var n=this._id;return arguments.length<2?ft(this.node(),n).on.on(t):this.each(nl(n,t,e))}function rl(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function il(){return this.on("end.remove",rl(this._id))}function sl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=yn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,He(l[d],e,n,d,l,ft(f,n)));return new xt(i,this._parents,e,n)}function al(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Vo(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=t.call(f,f.__data__,u,c),h,g=ft(f,n),x=0,y=d.length;x<y;++x)(h=d[x])&&He(h,e,n,x,d,g);i.push(d),s.push(f)}return new xt(i,s,e,n)}var cl=se.prototype.constructor;function ll(){return new cl(this._groups,this._parents)}function ul(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function sr(t){return function(){this.style.removeProperty(t)}}function dl(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function fl(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ht(this,t))),s===c?null:s===o&&c===r?i:(r=c,i=e(o=s,a))}}function hl(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var c=gt(this,t),l=c.on,f=c.value[i]==null?a||(a=sr(e)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function gl(t,e,n){var o=(t+="")=="transform"?pc:ir;return e==null?this.styleTween(t,ul(t,o)).on("end.style."+t,sr(t)):typeof e=="function"?this.styleTween(t,fl(t,o,_n(this,"style."+t,e))).each(hl(this._id,t)):this.styleTween(t,dl(t,o,e),n).on("end.style."+t,null)}function pl(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function ml(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&pl(t,s,n)),o}return i._value=e,i}function yl(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,ml(t,e,n??""))}function xl(t){return function(){this.textContent=t}}function wl(t){return function(){var e=t(this);this.textContent=e??""}}function vl(t){return this.tween("text",typeof t=="function"?wl(_n(this,"text",t)):xl(t==null?"":t+""))}function _l(t){return function(e){this.textContent=t.call(this,e)}}function bl(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&_l(r)),e}return o._value=t,o}function El(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,bl(t))}function Sl(){for(var t=this._name,e=this._id,n=ar(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=ft(c,e);He(c,t,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xt(o,this._parents,t,n)}function Nl(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),r===0&&i()})}var Cl=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function ar(){return++Cl}var mt=se.prototype;xt.prototype={constructor:xt,select:sl,selectAll:al,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:Jc,merge:tl,selection:ll,transition:Sl,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:ol,attr:Hc,attrTween:Oc,style:gl,styleTween:yl,text:vl,textTween:El,remove:il,tween:kc,delay:jc,duration:qc,ease:Zc,easeVarying:Qc,end:Nl,[Symbol.iterator]:mt[Symbol.iterator]};function Ml(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Il={time:null,delay:0,duration:250,ease:Ml};function Al(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function kl(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=ar(),(n=Il).time=wn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&He(c,t,e,l,s,n||Al(c,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Mc;se.prototype.transition=kl;const pe=t=>()=>t;function Pl(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);cr.prototype=yt.prototype;function cr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ue(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function $l(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Tl(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Un(){return this.__zoom||Re}function zl(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Dl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ll(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 lr(){var t=$l,e=Tl,n=Ll,o=zl,r=Dl,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=_e,l=ze("start","zoom","end"),f,u,d,h=500,g=150,x=0,y=10;function m(v){v.property("__zoom",Un).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,I,b,k){var C=v.selection?v.selection():v;C.property("__zoom",Un),v!==C?S(v,I,b,k):C.interrupt().each(function(){N(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(v,I,b,k){m.scaleTo(v,function(){var C=this.__zoom.k,E=typeof I=="function"?I.apply(this,arguments):I;return C*E},b,k)},m.scaleTo=function(v,I,b,k){m.transform(v,function(){var C=e.apply(this,arguments),E=this.__zoom,L=b==null?w(C):typeof b=="function"?b.apply(this,arguments):b,R=E.invert(L),H=typeof I=="function"?I.apply(this,arguments):I;return n(p(_(E,H),L,R),C,s)},b,k)},m.translateBy=function(v,I,b,k){m.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof b=="function"?b.apply(this,arguments):b),e.apply(this,arguments),s)},null,k)},m.translateTo=function(v,I,b,k,C){m.transform(v,function(){var E=e.apply(this,arguments),L=this.__zoom,R=k==null?w(E):typeof k=="function"?k.apply(this,arguments):k;return n(Re.translate(R[0],R[1]).scale(L.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof b=="function"?-b.apply(this,arguments):-b),E,s)},k,C)};function _(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new yt(I,v.x,v.y)}function p(v,I,b){var k=I[0]-b[0]*v.k,C=I[1]-b[1]*v.k;return k===v.x&&C===v.y?v:new yt(v.k,k,C)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,I,b,k){v.on("start.zoom",function(){N(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(k).end()}).tween("zoom",function(){var C=this,E=arguments,L=N(C,E).event(k),R=e.apply(C,E),H=b==null?w(R):typeof b=="function"?b.apply(C,E):b,O=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),X=C.__zoom,j=typeof I=="function"?I.apply(C,E):I,K=c(X.invert(H).concat(O/X.k),j.invert(H).concat(O/j.k));return function(G){if(G===1)G=j;else{var F=K(G),W=O/F[2];G=new yt(W,H[0]-F[0]*W,H[1]-F[1]*W)}L.zoom(null,G)}})}function N(v,I,b){return!b&&v.__zooming||new A(v,I)}function A(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,I),this.taps=0}A.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,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=at(this.that).datum();l.call(v,this.that,new Pl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),I)}};function $(v,...I){if(!t.apply(this,arguments))return;var b=N(this,I).event(v),k=this.__zoom,C=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),E=lt(v);if(b.wheel)(b.mouse[0][0]!==E[0]||b.mouse[0][1]!==E[1])&&(b.mouse[1]=k.invert(b.mouse[0]=E)),clearTimeout(b.wheel);else{if(k.k===C)return;b.mouse=[E,k.invert(E)],Se(this),b.start()}Kt(v),b.wheel=setTimeout(L,g),b.zoom("mouse",n(p(_(k,C),b.mouse[0],b.mouse[1]),b.extent,s));function L(){b.wheel=null,b.end()}}function P(v,...I){if(d||!t.apply(this,arguments))return;var b=v.currentTarget,k=N(this,I,!0).event(v),C=at(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),E=lt(v,b),L=v.clientX,R=v.clientY;Zo(v.view),Ue(v),k.mouse=[E,this.__zoom.invert(E)],Se(this),k.start();function H(X){if(Kt(X),!k.moved){var j=X.clientX-L,K=X.clientY-R;k.moved=j*j+K*K>x}k.event(X).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=lt(X,b),k.mouse[1]),k.extent,s))}function O(X){C.on("mousemove.zoom mouseup.zoom",null),Uo(X.view,k.moved),Kt(X),k.event(X).end()}}function B(v,...I){if(t.apply(this,arguments)){var b=this.__zoom,k=lt(v.changedTouches?v.changedTouches[0]:v,this),C=b.invert(k),E=b.k*(v.shiftKey?.5:2),L=n(p(_(b,E),k,C),e.apply(this,I),s);Kt(v),a>0?at(this).transition().duration(a).call(S,L,k,v):at(this).call(m.transform,L,k,v)}}function M(v,...I){if(t.apply(this,arguments)){var b=v.touches,k=b.length,C=N(this,I,v.changedTouches.length===k).event(v),E,L,R,H;for(Ue(v),L=0;L<k;++L)R=b[L],H=lt(R,this),H=[H,this.__zoom.invert(H),R.identifier],C.touch0?!C.touch1&&C.touch0[2]!==H[2]&&(C.touch1=H,C.taps=0):(C.touch0=H,E=!0,C.taps=1+!!f);f&&(f=clearTimeout(f)),E&&(C.taps<2&&(u=H[0],f=setTimeout(function(){f=null},h)),Se(this),C.start())}}function z(v,...I){if(this.__zooming){var b=N(this,I).event(v),k=v.changedTouches,C=k.length,E,L,R,H;for(Kt(v),E=0;E<C;++E)L=k[E],R=lt(L,this),b.touch0&&b.touch0[2]===L.identifier?b.touch0[0]=R:b.touch1&&b.touch1[2]===L.identifier&&(b.touch1[0]=R);if(L=b.that.__zoom,b.touch1){var O=b.touch0[0],X=b.touch0[1],j=b.touch1[0],K=b.touch1[1],G=(G=j[0]-O[0])*G+(G=j[1]-O[1])*G,F=(F=K[0]-X[0])*F+(F=K[1]-X[1])*F;L=_(L,Math.sqrt(G/F)),R=[(O[0]+j[0])/2,(O[1]+j[1])/2],H=[(X[0]+K[0])/2,(X[1]+K[1])/2]}else if(b.touch0)R=b.touch0[0],H=b.touch0[1];else return;b.zoom("touch",n(p(L,R,H),b.extent,s))}}function V(v,...I){if(this.__zooming){var b=N(this,I).event(v),k=v.changedTouches,C=k.length,E,L;for(Ue(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),E=0;E<C;++E)L=k[E],b.touch0&&b.touch0[2]===L.identifier?delete b.touch0:b.touch1&&b.touch1[2]===L.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(L=lt(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<y)){var R=at(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},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?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const ht={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ur=["Enter"," ","Escape"],dr={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const fr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const Qn={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function hr(t){return t===null?null:t?"valid":"invalid"}const gr=t=>"id"in t&&"source"in t&&"target"in t,Hl=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),bn=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Rl=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):bn(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},En=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...ue(e,[n,o,r]),width:e.width/r,height:e.height/r},c=[];for(const l of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const h=f.width??l.width??l.initialWidth??null,g=f.height??l.height??l.initialHeight??null,x=oe(a,Ft(l)),y=(h??0)*(g??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},Vl=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Bl(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Fl({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Bl(t,s),c=ce(a),l=Sn(c,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function pr({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&Ot(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Ot(u)?kt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Ol({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(x=>x.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Vl(s,c);for(const d of c)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function mr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const Jn=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,yr=(t,e,n=15,o=40)=>{const r=Jn(t.x,o,e.width-o)*n,i=Jn(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),un=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=bn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=bn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},xr=(t,e)=>Be(Ve(un(t),un(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},to=t=>ut(t.width)&&ut(t.height)&&ut(t.x)&&ut(t.y),ut=t=>!isNaN(t)&&isFinite(t),Xl=(t,e)=>{},le=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),ue=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?le(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Yl(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);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 jl(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:c,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const Sn=(t,e,n,o,r,i)=>{const s=Yl(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,l=Math.min(a,c),f=Bt(l,o,r),u=t.x+t.width/2,d=t.y+t.height/2,h=e/2-u*f,g=n/2-d*f,x=jl(t,h,g,f,e,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:f}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function wr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function vr(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function eo(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Wl(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function Gl(t){return{...dr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=dt(t),a=ue({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?le(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const Nn=t=>({width:t.offsetWidth,height:t.offsetHeight}),_r=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ql=["INPUT","SELECT","TEXTAREA"];function br(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:ql.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Er=t=>"clientX"in t,dt=(t,e)=>{var i,s;const n=Er(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},no=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Nn(s)}})};function Sr({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,f=Math.abs(c-t),u=Math.abs(l-e);return[c,l,f,u]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function oo({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Nr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,c]=oo({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,f]=oo({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[u,d,h,g]=Sr({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${t},${e} C${a},${c} ${l},${f} ${o},${r}`,u,d,h,g]}function Cr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function Kl({sourceNode:t,targetNode:e,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(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function Zl({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));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 oe(s,Be(i))>0}const Ul=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,Ql=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Jl=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||Ul;let r;return gr(t)?r={...t}:r={...t,id:o(t)},Ql(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Mr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=Cr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ro={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},tu=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},io=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function eu({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=ro[e],c=ro[o],l={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=tu({source:l,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",h=u[d];let g=[],x,y;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=Cr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(x=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const $=[{x,y:l.y},{x,y:f.y}],P=[{x:l.x,y},{x:f.x,y}];a[d]===h?g=d==="x"?$:P:g=d==="x"?P:$}else{const $=[{x:l.x,y:f.y}],P=[{x:f.x,y:l.y}];if(d==="x"?g=a.x===h?P:$:g=a.y===h?$:P,e===o){const v=Math.abs(t[d]-n[d]);if(v<=i){const I=Math.min(i-1,i-v);a[d]===h?m[d]=(l[d]>t[d]?-1:1)*I:_[d]=(f[d]>n[d]?-1:1)*I}}if(e!==o){const v=d==="x"?"y":"x",I=a[d]===c[v],b=l[v]>f[v],k=l[v]<f[v];(a[d]===1&&(!I&&b||I&&k)||a[d]!==1&&(!I&&k||I&&b))&&(g=d==="x"?$:P)}const B={x:l.x+m.x,y:l.y+m.y},M={x:f.x+_.x,y:f.y+_.y},z=Math.max(Math.abs(B.x-g[0].x),Math.abs(M.x-g[0].x)),V=Math.max(Math.abs(B.y-g[0].y),Math.abs(M.y-g[0].y));z>=V?(x=(B.x+M.x)/2,y=g[0].y):(x=g[0].x,y=(B.y+M.y)/2)}const S={x:l.x+m.x,y:l.y+m.y},N={x:f.x+_.x,y:f.y+_.y};return[[t,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...N.x!==g[g.length-1].x||N.y!==g[g.length-1].y?[N]:[],n],x,y,p,w]}function nu(t,e,n,o){const r=Math.min(io(t,e)/2,io(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function dn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,h,g,x]=eu({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=nu(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,d,h,g,x]}function so(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function ou(t){var u;const{sourceNode:e,targetNode:n}=t;if(!so(e)||!so(n))return null;const o=e.internals.handleBounds||ao(e.handles),r=n.internals.handleBounds||ao(n.handles),i=co((o==null?void 0:o.source)??[],t.sourceHandle),s=co(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,c=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),f=Pt(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function ao(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.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 co(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function fn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function ru(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=fn(c,e);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Ir=1e3,iu=10,Cn={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},su={...Cn,checkEquality:!0};function Mn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function au(t,e,n){const o=Mn(Cn,n);for(const r of t.values())if(r.parentId)An(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function cu(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.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 In(t){return t==="manual"}function hn(t,e,n,o={}){var f,u;const r=Mn(su,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!In(r.zIndexMode)?Ir:0;let c=t.length>0,l=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(r.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=ae(d,r.nodeOrigin),x=Ot(d.extent)?d.extent:r.nodeExtent,y=kt(g,x,wt(d));h={...r.defaults,...d,measured:{width:(f=d.measured)==null?void 0:f.width,height:(u=d.measured)==null?void 0:u.height},internals:{positionAbsolute:y,handleBounds:cu(d,h),z:Ar(d,a,r.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&An(h,e,n,o,i),l||(l=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function lu(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function An(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Mn(Cn,o),l=t.parentId,f=e.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}lu(t,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*iu),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!In(c)?Ir:0,{x:d,y:h,z:g}=uu(t,f,s,a,u,c),{positionAbsolute:x}=t.internals,y=d!==x.x||h!==x.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:h}:x,z:g}})}function Ar(t,e,n){const o=ut(t.zIndex)?t.zIndex:0;return In(n)?o:o+(t.selected?e:0)}function uu(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,c=wt(t),l=ae(t,n),f=Ot(t.extent)?kt(l,t.extent,c):l;let u=kt({x:s+f.x,y:a+f.y},o,c);t.extent==="parent"&&(u=mr(u,c,e));const d=Ar(t,r,i),h=e.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}function kn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(c),f=xr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const f=c.internals.positionAbsolute,u=wt(c),d=c.origin??o,h=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*d[0],_=(y-u.height)*d[1];(h>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+_}}),(p=n.get(l))==null||p.forEach(w=>{t.some(S=>S.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?d[0]*h-m:0),height:y+(g?d[1]*g-_:0)}})}),r}function du(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Nn(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Ot(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=mr(w,x,e.get(g.parentId)):p&&(w=kt(w,p,x));const S={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:no("source",h.nodeElement,_,u,g.id),target:no("target",h.nodeElement,_,u,g.id)}}};e.set(g.id,S),g.parentId&&An(S,e,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ft(S,r)}))}}if(d.length>0){const h=kn(d,e,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function fu({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.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 lo(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function kr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;lo("source",c,f,t,r,s),lo("target",c,l,t,i,a),e.set(o.id,o)}}function Pr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Pr(n,e):!1}function uo(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function hu(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Pr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of e){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function gu({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=le(i,e);return{x:s.x-i.x,y:s.y-i.y}}function pu({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,h=!1,g=!1,x=null;function y({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:S,nodeId:N,nodeClickDistance:A=0}){d=at(w);function $({x:z,y:V}){const{nodeLookup:v,nodeExtent:I,snapGrid:b,snapToGrid:k,nodeOrigin:C,onNodeDrag:E,onSelectionDrag:L,onError:R,updateNodePositions:H}=e();i={x:z,y:V};let O=!1;const X=a.size>1,j=X&&I?un(ce(a)):null,K=X&&k?gu({dragItems:a,snapGrid:b,x:z,y:V}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:z-F.distance.x,y:V-F.distance.y};k&&(W=K?{x:Math.round(W.x+K.x),y:Math.round(W.y+K.y)}:le(W,b));let Q=null;if(X&&I&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+I[0][0],nt=q.x+F.measured.width-j.x2+I[1][0],tt=q.y-j.y+I[0][1],st=q.y+F.measured.height-j.y2+I[1][1];Q=[[et,tt],[nt,st]]}const{position:U,positionAbsolute:Z}=pr({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||I,nodeOrigin:C,onError:R});O=O||F.position.x!==U.x||F.position.y!==U.y,F.position=U,F.internals.positionAbsolute=Z}if(g=g||O,!!O&&(H(a,!0),x&&(o||E||!N&&L))){const[G,F]=Qe({nodeId:N,dragItems:a,nodeLookup:v});o==null||o(x,a,G,F),E==null||E(x,G,F),N||L==null||L(x,F)}}async function P(){if(!f)return;const{transform:z,panBy:V,autoPanSpeed:v,autoPanOnNodeDrag:I}=e();if(!I){c=!1,cancelAnimationFrame(s);return}const[b,k]=yr(l,f,v);(b!==0||k!==0)&&(i.x=(i.x??0)-b/z[2],i.y=(i.y??0)-k/z[2],await V({x:b,y:k})&&$(i)),s=requestAnimationFrame(P)}function B(z){var X;const{nodeLookup:V,multiSelectionActive:v,nodesDraggable:I,transform:b,snapGrid:k,snapToGrid:C,selectNodesOnDrag:E,onNodeDragStart:L,onSelectionDragStart:R,unselectNodesAndEdges:H}=e();u=!0,(!E||!S)&&!v&&N&&((X=V.get(N))!=null&&X.selected||H()),S&&E&&N&&(t==null||t(N));const O=Qt(z.sourceEvent,{transform:b,snapGrid:k,snapToGrid:C,containerBounds:f});if(i=O,a=hu(V,I,O,N),a.size>0&&(n||L||!N&&R)){const[j,K]=Qe({nodeId:N,dragItems:a,nodeLookup:V});n==null||n(z.sourceEvent,a,j,K),L==null||L(z.sourceEvent,j,K),N||R==null||R(z.sourceEvent,K)}}const M=Qo().clickDistance(A).on("start",z=>{const{domNode:V,nodeDragThreshold:v,transform:I,snapGrid:b,snapToGrid:k}=e();f=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,g=!1,x=z.sourceEvent,v===0&&B(z),i=Qt(z.sourceEvent,{transform:I,snapGrid:b,snapToGrid:k,containerBounds:f}),l=dt(z.sourceEvent,f)}).on("drag",z=>{const{autoPanOnNodeDrag:V,transform:v,snapGrid:I,snapToGrid:b,nodeDragThreshold:k,nodeLookup:C}=e(),E=Qt(z.sourceEvent,{transform:v,snapGrid:I,snapToGrid:b,containerBounds:f});if(x=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||N&&!C.has(N))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,P()),!u){const L=dt(z.sourceEvent,f),R=L.x-l.x,H=L.y-l.y;Math.sqrt(R*R+H*H)>k&&B(z)}(i.x!==E.xSnapped||i.y!==E.ySnapped)&&a&&u&&(l=dt(z.sourceEvent,f),$(E))}}).on("end",z=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:V,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:b}=e();if(g&&(v(a,!1),g=!1),r||I||!N&&b){const[k,C]=Qe({nodeId:N,dragItems:a,nodeLookup:V,dragging:!1});r==null||r(z.sourceEvent,a,k,C),I==null||I(z.sourceEvent,k,C),N||b==null||b(z.sourceEvent,C)}}}).filter(z=>{const V=z.target;return!z.button&&(!_||!uo(V,`.${_}`,w))&&(!p||uo(V,p,w))});d.call(M)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function mu(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const yu=250;function xu(t,e,n,o){var a,c;let r=[],i=1/0;const s=mu(t,n,e+yu);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:h}=Pt(l,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(r=[{...u,x:d,y:h}],i=g):g===i&&r.push({...u,x:d,y:h}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function $r(t,e,n,o,r,i=!1){var l,f,u;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Pt(s,c,c.position,!0)}:c}function Tr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function wu(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const zr=()=>!0;function vu(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:m=zr,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:N,dragThreshold:A=1,handleDomNode:$}){const P=_r(t.target);let B=0,M;const{x:z,y:V}=dt(t),v=Tr(i,$),I=a==null?void 0:a.getBoundingClientRect();let b=!1;if(!I||!v)return;const k=$r(r,v,o,c,e);if(!k)return;let C=dt(t,I),E=!1,L=null,R=!1,H=null;function O(){if(!f||!I)return;const[U,Z]=yr(C,I,N);d({x:U,y:Z}),B=requestAnimationFrame(O)}const X={...k,nodeId:r,type:v,position:k.position},j=c.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,X,Y.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:j,to:C,toHandle:null,toPosition:Qn[X.position],toNode:null,pointer:C};function F(){b=!0,p(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}A===0&&F();function W(U){if(!b){const{x:st,y:vt}=dt(U),pt=st-z,Nt=vt-V;if(!(pt*pt+Nt*Nt>A*A))return;F()}if(!S()||!X){Q(U);return}const Z=w();C=dt(U,I),M=xu(ue(C,Z,!1,[1,1]),n,c,X),E||(O(),E=!0);const q=Dr(U,{handle:M,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:P,lib:l,flowId:u,nodeLookup:c});H=q.handleDomNode,L=q.connection,R=wu(!!M,q.isValid);const et=c.get(r),nt=et?Pt(et,X,Y.Left,!0):G.from,tt={...G,from:nt,isValid:R,to:q.toHandle&&R?Pe({x:q.toHandle.x,y:q.toHandle.y},Z):C,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Qn[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:C};p(tt),G=tt}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(b){(M||H)&&L&&R&&(x==null||x(L));const{inProgress:Z,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};y==null||y(U,et),i&&(_==null||_(U,et))}h(),cancelAnimationFrame(B),E=!1,R=!1,L=null,H=null,P.removeEventListener("mousemove",W),P.removeEventListener("mouseup",Q),P.removeEventListener("touchmove",W),P.removeEventListener("touchend",Q)}}P.addEventListener("mousemove",W),P.addEventListener("mouseup",Q),P.addEventListener("touchmove",W),P.addEventListener("touchend",Q)}function Dr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=zr,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=dt(t),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const _=Tr(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),N=y.classList.contains("connectableend");if(!p||!_)return m;const A={source:u?p:o,sourceHandle:u?w:r,target:u?o:p,targetHandle:u?r:w};m.connection=A;const P=S&&N&&(n===Vt.Strict?u&&_==="source"||!u&&_==="target":p!==o||w!==r);m.isValid=P&&l(A),m.toHandle=$r(p,_,w,f,n,!0)}return m}const gn={onPointerDown:vu,isValid:Dr};function _u({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),S=p.sourceEvent.ctrlKey&&re()?10:1,N=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,A=w[2]*Math.pow(2,N*S);e.scaleTo(A)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],N=[S[0]-x[0],S[1]-x[1]];x=S;const A=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-N[0]*A,y:w[1]-N[1]*A},P=[[0,0],[c,l]];e.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},P,a)},_=lr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:lt}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Lr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),bu=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=bu,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Hr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Eu({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(zt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=lt(f),m=Hr(f),_=u*Math.pow(2,m);o.scaleTo(n,_,y,f);return}const d=f.deltaMode===1?20:1;let h=r===It.Vertical?0:f.deltaX*d,g=r===It.Horizontal?0:f.deltaY*d;!re()&&f.shiftKey&&r!==It.Vertical&&(h=f.deltaY*d,g=0),o.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const x=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(f,x),t.panScrollTimeout=setTimeout(()=>{l==null||l(f,x),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,x))}}function Su({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Nu({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Cu({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Lr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Mu({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Lr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const c=Fe(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Iu({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=t||e,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(zt(u,`${l}-flow__node`)||zt(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!g||zt(u,a)&&g||zt(u,c)&&(!g||r&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Au({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=lr().scaleExtent([e,n]).translateExtent(o),d=at(t).call(u);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[f.width,f.height]],o);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Hr);function x(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).transform(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function y({noWheelClassName:M,noPanClassName:z,onPaneContextMenu:V,userSelectionActive:v,panOnScroll:I,panOnDrag:b,panOnScrollMode:k,panOnScrollSpeed:C,preventScrolling:E,zoomOnPinch:L,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:X,onTransformChange:j,connectionInProgress:K,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=I&&!O&&!v;u.clickDistance(F?1/0:!ut(G)||G<0?0:G);const Q=W?Eu({zoomPanValues:l,noWheelClassName:M,d3Selection:d,d3Zoom:u,panOnScrollMode:k,panOnScrollSpeed:C,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Su({noWheelClassName:M,preventScrolling:E,d3ZoomHandler:h});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const Z=Nu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",Z);const q=Cu({zoomPanValues:l,panOnDrag:b,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:j});u.on("zoom",q);const et=Mu({zoomPanValues:l,panOnDrag:b,panOnScroll:I,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",et)}const U=Iu({zoomActivationKeyPressed:O,panOnDrag:b,zoomOnScroll:R,panOnScroll:I,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:v,noPanClassName:z,noWheelClassName:M,lib:X,connectionInProgress:K});u.filter(U),H?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function _(M,z,V){const v=Je(M),I=u==null?void 0:u.constrain()(v,z,V);return I&&await x(I),new Promise(b=>b(I))}async function p(M,z){const V=Je(M);return await x(V,z),new Promise(v=>v(V))}function w(M){if(d){const z=Je(M),V=d.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(d,z,null,{sync:!0}))}}function S(){const M=d?cr(d.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function N(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).scaleTo(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function A(M,z){return d?new Promise(V=>{u==null||u.interpolate((z==null?void 0:z.interpolate)==="linear"?Ke:_e).scaleBy(tn(d,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function $(M){u==null||u.scaleExtent(M)}function P(M){u==null||u.translateExtent(M)}function B(M){const z=!ut(M)||M<0?0:M;u==null||u.clickDistance(z)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:_,getViewport:S,scaleTo:N,scaleBy:A,setScaleExtent:$,setTranslateExtent:P,syncViewport:w,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function ku({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function fo(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function ho(t,e){return t?!e:e}function Pu(t,e,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:S,height:N,aspectRatio:A}=t;let $=Math.floor(f?h-t.pointerX:0),P=Math.floor(u?g-t.pointerY:0);const B=S+(c?-$:$),M=N+(l?-P:P),z=-i[0]*S,V=-i[1]*N;let v=ye(B,x,y),I=ye(M,m,_);if(s){let C=0,E=0;c&&$<0?C=_t(p+$+z,s[0][0]):!c&&$>0&&(C=bt(p+B+z,s[1][0])),l&&P<0?E=_t(w+P+V,s[0][1]):!l&&P>0&&(E=bt(w+M+V,s[1][1])),v=Math.max(v,C),I=Math.max(I,E)}if(a){let C=0,E=0;c&&$>0?C=bt(p+$,a[0][0]):!c&&$<0&&(C=_t(p+B,a[1][0])),l&&P>0?E=bt(w+P,a[0][1]):!l&&P<0&&(E=_t(w+M,a[1][1])),v=Math.max(v,C),I=Math.max(I,E)}if(r){if(f){const C=ye(B/A,m,_)*A;if(v=Math.max(v,C),s){let E=0;!c&&!l||c&&!l&&d?E=bt(w+V+B/A,s[1][1])*A:E=_t(w+V+(c?$:-$)/A,s[0][1])*A,v=Math.max(v,E)}if(a){let E=0;!c&&!l||c&&!l&&d?E=_t(w+B/A,a[1][1])*A:E=bt(w+(c?$:-$)/A,a[0][1])*A,v=Math.max(v,E)}}if(u){const C=ye(M*A,x,y)/A;if(I=Math.max(I,C),s){let E=0;!c&&!l||l&&!c&&d?E=bt(p+M*A+z,s[1][0])/A:E=_t(p+(l?P:-P)*A+z,s[0][0])/A,I=Math.max(I,E)}if(a){let E=0;!c&&!l||l&&!c&&d?E=_t(p+M*A,a[1][0])/A:E=bt(p+(l?P:-P)*A,a[0][0])/A,I=Math.max(I,E)}}}P=P+(P<0?I:-I),$=$+($<0?v:-v),r&&(d?B>M*A?P=(ho(c,l)?-$:$)/A:$=(ho(c,l)?-P:P)*A:f?(P=$/A,l=c):($=P*A,c=l));const b=c?p+$:p,k=l?w+P:w;return{width:S+(c?-$:$),height:N+(l?-P:P),x:i[0]*$*(c?-1:1)+b,y:i[1]*P*(l?-1:1)+k}}const Rr={width:0,height:0,x:0,y:0},$u={...Rr,pointerX:0,pointerY:0,aspectRatio:1};function Tu(t){return[[0,0],[t.measured.width,t.measured.height]]}function zu(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Du({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:fo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let m={...Rr},_={...$u};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:fo(l)};let p,w=null,S=[],N,A,$,P=!1;const B=Qo().on("start",M=>{const{nodeLookup:z,transform:V,snapGrid:v,snapToGrid:I,nodeOrigin:b,paneDomNode:k}=n();if(p=z.get(e),!p)return;w=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:E}=Qt(M.sourceEvent,{transform:V,snapGrid:v,snapToGrid:I,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:C,pointerY:E,aspectRatio:m.width/m.height},N=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(N=z.get(p.parentId),A=N&&p.extent==="parent"?Tu(N):void 0),S=[],$=void 0;for(const[L,R]of z)if(R.parentId===e&&(S.push({id:L,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const H=zu(R,p,R.origin??b);$?$=[[Math.min(H[0][0],$[0][0]),Math.min(H[0][1],$[0][1])],[Math.max(H[1][0],$[1][0]),Math.max(H[1][1],$[1][1])]]:$=H}h==null||h(M,{...m})}).on("drag",M=>{const{transform:z,snapGrid:V,snapToGrid:v,nodeOrigin:I}=n(),b=Qt(M.sourceEvent,{transform:z,snapGrid:V,snapToGrid:v,containerBounds:w}),k=[];if(!p)return;const{x:C,y:E,width:L,height:R}=m,H={},O=p.origin??I,{width:X,height:j,x:K,y:G}=Pu(_,s.controlDirection,b,s.boundaries,s.keepAspectRatio,O,A,$),F=X!==L,W=j!==R,Q=K!==C&&F,U=G!==E&&W;if(!Q&&!U&&!F&&!W)return;if((Q||U||O[0]===1||O[1]===1)&&(H.x=Q?K:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,S.length>0)){const nt=K-C,tt=G-E;for(const st of S)st.position={x:st.position.x-nt+O[0]*(X-L),y:st.position.y-tt+O[1]*(j-R)},k.push(st)}if((F||W)&&(H.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=H.width,m.height=H.height),N&&p.expandParent){const nt=O[0]*(H.width??0);H.x&&H.x<nt&&(m.x=nt,_.x=_.x-(H.x-nt));const tt=O[1]*(H.height??0);H.y&&H.y<tt&&(m.y=tt,_.y=_.y-(H.y-tt))}const Z=ku({width:m.width,prevWidth:L,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:Z};(y==null?void 0:y(M,q))!==!1&&(P=!0,g==null||g(M,q),o(H,k))}).on("end",M=>{P&&(x==null||x(M,{...m}),r==null||r({...m}),P=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Lu={},go=t=>{let e;const n=new Set,o=(f,u)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const h=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(g=>g(e,h))}},r=()=>e,c={setState:o,getState:r,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Lu?"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()}},l=e=t(o,r,c);return c},Hu=t=>t?go(t):go,{useDebugValue:Ru}=Es,{useSyncExternalStoreWithSelector:Vu}=Ns,Bu=t=>t;function Vr(t,e=Bu,n){const o=Vu(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Ru(o),o}const po=(t,e)=>{const n=Hu(t),o=(r,i=e)=>Vr(n,r,i);return Object.assign(o,n),o},Fu=(t,e)=>t?po(t,e):po;function ot(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}const Oe=D.createContext(null),Ou=Oe.Provider,Br=ht.error001();function J(t,e){const n=D.useContext(Oe);if(n===null)throw new Error(Br);return Vr(n,t,e)}function rt(){const t=D.useContext(Oe);if(t===null)throw new Error(Br);return D.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const mo={display:"none"},Xu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fr="react-flow__node-desc",Or="react-flow__edge-desc",Yu="react-flow__aria-live",ju=t=>t.ariaLiveMessage,Wu=t=>t.ariaLabelConfig;function Gu({rfId:t}){const e=J(ju);return T.jsx("div",{id:`${Yu}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Xu,children:e})}function qu({rfId:t,disableKeyboardA11y:e}){const n=J(Wu);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${Fr}-${t}`,style:mo,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${Or}-${t}`,style:mo,children:n["edge.a11yDescription.default"]}),!e&&T.jsx(Gu,{rfId:t})]})}const Xe=D.forwardRef(({position:t="top-left",children:e,className:n,style:o,...r},i)=>{const s=`${t}`.split("-");return T.jsx("div",{className:it(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:e})});Xe.displayName="Panel";function Ku({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:T.jsx(Xe,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zu=t=>{const e=[],n=[];for(const[,o]of t.nodeLookup)o.selected&&e.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&n.push(o);return{selectedNodes:e,selectedEdges:n}},xe=t=>t.id;function Uu(t,e){return ot(t.selectedNodes.map(xe),e.selectedNodes.map(xe))&&ot(t.selectedEdges.map(xe),e.selectedEdges.map(xe))}function Qu({onSelectionChange:t}){const e=rt(),{selectedNodes:n,selectedEdges:o}=J(Zu,Uu);return D.useEffect(()=>{const r={nodes:n,edges:o};t==null||t(r),e.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,t]),null}const Ju=t=>!!t.onSelectionChangeHandlers;function td({onSelectionChange:t}){const e=J(Ju);return t||e?T.jsx(Qu,{onSelectionChange:t}):null}const pn=typeof window<"u"?D.useLayoutEffect:D.useEffect,Xr=[0,0],ed={x:0,y:0,zoom:1},nd=["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"],yo=[...nd,"rfId"],od=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),xo={translateExtent:ee,nodeOrigin:Xr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function rd(t){const{setNodes:e,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(od,ot),l=rt();pn(()=>(c(t.defaultNodes,t.defaultEdges),()=>{f.current=xo,a()}),[]);const f=D.useRef(xo);return pn(()=>{for(const u of yo){const d=t[u],h=f.current[u];d!==h&&(typeof t[u]>"u"||(u==="nodes"?e(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:Gl(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=t},yo.map(u=>t[u])),null}function wo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function id(t){var o;const[e,n]=D.useState(t==="system"?null:t);return D.useEffect(()=>{if(t!=="system"){n(t);return}const r=wo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[t]),e!==null?e:(o=wo())!=null&&o.matches?"dark":"light"}const vo=typeof document<"u"?document:null;function ie(t=null,e={target:vo,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(t!==null){const l=(Array.isArray(t)?t:[t]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1,4 +1,4 @@
1
- import{b as I,a as M}from"./index-BBrVVMkD.js";var w={exports:{}},R={},x={exports:{}},j={};/**
1
+ import{b as I,a as M}from"./index-DOl6hFR0.js";var w={exports:{}},R={},x={exports:{}},j={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *
@@ -16,8 +16,8 @@
16
16
  </script>
17
17
  <link rel="preconnect" href="https://fonts.googleapis.com" />
18
18
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
19
- <script type="module" crossorigin src="/assets/index-BBrVVMkD.js"></script>
20
- <link rel="stylesheet" crossorigin href="/assets/index-BXyO9WJn.css">
19
+ <script type="module" crossorigin src="/assets/index-DOl6hFR0.js"></script>
20
+ <link rel="stylesheet" crossorigin href="/assets/index-PHcsJJs8.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="root"></div>
@@ -262,6 +262,7 @@ export interface Session {
262
262
  branch_name: string | null;
263
263
  worktree_path: string | null;
264
264
  base_commit: string | null;
265
+ snapshots: string | null;
265
266
  use_worktree: number;
266
267
  token_usage: string | null;
267
268
  total_cost_usd: number | null;
@@ -272,11 +273,12 @@ export interface Session {
272
273
  tag_id: string | null;
273
274
  created_at: string;
274
275
  updated_at: string;
276
+ is_git_repo?: number;
275
277
  }
276
278
  export declare function createSession(projectId: string, title: string, description?: string, cliTool?: string, cliModel?: string, useWorktree?: boolean, memoryInjectMode?: string | null, memoryNodeIds?: string | null, memoryRawFilePaths?: string | null, tagId?: string | null): Session;
277
279
  export declare function getSessionsByProjectId(projectId: string): Session[];
278
280
  export declare function getSessionById(id: string): Session | undefined;
279
- export declare function updateSession(id: string, updates: Partial<Pick<Session, 'title' | 'description' | 'cli_tool' | 'cli_model' | 'process_pid' | 'branch_name' | 'worktree_path' | 'base_commit' | 'use_worktree' | 'token_usage' | 'total_cost_usd' | 'total_tokens' | 'memory_inject_mode' | 'memory_node_ids' | 'memory_raw_file_paths' | 'tag_id'>>): Session | undefined;
281
+ export declare function updateSession(id: string, updates: Partial<Pick<Session, 'title' | 'description' | 'cli_tool' | 'cli_model' | 'process_pid' | 'branch_name' | 'worktree_path' | 'base_commit' | 'snapshots' | 'use_worktree' | 'token_usage' | 'total_cost_usd' | 'total_tokens' | 'memory_inject_mode' | 'memory_node_ids' | 'memory_raw_file_paths' | 'tag_id'>>): Session | undefined;
280
282
  export declare function updateSessionStatus(id: string, status: string): Session | undefined;
281
283
  export declare function getSessionsByStatus(status: string): Session[];
282
284
  export declare function deleteSession(id: string): boolean;