angine 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +11 -8
- package/dist/src/daemon.js +46 -2
- package/dist/src/daemon.js.map +1 -1
- package/dist/src/dashboard.d.ts +6 -1
- package/dist/src/dashboard.js +28 -3
- package/dist/src/dashboard.js.map +1 -1
- package/dist/src/insights.d.ts +24 -0
- package/dist/src/insights.js +62 -0
- package/dist/src/insights.js.map +1 -0
- package/dist/src/notifications.d.ts +15 -0
- package/dist/src/notifications.js +56 -0
- package/dist/src/notifications.js.map +1 -0
- package/dist/src/reporting.d.ts +1 -1
- package/dist/src/reporting.js +1 -1
- package/dist/src/setup.d.ts +4 -0
- package/dist/src/setup.js +17 -2
- package/dist/src/setup.js.map +1 -1
- package/dist/src/store.d.ts +3 -0
- package/dist/src/store.js +18 -0
- package/dist/src/store.js.map +1 -1
- package/dist/src/terminal.d.ts +14 -0
- package/dist/src/terminal.js +38 -0
- package/dist/src/terminal.js.map +1 -0
- package/dist/src/workflow.d.ts +6 -1
- package/dist/src/workflow.js +12 -2
- package/dist/src/workflow.js.map +1 -1
- package/docs/releases/v0.2.1.md +8 -0
- package/docs/releases/v0.3.0.md +13 -0
- package/docs/releases/v0.4.0.md +24 -0
- package/docs/releasing.md +10 -8
- package/package.json +1 -1
- package/ui/dist/assets/index-BD3o7HYE.js +7 -0
- package/ui/dist/assets/{index-Dp9zV-L8.css → index-BiEhwV2_.css} +1 -1
- package/ui/dist/favicon.svg +8 -3
- package/ui/dist/fonts/dm-sans-LICENSE.txt +93 -0
- package/ui/dist/fonts/dm-sans-latin-variable.woff2 +0 -0
- package/ui/dist/fonts/manrope-LICENSE.txt +93 -0
- package/ui/dist/fonts/manrope-latin-variable.woff2 +0 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-1Bigipo-.js +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var fn,te,js,lt,ii,Hs,Ls,Ao,Ln,qt,zs,_r,qo,Go,Bs,Yn={},Zn=[],ou=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hn=Array.isArray;function qe(e,t){for(var n in t)e[n]=t[n];return e}function vr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ke(e,t,n){var o,r,i,s={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?fn.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Gt(e,s,o,r,null)}function Gt(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++js,__i:-1,__u:0};return r==null&&te.vnode!=null&&te.vnode(i),i}function Vs(){return{current:null}}function ae(e){return e.children}function Ve(e,t){this.props=e,this.context=t}function vt(e,t){if(t==null)return e.__?vt(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?vt(e):null}function ru(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=qe({},t);i.__v=t.__v+1,te.vnode&&te.vnode(i),wr(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??vt(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Ys(o,i,r),t.__e=t.__=null,i.__e!=n&&Fs(i)}}function Fs(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Fs(e)}function Ko(e){(!e.__d&&(e.__d=!0)&<.push(e)&&!qn.__r++||ii!=te.debounceRendering)&&((ii=te.debounceRendering)||Hs)(qn)}function qn(){try{for(var e,t=1;lt.length;)lt.length>t&<.sort(Ls),e=lt.shift(),t=lt.length,ru(e)}finally{lt.length=qn.__r=0}}function Us(e,t,n,o,r,i,s,c,d,l,f){var h,u,p,y,_,w,m=o&&o.__k||Zn,S=t.length;for(d=iu(n,t,m,d,S),h=0;h<S;h++)(p=n.__k[h])!=null&&(u=p.__i!=-1&&m[p.__i]||Yn,p.__i=h,w=wr(e,p,u,r,i,s,c,d,l,f),y=p.__e,p.ref&&u.ref!=p.ref&&(u.ref&&xr(u.ref,null,p),f.push(p.ref,p.__c||y,p)),_==null&&y!=null&&(_=y),4&p.__u?(d=Ws(p,d,e),u.__e&&(u.__e=null)):typeof p.type=="function"&&w!==void 0?d=w:y&&(d=y.nextSibling),p.__u&=-7);return n.__e=_,d}function iu(e,t,n,o,r){var i,s,c,d,l,f=n.length,h=f,u=0;for(e.__k=new Array(r),i=0;i<r;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=Gt(null,s,null,null,null):hn(s)?s=e.__k[i]=Gt(ae,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=Gt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,d=i+u,s.__=e,s.__b=e.__b+1,c=null,(l=s.__i=su(s,n,d,h))!=-1&&(h--,(c=n[l])&&(c.__u|=2)),c==null||c.__v==null?(l==-1&&(r>f?u--:r<f&&u++),typeof s.type!="function"&&(s.__u|=4)):l!=d&&(l==d-1?u--:l==d+1?u++:(l>d?u--:u++,s.__u|=4))):e.__k[i]=null;if(h)for(i=0;i<f;i++)(c=n[i])!=null&&(2&c.__u)==0&&(c.__e==o&&(o=vt(c)),qs(c,c));return o}function Ws(e,t,n){var o,r;if(typeof e.type=="function"){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=Ws(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=vt(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function nt(e,t){return t=t||[],e==null||typeof e=="boolean"||(hn(e)?e.some(function(n){nt(n,t)}):t.push(e)),t}function su(e,t,n,o){var r,i,s,c=e.key,d=e.type,l=t[n],f=l!=null&&(2&l.__u)==0;if(l===null&&c==null||f&&c==l.key&&d==l.type)return n;if(o>(f?1:0)){for(r=n-1,i=n+1;r>=0||i<t.length;)if((l=t[s=r>=0?r--:i++])!=null&&(2&l.__u)==0&&c==l.key&&d==l.type)return s}return-1}function si(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ou.test(t)?n:n+"px"}function Nn(e,t,n,o,r){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||si(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||si(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(zs,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[qt]=o[qt]:(n[qt]=_r,e.addEventListener(t,i?Go:qo,i)):e.removeEventListener(t,i?Go:qo,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ai(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ln]==null)t[Ln]=_r++;else if(t[Ln]<n[qt])return;return n(te.event?te.event(t):t)}}}function wr(e,t,n,o,r,i,s,c,d,l){var f,h,u,p,y,_,w,m,S,g,x,C,k,E,T,D,L=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),i=[c=t.__e=n.__e]),(f=te.__b)&&f(t);e:if(typeof L=="function"){h=s.length;try{if(S=t.props,g=L.prototype&&L.prototype.render,x=(f=L.contextType)&&o[f.__c],C=f?x?x.props.value:f.__:o,n.__c?m=(u=t.__c=n.__c).__=u.__E:(g?t.__c=u=new L(S,C):(t.__c=u=new Ve(S,C),u.constructor=L,u.render=cu),x&&x.sub(u),u.state||(u.state={}),u.__n=o,p=u.__d=!0,u.__h=[],u._sb=[]),g&&u.__s==null&&(u.__s=u.state),g&&L.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=qe({},u.__s)),qe(u.__s,L.getDerivedStateFromProps(S,u.__s))),y=u.props,_=u.state,u.__v=t,p)g&&L.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),g&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(g&&L.getDerivedStateFromProps==null&&S!==y&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,C),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,C)===!1){t.__v!=n.__v&&(u.props=S,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),Zn.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u),c=vt(n);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,C),g&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(y,_,w)})}if(u.context=C,u.props=S,u.__P=e,u.__e=!1,k=te.__r,E=0,g)u.state=u.__s,u.__d=!1,k&&k(t),f=u.render(u.props,u.state,u.context),Zn.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,k&&k(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++E<25);u.state=u.__s,u.getChildContext!=null&&(o=qe(qe({},o),u.getChildContext())),g&&!p&&u.getSnapshotBeforeUpdate!=null&&(w=u.getSnapshotBeforeUpdate(y,_)),T=f!=null&&f.type===ae&&f.key==null?Zs(f.props.children):f,c=Us(e,hn(T)?T:[T],t,n,o,r,i,s,c,d,l),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),m&&(u.__E=u.__=null)}catch(j){if(s.length=h,t.__v=null,d||i!=null){if(j.then){for(t.__u|=d?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;i!=null&&(i[i.indexOf(c)]=null),t.__e=c}else if(i!=null)for(D=i.length;D--;)vr(i[D])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),j.then||Xs(t),te.__e(j,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=au(n.__e,t,n,o,r,i,s,d,l);return(f=te.diffed)&&f(t),128&t.__u?void 0:c}function Xs(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Xs))}function Ys(e,t,n){for(var o=0;o<n.length;o++)xr(n[o],n[++o],n[++o]);te.__c&&te.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){te.__e(i,r.__v)}})}function Zs(e){return typeof e!="object"||e==null||e.__b>0?e:hn(e)?e.map(Zs):e.constructor!==void 0?null:qe({},e)}function au(e,t,n,o,r,i,s,c,d){var l,f,h,u,p,y,_,w=n.props||Yn,m=t.props,S=t.type;if(S=="svg"?r="http://www.w3.org/2000/svg":S=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(l=0;l<i.length;l++)if((p=i[l])&&"setAttribute"in p==!!S&&(S?p.localName==S:p.nodeType==3)){e=p,i[l]=null;break}}if(e==null){if(S==null)return document.createTextNode(m);e=document.createElementNS(r,S,m.is&&m),c&&(te.__m&&te.__m(t,i),c=!1),i=null}if(S==null)w===m||c&&e.data==m||(e.data=m);else{if(i=S=="textarea"&&m.defaultValue!=null?null:i&&fn.call(e.childNodes),!c&&i!=null)for(w={},l=0;l<e.attributes.length;l++)w[(p=e.attributes[l]).name]=p.value;for(l in w)p=w[l],l=="dangerouslySetInnerHTML"?h=p:l=="children"||l in m||l=="value"&&"defaultValue"in m||l=="checked"&&"defaultChecked"in m||Nn(e,l,null,p,r);for(l in m)p=m[l],l=="children"?u=p:l=="dangerouslySetInnerHTML"?f=p:l=="value"?y=p:l=="checked"?_=p:c&&typeof p!="function"||w[l]===p||Nn(e,l,p,w[l],r);if(f)c||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(h&&(e.innerHTML=""),Us(t.type=="template"?e.content:e,hn(u)?u:[u],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,s,i?i[0]:n.__k&&vt(n,0),c,d),i!=null)for(l=i.length;l--;)vr(i[l]);c&&S!="textarea"||(l="value",S=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[l]||S=="progress"&&!y||S=="option"&&y!=w[l])&&Nn(e,l,y,w[l],r),l="checked",_!=null&&_!=e[l]&&Nn(e,l,_,w[l],r))}return e}function xr(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){te.__e(r,n)}}function qs(e,t,n){var o,r;if(te.unmount&&te.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||xr(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){te.__e(i,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&qs(o[r],t,n||typeof e.type!="function");n||vr(e.__e),e.__c=e.__=e.__e=void 0}function cu(e,t,n){return this.constructor(e,n)}function Pt(e,t,n){var o,r,i,s;t==document&&(t=document.documentElement),te.__&&te.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],wr(t,e=(!o&&n||t).__k=Ke(ae,null,[e]),r||Yn,Yn,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?fn.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,s),Ys(i,e,s),e.props.children=null}function Gs(e,t){Pt(e,t,Gs)}function lu(e,t,n){var o,r,i,s,c=qe({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)i=="key"?o=t[i]:i=="ref"?r=t[i]:c[i]=t[i]===void 0&&s!=null?s[i]:t[i];return arguments.length>2&&(c.children=arguments.length>3?fn.call(arguments,2):n),Gt(e.type,c,o||e.key,r||e.ref,null)}function Bt(e){function t(n){var o,r;return this.getChildContext||(o=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!=i.value&&o.forEach(function(s){s.__e=!0,Ko(s)})},this.sub=function(i){o.add(i);var s=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.delete(i),s&&s.call(i)}}),n.children}return t.__c="__cC"+Bs++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,o){return n.children(o)}).contextType=t,t}fn=Zn.slice,te={__e:function(e,t,n,o){for(var r,i,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(c){e=c}throw e}},js=0,Ve.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=qe({},this.state),typeof e=="function"&&(e=e(qe({},n),this.props)),e&&qe(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ko(this))},Ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ko(this))},Ve.prototype.render=ae,lt=[],Hs=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ls=function(e,t){return e.__v.__b-t.__v.__b},qn.__r=0,Ao=Math.random().toString(8),Ln="__d"+Ao,qt="__a"+Ao,zs=/(PointerCapture)$|Capture$/i,_r=0,qo=ai(!1),Go=ai(!0),Bs=0;var uu=0;function a(e,t,n,o,r,i){t||(t={});var s,c,d=t;if("ref"in d)for(c in d={},t)c=="ref"?s=t[c]:d[c]=t[c];var l={type:e,props:d,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--uu,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)d[c]===void 0&&(d[c]=s[c]);return te.vnode&&te.vnode(l),l}var ot,ue,$o,ci,Tt=0,Ks=[],fe=te,li=fe.__b,ui=fe.__r,di=fe.diffed,fi=fe.__c,hi=fe.unmount,pi=fe.__;function Et(e,t){fe.__h&&fe.__h(ue,e,Tt||t),Tt=0;var n=ue.__H||(ue.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return Tt=1,co(Qs,e)}function co(e,t,n){var o=Et(ot++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Qs(void 0,t),function(c){var d=o.__N?o.__N[0]:o.__[0],l=o.t(d,c);d!==l&&(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=ue,!ue.__f)){var r=function(c,d,l){if(!o.__c.__H)return!0;var f=!1,h=o.__c.props!==c;if(o.__c.__H.__.some(function(p){if(p.__N){f=!0;var y=p.__[0];p.__=p.__N,p.__N=void 0,y!==p.__[0]&&(h=!0)}}),i){var u=i.call(this,c,d,l);return f?u||h:u}return!f||h};ue.__f=!0;var i=ue.shouldComponentUpdate,s=ue.componentWillUpdate;ue.componentWillUpdate=function(c,d,l){if(this.__e){var f=i;i=void 0,r(c,d,l),i=f}s&&s.call(this,c,d,l)},ue.shouldComponentUpdate=r}return o.__N||o.__}function oe(e,t){var n=Et(ot++,3);!fe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ue.__H.__h.push(n))}function it(e,t){var n=Et(ot++,4);!fe.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,ue.__h.push(n))}function ne(e){return Tt=5,_e(function(){return{current:e}},[])}function br(e,t,n){Tt=6,it(function(){if(typeof e=="function"){var o=e(t());return function(){e(null),o&&typeof o=="function"&&o()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function _e(e,t){var n=Et(ot++,7);return Er(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Me(e,t){return Tt=8,_e(function(){return e},t)}function st(e){var t=ue.context[e.__c],n=Et(ot++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(ue)),t.props.value):e.__}function Sr(e,t){fe.useDebugValue&&fe.useDebugValue(t?t(e):e)}function du(e){var t=Et(ot++,10),n=J();return t.__=e,ue.componentDidCatch||(ue.componentDidCatch=function(o,r){t.__&&t.__(o,r),n[1](o)}),[n[0],function(){n[1](void 0)}]}function kr(){var e=Et(ot++,11);if(!e.__){for(var t=ue.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function fu(){for(var e;e=Ks.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(zn),t.__h.some(Qo),t.__h=[]}catch(n){t.__h=[],fe.__e(n,e.__v)}}}fe.__b=function(e){ue=null,li&&li(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),pi&&pi(e,t)},fe.__r=function(e){ui&&ui(e),ot=0;var t=(ue=e.__c).__H;t&&($o===ue?(t.__h=[],ue.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(zn),t.__h.some(Qo),t.__h=[],ot=0)),$o=ue},fe.diffed=function(e){di&&di(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ks.push(t)!==1&&ci===fe.requestAnimationFrame||((ci=fe.requestAnimationFrame)||hu)(fu)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),$o=ue=null},fe.__c=function(e,t){t.some(function(n){try{n.__h.some(zn),n.__h=n.__h.filter(function(o){return!o.__||Qo(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],fe.__e(o,n.__v)}}),fi&&fi(e,t)},fe.unmount=function(e){hi&&hi(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{zn(o)}catch(r){t=r}}),n.__H=void 0,t&&fe.__e(t,n.__v))};var gi=typeof requestAnimationFrame=="function";function hu(e){var t,n=function(){clearTimeout(o),gi&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);gi&&(t=requestAnimationFrame(n))}function zn(e){var t=ue,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ue=t}function Qo(e){var t=ue;e.__c=e.__(),ue=t}function Er(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Qs(e,t){return typeof t=="function"?t(e):t}function Js(e,t){for(var n in t)e[n]=t[n];return e}function Jo(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Cr(e,t){var n=t(),o=J({t:{__:n,u:t}}),r=o[0].t,i=o[1];return it(function(){r.__=n,r.u=t,Po(r)&&i({t:r})},[e,n,t]),oe(function(){return Po(r)&&i({t:r}),e(function(){Po(r)&&i({t:r})})},[e]),n}function Po(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function Nr(e){e()}function Ir(e){return e}function Mr(){return[!1,Nr]}var Ar=it;function Gn(e,t){this.props=e,this.context=t}function pe(e,t){function n(r){var i=this.props.ref;return i!=r.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,r)||i!=r.ref:Jo(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Ke(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Gn.prototype=new Ve).isPureReactComponent=!0,Gn.prototype.shouldComponentUpdate=function(e,t){return Jo(this.props,e)||Jo(this.state,t)};var mi=te.__b;te.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),mi&&mi(e)};var pu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function lo(e){function t(n){var o=Js({},n);return delete o.ref,e(o,n.ref||null)}return t.$$typeof=pu,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var yi=function(e,t){return e==null?null:nt(nt(e).map(t))},ea={map:yi,forEach:yi,count:function(e){return e?nt(e).length:0},only:function(e){var t=nt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:nt},gu=te.__e;te.__e=function(e,t,n,o){if(e.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}gu(e,t,n,o)};var _i=te.unmount;function ta(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=Js({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return ta(o,t,n)})),e}function na(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return na(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Kt(){this.__u=0,this.o=null,this.__b=null}function oa(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function ra(e){var t,n,o,r=null;function i(s){if(t||(t=e()).then(function(c){c&&(r=c.default||c),o=!0},function(c){n=c,o=!0}),n)throw n;if(!o)throw t;return r?Ke(r,s):null}return i.displayName="Lazy",i.__f=!0,i}function Nt(){this.i=null,this.l=null}te.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),_i&&_i(e)},(Kt.prototype=new Ve).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=oa(o.__v),i=!1,s=function(){i||o.__z||(i=!0,n.__R=null,r?r(d):d())};n.__R=s;var c=n.__P;n.__P=null;var d=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=na(l,l.__c.__P,l.__c.__O)}var f;for(o.setState({__a:o.__b=null});f=o.o.pop();)f.__P=c,f.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},Kt.prototype.componentWillUnmount=function(){this.o=[]},Kt.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=ta(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Ke(ae,null,e.fallback);return r&&(r.__u&=-33),[Ke(ae,null,t.__a?null:e.children),r]};var vi=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function mu(e){return this.getChildContext=function(){return e.context},e.children}function yu(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Pt(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;o!==null&&!o.__m&&o.__!==null;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(r,i){this.childNodes.push(r),t.h.insertBefore(r,i)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.h.removeChild(r)}}}Pt(Ke(mu,{context:t.context},e.__v),t.v)}function ia(e,t){var n=Ke(yu,{__v:e,h:t});return n.containerInfo=t,n}(Nt.prototype=new Ve).__a=function(e){var t=this,n=oa(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),vi(t,e,o)):r()};n?n(i):i()}},Nt.prototype.render=function(e){this.i=null,this.l=new Map;var t=nt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Nt.prototype.componentDidUpdate=Nt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){vi(e,n,t)})};var sa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,_u=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vu=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wu=/[A-Z0-9]/g,xu=typeof document<"u",bu=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function aa(e,t,n){return t.__k==null&&(t.textContent=""),Pt(e,t),typeof n=="function"&&n(),e?e.__c:null}function ca(e,t,n){return Gs(e,t),typeof n=="function"&&n(),e?e.__c:null}Ve.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ve.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var wi=te.event;te.event=function(e){return wi&&(e=wi(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var $r,Su={configurable:!0,get:function(){return this.class}},xi=te.vnode;te.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},i=o.indexOf("-")==-1;for(var s in n){var c=n[s];if(!(s==="value"&&"defaultValue"in n&&c==null||xu&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var d=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&c===!0?c="":d==="translate"&&c==="no"?c=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?s="ondblclick":d!=="onchange"||o!=="input"&&o!=="textarea"||bu(n.type)?d==="onfocus"?s="onfocusin":d==="onblur"?s="onfocusout":vu.test(s)&&(s=d):d=s="oninput":i&&_u.test(s)?s=s.replace(wu,"-$&").toLowerCase():c===null&&(c=void 0),d==="oninput"&&r[s=d]&&(s="oninputCapture"),r[s]=c}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=nt(n.children).forEach(function(l){l.props.selected=r.value.indexOf(l.props.value)!=-1})),r.defaultValue!=null&&(r.value=nt(n.children).forEach(function(l){l.props.selected=r.multiple?r.defaultValue.indexOf(l.props.value)!=-1:r.defaultValue==l.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",Su)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=sa,xi&&xi(e)};var bi=te.__r;te.__r=function(e){bi&&bi(e),$r=e.__c};var Si=te.diffed;te.diffed=function(e){Si&&Si(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),$r=null};var la={ReactCurrentDispatcher:{current:{readContext:function(e){return $r.__n[e.__c].props.value},useCallback:Me,useContext:st,useDebugValue:Sr,useDeferredValue:Ir,useEffect:oe,useId:kr,useImperativeHandle:br,useInsertionEffect:Ar,useLayoutEffect:it,useMemo:_e,useReducer:co,useRef:ne,useState:J,useSyncExternalStore:Cr,useTransition:Mr}}},ku="18.3.1";function ua(e){return Ke.bind(null,e)}function pn(e){return!!e&&e.$$typeof===sa}function da(e){return pn(e)&&e.type===ae}function fa(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function ha(e){return pn(e)?lu.apply(null,arguments):e}function pa(e){return!!e.__k&&(Pt(null,e),!0)}function ga(e){return e&&(e.base||e.nodeType===1&&e)||null}var ma=function(e,t){return e(t)},ya=function(e,t){var n,o=te.debounceRendering;te.debounceRendering=function(i){n=i};try{var r=e(t);return n&&n(),r}finally{te.debounceRendering=o}},_a=pn,va={useState:J,useId:kr,useReducer:co,useEffect:oe,useLayoutEffect:it,useInsertionEffect:Ar,useTransition:Mr,useDeferredValue:Ir,useSyncExternalStore:Cr,startTransition:Nr,useRef:ne,useImperativeHandle:br,useMemo:_e,useCallback:Me,useContext:st,useDebugValue:Sr,version:"18.3.1",Children:ea,render:aa,hydrate:ca,unmountComponentAtNode:pa,createPortal:ia,createElement:Ke,createContext:Bt,createFactory:ua,cloneElement:ha,createRef:Vs,Fragment:ae,isValidElement:pn,isElement:_a,isFragment:da,isMemo:fa,findDOMNode:ga,Component:Ve,PureComponent:Gn,memo:pe,forwardRef:lo,flushSync:ya,unstable_batchedUpdates:ma,StrictMode:ae,Suspense:Kt,SuspenseList:Nt,lazy:ra,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:la};const Eu=Object.freeze(Object.defineProperty({__proto__:null,Children:ea,Component:Ve,Fragment:ae,PureComponent:Gn,StrictMode:ae,Suspense:Kt,SuspenseList:Nt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:la,cloneElement:ha,createContext:Bt,createElement:Ke,createFactory:ua,createPortal:ia,createRef:Vs,default:va,findDOMNode:ga,flushSync:ya,forwardRef:lo,hydrate:ca,isElement:_a,isFragment:da,isMemo:fa,isValidElement:pn,lazy:ra,memo:pe,render:aa,startTransition:Nr,unmountComponentAtNode:pa,unstable_batchedUpdates:ma,useCallback:Me,useContext:st,useDebugValue:Sr,useDeferredValue:Ir,useEffect:oe,useErrorBoundary:du,useId:kr,useImperativeHandle:br,useInsertionEffect:Ar,useLayoutEffect:it,useMemo:_e,useReducer:co,useRef:ne,useState:J,useSyncExternalStore:Cr,useTransition:Mr,version:ku},Symbol.toStringTag,{value:"Module"}));function ge(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ge(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Cu={value:()=>{}};function uo(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Bn(n)}function Bn(e){this._=e}function Nu(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Bn.prototype=uo.prototype={constructor:Bn,on:function(e,t){var n=this._,o=Nu(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Iu(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=ki(n[r],e.name,t);else if(t==null)for(r in n)n[r]=ki(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function Iu(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function ki(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Cu,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var er="http://www.w3.org/1999/xhtml";const Ei={svg:"http://www.w3.org/2000/svg",xhtml:er,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fo(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ei.hasOwnProperty(t)?{space:Ei[t],local:e}:e}function Mu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===er&&t.documentElement.namespaceURI===er?t.createElement(e):t.createElementNS(n,e)}}function Au(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wa(e){var t=fo(e);return(t.local?Au:Mu)(t)}function $u(){}function Pr(e){return e==null?$u:function(){return this.querySelector(e)}}function Pu(e){typeof e!="function"&&(e=Pr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=new Array(s),d,l,f=0;f<s;++f)(d=i[f])&&(l=e.call(d,d.__data__,f,i))&&("__data__"in d&&(l.__data__=d.__data__),c[f]=l);return new Ae(o,this._parents)}function Tu(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Du(){return[]}function xa(e){return e==null?Du:function(){return this.querySelectorAll(e)}}function Ru(e){return function(){return Tu(e.apply(this,arguments))}}function Ou(e){typeof e=="function"?e=Ru(e):e=xa(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],c=s.length,d,l=0;l<c;++l)(d=s[l])&&(o.push(e.call(d,d.__data__,l,s)),r.push(d));return new Ae(o,r)}function ba(e){return function(){return this.matches(e)}}function Sa(e){return function(t){return t.matches(e)}}var ju=Array.prototype.find;function Hu(e){return function(){return ju.call(this.children,e)}}function Lu(){return this.firstElementChild}function zu(e){return this.select(e==null?Lu:Hu(typeof e=="function"?e:Sa(e)))}var Bu=Array.prototype.filter;function Vu(){return Array.from(this.children)}function Fu(e){return function(){return Bu.call(this.children,e)}}function Uu(e){return this.selectAll(e==null?Vu:Fu(typeof e=="function"?e:Sa(e)))}function Wu(e){typeof e!="function"&&(e=ba(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],d,l=0;l<s;++l)(d=i[l])&&e.call(d,d.__data__,l,i)&&c.push(d);return new Ae(o,this._parents)}function ka(e){return new Array(e.length)}function Xu(){return new Ae(this._enter||this._groups.map(ka),this._parents)}function Kn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Kn.prototype={constructor:Kn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Yu(e){return function(){return e}}function Zu(e,t,n,o,r,i){for(var s=0,c,d=t.length,l=i.length;s<l;++s)(c=t[s])?(c.__data__=i[s],o[s]=c):n[s]=new Kn(e,i[s]);for(;s<d;++s)(c=t[s])&&(r[s]=c)}function qu(e,t,n,o,r,i,s){var c,d,l=new Map,f=t.length,h=i.length,u=new Array(f),p;for(c=0;c<f;++c)(d=t[c])&&(u[c]=p=s.call(d,d.__data__,c,t)+"",l.has(p)?r[c]=d:l.set(p,d));for(c=0;c<h;++c)p=s.call(e,i[c],c,i)+"",(d=l.get(p))?(o[c]=d,d.__data__=i[c],l.delete(p)):n[c]=new Kn(e,i[c]);for(c=0;c<f;++c)(d=t[c])&&l.get(u[c])===d&&(r[c]=d)}function Gu(e){return e.__data__}function Ku(e,t){if(!arguments.length)return Array.from(this,Gu);var n=t?qu:Zu,o=this._parents,r=this._groups;typeof e!="function"&&(e=Yu(e));for(var i=r.length,s=new Array(i),c=new Array(i),d=new Array(i),l=0;l<i;++l){var f=o[l],h=r[l],u=h.length,p=Qu(e.call(f,f&&f.__data__,l,o)),y=p.length,_=c[l]=new Array(y),w=s[l]=new Array(y),m=d[l]=new Array(u);n(f,h,_,w,m,p,t);for(var S=0,g=0,x,C;S<y;++S)if(x=_[S]){for(S>=g&&(g=S+1);!(C=w[g])&&++g<y;);x._next=C||null}}return s=new Ae(s,o),s._enter=c,s._exit=d,s}function Qu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ju(){return new Ae(this._exit||this._groups.map(ka),this._parents)}function ed(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function td(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),c=new Array(r),d=0;d<s;++d)for(var l=n[d],f=o[d],h=l.length,u=c[d]=new Array(h),p,y=0;y<h;++y)(p=l[y]||f[y])&&(u[y]=p);for(;d<r;++d)c[d]=n[d];return new Ae(c,this._parents)}function nd(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function od(e){e||(e=rd);function t(h,u){return h&&u?e(h.__data__,u.__data__):!h-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],c=s.length,d=r[i]=new Array(c),l,f=0;f<c;++f)(l=s[f])&&(d[f]=l);d.sort(t)}return new Ae(r,this._parents).order()}function rd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function id(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function sd(){return Array.from(this)}function ad(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function cd(){let e=0;for(const t of this)++e;return e}function ld(){return!this.node()}function ud(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,c;i<s;++i)(c=r[i])&&e.call(c,c.__data__,i,r);return this}function dd(e){return function(){this.removeAttribute(e)}}function fd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hd(e,t){return function(){this.setAttribute(e,t)}}function pd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function gd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function md(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function yd(e,t){var n=fo(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?fd:dd:typeof t=="function"?n.local?md:gd:n.local?pd:hd)(n,t))}function Ea(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function _d(e){return function(){this.style.removeProperty(e)}}function vd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function wd(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function xd(e,t,n){return arguments.length>1?this.each((t==null?_d:typeof t=="function"?wd:vd)(e,t,n??"")):Dt(this.node(),e)}function Dt(e,t){return e.style.getPropertyValue(t)||Ea(e).getComputedStyle(e,null).getPropertyValue(t)}function bd(e){return function(){delete this[e]}}function Sd(e,t){return function(){this[e]=t}}function kd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ed(e,t){return arguments.length>1?this.each((t==null?bd:typeof t=="function"?kd:Sd)(e,t)):this.node()[e]}function Ca(e){return e.trim().split(/^|\s+/)}function Tr(e){return e.classList||new Na(e)}function Na(e){this._node=e,this._names=Ca(e.getAttribute("class")||"")}Na.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ia(e,t){for(var n=Tr(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ma(e,t){for(var n=Tr(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Cd(e){return function(){Ia(this,e)}}function Nd(e){return function(){Ma(this,e)}}function Id(e,t){return function(){(t.apply(this,arguments)?Ia:Ma)(this,e)}}function Md(e,t){var n=Ca(e+"");if(arguments.length<2){for(var o=Tr(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Id:t?Cd:Nd)(n,t))}function Ad(){this.textContent=""}function $d(e){return function(){this.textContent=e}}function Pd(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Td(e){return arguments.length?this.each(e==null?Ad:(typeof e=="function"?Pd:$d)(e)):this.node().textContent}function Dd(){this.innerHTML=""}function Rd(e){return function(){this.innerHTML=e}}function Od(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function jd(e){return arguments.length?this.each(e==null?Dd:(typeof e=="function"?Od:Rd)(e)):this.node().innerHTML}function Hd(){this.nextSibling&&this.parentNode.appendChild(this)}function Ld(){return this.each(Hd)}function zd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bd(){return this.each(zd)}function Vd(e){var t=typeof e=="function"?e:wa(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Fd(){return null}function Ud(e,t){var n=typeof e=="function"?e:wa(e),o=t==null?Fd:typeof t=="function"?t:Pr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Wd(){var e=this.parentNode;e&&e.removeChild(this)}function Xd(){return this.each(Wd)}function Yd(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Zd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qd(e){return this.select(e?Zd:Yd)}function Gd(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Kd(e){return function(t){e.call(this,t,this.__data__)}}function Qd(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Jd(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function ef(e,t,n){return function(){var o=this.__on,r,i=Kd(t);if(o){for(var s=0,c=o.length;s<c;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function tf(e,t,n){var o=Qd(e+""),r,i=o.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var d=0,l=c.length,f;d<l;++d)for(r=0,f=c[d];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(c=t?ef:Jd,r=0;r<i;++r)this.each(c(o[r],t,n));return this}function Aa(e,t,n){var o=Ea(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function nf(e,t){return function(){return Aa(this,e,t)}}function of(e,t){return function(){return Aa(this,e,t.apply(this,arguments))}}function rf(e,t){return this.each((typeof t=="function"?of:nf)(e,t))}function*sf(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var $a=[null];function Ae(e,t){this._groups=e,this._parents=t}function gn(){return new Ae([[document.documentElement]],$a)}function af(){return this}Ae.prototype=gn.prototype={constructor:Ae,select:Pu,selectAll:Ou,selectChild:zu,selectChildren:Uu,filter:Wu,data:Ku,enter:Xu,exit:Ju,join:ed,merge:td,selection:af,order:nd,sort:od,call:id,nodes:sd,node:ad,size:cd,empty:ld,each:ud,attr:yd,style:xd,property:Ed,classed:Md,text:Td,html:jd,raise:Ld,lower:Bd,append:Vd,insert:Ud,remove:Xd,clone:qd,datum:Gd,on:tf,dispatch:rf,[Symbol.iterator]:sf};function Ie(e){return typeof e=="string"?new Ae([[document.querySelector(e)]],[document.documentElement]):new Ae([[e]],$a)}function cf(e){let t;for(;t=e.sourceEvent;)e=t;return e}function He(e,t){if(e=cf(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const lf={passive:!1},nn={capture:!0,passive:!1};function To(e){e.stopImmediatePropagation()}function At(e){e.preventDefault(),e.stopImmediatePropagation()}function Pa(e){var t=e.document.documentElement,n=Ie(e).on("dragstart.drag",At,nn);"onselectstart"in t?n.on("selectstart.drag",At,nn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ta(e,t){var n=e.document.documentElement,o=Ie(e).on("dragstart.drag",null);t&&(o.on("click.drag",At,nn),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 In=e=>()=>e;function tr(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:d,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}tr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function uf(e){return!e.ctrlKey&&!e.button}function df(){return this.parentNode}function ff(e,t){return t??{x:e.x,y:e.y}}function hf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Da(){var e=uf,t=df,n=ff,o=hf,r={},i=uo("start","drag","end"),s=0,c,d,l,f,h=0;function u(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",w).on("touchmove.drag",m,lf).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,C){if(!(f||!e.call(this,x,C))){var k=g(this,t.call(this,x,C),x,C,"mouse");k&&(Ie(x.view).on("mousemove.drag",y,nn).on("mouseup.drag",_,nn),Pa(x.view),To(x),l=!1,c=x.clientX,d=x.clientY,k("start",x))}}function y(x){if(At(x),!l){var C=x.clientX-c,k=x.clientY-d;l=C*C+k*k>h}r.mouse("drag",x)}function _(x){Ie(x.view).on("mousemove.drag mouseup.drag",null),Ta(x.view,l),At(x),r.mouse("end",x)}function w(x,C){if(e.call(this,x,C)){var k=x.changedTouches,E=t.call(this,x,C),T=k.length,D,L;for(D=0;D<T;++D)(L=g(this,E,x,C,k[D].identifier,k[D]))&&(To(x),L("start",x,k[D]))}}function m(x){var C=x.changedTouches,k=C.length,E,T;for(E=0;E<k;++E)(T=r[C[E].identifier])&&(At(x),T("drag",x,C[E]))}function S(x){var C=x.changedTouches,k=C.length,E,T;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),E=0;E<k;++E)(T=r[C[E].identifier])&&(To(x),T("end",x,C[E]))}function g(x,C,k,E,T,D){var L=i.copy(),j=He(D||k,C),B,N,b;if((b=n.call(x,new tr("beforestart",{sourceEvent:k,target:u,identifier:T,active:s,x:j[0],y:j[1],dx:0,dy:0,dispatch:L}),E))!=null)return B=b.x-j[0]||0,N=b.y-j[1]||0,function I(A,P,$){var M=j,O;switch(A){case"start":r[T]=I,O=s++;break;case"end":delete r[T],--s;case"drag":j=He($||P,C),O=s;break}L.call(A,x,new tr(A,{sourceEvent:P,subject:b,target:u,identifier:T,active:O,x:j[0]+B,y:j[1]+N,dx:j[0]-M[0],dy:j[1]-M[1],dispatch:L}),E)}}return u.filter=function(x){return arguments.length?(e=typeof x=="function"?x:In(!!x),u):e},u.container=function(x){return arguments.length?(t=typeof x=="function"?x:In(x),u):t},u.subject=function(x){return arguments.length?(n=typeof x=="function"?x:In(x),u):n},u.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:In(!!x),u):o},u.on=function(){var x=i.on.apply(i,arguments);return x===i?u:x},u.clickDistance=function(x){return arguments.length?(h=(x=+x)*x,u):Math.sqrt(h)},u}function Dr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ra(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function mn(){}var on=.7,Qn=1/on,$t="\\s*([+-]?\\d+)\\s*",rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",pf=/^#([0-9a-f]{3,8})$/,gf=new RegExp(`^rgb\\(${$t},${$t},${$t}\\)$`),mf=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),yf=new RegExp(`^rgba\\(${$t},${$t},${$t},${rn}\\)$`),_f=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${rn}\\)$`),vf=new RegExp(`^hsl\\(${rn},${Ge},${Ge}\\)$`),wf=new RegExp(`^hsla\\(${rn},${Ge},${Ge},${rn}\\)$`),Ci={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Dr(mn,wt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ni,formatHex:Ni,formatHex8:xf,formatHsl:bf,formatRgb:Ii,toString:Ii});function Ni(){return this.rgb().formatHex()}function xf(){return this.rgb().formatHex8()}function bf(){return Oa(this).formatHsl()}function Ii(){return this.rgb().formatRgb()}function wt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=pf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Mi(t):n===3?new ke(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=gf.exec(e))?new ke(t[1],t[2],t[3],1):(t=mf.exec(e))?new ke(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yf.exec(e))?Mn(t[1],t[2],t[3],t[4]):(t=_f.exec(e))?Mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=vf.exec(e))?Pi(t[1],t[2]/100,t[3]/100,1):(t=wf.exec(e))?Pi(t[1],t[2]/100,t[3]/100,t[4]):Ci.hasOwnProperty(e)?Mi(Ci[e]):e==="transparent"?new ke(NaN,NaN,NaN,0):null}function Mi(e){return new ke(e>>16&255,e>>8&255,e&255,1)}function Mn(e,t,n,o){return o<=0&&(e=t=n=NaN),new ke(e,t,n,o)}function Sf(e){return e instanceof mn||(e=wt(e)),e?(e=e.rgb(),new ke(e.r,e.g,e.b,e.opacity)):new ke}function nr(e,t,n,o){return arguments.length===1?Sf(e):new ke(e,t,n,o??1)}function ke(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Dr(ke,nr,Ra(mn,{brighter(e){return e=e==null?Qn:Math.pow(Qn,e),new ke(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?on:Math.pow(on,e),new ke(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ke(yt(this.r),yt(this.g),yt(this.b),Jn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ai,formatHex:Ai,formatHex8:kf,formatRgb:$i,toString:$i}));function Ai(){return`#${mt(this.r)}${mt(this.g)}${mt(this.b)}`}function kf(){return`#${mt(this.r)}${mt(this.g)}${mt(this.b)}${mt((isNaN(this.opacity)?1:this.opacity)*255)}`}function $i(){const e=Jn(this.opacity);return`${e===1?"rgb(":"rgba("}${yt(this.r)}, ${yt(this.g)}, ${yt(this.b)}${e===1?")":`, ${e})`}`}function Jn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function yt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mt(e){return e=yt(e),(e<16?"0":"")+e.toString(16)}function Pi(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Le(e,t,n,o)}function Oa(e){if(e instanceof Le)return new Le(e.h,e.s,e.l,e.opacity);if(e instanceof mn||(e=wt(e)),!e)return new Le;if(e instanceof Le)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,c=i-r,d=(i+r)/2;return c?(t===i?s=(n-o)/c+(n<o)*6:n===i?s=(o-t)/c+2:s=(t-n)/c+4,c/=d<.5?i+r:2-i-r,s*=60):c=d>0&&d<1?0:s,new Le(s,c,d,e.opacity)}function Ef(e,t,n,o){return arguments.length===1?Oa(e):new Le(e,t,n,o??1)}function Le(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Dr(Le,Ef,Ra(mn,{brighter(e){return e=e==null?Qn:Math.pow(Qn,e),new Le(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?on:Math.pow(on,e),new Le(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ke(Do(e>=240?e-240:e+120,r,o),Do(e,r,o),Do(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Le(Ti(this.h),An(this.s),An(this.l),Jn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Jn(this.opacity);return`${e===1?"hsl(":"hsla("}${Ti(this.h)}, ${An(this.s)*100}%, ${An(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ti(e){return e=(e||0)%360,e<0?e+360:e}function An(e){return Math.max(0,Math.min(1,e||0))}function Do(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Rr=e=>()=>e;function Cf(e,t){return function(n){return e+n*t}}function Nf(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function If(e){return(e=+e)==1?ja:function(t,n){return n-t?Nf(t,n,e):Rr(isNaN(t)?n:t)}}function ja(e,t){var n=t-e;return n?Cf(e,n):Rr(isNaN(e)?t:e)}const eo=(function e(t){var n=If(t);function o(r,i){var s=n((r=nr(r)).r,(i=nr(i)).r),c=n(r.g,i.g),d=n(r.b,i.b),l=ja(r.opacity,i.opacity);return function(f){return r.r=s(f),r.g=c(f),r.b=d(f),r.opacity=l(f),r+""}}return o.gamma=e,o})(1);function Mf(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function Af(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $f(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=Qt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(c){for(s=0;s<o;++s)i[s]=r[s](c);return i}}function Pf(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Xe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Tf(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=Qt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var or=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ro=new RegExp(or.source,"g");function Df(e){return function(){return e}}function Rf(e){return function(t){return e(t)+""}}function Ha(e,t){var n=or.lastIndex=Ro.lastIndex=0,o,r,i,s=-1,c=[],d=[];for(e=e+"",t=t+"";(o=or.exec(e))&&(r=Ro.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),c[s]?c[s]+=i:c[++s]=i),(o=o[0])===(r=r[0])?c[s]?c[s]+=r:c[++s]=r:(c[++s]=null,d.push({i:s,x:Xe(o,r)})),n=Ro.lastIndex;return n<t.length&&(i=t.slice(n),c[s]?c[s]+=i:c[++s]=i),c.length<2?d[0]?Rf(d[0].x):Df(t):(t=d.length,function(l){for(var f=0,h;f<t;++f)c[(h=d[f]).i]=h.x(l);return c.join("")})}function Qt(e,t){var n=typeof t,o;return t==null||n==="boolean"?Rr(t):(n==="number"?Xe:n==="string"?(o=wt(t))?(t=o,eo):Ha:t instanceof wt?eo:t instanceof Date?Pf:Af(t)?Mf:Array.isArray(t)?$f:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Tf:Xe)(e,t)}var Di=180/Math.PI,rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function La(e,t,n,o,r,i){var s,c,d;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(d=e*n+t*o)&&(n-=e*d,o-=t*d),(c=Math.sqrt(n*n+o*o))&&(n/=c,o/=c,d/=c),e*o<t*n&&(e=-e,t=-t,d=-d,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Di,skewX:Math.atan(d)*Di,scaleX:s,scaleY:c}}var $n;function Of(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?rr:La(t.a,t.b,t.c,t.d,t.e,t.f)}function jf(e){return e==null||($n||($n=document.createElementNS("http://www.w3.org/2000/svg","g")),$n.setAttribute("transform",e),!(e=$n.transform.baseVal.consolidate()))?rr:(e=e.matrix,La(e.a,e.b,e.c,e.d,e.e,e.f))}function za(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,h,u,p,y){if(l!==h||f!==u){var _=p.push("translate(",null,t,null,n);y.push({i:_-4,x:Xe(l,h)},{i:_-2,x:Xe(f,u)})}else(h||u)&&p.push("translate("+h+t+u+n)}function s(l,f,h,u){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),u.push({i:h.push(r(h)+"rotate(",null,o)-2,x:Xe(l,f)})):f&&h.push(r(h)+"rotate("+f+o)}function c(l,f,h,u){l!==f?u.push({i:h.push(r(h)+"skewX(",null,o)-2,x:Xe(l,f)}):f&&h.push(r(h)+"skewX("+f+o)}function d(l,f,h,u,p,y){if(l!==h||f!==u){var _=p.push(r(p)+"scale(",null,",",null,")");y.push({i:_-4,x:Xe(l,h)},{i:_-2,x:Xe(f,u)})}else(h!==1||u!==1)&&p.push(r(p)+"scale("+h+","+u+")")}return function(l,f){var h=[],u=[];return l=e(l),f=e(f),i(l.translateX,l.translateY,f.translateX,f.translateY,h,u),s(l.rotate,f.rotate,h,u),c(l.skewX,f.skewX,h,u),d(l.scaleX,l.scaleY,f.scaleX,f.scaleY,h,u),l=f=null,function(p){for(var y=-1,_=u.length,w;++y<_;)h[(w=u[y]).i]=w.x(p);return h.join("")}}}var Hf=za(Of,"px, ","px)","deg)"),Lf=za(jf,", ",")",")"),zf=1e-12;function Ri(e){return((e=Math.exp(e))+1/e)/2}function Bf(e){return((e=Math.exp(e))-1/e)/2}function Vf(e){return((e=Math.exp(2*e))-1)/(e+1)}const Vn=(function e(t,n,o){function r(i,s){var c=i[0],d=i[1],l=i[2],f=s[0],h=s[1],u=s[2],p=f-c,y=h-d,_=p*p+y*y,w,m;if(_<zf)m=Math.log(u/l)/t,w=function(E){return[c+E*p,d+E*y,l*Math.exp(t*E*m)]};else{var S=Math.sqrt(_),g=(u*u-l*l+o*_)/(2*l*n*S),x=(u*u-l*l-o*_)/(2*u*n*S),C=Math.log(Math.sqrt(g*g+1)-g),k=Math.log(Math.sqrt(x*x+1)-x);m=(k-C)/t,w=function(E){var T=E*m,D=Ri(C),L=l/(n*S)*(D*Vf(t*T+C)-Bf(C));return[c+L*p,d+L*y,l*D/Ri(t*T+C)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),c=s*s,d=c*c;return e(s,c,d)},r})(Math.SQRT2,2,4);var Rt=0,Yt=0,Ut=0,Ba=1e3,to,Zt,no=0,xt=0,ho=0,sn=typeof performance=="object"&&performance.now?performance:Date,Va=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Or(){return xt||(Va(Ff),xt=sn.now()+ho)}function Ff(){xt=0}function oo(){this._call=this._time=this._next=null}oo.prototype=Fa.prototype={constructor:oo,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Or():+n)+(t==null?0:+t),!this._next&&Zt!==this&&(Zt?Zt._next=this:to=this,Zt=this),this._call=e,this._time=n,ir()},stop:function(){this._call&&(this._call=null,this._time=1/0,ir())}};function Fa(e,t,n){var o=new oo;return o.restart(e,t,n),o}function Uf(){Or(),++Rt;for(var e=to,t;e;)(t=xt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rt}function Oi(){xt=(no=sn.now())+ho,Rt=Yt=0;try{Uf()}finally{Rt=0,Xf(),xt=0}}function Wf(){var e=sn.now(),t=e-no;t>Ba&&(ho-=t,no=e)}function Xf(){for(var e,t=to,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:to=n);Zt=e,ir(o)}function ir(e){if(!Rt){Yt&&(Yt=clearTimeout(Yt));var t=e-xt;t>24?(e<1/0&&(Yt=setTimeout(Oi,e-sn.now()-ho)),Ut&&(Ut=clearInterval(Ut))):(Ut||(no=sn.now(),Ut=setInterval(Wf,Ba)),Rt=1,Va(Oi))}}function ji(e,t,n){var o=new oo;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Yf=uo("start","end","cancel","interrupt"),Zf=[],Ua=0,Hi=1,sr=2,Fn=3,Li=4,ar=5,Un=6;function po(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;qf(e,n,{name:t,index:o,group:r,on:Yf,tween:Zf,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ua})}function jr(e,t){var n=Ue(e,t);if(n.state>Ua)throw new Error("too late; already scheduled");return n}function Qe(e,t){var n=Ue(e,t);if(n.state>Fn)throw new Error("too late; already running");return n}function Ue(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qf(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Fa(i,0,n.time);function i(l){n.state=Hi,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,h,u,p;if(n.state!==Hi)return d();for(f in o)if(p=o[f],p.name===n.name){if(p.state===Fn)return ji(s);p.state===Li?(p.state=Un,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[f]):+f<t&&(p.state=Un,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[f])}if(ji(function(){n.state===Fn&&(n.state=Li,n.timer.restart(c,n.delay,n.time),c(l))}),n.state=sr,n.on.call("start",e,e.__data__,n.index,n.group),n.state===sr){for(n.state=Fn,r=new Array(u=n.tween.length),f=0,h=-1;f<u;++f)(p=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(r[++h]=p);r.length=h+1}}function c(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(d),n.state=ar,1),h=-1,u=r.length;++h<u;)r[h].call(e,f);n.state===ar&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Un,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Wn(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>sr&&o.state<ar,o.state=Un,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Gf(e){return this.each(function(){Wn(this,e)})}function Kf(e,t){var n,o;return function(){var r=Qe(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,c=o.length;s<c;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Qf(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Qe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var c={name:t,value:n},d=0,l=r.length;d<l;++d)if(r[d].name===t){r[d]=c;break}d===l&&r.push(c)}i.tween=r}}function Jf(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Ue(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Kf:Qf)(n,e,t))}function Hr(e,t,n){var o=e._id;return e.each(function(){var r=Qe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return Ue(r,o).value[t]}}function Wa(e,t){var n;return(typeof t=="number"?Xe:t instanceof wt?eo:(n=wt(t))?(t=n,eo):Ha)(e,t)}function eh(e){return function(){this.removeAttribute(e)}}function th(e){return function(){this.removeAttributeNS(e.space,e.local)}}function nh(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function oh(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function rh(e,t,n){var o,r,i;return function(){var s,c=n(this),d;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),d=c+"",s===d?null:s===o&&d===r?i:(r=d,i=t(o=s,c)))}}function ih(e,t,n){var o,r,i;return function(){var s,c=n(this),d;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),d=c+"",s===d?null:s===o&&d===r?i:(r=d,i=t(o=s,c)))}}function sh(e,t){var n=fo(e),o=n==="transform"?Lf:Wa;return this.attrTween(e,typeof t=="function"?(n.local?ih:rh)(n,o,Hr(this,"attr."+e,t)):t==null?(n.local?th:eh)(n):(n.local?oh:nh)(n,o,t))}function ah(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ch(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function lh(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ch(e,i)),n}return r._value=t,r}function uh(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ah(e,i)),n}return r._value=t,r}function dh(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=fo(e);return this.tween(n,(o.local?lh:uh)(o,t))}function fh(e,t){return function(){jr(this,e).delay=+t.apply(this,arguments)}}function hh(e,t){return t=+t,function(){jr(this,e).delay=t}}function ph(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fh:hh)(t,e)):Ue(this.node(),t).delay}function gh(e,t){return function(){Qe(this,e).duration=+t.apply(this,arguments)}}function mh(e,t){return t=+t,function(){Qe(this,e).duration=t}}function yh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gh:mh)(t,e)):Ue(this.node(),t).duration}function _h(e,t){if(typeof t!="function")throw new Error;return function(){Qe(this,e).ease=t}}function vh(e){var t=this._id;return arguments.length?this.each(_h(t,e)):Ue(this.node(),t).ease}function wh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Qe(this,e).ease=n}}function xh(e){if(typeof e!="function")throw new Error;return this.each(wh(this._id,e))}function bh(e){typeof e!="function"&&(e=ba(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,c=o[r]=[],d,l=0;l<s;++l)(d=i[l])&&e.call(d,d.__data__,l,i)&&c.push(d);return new rt(o,this._parents,this._name,this._id)}function Sh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),c=0;c<i;++c)for(var d=t[c],l=n[c],f=d.length,h=s[c]=new Array(f),u,p=0;p<f;++p)(u=d[p]||l[p])&&(h[p]=u);for(;c<o;++c)s[c]=t[c];return new rt(s,this._parents,this._name,this._id)}function kh(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Eh(e,t,n){var o,r,i=kh(t)?jr:Qe;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Ch(e,t){var n=this._id;return arguments.length<2?Ue(this.node(),n).on.on(e):this.each(Eh(n,e,t))}function Nh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ih(){return this.on("end.remove",Nh(this._id))}function Mh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Pr(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var c=o[s],d=c.length,l=i[s]=new Array(d),f,h,u=0;u<d;++u)(f=c[u])&&(h=e.call(f,f.__data__,u,c))&&("__data__"in f&&(h.__data__=f.__data__),l[u]=h,po(l[u],t,n,u,l,Ue(f,n)));return new rt(i,this._parents,t,n)}function Ah(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xa(e));for(var o=this._groups,r=o.length,i=[],s=[],c=0;c<r;++c)for(var d=o[c],l=d.length,f,h=0;h<l;++h)if(f=d[h]){for(var u=e.call(f,f.__data__,h,d),p,y=Ue(f,n),_=0,w=u.length;_<w;++_)(p=u[_])&&po(p,t,n,_,u,y);i.push(u),s.push(f)}return new rt(i,s,t,n)}var $h=gn.prototype.constructor;function Ph(){return new $h(this._groups,this._parents)}function Th(e,t){var n,o,r;return function(){var i=Dt(this,e),s=(this.style.removeProperty(e),Dt(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Xa(e){return function(){this.style.removeProperty(e)}}function Dh(e,t,n){var o,r=n+"",i;return function(){var s=Dt(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Rh(e,t,n){var o,r,i;return function(){var s=Dt(this,e),c=n(this),d=c+"";return c==null&&(d=c=(this.style.removeProperty(e),Dt(this,e))),s===d?null:s===o&&d===r?i:(r=d,i=t(o=s,c))}}function Oh(e,t){var n,o,r,i="style."+t,s="end."+i,c;return function(){var d=Qe(this,e),l=d.on,f=d.value[i]==null?c||(c=Xa(t)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),d.on=o}}function jh(e,t,n){var o=(e+="")=="transform"?Hf:Wa;return t==null?this.styleTween(e,Th(e,o)).on("end.style."+e,Xa(e)):typeof t=="function"?this.styleTween(e,Rh(e,o,Hr(this,"style."+e,t))).each(Oh(this._id,e)):this.styleTween(e,Dh(e,o,t),n).on("end.style."+e,null)}function Hh(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Lh(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Hh(e,s,n)),o}return i._value=t,i}function zh(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Lh(e,t,n??""))}function Bh(e){return function(){this.textContent=e}}function Vh(e){return function(){var t=e(this);this.textContent=t??""}}function Fh(e){return this.tween("text",typeof e=="function"?Vh(Hr(this,"text",e)):Bh(e==null?"":e+""))}function Uh(e){return function(t){this.textContent=e.call(this,t)}}function Wh(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Uh(r)),t}return o._value=e,o}function Xh(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Wh(e))}function Yh(){for(var e=this._name,t=this._id,n=Ya(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,d,l=0;l<c;++l)if(d=s[l]){var f=Ue(d,t);po(d,e,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new rt(o,this._parents,e,n)}function Zh(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var c={value:s},d={value:function(){--r===0&&i()}};n.each(function(){var l=Qe(this,o),f=l.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(d)),l.on=t}),r===0&&i()})}var qh=0;function rt(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ya(){return++qh}var et=gn.prototype;rt.prototype={constructor:rt,select:Mh,selectAll:Ah,selectChild:et.selectChild,selectChildren:et.selectChildren,filter:bh,merge:Sh,selection:Ph,transition:Yh,call:et.call,nodes:et.nodes,node:et.node,size:et.size,empty:et.empty,each:et.each,on:Ch,attr:sh,attrTween:dh,style:jh,styleTween:zh,text:Fh,textTween:Xh,remove:Ih,tween:Jf,delay:ph,duration:yh,ease:vh,easeVarying:xh,end:Zh,[Symbol.iterator]:et[Symbol.iterator]};function Gh(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kh={time:null,delay:0,duration:250,ease:Gh};function Qh(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Jh(e){var t,n;e instanceof rt?(t=e._id,e=e._name):(t=Ya(),(n=Kh).time=Or(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,d,l=0;l<c;++l)(d=s[l])&&po(d,e,t,l,s,n||Qh(d,t));return new rt(o,this._parents,e,t)}gn.prototype.interrupt=Gf;gn.prototype.transition=Jh;const Pn=e=>()=>e;function ep(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function tt(e,t,n){this.k=e,this.x=t,this.y=n}tt.prototype={constructor:tt,scale:function(e){return e===1?this:new tt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new tt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var go=new tt(1,0,0);Za.prototype=tt.prototype;function Za(e){for(;!e.__zoom;)if(!(e=e.parentNode))return go;return e.__zoom}function Oo(e){e.stopImmediatePropagation()}function Wt(e){e.preventDefault(),e.stopImmediatePropagation()}function tp(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function np(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function zi(){return this.__zoom||go}function op(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function rp(){return navigator.maxTouchPoints||"ontouchstart"in this}function ip(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function qa(){var e=tp,t=np,n=ip,o=op,r=rp,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,d=Vn,l=uo("start","zoom","end"),f,h,u,p=500,y=150,_=0,w=10;function m(b){b.property("__zoom",zi).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",L).filter(r).on("touchstart.zoom",j).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(b,I,A,P){var $=b.selection?b.selection():b;$.property("__zoom",zi),b!==$?C(b,I,A,P):$.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(b,I,A,P){m.scaleTo(b,function(){var $=this.__zoom.k,M=typeof I=="function"?I.apply(this,arguments):I;return $*M},A,P)},m.scaleTo=function(b,I,A,P){m.transform(b,function(){var $=t.apply(this,arguments),M=this.__zoom,O=A==null?x($):typeof A=="function"?A.apply(this,arguments):A,z=M.invert(O),V=typeof I=="function"?I.apply(this,arguments):I;return n(g(S(M,V),O,z),$,s)},A,P)},m.translateBy=function(b,I,A,P){m.transform(b,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),s)},null,P)},m.translateTo=function(b,I,A,P,$){m.transform(b,function(){var M=t.apply(this,arguments),O=this.__zoom,z=P==null?x(M):typeof P=="function"?P.apply(this,arguments):P;return n(go.translate(z[0],z[1]).scale(O.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof A=="function"?-A.apply(this,arguments):-A),M,s)},P,$)};function S(b,I){return I=Math.max(i[0],Math.min(i[1],I)),I===b.k?b:new tt(I,b.x,b.y)}function g(b,I,A){var P=I[0]-A[0]*b.k,$=I[1]-A[1]*b.k;return P===b.x&&$===b.y?b:new tt(b.k,P,$)}function x(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function C(b,I,A,P){b.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var $=this,M=arguments,O=k($,M).event(P),z=t.apply($,M),V=A==null?x(z):typeof A=="function"?A.apply($,M):A,Z=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),F=$.__zoom,G=typeof I=="function"?I.apply($,M):I,ee=d(F.invert(V).concat(Z/F.k),G.invert(V).concat(Z/G.k));return function(X){if(X===1)X=G;else{var H=ee(X),U=Z/H[2];X=new tt(U,V[0]-H[0]*U,V[1]-H[1]*U)}O.zoom(null,X)}})}function k(b,I,A){return!A&&b.__zooming||new E(b,I)}function E(b,I){this.that=b,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,I),this.taps=0}E.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,I){return this.mouse&&b!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&b!=="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(b){var I=Ie(this.that).datum();l.call(b,this.that,new ep(b,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),I)}};function T(b,...I){if(!e.apply(this,arguments))return;var A=k(this,I).event(b),P=this.__zoom,$=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),M=He(b);if(A.wheel)(A.mouse[0][0]!==M[0]||A.mouse[0][1]!==M[1])&&(A.mouse[1]=P.invert(A.mouse[0]=M)),clearTimeout(A.wheel);else{if(P.k===$)return;A.mouse=[M,P.invert(M)],Wn(this),A.start()}Wt(b),A.wheel=setTimeout(O,y),A.zoom("mouse",n(g(S(P,$),A.mouse[0],A.mouse[1]),A.extent,s));function O(){A.wheel=null,A.end()}}function D(b,...I){if(u||!e.apply(this,arguments))return;var A=b.currentTarget,P=k(this,I,!0).event(b),$=Ie(b.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Z,!0),M=He(b,A),O=b.clientX,z=b.clientY;Pa(b.view),Oo(b),P.mouse=[M,this.__zoom.invert(M)],Wn(this),P.start();function V(F){if(Wt(F),!P.moved){var G=F.clientX-O,ee=F.clientY-z;P.moved=G*G+ee*ee>_}P.event(F).zoom("mouse",n(g(P.that.__zoom,P.mouse[0]=He(F,A),P.mouse[1]),P.extent,s))}function Z(F){$.on("mousemove.zoom mouseup.zoom",null),Ta(F.view,P.moved),Wt(F),P.event(F).end()}}function L(b,...I){if(e.apply(this,arguments)){var A=this.__zoom,P=He(b.changedTouches?b.changedTouches[0]:b,this),$=A.invert(P),M=A.k*(b.shiftKey?.5:2),O=n(g(S(A,M),P,$),t.apply(this,I),s);Wt(b),c>0?Ie(this).transition().duration(c).call(C,O,P,b):Ie(this).call(m.transform,O,P,b)}}function j(b,...I){if(e.apply(this,arguments)){var A=b.touches,P=A.length,$=k(this,I,b.changedTouches.length===P).event(b),M,O,z,V;for(Oo(b),O=0;O<P;++O)z=A[O],V=He(z,this),V=[V,this.__zoom.invert(V),z.identifier],$.touch0?!$.touch1&&$.touch0[2]!==V[2]&&($.touch1=V,$.taps=0):($.touch0=V,M=!0,$.taps=1+!!f);f&&(f=clearTimeout(f)),M&&($.taps<2&&(h=V[0],f=setTimeout(function(){f=null},p)),Wn(this),$.start())}}function B(b,...I){if(this.__zooming){var A=k(this,I).event(b),P=b.changedTouches,$=P.length,M,O,z,V;for(Wt(b),M=0;M<$;++M)O=P[M],z=He(O,this),A.touch0&&A.touch0[2]===O.identifier?A.touch0[0]=z:A.touch1&&A.touch1[2]===O.identifier&&(A.touch1[0]=z);if(O=A.that.__zoom,A.touch1){var Z=A.touch0[0],F=A.touch0[1],G=A.touch1[0],ee=A.touch1[1],X=(X=G[0]-Z[0])*X+(X=G[1]-Z[1])*X,H=(H=ee[0]-F[0])*H+(H=ee[1]-F[1])*H;O=S(O,Math.sqrt(X/H)),z=[(Z[0]+G[0])/2,(Z[1]+G[1])/2],V=[(F[0]+ee[0])/2,(F[1]+ee[1])/2]}else if(A.touch0)z=A.touch0[0],V=A.touch0[1];else return;A.zoom("touch",n(g(O,z,V),A.extent,s))}}function N(b,...I){if(this.__zooming){var A=k(this,I).event(b),P=b.changedTouches,$=P.length,M,O;for(Oo(b),u&&clearTimeout(u),u=setTimeout(function(){u=null},p),M=0;M<$;++M)O=P[M],A.touch0&&A.touch0[2]===O.identifier?delete A.touch0:A.touch1&&A.touch1[2]===O.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(O=He(O,this),Math.hypot(h[0]-O[0],h[1]-O[1])<w)){var z=Ie(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return m.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:Pn(+b),m):o},m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Pn(!!b),m):e},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Pn(!!b),m):r},m.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Pn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),m):t},m.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],m):[i[0],i[1]]},m.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(b){return arguments.length?(n=b,m):n},m.duration=function(b){return arguments.length?(c=+b,m):c},m.interpolate=function(b){return arguments.length?(d=b,m):d},m.on=function(){var b=l.on.apply(l,arguments);return b===l?m:b},m.clickDistance=function(b){return arguments.length?(_=(b=+b)*b,m):Math.sqrt(_)},m.tapDistance=function(b){return arguments.length?(w=+b,m):w},m}const Fe={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},an=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ga=["Enter"," ","Escape"],Ka={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ot;(function(e){e.Strict="strict",e.Loose="loose"})(Ot||(Ot={}));var _t;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(_t||(_t={}));var cn;(function(e){e.Partial="partial",e.Full="full"})(cn||(cn={}));const Qa={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var dt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(dt||(dt={}));var ro;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ro||(ro={}));var q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(q||(q={}));const Bi={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top},Ja=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,sp=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Lr=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),yn=(e,t=[0,0])=>{const{width:n,height:o}=We(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},ap=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((r,i)=>{const s=typeof i=="string";let c=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(c=s?t.nodeLookup.get(i):Lr(i)?i:t.nodeLookup.get(i.id)),c?(n=!0,mo(r,io(c,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?yo(o):{x:0,y:0,width:0,height:0}},_n=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=mo(n,io(r)),o=!0)}),o?yo(n):{x:0,y:0,width:0,height:0}},zr=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c=(t.x-n)/r,d=(t.y-o)/r,l=t.width/r,f=t.height/r,h=[];for(const u of e.values()){const{measured:p,selectable:y=!0,hidden:_=!1}=u;if(s&&!y||_)continue;const w=p.width??u.width??u.initialWidth??0,m=p.height??u.height??u.initialHeight??0,{x:S,y:g}=u.internals.positionAbsolute,x=oc(c,d,l,f,S,g,w,m),C=w*m,k=i&&x>0;(!u.internals.handleBounds||k||x>=C||u.dragging)&&h.push(u)}return h},cp=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function lp(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:c}=We(r);i=s>0&&c>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function up({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const c=lp(e,s),d=_n(c),l=Vr(d,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function ec({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:d,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let h=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",Fe.error005());else{const{width:p,height:y}=We(c);p&&y&&(h=[[d,l],[d+p,l+y]])}else c&&St(s.extent)&&(h=[[s.extent[0][0]+d,s.extent[0][1]+l],[s.extent[1][0]+d,s.extent[1][1]+l]]);const u=St(h)?bt(t,h,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",Fe.error015()),{position:{x:u.x-d+(s.measured.width??0)*f[0],y:u.y-l+(s.measured.height??0)*f[1]},positionAbsolute:u}}async function dp({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const p=i.has(u.id),y=!p&&u.parentId&&s.find(_=>_.id===u.parentId);(p||y)&&s.push(u)}const c=new Set(t.map(u=>u.id)),d=o.filter(u=>u.deletable!==!1),f=cp(s,d);for(const u of d)c.has(u.id)&&!f.find(y=>y.id===u.id)&&f.push(u);if(!r)return{edges:f,nodes:s};const h=await r({nodes:s,edges:f});return typeof h=="boolean"?h?{edges:f,nodes:s}:{edges:[],nodes:[]}:h}const jt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),bt=(e={x:0,y:0},t,n)=>({x:jt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:jt(e.y,t[0][1],t[1][1]-(n?.height??0))});function tc(e,t,n){const{width:o,height:r}=We(n),{x:i,y:s}=n.internals.positionAbsolute;return bt(e,[[i,s],[i+o,s+r]],t)}const Vi=(e,t,n)=>e<t?jt(Math.abs(e-t),1,t)/t:e>n?-jt(Math.abs(e-n),1,t)/t:0,Br=(e,t,n=15,o=40)=>{const r=Vi(e.x,o,t.width-o)*n,i=Vi(e.y,o,t.height-o)*n;return[r,i]},mo=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),cr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),yo=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),ln=(e,t=[0,0])=>{const{x:n,y:o}=Lr(e)?e.internals.positionAbsolute:yn(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},io=(e,t=[0,0])=>{const{x:n,y:o}=Lr(e)?e.internals.positionAbsolute:yn(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},nc=(e,t)=>yo(mo(cr(e),cr(t))),oc=(e,t,n,o,r,i,s,c)=>{const d=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+c)-Math.max(t,i));return Math.ceil(d*l)},so=(e,t)=>oc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Fi=e=>ze(e.width)&&ze(e.height)&&ze(e.x)&&ze(e.y),ze=e=>!isNaN(e)&&isFinite(e),rc=(e,t)=>(n,o)=>{},vn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),wn=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?vn(c,s):c},Ht=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ct(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function fp(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ct(e,n),r=Ct(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ct(e.top??e.y??0,n),r=Ct(e.bottom??e.y??0,n),i=Ct(e.left??e.x??0,t),s=Ct(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function hp(e,t,n,o,r,i){const{x:s,y:c}=Ht(e,[t,n,o]),{x:d,y:l}=Ht({x:e.x+e.width,y:e.y+e.height},[t,n,o]),f=r-d,h=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(f),bottom:Math.floor(h)}}const Vr=(e,t,n,o,r,i)=>{const s=fp(i,t,n),c=(t-s.x)/e.width,d=(n-s.y)/e.height,l=Math.min(c,d),f=jt(l,o,r),h=e.x+e.width/2,u=e.y+e.height/2,p=t/2-h*f,y=n/2-u*f,_=hp(e,p,y,f,t,n),w={left:Math.min(_.left-s.left,0),top:Math.min(_.top-s.top,0),right:Math.min(_.right-s.right,0),bottom:Math.min(_.bottom-s.bottom,0)};return{x:p-w.left+w.right,y:y-w.top+w.bottom,zoom:f}},un=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function St(e){return e!=null&&e!=="parent"}function We(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ic(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function sc(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Ui(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function pp(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function gp(e){return{...Ka,...e||{}}}function ac(e){return e===null?null:e?"valid":"invalid"}function Jt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=Be(e),c=wn({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:d,y:l}=n?vn(c,t):c;return{xSnapped:d,ySnapped:l,...c}}const Fr=e=>({width:e.offsetWidth,height:e.offsetHeight}),cc=e=>e?.getRootNode?.()||window?.document,mp=["INPUT","SELECT","TEXTAREA"];function lc(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:mp.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const uc=e=>"clientX"in e,Be=(e,t)=>{const n=uc(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Wi=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...Fr(s)}})};function dc({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const d=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,f=Math.abs(d-e),h=Math.abs(l-t);return[d,l,f,h]}function Tn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case q.Left:return[t-Tn(t-o,i),n];case q.Right:return[t+Tn(o-t,i),n];case q.Top:return[t,n-Tn(n-r,i)];case q.Bottom:return[t,n+Tn(r-n,i)]}}function fc({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top,curvature:s=.25}){const[c,d]=Xi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,f]=Xi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[h,u,p,y]=dc({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:d,targetControlX:l,targetControlY:f});return[`M${e},${t} C${c},${d} ${l},${f} ${o},${r}`,h,u,p,y]}function hc({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,c=o<t?o+s:o-s;return[i,c,r,s]}function yp({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,c=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+c}function _p({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=mo(io(e),io(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return so(s,yo(i))>0}const vp=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,wp=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),xp=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",Fe.error006()),t;const o=n.getEdgeId||vp;let r;return Ja(e)?r={...e}:r={...e,id:o(e)},wp(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function pc({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hc({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Yi={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},bp=({source:e,sourcePosition:t=q.Bottom,target:n})=>t===q.Left||t===q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Zi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Sp({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:o=q.Top,center:r,offset:i,stepPosition:s}){const c=Yi[t],d=Yi[o],l={x:e.x+c.x*i,y:e.y+c.y*i},f={x:n.x+d.x*i,y:n.y+d.y*i},h=bp({source:l,sourcePosition:t,target:f}),u=h.x!==0?"x":"y",p=h[u];let y=[],_,w;const m={x:0,y:0},S={x:0,y:0},[,,g,x]=hc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[u]*d[u]===-1){u==="x"?(_=r.x??l.x+(f.x-l.x)*s,w=r.y??(l.y+f.y)/2):(_=r.x??(l.x+f.x)/2,w=r.y??l.y+(f.y-l.y)*s);const T=[{x:_,y:l.y},{x:_,y:f.y}],D=[{x:l.x,y:w},{x:f.x,y:w}];c[u]===p?y=u==="x"?T:D:y=u==="x"?D:T}else{const T=[{x:l.x,y:f.y}],D=[{x:f.x,y:l.y}];if(u==="x"?y=c.x===p?D:T:y=c.y===p?T:D,t===o){const b=Math.abs(e[u]-n[u]);if(b<=i){const I=Math.min(i-1,i-b);c[u]===p?m[u]=(l[u]>e[u]?-1:1)*I:S[u]=(f[u]>n[u]?-1:1)*I}}if(t!==o){const b=u==="x"?"y":"x",I=c[u]===d[b],A=l[b]>f[b],P=l[b]<f[b];(c[u]===1&&(!I&&A||I&&P)||c[u]!==1&&(!I&&P||I&&A))&&(y=u==="x"?T:D)}const L={x:l.x+m.x,y:l.y+m.y},j={x:f.x+S.x,y:f.y+S.y},B=Math.max(Math.abs(L.x-y[0].x),Math.abs(j.x-y[0].x)),N=Math.max(Math.abs(L.y-y[0].y),Math.abs(j.y-y[0].y));B>=N?(_=(L.x+j.x)/2,w=y[0].y):(_=y[0].x,w=(L.y+j.y)/2)}const C={x:l.x+m.x,y:l.y+m.y},k={x:f.x+S.x,y:f.y+S.y};return[[e,...C.x!==y[0].x||C.y!==y[0].y?[C]:[],...y,...k.x!==y[y.length-1].x||k.y!==y[y.length-1].y?[k]:[],n],_,w,g,x]}function kp(e,t,n,o){const r=Math.min(Zi(e,t)/2,Zi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const c=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${s+r*d}Q ${i},${s} ${i+r*c},${s}`}function lr({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top,borderRadius:s=5,centerX:c,centerY:d,offset:l=20,stepPosition:f=.5}){const[h,u,p,y,_]=Sp({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:c,y:d},offset:l,stepPosition:f});let w=`M${h[0].x} ${h[0].y}`;for(let m=1;m<h.length-1;m++)w+=kp(h[m-1],h[m],h[m+1],s);return w+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[w,u,p,y,_]}function qi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ep(e){const{sourceNode:t,targetNode:n}=e;if(!qi(t)||!qi(n))return null;const o=t.internals.handleBounds||Gi(t.handles),r=n.internals.handleBounds||Gi(n.handles),i=Ki(o?.source??[],e.sourceHandle),s=Ki(e.connectionMode===Ot.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",Fe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||q.Bottom,d=s?.position||q.Top,l=kt(t,i,c),f=kt(n,s,d);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:c,targetPosition:d}}function Gi(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function kt(e,t,n=q.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??We(e);if(o)return{x:r+s/2,y:i+c/2};switch(t?.position??n){case q.Top:return{x:r+s/2,y:i};case q.Right:return{x:r+s,y:i+c/2};case q.Bottom:return{x:r+s/2,y:i+c};case q.Left:return{x:r,y:i+c/2}}}function Ki(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ur(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Cp(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(d=>{if(d&&typeof d=="object"){const l=ur(d,t);i.has(l)||(s.push({id:l,color:d.color||n,...d}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const gc=1e3,Np=10,Ur={nodeOrigin:[0,0],nodeExtent:an,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ip={...Ur,checkEquality:!0};function Wr(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Mp(e,t,n){const o=Wr(Ur,n);for(const r of e.values())if(r.parentId)Yr(r,e,t,o);else{const i=yn(r,o.nodeOrigin),s=St(r.extent)?r.extent:o.nodeExtent,c=bt(i,s,We(r));r.internals.positionAbsolute=c}}function Ap(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Xr(e){return e==="manual"}function dr(e,t,n,o={}){const r=Wr(Ip,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!Xr(r.zIndexMode)?gc:0;let d=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(r.checkEquality&&f===h?.internals.userNode)t.set(f.id,h);else{const u=yn(f,r.nodeOrigin),p=St(f.extent)?f.extent:r.nodeExtent,y=bt(u,p,We(f));h={...r.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:y,handleBounds:Ap(f,h),z:mc(f,c,r.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(d=!1),f.parentId&&Yr(h,t,n,o,i),l||=f.selected??!1}return{nodesInitialized:d,hasSelectedNodes:l}}function $p(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Yr(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:d}=Wr(Ur,o),l=e.parentId,f=t.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}$p(e,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&d==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*Np),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const h=i&&!Xr(d)?gc:0,{x:u,y:p,z:y}=Pp(e,f,s,c,h,d),{positionAbsolute:_}=e.internals,w=u!==_.x||p!==_.y;(w||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:u,y:p}:_,z:y}})}function mc(e,t,n){const o=ze(e.zIndex)?e.zIndex:0;return Xr(n)?o:o+(e.selected?t:0)}function Pp(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,d=We(e),l=yn(e,n),f=St(e.extent)?bt(l,e.extent,d):l;let h=bt({x:s+f.x,y:c+f.y},o,d);e.extent==="parent"&&(h=tc(h,d,t));const u=mc(e,r,i),p=t.internals.z??0;return{x:h.x,y:h.y,z:p>=u?p+1:u}}function Zr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const d=i.get(s.parentId)?.expandedRect??ln(c),l=nc(d,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},d)=>{const l=c.internals.positionAbsolute,f=We(c),h=c.origin??o,u=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,p=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,y=Math.max(f.width,Math.round(s.width)),_=Math.max(f.height,Math.round(s.height)),w=(y-f.width)*h[0],m=(_-f.height)*h[1];(u>0||p>0||w||m)&&(r.push({id:d,type:"position",position:{x:c.position.x-u+w,y:c.position.y-p+m}}),n.get(d)?.forEach(S=>{e.some(g=>g.id===S.id)||r.push({id:S.id,type:"position",position:{x:S.position.x+u,y:S.position.y+p}})})),(f.width<s.width||f.height<s.height||u||p)&&r.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:y+(u?h[0]*u-w:0),height:_+(p?h[1]*p-m:0)}})}),r}function Tp(e,t,n,o,r,i,s){const c=o?.querySelector(".xyflow__viewport");let d=!1;if(!c)return{changes:[],updatedInternals:d};const l=[],f=window.getComputedStyle(c),{m22:h}=new window.DOMMatrixReadOnly(f.transform),u=[];for(const p of e.values()){const y=t.get(p.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),d=!0;continue}const _=Fr(p.nodeElement),w=y.measured.width!==_.width||y.measured.height!==_.height;if(!!(_.width&&_.height&&(w||!y.internals.handleBounds||p.force))){const S=p.nodeElement.getBoundingClientRect(),g=St(y.extent)?y.extent:i;let{positionAbsolute:x}=y.internals;if(y.parentId&&y.extent==="parent"){const k=t.get(y.parentId);k&&(x=tc(x,_,k))}else g&&(x=bt(x,g,_));const C={...y,measured:_,internals:{...y.internals,positionAbsolute:x,handleBounds:{source:Wi("source",p.nodeElement,S,h,y.id),target:Wi("target",p.nodeElement,S,h,y.id)}}};t.set(y.id,C),y.parentId&&Yr(C,t,n,{nodeOrigin:r,zIndexMode:s}),d=!0,w&&(l.push({id:y.id,type:"dimensions",dimensions:_}),y.expandParent&&y.parentId&&u.push({id:y.id,parentId:y.parentId,rect:ln(C,r)}))}}if(u.length>0){const p=Zr(u,t,n,r);l.push(...p)}return{changes:l,updatedInternals:d}}async function Dp({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Qi(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const d=o.get(s)||new Map;if(o.set(s,d.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yc(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,d={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,f=`${i}-${c}--${r}-${s}`;Qi("source",d,f,e,r,s),Qi("target",d,l,e,i,c),t.set(o.id,o)}}function _c(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_c(n,t):!1}function Ji(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Rp(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!_c(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function jo({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const d=n.get(s)?.internals.userNode;d&&r.push({...d,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Op({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=vn(i,t);return{x:s.x-i.x,y:s.y-i.y}}function jp({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,d=!1,l={x:0,y:0},f=null,h=!1,u=null,p=!1,y=!1,_=null;function w({noDragClassName:S,handleSelector:g,domNode:x,isSelectable:C,nodeId:k,nodeClickDistance:E=0}){u=Ie(x);function T({x:B,y:N}){const{nodeLookup:b,nodeExtent:I,snapGrid:A,snapToGrid:P,nodeOrigin:$,onNodeDrag:M,onSelectionDrag:O,onError:z,updateNodePositions:V}=t();i={x:B,y:N};let Z=!1;const F=c.size>1,G=F&&I?cr(_n(c)):null,ee=F&&P?Op({dragItems:c,snapGrid:A,x:B,y:N}):null;for(const[X,H]of c){if(!b.has(X))continue;let U={x:B-H.distance.x,y:N-H.distance.y};P&&(U=ee?{x:Math.round(U.x+ee.x),y:Math.round(U.y+ee.y)}:vn(U,A));let Q=null;if(F&&I&&!H.extent&&G){const{positionAbsolute:K}=H.internals,re=K.x-G.x+I[0][0],ie=K.x+H.measured.width-G.x2+I[1][0],ce=K.y-G.y+I[0][1],me=K.y+H.measured.height-G.y2+I[1][1];Q=[[re,ce],[ie,me]]}const{position:Y,positionAbsolute:W}=ec({nodeId:X,nextPosition:U,nodeLookup:b,nodeExtent:Q||I,nodeOrigin:$,onError:z});Z=Z||H.position.x!==Y.x||H.position.y!==Y.y,H.position=Y,H.internals.positionAbsolute=W}if(y=y||Z,!!Z&&(V(c,!0),_&&(o||M||!k&&O))){const[X,H]=jo({nodeId:k,dragItems:c,nodeLookup:b});o?.(_,c,X,H),M?.(_,X,H),k||O?.(_,H)}}async function D(){if(!f)return;const{transform:B,panBy:N,autoPanSpeed:b,autoPanOnNodeDrag:I}=t();if(!I){d=!1,cancelAnimationFrame(s);return}const[A,P]=Br(l,f,b);(A!==0||P!==0)&&(i.x=(i.x??0)-A/B[2],i.y=(i.y??0)-P/B[2],await N({x:A,y:P})&&T(i)),s=requestAnimationFrame(D)}function L(B){const{nodeLookup:N,multiSelectionActive:b,nodesDraggable:I,transform:A,snapGrid:P,snapToGrid:$,selectNodesOnDrag:M,onNodeDragStart:O,onSelectionDragStart:z,unselectNodesAndEdges:V}=t();h=!0,(!M||!C)&&!b&&k&&(N.get(k)?.selected||V()),C&&M&&k&&e?.(k);const Z=Jt(B.sourceEvent,{transform:A,snapGrid:P,snapToGrid:$,containerBounds:f});if(i=Z,c=Rp(N,I,Z,k),c.size>0&&(n||O||!k&&z)){const[F,G]=jo({nodeId:k,dragItems:c,nodeLookup:N});n?.(B.sourceEvent,c,F,G),O?.(B.sourceEvent,F,G),k||z?.(B.sourceEvent,G)}}const j=Da().clickDistance(E).on("start",B=>{const{domNode:N,nodeDragThreshold:b,transform:I,snapGrid:A,snapToGrid:P}=t();f=N?.getBoundingClientRect()||null,p=!1,y=!1,_=B.sourceEvent,b===0&&L(B),i=Jt(B.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:f}),l=Be(B.sourceEvent,f)}).on("drag",B=>{const{autoPanOnNodeDrag:N,transform:b,snapGrid:I,snapToGrid:A,nodeDragThreshold:P,nodeLookup:$}=t(),M=Jt(B.sourceEvent,{transform:b,snapGrid:I,snapToGrid:A,containerBounds:f});if(_=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||k&&!$.has(k))&&(p=!0),!p){if(!d&&N&&h&&(d=!0,D()),!h){const O=Be(B.sourceEvent,f),z=O.x-l.x,V=O.y-l.y;Math.sqrt(z*z+V*V)>P&&L(B)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&c&&h&&(l=Be(B.sourceEvent,f),T(M))}}).on("end",B=>{if(!h||p){p&&c.size>0&&t().updateNodePositions(c,!1);return}if(d=!1,h=!1,cancelAnimationFrame(s),c.size>0){const{nodeLookup:N,updateNodePositions:b,onNodeDragStop:I,onSelectionDragStop:A}=t();if(y&&(b(c,!1),y=!1),r||I||!k&&A){const[P,$]=jo({nodeId:k,dragItems:c,nodeLookup:N,dragging:!1});r?.(B.sourceEvent,c,P,$),I?.(B.sourceEvent,P,$),k||A?.(B.sourceEvent,$)}}}).filter(B=>{const N=B.target;return!B.button&&(!S||!Ji(N,`.${S}`,x))&&(!g||Ji(N,g,x))});u.call(j)}function m(){u?.on(".drag",null)}return{update:w,destroy:m}}function Hp(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())so(r,ln(i))>0&&o.push(i);return o}const Lp=250;function zp(e,t,n,o){let r=[],i=1/0;const s=Hp(e,n,t+Lp);for(const c of s){const d=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of d){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:f,y:h}=kt(c,l,l.position,!0),u=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));u>t||(u<i?(r=[{...l,x:f,y:h}],i=u):u===i&&r.push({...l,x:f,y:h}))}}if(!r.length)return null;if(r.length>1){const c=o.type==="source"?"target":"source";return r.find(d=>d.type===c)??r[0]}return r[0]}function vc(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],d=(n?c?.find(l=>l.id===n):c?.[0])??null;return d&&i?{...d,...kt(s,d,d.position,!0)}:d}function wc(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Bp(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const xc=()=>!0;function Vp(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:d,lib:l,autoPanOnConnect:f,flowId:h,panBy:u,cancelConnection:p,onConnectStart:y,onConnect:_,onConnectEnd:w,isValidConnection:m=xc,onReconnectEnd:S,updateConnection:g,getTransform:x,getFromHandle:C,autoPanSpeed:k,dragThreshold:E=1,handleDomNode:T}){const D=cc(e.target);let L=0,j;const{x:B,y:N}=Be(e),b=wc(i,T),I=c?.getBoundingClientRect();let A=!1;if(!I||!b)return;const P=vc(r,b,o,d,t);if(!P)return;let $=Be(e,I),M=!1,O=null,z=!1,V=null;function Z(){if(!f||!I)return;const[Y,W]=Br($,I,k);u({x:Y,y:W}),L=requestAnimationFrame(Z)}const F={...P,nodeId:r,type:b,position:P.position},G=d.get(r);let X={inProgress:!0,isValid:null,from:kt(G,F,q.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:G,to:$,toHandle:null,toPosition:Bi[F.position],toNode:null,pointer:$};function H(){A=!0,g(X),y?.(e,{nodeId:r,handleId:o,handleType:b})}E===0&&H();function U(Y){if(!A){const{x:me,y:$e}=Be(Y),xe=me-B,Ee=$e-N;if(!(xe*xe+Ee*Ee>E*E))return;H()}if(!C()||!F){Q(Y);return}const W=x();$=Be(Y,I),j=zp(wn($,W,!1,[1,1]),n,d,F),M||(Z(),M=!0);const K=bc(Y,{handle:j,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:D,lib:l,flowId:h,nodeLookup:d});V=K.handleDomNode,O=K.connection,z=Bp(!!j,K.isValid);const re=d.get(r),ie=re?kt(re,F,q.Left,!0):X.from,ce={...X,from:ie,isValid:z,to:K.toHandle&&z?Ht({x:K.toHandle.x,y:K.toHandle.y},W):$,toHandle:K.toHandle,toPosition:z&&K.toHandle?K.toHandle.position:Bi[F.position],toNode:K.toHandle?d.get(K.toHandle.nodeId):null,pointer:$};g(ce),X=ce}function Q(Y){if(!("touches"in Y&&Y.touches.length>0)){if(A){(j||V)&&O&&z&&_?.(O);const{inProgress:W,...K}=X,re={...K,toPosition:X.toHandle?X.toPosition:null};w?.(Y,re),i&&S?.(Y,re)}p(),cancelAnimationFrame(L),M=!1,z=!1,O=null,V=null,D.removeEventListener("mousemove",U),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",U),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",U),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",U),D.addEventListener("touchend",Q)}function bc(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:d,isValidConnection:l=xc,nodeLookup:f}){const h=i==="target",u=t?s.querySelector(`.${c}-flow__handle[data-id="${d}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y}=Be(e),_=s.elementFromPoint(p,y),w=_?.classList.contains(`${c}-flow__handle`)?_:u,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const S=wc(void 0,w),g=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),C=w.classList.contains("connectable"),k=w.classList.contains("connectableend");if(!g||!S)return m;const E={source:h?g:o,sourceHandle:h?x:r,target:h?o:g,targetHandle:h?r:x};m.connection=E;const D=C&&k&&(n===Ot.Strict?h&&S==="source"||!h&&S==="target":g!==o||x!==r);m.isValid=D&&l(E),m.toHandle=vc(g,S,x,f,n,!0)}return m}const fr={onPointerDown:Vp,isValid:bc};function Fp({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Ie(e);function i({translateExtent:c,width:d,height:l,zoomStep:f=1,pannable:h=!0,zoomable:u=!0,inversePan:p=!1}){const y=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),C=g.sourceEvent.ctrlKey&&un()?10:1,k=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*f,E=x[2]*Math.pow(2,k*C);t.scaleTo(E)};let _=[0,0];const w=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(_=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const C=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],k=[C[0]-_[0],C[1]-_[1]];_=C;const E=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-k[0]*E,y:x[1]-k[1]*E},D=[[0,0],[d,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},D,c)},S=qa().on("start",w).on("zoom",h?m:null).on("zoom.wheel",u?y:null);r.call(S,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:He}}const _o=e=>({x:e.x,y:e.y,zoom:e.k}),Ho=({x:e,y:t,zoom:n})=>go.translate(e,t).scale(n),ut=(e,t)=>e.target.closest(`.${t}`),Sc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Up=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Lo=(e,t=0,n=Up,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},kc=e=>{const t=e.ctrlKey&&un()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Wp({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:l}){return f=>{if(ut(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(f.ctrlKey&&s){const w=He(f),m=kc(f),S=h*Math.pow(2,m);o.scaleTo(n,S,w,f);return}const u=f.deltaMode===1?20:1;let p=r===_t.Vertical?0:f.deltaX*u,y=r===_t.Horizontal?0:f.deltaY*u;!un()&&f.shiftKey&&r!==_t.Vertical&&(p=f.deltaY*u,y=0),o.translateBy(n,-(p/h)*i,-(y/h)*i,{internal:!0});const _=_o(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?d?.(f,_):(e.isPanScrolling=!0,c?.(f,_)),e.panScrollTimeout=setTimeout(()=>{l?.(f,_),e.isPanScrolling=!1},150)}}function Xp({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=ut(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function Yp({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=_o(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Zp({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Sc(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,_o(i.transform))}}function qp({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Sc(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=_o(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function Gp({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:c,noWheelClassName:d,noPanClassName:l,lib:f,connectionInProgress:h}){return u=>{const p=t||n,y=o&&u.ctrlKey,_=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(ut(u,`${f}-flow__node`)||ut(u,`${f}-flow__edge`)||ut(u,`${f}-flow__selection`)||ut(u,`${f}-flow__nodesselection`)))return!0;if(!r&&!p&&!i&&!s&&!o||c||h&&!_||ut(u,d)&&_||ut(u,l)&&(!_||i&&_&&!t)||!o&&u.ctrlKey&&_)return!1;if(!o&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!p&&!i&&!y&&_||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||_||e)&&w}}function Kp({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:d}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect();let h=[[0,0],[f.width,f.height]];(typeof ResizeObserver<"u"?new ResizeObserver(N=>{const b=N[0];b&&(h=[[0,0],[b.contentRect.width,b.contentRect.height]])}):null)?.observe(e);const p=qa().extent(()=>h).scaleExtent([t,n]).translateExtent(o),y=Ie(e).call(p);x({x:r.x,y:r.y,zoom:jt(r.zoom,t,n)},[[0,0],[f.width,f.height]],o);const _=y.on("wheel.zoom"),w=y.on("dblclick.zoom");p.wheelDelta(kc);async function m(N,b){return y?new Promise(I=>{p?.interpolate(b?.interpolate==="linear"?Qt:Vn).transform(Lo(y,b?.duration,b?.ease,()=>I(!0)),N)}):!1}function S({noWheelClassName:N,noPanClassName:b,onPaneContextMenu:I,userSelectionActive:A,panOnScroll:P,panOnDrag:$,panOnScrollMode:M,panOnScrollSpeed:O,preventScrolling:z,zoomOnPinch:V,zoomOnScroll:Z,zoomOnDoubleClick:F,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:ee,lib:X,onTransformChange:H,connectionInProgress:U,paneClickDistance:Q,selectionOnDrag:Y}){A&&!l.isZoomingOrPanning&&g();const W=P&&!ee&&!A;p.clickDistance(Y?1/0:!ze(Q)||Q<0?0:Q);const K=W?Wp({zoomPanValues:l,noWheelClassName:N,d3Selection:y,d3Zoom:p,panOnScrollMode:M,panOnScrollSpeed:O,zoomOnPinch:V,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):Xp({noWheelClassName:N,preventScrolling:z,d3ZoomHandler:_});y.on("wheel.zoom",K,{passive:!1});const re=Yp({zoomPanValues:l,onDraggingChange:d,onPanZoomStart:s});p.on("start",re);const ie=Zp({zoomPanValues:l,panOnDrag:$,onPaneContextMenu:!!I,onPanZoom:i,onTransformChange:H});p.on("zoom",ie);const ce=qp({zoomPanValues:l,panOnDrag:$,panOnScroll:P,onPaneContextMenu:I,onPanZoomEnd:c,onDraggingChange:d});p.on("end",ce);const me=Gp({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:$,zoomOnScroll:Z,panOnScroll:P,zoomOnDoubleClick:F,zoomOnPinch:V,userSelectionActive:A,noPanClassName:b,noWheelClassName:N,lib:X,connectionInProgress:U});p.filter(me),F?y.on("dblclick.zoom",w):y.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function x(N,b,I){const A=Ho(N),P=p?.constrain()(A,b,I);return P&&await m(P),P}async function C(N,b){const I=Ho(N);return await m(I,b),I}function k(N){if(y){const b=Ho(N),I=y.property("__zoom");(I.k!==N.zoom||I.x!==N.x||I.y!==N.y)&&p?.transform(y,b,null,{sync:!0})}}function E(){const N=y?Za(y.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}async function T(N,b){return y?new Promise(I=>{p?.interpolate(b?.interpolate==="linear"?Qt:Vn).scaleTo(Lo(y,b?.duration,b?.ease,()=>I(!0)),N)}):!1}async function D(N,b){return y?new Promise(I=>{p?.interpolate(b?.interpolate==="linear"?Qt:Vn).scaleBy(Lo(y,b?.duration,b?.ease,()=>I(!0)),N)}):!1}function L(N){p?.scaleExtent(N)}function j(N){p?.translateExtent(N)}function B(N){const b=!ze(N)||N<0?0:N;p?.clickDistance(b)}return{update:S,destroy:g,setViewport:C,setViewportConstrained:x,getViewport:E,scaleTo:T,scaleBy:D,setScaleExtent:L,setTranslateExtent:j,syncViewport:k,setClickDistance:B}}var Lt;(function(e){e.Line="line",e.Handle="handle"})(Lt||(Lt={}));function Qp({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,d=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(d[0]=d[0]*-1),c&&i&&(d[1]=d[1]*-1),d}function es(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function at(e,t){return Math.max(0,t-e)}function ct(e,t){return Math.max(0,e-t)}function Dn(e,t,n){return Math.max(0,t-e,e-n)}function ts(e,t){return e?!t:t}function Jp(e,t,n,o,r,i,s,c){let{affectsX:d,affectsY:l}=t;const{isHorizontal:f,isVertical:h}=t,u=f&&h,{xSnapped:p,ySnapped:y}=n,{minWidth:_,maxWidth:w,minHeight:m,maxHeight:S}=o,{x:g,y:x,width:C,height:k,aspectRatio:E}=e;let T=Math.floor(f?p-e.pointerX:0),D=Math.floor(h?y-e.pointerY:0);const L=C+(d?-T:T),j=k+(l?-D:D),B=-i[0]*C,N=-i[1]*k;let b=Dn(L,_,w),I=Dn(j,m,S);if(s){let $=0,M=0;d&&T<0?$=at(g+T+B,s[0][0]):!d&&T>0&&($=ct(g+L+B,s[1][0])),l&&D<0?M=at(x+D+N,s[0][1]):!l&&D>0&&(M=ct(x+j+N,s[1][1])),b=Math.max(b,$),I=Math.max(I,M)}if(c){let $=0,M=0;d&&T>0?$=ct(g+T,c[0][0]):!d&&T<0&&($=at(g+L,c[1][0])),l&&D>0?M=ct(x+D,c[0][1]):!l&&D<0&&(M=at(x+j,c[1][1])),b=Math.max(b,$),I=Math.max(I,M)}if(r){if(f){const $=Dn(L/E,m,S)*E;if(b=Math.max(b,$),s){let M=0;!d&&!l||d&&!l&&u?M=ct(x+N+L/E,s[1][1])*E:M=at(x+N+(d?T:-T)/E,s[0][1])*E,b=Math.max(b,M)}if(c){let M=0;!d&&!l||d&&!l&&u?M=at(x+L/E,c[1][1])*E:M=ct(x+(d?T:-T)/E,c[0][1])*E,b=Math.max(b,M)}}if(h){const $=Dn(j*E,_,w)/E;if(I=Math.max(I,$),s){let M=0;!d&&!l||l&&!d&&u?M=ct(g+j*E+B,s[1][0])/E:M=at(g+(l?D:-D)*E+B,s[0][0])/E,I=Math.max(I,M)}if(c){let M=0;!d&&!l||l&&!d&&u?M=at(g+j*E,c[1][0])/E:M=ct(g+(l?D:-D)*E,c[0][0])/E,I=Math.max(I,M)}}}D=D+(D<0?I:-I),T=T+(T<0?b:-b),r&&(u?L>j*E?D=(ts(d,l)?-T:T)/E:T=(ts(d,l)?-D:D)*E:f?(D=T/E,l=d):(T=D*E,d=l));const A=d?g+T:g,P=l?x+D:x;return{width:C+(d?-T:T),height:k+(l?-D:D),x:i[0]*T*(d?-1:1)+A,y:i[1]*D*(l?-1:1)+P}}const Ec={width:0,height:0,x:0,y:0},eg={...Ec,pointerX:0,pointerY:0,aspectRatio:1};function tg(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,d=n[1]*s;return[[o-c,r-d],[o+i-c,r+s-d]]}function ng({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Ie(e);let s={controlDirection:es("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:f,keepAspectRatio:h,resizeDirection:u,onResizeStart:p,onResize:y,onResizeEnd:_,shouldResize:w}){let m={...Ec},S={...eg};s={boundaries:f,resizeDirection:u,keepAspectRatio:h,controlDirection:es(l)};let g,x=null,C=[],k,E,T;const D=Da().on("start",L=>{const{nodeLookup:j,transform:B,snapGrid:N,snapToGrid:b,nodeOrigin:I,paneDomNode:A}=n();if(g=j.get(t),!g)return;x=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:$}=Jt(L.sourceEvent,{transform:B,snapGrid:N,snapToGrid:b,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},S={...m,pointerX:P,pointerY:$,aspectRatio:m.width/m.height},k=void 0,E=St(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(k=j.get(g.parentId)),k&&g.extent==="parent"&&(E=[[0,0],[k.measured.width,k.measured.height]]),C=[],T=void 0;for(const[M,O]of j)if(O.parentId===t&&(C.push({id:M,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const z=tg(O,g,O.origin??I);T?T=[[Math.min(z[0][0],T[0][0]),Math.min(z[0][1],T[0][1])],[Math.max(z[1][0],T[1][0]),Math.max(z[1][1],T[1][1])]]:T=z}p?.(L,{...m})}).on("drag",L=>{const{transform:j,snapGrid:B,snapToGrid:N,nodeOrigin:b}=n(),I=Jt(L.sourceEvent,{transform:j,snapGrid:B,snapToGrid:N,containerBounds:x}),A=[];if(!g)return;const{x:P,y:$,width:M,height:O}=m,z={},V=g.origin??b,{width:Z,height:F,x:G,y:ee}=Jp(S,s.controlDirection,I,s.boundaries,s.keepAspectRatio,V,E,T),X=Z!==M,H=F!==O,U=G!==P&&X,Q=ee!==$&&H;if(!U&&!Q&&!X&&!H)return;const Y={prevValues:{...m},startX:S.x,startY:S.y,childNodes:C.map(ie=>({...ie,position:{...ie.position}}))};if((U||Q||V[0]===1||V[1]===1)&&(z.x=U?G:m.x,z.y=Q?ee:m.y,m.x=z.x,m.y=z.y,C.length>0)){const ie=G-P,ce=ee-$;for(const me of C)me.position={x:me.position.x-ie+V[0]*(Z-M),y:me.position.y-ce+V[1]*(F-O)},A.push(me)}if((X||H)&&(z.width=X&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Z:m.width,z.height=H&&(!s.resizeDirection||s.resizeDirection==="vertical")?F:m.height,m.width=z.width,m.height=z.height),k&&g.expandParent){const ie=V[0]*(z.width??0);z.x&&z.x<ie&&(m.x=ie,S.x=S.x-(z.x-ie));const ce=V[1]*(z.height??0);z.y&&z.y<ce&&(m.y=ce,S.y=S.y-(z.y-ce))}const W=Qp({width:m.width,prevWidth:M,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),K={...m,direction:W};if(w?.(L,K)===!1){m=Y.prevValues,S.x=Y.startX,S.y=Y.startY,C.forEach((ie,ce)=>{ie.position=Y.childNodes[ce].position});return}y?.(L,K),o(z,A)}).on("end",L=>{_?.(L,{...m}),r?.({...m})});i.call(D)}function d(){i.on(".drag",null)}return{update:c,destroy:d}}function og(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function rg(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function o(){var r=!1;try{r=this instanceof o}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),n}var zo={exports:{}},Bo={};const Cc=rg(Eu);var Vo={exports:{}},Fo={};var ns;function ig(){if(ns)return Fo;ns=1;var e=Cc;function t(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function c(h,u){var p=u(),y=o({inst:{value:p,getSnapshot:u}}),_=y[0].inst,w=y[1];return i(function(){_.value=p,_.getSnapshot=u,d(_)&&w({inst:_})},[h,p,u]),r(function(){return d(_)&&w({inst:_}),h(function(){d(_)&&w({inst:_})})},[h]),s(p),p}function d(h){var u=h.getSnapshot;h=h.value;try{var p=u();return!n(h,p)}catch{return!0}}function l(h,u){return u()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return Fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Fo}var os;function sg(){return os||(os=1,Vo.exports=ig()),Vo.exports}var rs;function ag(){if(rs)return Bo;rs=1;var e=Cc,t=sg();function n(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,c=e.useMemo,d=e.useDebugValue;return Bo.useSyncExternalStoreWithSelector=function(l,f,h,u,p){var y=i(null);if(y.current===null){var _={hasValue:!1,value:null};y.current=_}else _=y.current;y=c(function(){function m(k){if(!S){if(S=!0,g=k,k=u(k),p!==void 0&&_.hasValue){var E=_.value;if(p(E,k))return x=E}return x=k}if(E=x,o(g,k))return E;var T=u(k);return p!==void 0&&p(E,T)?(g=k,E):(g=k,x=T)}var S=!1,g,x,C=h===void 0?null:h;return[function(){return m(f())},C===null?void 0:function(){return m(C())}]},[f,h,u,p]);var w=r(l,y[0],y[1]);return s(function(){_.hasValue=!0,_.value=w},[w]),d(w),w},Bo}var is;function cg(){return is||(is=1,zo.exports=ag()),zo.exports}var lg=cg();const ug=og(lg),dg={},ss=e=>{let t;const n=new Set,o=(f,h)=>{const u=typeof f=="function"?f(t):f;if(!Object.is(u,t)){const p=t;t=h??(typeof u!="object"||u===null)?u:Object.assign({},t,u),n.forEach(y=>y(t,p))}},r=()=>t,d={setState:o,getState:r,getInitialState:()=>l,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(dg?"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=t=e(o,r,d);return d},fg=e=>e?ss(e):ss,{useDebugValue:hg}=va,{useSyncExternalStoreWithSelector:pg}=ug,gg=e=>e;function Nc(e,t=gg,n){const o=pg(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hg(o),o}const as=(e,t)=>{const n=fg(e),o=(r,i=t)=>Nc(n,r,i);return Object.assign(o,n),o},mg=(e,t)=>e?as(e,t):as;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const vo=Bt(null),yg=vo.Provider,Ic=Fe.error001("react");function le(e,t){const n=st(vo);if(n===null)throw new Error(Ic);return Nc(n,e,t)}function de(){const e=st(vo);if(e===null)throw new Error(Ic);return _e(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const cs={display:"none"},_g={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mc="react-flow__node-desc",Ac="react-flow__edge-desc",vg="react-flow__aria-live",wg=e=>e.ariaLiveMessage,xg=e=>e.ariaLabelConfig;function bg({rfId:e}){const t=le(wg);return a("div",{id:`${vg}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:_g,children:t})}function Sg({rfId:e,disableKeyboardA11y:t}){const n=le(xg);return a(ae,{children:[a("div",{id:`${Mc}-${e}`,style:cs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a("div",{id:`${Ac}-${e}`,style:cs,children:n["edge.a11yDescription.default"]}),!t&&a(bg,{rfId:e})]})}const wo=lo(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return a("div",{className:ge(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});wo.displayName="Panel";const ls="https://reactflow.dev?utm_source=attribution";function kg({proOptions:e,position:t="bottom-right"}){return oe(()=>{},[]),e?.hideAttribution?null:a(wo,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ls}`,children:a("a",{href:ls,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Eg=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Rn=e=>e.id;function Cg(e,t){return he(e.selectedNodes.map(Rn),t.selectedNodes.map(Rn))&&he(e.selectedEdges.map(Rn),t.selectedEdges.map(Rn))}function Ng({onSelectionChange:e}){const t=de(),{selectedNodes:n,selectedEdges:o}=le(Eg,Cg);return oe(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Ig=e=>!!e.onSelectionChangeHandlers;function Mg({onSelectionChange:e}){const t=le(Ig);return e||t?a(Ng,{onSelectionChange:e}):null}const $c=[0,0],Ag={x:0,y:0,zoom:1},$g=["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"],us=[...$g,"rfId"],Pg=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ds={translateExtent:an,nodeOrigin:$c,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Tg(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:d}=le(Pg,he),l=de();oe(()=>(d(e.defaultNodes,e.defaultEdges),()=>{f.current=ds,c()}),[]);const f=ne(ds);return oe(()=>{for(const h of us){const u=e[h],p=f.current[h];u!==p&&(typeof e[h]>"u"||(h==="nodes"?t(u):h==="edges"?n(u):h==="minZoom"?o(u):h==="maxZoom"?r(u):h==="translateExtent"?i(u):h==="nodeExtent"?s(u):h==="ariaLabelConfig"?l.setState({ariaLabelConfig:gp(u)}):h==="fitView"?l.setState({fitViewQueued:u}):h==="fitViewOptions"?l.setState({fitViewOptions:u}):l.setState({[h]:u})))}f.current=e},us.map(h=>e[h])),null}function fs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Dg(e){const[t,n]=J(e==="system"?null:e);return oe(()=>{if(e!=="system"){n(e);return}const o=fs(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:fs()?.matches?"dark":"light"}const hs=typeof document<"u"?document:null;function dn(e=null,t={target:hs,actInsideInputWithModifier:!0}){const[n,o]=J(!1),r=ne(!1),i=ne(new Set([])),[s,c]=_e(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace(/\+/g,`
|
|
2
|
-
`).replace(`
|
|
3
|
-
|
|
4
|
-
`,`
|
|
5
|
-
+`).split(`
|
|
6
|
-
`)),f=l.reduce((h,u)=>h.concat(...u),[]);return[l,f]}return[[],[]]},[e]);return oe(()=>{const d=t?.target??hs,l=t?.actInsideInputWithModifier??!0;if(e!==null){const f=p=>{if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!l)&&lc(p))return!1;const _=gs(p.code,c);if(i.current.add(p[_]),ps(s,i.current,!1)){const w=p.composedPath?.()?.[0]||p.target,m=w?.nodeName==="BUTTON"||w?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&p.preventDefault(),o(!0)}},h=p=>{const y=gs(p.code,c);ps(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(p[y]),p.key==="Meta"&&i.current.clear(),r.current=!1},u=()=>{i.current.clear(),o(!1)};return d?.addEventListener("keydown",f),d?.addEventListener("keyup",h),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{d?.removeEventListener("keydown",f),d?.removeEventListener("keyup",h),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,o]),n}function ps(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function gs(e,t){return t.includes(e)?"code":"key"}const Rg=()=>{const e=de();return _e(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:c}=e.getState(),d=Vr(t,o,r,i,s,n?.padding??.1);return c?(await c.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:c,y:d}=s.getBoundingClientRect(),l={x:t.x-c,y:t.y-d},f=n.snapGrid??r,h=n.snapToGrid??i;return wn(l,o,h,f)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Ht(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Pc(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const c={...i};for(const d of s)Og(d,c);n.push(c)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Og(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Tc(e,t){return Pc(e,t)}function jg(e,t){return Pc(e,t)}function gt(e,t){return{id:e,type:"select",selected:t}}function It(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(gt(i.id,s)))}return o}function ms({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),c=s?.internals?.userNode??s;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function ys(e){return{id:e.id,type:"remove"}}const Hg=rc();function Lg(e,t,n={}){return xp(e,t,{...n,onError:n.onError??Hg})}const _s=e=>sp(e),zg=e=>Ja(e);function Dc(e){return lo(e)}const Rc=typeof window<"u"?it:oe;function vs(e){const[t,n]=J(BigInt(0)),[o]=J(()=>Bg(()=>n(r=>r+BigInt(1))));return Rc(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Bg(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Oc=Bt(null);function Vg({children:e}){const t=de(),n=Me(c=>{const{nodes:d=[],setNodes:l,hasDefaultNodes:f,onNodesChange:h,nodeLookup:u,fitViewQueued:p,onNodesChangeMiddlewareMap:y}=t.getState();let _=d;for(const m of c)_=typeof m=="function"?m(_):m;let w=ms({items:_,lookup:u});for(const m of y.values())w=m(w);f&&l(_),w.length>0?h?.(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:S,setNodes:g}=t.getState();m&&g(S)})},[]),o=vs(n),r=Me(c=>{const{edges:d=[],setEdges:l,hasDefaultEdges:f,onEdgesChange:h,edgeLookup:u}=t.getState();let p=d;for(const y of c)p=typeof y=="function"?y(p):y;f?l(p):h&&h(ms({items:p,lookup:u}))},[]),i=vs(r),s=_e(()=>({nodeQueue:o,edgeQueue:i}),[]);return a(Oc.Provider,{value:s,children:e})}function Fg(){const e=st(Oc);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Ug=e=>!!e.panZoom;function qr(){const e=Rg(),t=de(),n=Fg(),o=le(Ug),r=_e(()=>{const i=h=>t.getState().nodeLookup.get(h),s=h=>{n.nodeQueue.push(h)},c=h=>{n.edgeQueue.push(h)},d=h=>{const{nodeLookup:u,nodeOrigin:p}=t.getState(),y=_s(h)?h:u.get(h.id),_=y.parentId?sc(y.position,y.measured,y.parentId,u,p):y.position,w={...y,position:_,width:y.measured?.width??y.width,height:y.measured?.height??y.height};return ln(w)},l=(h,u,p={replace:!1})=>{s(y=>y.map(_=>{if(_.id===h){const w=typeof u=="function"?u(_):u;return p.replace&&_s(w)?w:{..._,...w}}return _}))},f=(h,u,p={replace:!1})=>{c(y=>y.map(_=>{if(_.id===h){const w=typeof u=="function"?u(_):u;return p.replace&&zg(w)?w:{..._,...w}}return _}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>i(h)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(u=>({...u}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:s,setEdges:c,addNodes:h=>{const u=Array.isArray(h)?h:[h];n.nodeQueue.push(p=>[...p,...u])},addEdges:h=>{const u=Array.isArray(h)?h:[h];n.edgeQueue.push(p=>[...p,...u])},toObject:()=>{const{nodes:h=[],edges:u=[],transform:p}=t.getState(),[y,_,w]=p;return{nodes:h.map(m=>({...m})),edges:u.map(m=>({...m})),viewport:{x:y,y:_,zoom:w}}},deleteElements:async({nodes:h=[],edges:u=[]})=>{const{nodes:p,edges:y,onNodesDelete:_,onEdgesDelete:w,triggerNodeChanges:m,triggerEdgeChanges:S,onDelete:g,onBeforeDelete:x}=t.getState(),{nodes:C,edges:k}=await dp({nodesToRemove:h,edgesToRemove:u,nodes:p,edges:y,onBeforeDelete:x}),E=k.length>0,T=C.length>0;if(E){const D=k.map(ys);w?.(k),S(D)}if(T){const D=C.map(ys);_?.(C),m(D)}return(T||E)&&g?.({nodes:C,edges:k}),{deletedNodes:C,deletedEdges:k}},getIntersectingNodes:(h,u=!0,p)=>{const y=Fi(h),_=y?h:d(h),w=p!==void 0;return _?(p||t.getState().nodes).filter(m=>{const S=t.getState().nodeLookup.get(m.id);if(S&&!y&&(m.id===h.id||!S.internals.positionAbsolute))return!1;const g=ln(w?m:S),x=so(g,_);return u&&x>0||x>=g.width*g.height||x>=_.width*_.height}):[]},isNodeIntersecting:(h,u,p=!0)=>{const _=Fi(h)?h:d(h);if(!_)return!1;const w=so(_,u);return p&&w>0||w>=u.width*u.height||w>=_.width*_.height},updateNode:l,updateNodeData:(h,u,p={replace:!1})=>{l(h,y=>{const _=typeof u=="function"?u(y):u;return p.replace?{...y,data:_}:{...y,data:{...y.data,..._}}},p)},updateEdge:f,updateEdgeData:(h,u,p={replace:!1})=>{f(h,y=>{const _=typeof u=="function"?u(y):u;return p.replace?{...y,data:_}:{...y,data:{...y.data,..._}}},p)},getNodesBounds:h=>{const{nodeLookup:u,nodeOrigin:p}=t.getState();return ap(h,{nodeLookup:u,nodeOrigin:p})},getHandleConnections:({type:h,id:u,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}-${h}${u?`-${u}`:""}`)?.values()??[]),getNodeConnections:({type:h,handleId:u,nodeId:p})=>Array.from(t.getState().connectionLookup.get(`${p}${h?u?`-${h}-${u}`:`-${h}`:""}`)?.values()??[]),fitView:async h=>{const u=t.getState().fitViewResolver??pp();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:u}),n.nodeQueue.push(p=>[...p]),u.promise}}},[]);return _e(()=>({...r,...e,viewportInitialized:o}),[o])}const ws=e=>e.selected,Wg=typeof window<"u"?window:void 0;function Xg({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=de(),{deleteElements:o}=qr(),r=dn(e,{actInsideInputWithModifier:!1}),i=dn(t,{target:Wg});oe(()=>{if(r){const{edges:s,nodes:c}=n.getState();o({nodes:c.filter(ws),edges:s.filter(ws)}),n.setState({nodesSelectionActive:!1})}},[r]),oe(()=>{n.setState({multiSelectionActive:i})},[i])}function Yg(e){const t=de();oe(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Fr(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",Fe.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const xo={position:"absolute",width:"100%",height:"100%",top:0,left:0},Zg=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function qg({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=_t.Free,zoomOnDoubleClick:c=!0,panOnDrag:d=!0,defaultViewport:l,translateExtent:f,minZoom:h,maxZoom:u,zoomActivationKeyCode:p,preventScrolling:y=!0,children:_,noWheelClassName:w,noPanClassName:m,onViewportChange:S,isControlledViewport:g,paneClickDistance:x,selectionOnDrag:C}){const k=de(),E=ne(null),{userSelectionActive:T,lib:D,connectionInProgress:L}=le(Zg,he),j=dn(p),B=ne();Yg(E);const N=Me(b=>{S?.({x:b[0],y:b[1],zoom:b[2]}),g||k.setState({transform:b})},[S,g]);return oe(()=>{if(E.current){B.current=Kp({domNode:E.current,minZoom:h,maxZoom:u,translateExtent:f,viewport:l,onDraggingChange:P=>k.setState($=>$.paneDragging===P?$:{paneDragging:P}),onPanZoomStart:(P,$)=>{const{onViewportChangeStart:M,onMoveStart:O}=k.getState();O?.(P,$),M?.($)},onPanZoom:(P,$)=>{const{onViewportChange:M,onMove:O}=k.getState();O?.(P,$),M?.($)},onPanZoomEnd:(P,$)=>{const{onViewportChangeEnd:M,onMoveEnd:O}=k.getState();O?.(P,$),M?.($)}});const{x:b,y:I,zoom:A}=B.current.getViewport();return k.setState({panZoom:B.current,transform:[b,I,A],domNode:E.current.closest(".react-flow")}),()=>{B.current?.destroy()}}},[]),oe(()=>{B.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:c,panOnDrag:d,zoomActivationKeyPressed:j,preventScrolling:y,noPanClassName:m,userSelectionActive:T,noWheelClassName:w,lib:D,onTransformChange:N,connectionInProgress:L,selectionOnDrag:C,paneClickDistance:x})},[e,t,n,o,r,i,s,c,d,j,y,m,T,w,D,N,L,C,x]),a("div",{className:"react-flow__renderer",ref:E,style:xo,children:_})}const Gg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Kg(){const{userSelectionActive:e,userSelectionRect:t}=le(Gg,he);return e&&t?a("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Uo=(e,t)=>n=>{n.target===t.current&&e?.(n)},Qg=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Jg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=cn.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:c,onSelectionEnd:d,onPaneClick:l,onPaneContextMenu:f,onPaneScroll:h,onPaneMouseEnter:u,onPaneMouseMove:p,onPaneMouseLeave:y,children:_}){const w=ne(0),m=de(),{userSelectionActive:S,elementsSelectable:g,dragging:x,panBy:C,autoPanSpeed:k}=le(Qg,he),E=g&&(e||S),T=ne(null),D=ne(),L=ne(new Set),j=ne(new Set),B=ne(!1),N=ne(!1),b=ne({x:0,y:0}),I=ne(!1),A=H=>{if(N.current||B.current||m.getState().connection.inProgress){N.current=!1,B.current=!1;return}l?.(H),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},P=H=>{if(Array.isArray(o)&&o?.includes(2)){H.preventDefault();return}f?.(H)},$=h?H=>h(H):void 0,M=H=>{N.current&&(H.stopPropagation(),N.current=!1)},O=H=>{if(H.pointerType==="touch"&&o!==!1&&!t)return;const{domNode:U,transform:Q}=m.getState();if(D.current=U?.getBoundingClientRect(),!D.current)return;const Y=H.target===T.current;if(!Y&&!!H.target.closest(".nokey")||!e||!(s&&Y||t)||H.button!==0||!H.isPrimary)return;H.target?.setPointerCapture?.(H.pointerId),N.current=!1;const{x:re,y:ie}=Be(H.nativeEvent,D.current),ce=wn({x:re,y:ie},Q);m.setState({userSelectionRect:{width:0,height:0,startX:ce.x,startY:ce.y,x:re,y:ie}}),Y||(H.stopPropagation(),H.preventDefault())};function z(H,U){const{userSelectionRect:Q}=m.getState();if(!Q)return;const{transform:Y,nodeLookup:W,edgeLookup:K,connectionLookup:re,triggerNodeChanges:ie,triggerEdgeChanges:ce,defaultEdgeOptions:me}=m.getState(),$e={x:Q.startX,y:Q.startY},{x:xe,y:Ee}=Ht($e,Y),be={startX:$e.x,startY:$e.y,x:H<xe?H:xe,y:U<Ee?U:Ee,width:Math.abs(H-xe),height:Math.abs(U-Ee)},Oe=L.current,we=j.current;L.current=new Set(zr(W,be,Y,n===cn.Partial,!0).map(Ce=>Ce.id)),j.current=new Set;const ve=me?.selectable??!0;for(const Ce of L.current){const je=re.get(Ce);if(je)for(const{edgeId:Pe}of je.values()){const Je=K.get(Pe);Je&&(Je.selectable??ve)&&j.current.add(Pe)}}if(!Ui(Oe,L.current)){const Ce=It(W,L.current,!0);ie(Ce)}if(!Ui(we,j.current)){const Ce=It(K,j.current);ce(Ce)}m.setState({userSelectionRect:be,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!r||!D.current)return;const[H,U]=Br(b.current,D.current,k);C({x:H,y:U}).then(Q=>{if(!N.current||!Q){w.current=requestAnimationFrame(V);return}const{x:Y,y:W}=b.current;z(Y,W),w.current=requestAnimationFrame(V)})}const Z=()=>{cancelAnimationFrame(w.current),w.current=0,I.current=!1};oe(()=>()=>Z(),[]);const F=H=>{const{userSelectionRect:U,transform:Q,resetSelectedElements:Y}=m.getState();if(!D.current||!U)return;const{x:W,y:K}=Be(H.nativeEvent,D.current);b.current={x:W,y:K};const re=Ht({x:U.startX,y:U.startY},Q);if(!N.current){const ie=t?0:i;if(Math.hypot(W-re.x,K-re.y)<=ie)return;Y(),c?.(H)}N.current=!0,I.current||(V(),I.current=!0),z(W,K)},G=H=>{if(!E){H.target===T.current&&m.getState().connection.inProgress&&(B.current=!0);return}H.button===0&&(H.target?.releasePointerCapture?.(H.pointerId),!S&&H.target===T.current&&m.getState().userSelectionRect&&A?.(H),m.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(d?.(H),m.setState({nodesSelectionActive:L.current.size>0})),Z())},ee=H=>{H.target?.releasePointerCapture?.(H.pointerId),Z()},X=o===!0||Array.isArray(o)&&o.includes(0);return a("div",{className:ge(["react-flow__pane",{draggable:X,dragging:x,selection:e}]),onClick:E?void 0:Uo(A,T),onContextMenu:Uo(P,T),onWheel:Uo($,T),onPointerEnter:E?void 0:u,onPointerMove:E?F:p,onPointerUp:G,onPointerCancel:E?ee:void 0,onPointerDownCapture:E?O:void 0,onClickCapture:E?M:void 0,onPointerLeave:y,ref:T,style:xo,children:[_,a(Kg,{})]})}function hr({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:c,onError:d}=t.getState(),l=c.get(e);if(!l){d?.("012",Fe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function jc({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const c=de(),[d,l]=J(!1),f=ne();return oe(()=>{if(!t)return f.current=jp({getStoreItems:()=>c.getState(),onNodeMouseDown:h=>{hr({id:h,store:c,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{f.current?.destroy(),f.current=void 0}},[t,c,e]),oe(()=>{t||!e.current||!f.current||f.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),d}const em=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Hc(){const e=de();return Me(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:c,updateNodePositions:d,nodeLookup:l,nodeOrigin:f}=e.getState(),h=new Map,u=em(s),p=r?i[0]:5,y=r?i[1]:5,_=n.direction.x*p*n.factor,w=n.direction.y*y*n.factor;for(const[,m]of l){if(!u(m))continue;let S={x:m.internals.positionAbsolute.x+_,y:m.internals.positionAbsolute.y+w};r&&(S=vn(S,i));const{position:g,positionAbsolute:x}=ec({nodeId:m.id,nextPosition:S,nodeLookup:l,nodeExtent:o,nodeOrigin:f,onError:c});m.position=g,m.internals.positionAbsolute=x,h.set(m.id,m)}d(h)},[])}const Gr=Bt(null),tm=Gr.Provider;Gr.Consumer;const Lc=()=>st(Gr),nm=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zc=Bt(null);function om({children:e}){const t=le(nm,he);return a(zc.Provider,{value:t,children:e})}function rm(){const e=st(zc);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const im={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},sm=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:c,toHandle:d,isValid:l}=s;if(!c&&!r)return im;const f=d?.nodeId===e&&d?.id===t&&d?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:f,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===Ot.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!r,valid:f&&l}};function am({type:e="source",position:t=q.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:c,children:d,className:l,onMouseDown:f,onTouchStart:h,...u},p){const y=s||null,_=e==="target",w=de(),m=Lc(),{connectOnClick:S,noPanClassName:g,rfId:x}=rm(),{connectingFrom:C,connectingTo:k,clickConnecting:E,isPossibleEndHandle:T,connectionInProcess:D,clickConnectionInProcess:L,valid:j}=le(sm(m,y,e),he);m||w.getState().onError?.("010",Fe.error010());const B=I=>{const{defaultEdgeOptions:A,onConnect:P,hasDefaultEdges:$}=w.getState(),M={...A,...I};if($){const{edges:O,setEdges:z,onError:V}=w.getState();z(Lg(M,O,{onError:V}))}P?.(M),c?.(M)},N=I=>{if(!m)return;const A=uc(I.nativeEvent);if(r&&(A&&I.button===0||!A)){const P=w.getState();fr.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:_,handleId:y,nodeId:m,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:(...$)=>w.getState().onConnectEnd?.(...$),updateConnection:P.updateConnection,onConnect:B,isValidConnection:n||((...$)=>w.getState().isValidConnection?.(...$)??!0),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed,dragThreshold:P.connectionDragThreshold})}A?f?.(I):h?.(I)},b=I=>{const{onClickConnectStart:A,onClickConnectEnd:P,connectionClickStartHandle:$,connectionMode:M,isValidConnection:O,lib:z,rfId:V,nodeLookup:Z,connection:F}=w.getState();if(!m||!$&&!r)return;if(!$){A?.(I.nativeEvent,{nodeId:m,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:m,type:e,id:y}});return}const G=cc(I.target),ee=n||O,{connection:X,isValid:H}=fr.isValid(I.nativeEvent,{handle:{nodeId:m,id:y,type:e},connectionMode:M,fromNodeId:$.nodeId,fromHandleId:$.id||null,fromType:$.type,isValidConnection:ee,flowId:V,doc:G,lib:z,nodeLookup:Z});H&&X&&B(X);const U=structuredClone(F);delete U.inProgress,U.toPosition=U.toHandle?U.toHandle.position:null,P?.(I,U),w.setState({connectionClickStartHandle:null})};return a("div",{"data-handleid":y,"data-nodeid":m,"data-handlepos":t,"data-id":`${x}-${m}-${y}-${e}`,className:ge(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,l,{source:!_,target:_,connectable:o,connectablestart:r,connectableend:i,clickconnecting:E,connectingfrom:C,connectingto:k,valid:j,connectionindicator:o&&(!D||T)&&(D||L?i:r)}]),onMouseDown:N,onTouchStart:N,onClick:S?b:void 0,ref:p,...u,children:d})}const zt=pe(Dc(am));function cm({data:e,isConnectable:t,sourcePosition:n=q.Bottom}){return a(ae,{children:[e?.label,a(zt,{type:"source",position:n,isConnectable:t})]})}function lm({data:e,isConnectable:t,targetPosition:n=q.Top,sourcePosition:o=q.Bottom}){return a(ae,{children:[a(zt,{type:"target",position:n,isConnectable:t}),e?.label,a(zt,{type:"source",position:o,isConnectable:t})]})}function um(){return null}function dm({data:e,isConnectable:t,targetPosition:n=q.Top}){return a(ae,{children:[a(zt,{type:"target",position:n,isConnectable:t}),e?.label]})}const ao={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xs={input:cm,default:lm,output:dm,group:um};function fm(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const hm=e=>{const{width:t,height:n,x:o,y:r}=_n(e.nodeLookup,{filter:i=>!!i.selected});return{width:ze(t)?t:null,height:ze(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function pm({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=de(),{width:r,height:i,transformString:s,userSelectionActive:c}=le(hm,he),d=Hc(),l=ne(null);oe(()=>{n||l.current?.focus({preventScroll:!0})},[n]);const f=!c&&r!==null&&i!==null;if(jc({nodeRef:l,disabled:!f}),!f)return null;const h=e?p=>{const y=o.getState().nodes.filter(_=>_.selected);e(p,y)}:void 0,u=p=>{Object.prototype.hasOwnProperty.call(ao,p.key)&&(p.preventDefault(),d({direction:ao[p.key],factor:p.shiftKey?4:1}))};return a("div",{className:ge(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:a("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:u,style:{width:r,height:i}})})}const bs=typeof window<"u"?window:void 0,gm=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Bc({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:l,selectionOnDrag:f,selectionMode:h,onSelectionStart:u,onSelectionEnd:p,multiSelectionKeyCode:y,panActivationKeyCode:_,zoomActivationKeyCode:w,elementsSelectable:m,zoomOnScroll:S,zoomOnPinch:g,panOnScroll:x,panOnScrollSpeed:C,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:T,autoPanOnSelection:D,defaultViewport:L,translateExtent:j,minZoom:B,maxZoom:N,preventScrolling:b,onSelectionContextMenu:I,noWheelClassName:A,noPanClassName:P,disableKeyboardA11y:$,onViewportChange:M,isControlledViewport:O}){const{nodesSelectionActive:z,userSelectionActive:V}=le(gm,he),Z=dn(l,{target:bs}),F=dn(_,{target:bs}),G=F||T,ee=F||x,X=f&&G!==!0,H=Z||V||X;return Xg({deleteKeyCode:d,multiSelectionKeyCode:y}),a(qg,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:S,zoomOnPinch:g,panOnScroll:ee,panActivationKeyPressed:F,panOnScrollSpeed:C,panOnScrollMode:k,zoomOnDoubleClick:E,panOnDrag:!Z&&G,defaultViewport:L,translateExtent:j,minZoom:B,maxZoom:N,zoomActivationKeyCode:w,preventScrolling:b,noWheelClassName:A,noPanClassName:P,onViewportChange:M,isControlledViewport:O,paneClickDistance:c,selectionOnDrag:X,children:a(Jg,{onSelectionStart:u,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:G,autoPanOnSelection:D,isSelecting:!!H,selectionMode:h,selectionKeyPressed:Z,paneClickDistance:c,selectionOnDrag:X,children:[e,z&&a(pm,{onSelectionContextMenu:I,noPanClassName:P,disableKeyboardA11y:$})]})})}Bc.displayName="FlowRenderer";const mm=pe(Bc),ym=e=>t=>e?zr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function _m(e){return le(Me(ym(e),[e]),he)}const vm=e=>e.updateNodeInternals;function wm(){const e=le(vm),[t]=J(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return oe(()=>()=>{t?.disconnect()},[t]),t}function xm({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=de(),i=ne(null),s=ne(null),c=ne(e.sourcePosition),d=ne(e.targetPosition),l=ne(t),f=n&&!!e.internals.handleBounds;return oe(()=>{i.current&&!e.hidden&&(!f||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[f,e.hidden]),oe(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),oe(()=>{if(i.current){const h=l.current!==t,u=c.current!==e.sourcePosition,p=d.current!==e.targetPosition;(h||u||p)&&(l.current=t,c.current=e.sourcePosition,d.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function bm({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:c,elementsSelectable:d,nodesConnectable:l,nodesFocusable:f,resizeObserver:h,noDragClassName:u,noPanClassName:p,disableKeyboardA11y:y,rfId:_,nodeTypes:w,nodeClickDistance:m,onError:S}){const{node:g,internals:x,isParent:C}=le(H=>{const U=H.nodeLookup.get(e),Q=H.parentLookup.has(e);return{node:U,internals:U.internals,isParent:Q}},he);let k=g.type||"default",E=w?.[k]||xs[k];E===void 0&&(S?.("003",Fe.error003(k)),k="default",E=w?.default||xs.default);const T=!!(g.draggable||c&&typeof g.draggable>"u"),D=!!(g.selectable||d&&typeof g.selectable>"u"),L=!!(g.connectable||l&&typeof g.connectable>"u"),j=!!(g.focusable||f&&typeof g.focusable>"u"),B=de(),N=ic(g),b=xm({node:g,nodeType:k,hasDimensions:N,resizeObserver:h}),I=jc({nodeRef:b,disabled:g.hidden||!T,noDragClassName:u,handleSelector:g.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:m}),A=Hc();if(g.hidden)return null;const P=We(g),$=fm(g),M=D||T||t||n||o||r,O=n?H=>n(H,{...x.userNode}):void 0,z=o?H=>o(H,{...x.userNode}):void 0,V=r?H=>r(H,{...x.userNode}):void 0,Z=i?H=>i(H,{...x.userNode}):void 0,F=s?H=>s(H,{...x.userNode}):void 0,G=H=>{const{selectNodesOnDrag:U,nodeDragThreshold:Q}=B.getState();D&&(!U||!T||Q>0)&&hr({id:e,store:B,nodeRef:b}),t&&t(H,{...x.userNode})},ee=H=>{if(!(lc(H.nativeEvent)||y)){if(Ga.includes(H.key)&&D){const U=H.key==="Escape";hr({id:e,store:B,unselect:U,nodeRef:b})}else if(T&&g.selected&&Object.prototype.hasOwnProperty.call(ao,H.key)){H.preventDefault();const{ariaLabelConfig:U}=B.getState();B.setState({ariaLiveMessage:U["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),A({direction:ao[H.key],factor:H.shiftKey?4:1})}}},X=()=>{if(y||!b.current?.matches(":focus-visible"))return;const{transform:H,width:U,height:Q,autoPanOnNodeFocus:Y,setCenter:W}=B.getState();if(!Y)return;zr(new Map([[e,g]]),{x:0,y:0,width:U,height:Q},H,!0).length>0||W(g.position.x+P.width/2,g.position.y+P.height/2,{zoom:H[2]})};return a("div",{className:ge(["react-flow__node",`react-flow__node-${k}`,{[p]:T},g.className,{selected:g.selected,selectable:D,parent:C,draggable:T,dragging:I}]),ref:b,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:N?"visible":"hidden",...g.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:z,onMouseLeave:V,onContextMenu:Z,onClick:G,onDoubleClick:F,onKeyDown:j?ee:void 0,tabIndex:j?0:void 0,onFocus:j?X:void 0,role:g.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Mc}-${_}`,"aria-label":g.ariaLabel,...g.domAttributes,children:a(tm,{value:e,children:a(E,{id:e,data:g.data,type:k,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:g.selected??!1,selectable:D,draggable:T,deletable:g.deletable??!0,isConnectable:L,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:I,dragHandle:g.dragHandle,zIndex:x.z,parentId:g.parentId,...P})})})}var Sm=pe(bm);const km=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Vc(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=le(km,he),i=_m(e.onlyRenderVisibleElements),s=wm();return a("div",{className:"react-flow__nodes",style:xo,children:i.map(c=>a(Sm,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},c))})}Vc.displayName="NodeRenderer";const Em=pe(Vc);function Cm(e){return le(Me(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&_p({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),he)}const Nm=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Im=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ss={[ro.Arrow]:Nm,[ro.ArrowClosed]:Im};function Mm(e){const t=de();return _e(()=>Object.prototype.hasOwnProperty.call(Ss,e)?Ss[e]:(t.getState().onError?.("009",Fe.error009(e)),null),[e])}const Am=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const d=Mm(t);return d?a("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:a(d,{color:n,strokeWidth:s})}):null},Fc=({defaultColor:e,rfId:t})=>{const n=le(i=>i.edges),o=le(i=>i.defaultEdgeOptions),r=_e(()=>Cp(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?a("svg",{className:"react-flow__marker","aria-hidden":"true",children:a("defs",{children:r.map(i=>a(Am,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Fc.displayName="MarkerDefinitions";var $m=pe(Fc);function Uc({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:c=2,children:d,className:l,...f}){const[h,u]=J({x:1,y:0,width:0,height:0}),p=ge(["react-flow__edge-textwrapper",l]),y=ne(null);return oe(()=>{if(y.current){const _=y.current.getBBox();u({x:_.x,y:_.y,width:_.width,height:_.height})}},[n]),n?a("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:p,visibility:h.width?"visible":"hidden",...f,children:[r&&a("rect",{width:h.width+2*s[0],x:-s[0],y:-s[1],height:h.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),a("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:y,style:o,children:n}),d]}):null}Uc.displayName="EdgeText";const Pm=pe(Uc);function bo({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:l=20,...f}){return a(ae,{children:[a("path",{...f,d:e,fill:"none",className:ge(["react-flow__edge-path",f.className])}),l?a("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,o&&ze(t)&&ze(n)?a(Pm,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function ks({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===q.Left||e===q.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Wc({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:o,targetY:r,targetPosition:i=q.Top}){const[s,c]=ks({pos:n,x1:e,y1:t,x2:o,y2:r}),[d,l]=ks({pos:i,x1:o,y1:r,x2:e,y2:t}),[f,h,u,p]=dc({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:d,targetControlY:l});return[`M${e},${t} C${s},${c} ${d},${l} ${o},${r}`,f,h,u,p]}function Xc(e){return pe(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:c,label:d,labelStyle:l,labelShowBg:f,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:p,style:y,markerEnd:_,markerStart:w,interactionWidth:m})=>{const[S,g,x]=Wc({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:c}),C=e.isInternal?void 0:t;return a(bo,{id:C,path:S,labelX:g,labelY:x,label:d,labelStyle:l,labelShowBg:f,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:p,style:y,markerEnd:_,markerStart:w,interactionWidth:m})})}const Tm=Xc({isInternal:!1}),Yc=Xc({isInternal:!0});Tm.displayName="SimpleBezierEdge";Yc.displayName="SimpleBezierEdgeInternal";function Zc(e){return pe(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:u,sourcePosition:p=q.Bottom,targetPosition:y=q.Top,markerEnd:_,markerStart:w,pathOptions:m,interactionWidth:S})=>{const[g,x,C]=lr({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:y,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),k=e.isInternal?void 0:t;return a(bo,{id:k,path:g,labelX:x,labelY:C,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:u,markerEnd:_,markerStart:w,interactionWidth:S})})}const qc=Zc({isInternal:!1}),Gc=Zc({isInternal:!0});qc.displayName="SmoothStepEdge";Gc.displayName="SmoothStepEdgeInternal";function Kc(e){return pe(({id:t,...n})=>{const o=e.isInternal?void 0:t;return a(qc,{...n,id:o,pathOptions:_e(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Dm=Kc({isInternal:!1}),Qc=Kc({isInternal:!0});Dm.displayName="StepEdge";Qc.displayName="StepEdgeInternal";function Jc(e){return pe(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:u,markerEnd:p,markerStart:y,interactionWidth:_})=>{const[w,m,S]=pc({sourceX:n,sourceY:o,targetX:r,targetY:i}),g=e.isInternal?void 0:t;return a(bo,{id:g,path:w,labelX:m,labelY:S,label:s,labelStyle:c,labelShowBg:d,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:u,markerEnd:p,markerStart:y,interactionWidth:_})})}const Rm=Jc({isInternal:!1}),el=Jc({isInternal:!0});Rm.displayName="StraightEdge";el.displayName="StraightEdgeInternal";function tl(e){return pe(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=q.Bottom,targetPosition:c=q.Top,label:d,labelStyle:l,labelShowBg:f,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:p,style:y,markerEnd:_,markerStart:w,pathOptions:m,interactionWidth:S})=>{const[g,x,C]=fc({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:c,curvature:m?.curvature}),k=e.isInternal?void 0:t;return a(bo,{id:k,path:g,labelX:x,labelY:C,label:d,labelStyle:l,labelShowBg:f,labelBgStyle:h,labelBgPadding:u,labelBgBorderRadius:p,style:y,markerEnd:_,markerStart:w,interactionWidth:S})})}const Om=tl({isInternal:!1}),nl=tl({isInternal:!0});Om.displayName="BezierEdge";nl.displayName="BezierEdgeInternal";const Es={default:nl,straight:el,step:Qc,smoothstep:Gc,simplebezier:Yc},Cs={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},jm=(e,t,n)=>n===q.Left?e-t:n===q.Right?e+t:e,Hm=(e,t,n)=>n===q.Top?e-t:n===q.Bottom?e+t:e,Ns="react-flow__edgeupdater";function Is({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:c}){return a("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ge([Ns,`${Ns}-${c}`]),cx:jm(t,o,e),cy:Hm(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Lm({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:c,targetPosition:d,onReconnect:l,onReconnectStart:f,onReconnectEnd:h,setReconnecting:u,setUpdateHover:p}){const y=de(),_=(x,C)=>{if(x.button!==0)return;const{autoPanOnConnect:k,domNode:E,connectionMode:T,connectionRadius:D,lib:L,onConnectStart:j,cancelConnection:B,nodeLookup:N,rfId:b,panBy:I,updateConnection:A}=y.getState(),P=C.type==="target",$=(z,V)=>{u(!1),h?.(z,n,C.type,V)},M=z=>l?.(n,z),O=(z,V)=>{u(!0),f?.(x,n,C.type),j?.(z,V)};fr.onPointerDown(x.nativeEvent,{autoPanOnConnect:k,connectionMode:T,connectionRadius:D,domNode:E,handleId:C.id,nodeId:C.nodeId,nodeLookup:N,isTarget:P,edgeUpdaterType:C.type,lib:L,flowId:b,cancelConnection:B,panBy:I,isValidConnection:(...z)=>y.getState().isValidConnection?.(...z)??!0,onConnect:M,onConnectStart:O,onConnectEnd:(...z)=>y.getState().onConnectEnd?.(...z),onReconnectEnd:$,updateConnection:A,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:x.currentTarget})},w=x=>_(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=x=>_(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),S=()=>p(!0),g=()=>p(!1);return a(ae,{children:[(e===!0||e==="source")&&a(Is,{position:c,centerX:o,centerY:r,radius:t,onMouseDown:w,onMouseEnter:S,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&a(Is,{position:d,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:S,onMouseOut:g,type:"target"})]})}function zm({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:c,onMouseMove:d,onMouseLeave:l,reconnectRadius:f,onReconnect:h,onReconnectStart:u,onReconnectEnd:p,rfId:y,edgeTypes:_,noPanClassName:w,onError:m,disableKeyboardA11y:S}){let g=le(W=>W.edgeLookup.get(e));const x=le(W=>W.defaultEdgeOptions);g=x?{...x,...g}:g;let C=g.type||"default",k=_?.[C]||Es[C];k===void 0&&(m?.("011",Fe.error011(C)),C="default",k=_?.default||Es.default);const E=!!(g.focusable||t&&typeof g.focusable>"u"),T=typeof h<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),D=!!(g.selectable||o&&typeof g.selectable>"u"),L=ne(null),[j,B]=J(!1),[N,b]=J(!1),I=de(),{zIndex:A=g.zIndex,sourceX:P,sourceY:$,targetX:M,targetY:O,sourcePosition:z,targetPosition:V}=le(Me(W=>{const K=W.nodeLookup.get(g.source),re=W.nodeLookup.get(g.target);if(!K||!re)return Cs;const ie=Ep({id:e,sourceNode:K,targetNode:re,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:W.connectionMode,onError:m}),ce=yp({selected:g.selected,zIndex:g.zIndex,sourceNode:K,targetNode:re,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode});return{...ie||Cs,zIndex:ce}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex,m]),he),Z=_e(()=>g.markerStart?`url('#${ur(g.markerStart,y)}')`:void 0,[g.markerStart,y]),F=_e(()=>g.markerEnd?`url('#${ur(g.markerEnd,y)}')`:void 0,[g.markerEnd,y]);if(g.hidden||P===null||$===null||M===null||O===null)return null;const G=W=>{const{addSelectedEdges:K,unselectNodesAndEdges:re,multiSelectionActive:ie}=I.getState();D&&(I.setState({nodesSelectionActive:!1}),g.selected&&ie?(re({nodes:[],edges:[g]}),L.current?.blur()):K([e])),r&&r(W,g)},ee=i?W=>{i(W,{...g})}:void 0,X=s?W=>{s(W,{...g})}:void 0,H=c?W=>{c(W,{...g})}:void 0,U=d?W=>{d(W,{...g})}:void 0,Q=l?W=>{l(W,{...g})}:void 0,Y=W=>{if(!S&&Ga.includes(W.key)&&D){const{unselectNodesAndEdges:K,addSelectedEdges:re}=I.getState();W.key==="Escape"?(L.current?.blur(),K({edges:[g]})):re([e])}};return a("svg",{style:{zIndex:A},children:a("g",{className:ge(["react-flow__edge",`react-flow__edge-${C}`,g.className,w,{selected:g.selected,animated:g.animated,inactive:!D&&!r,updating:j,selectable:D}]),onClick:G,onDoubleClick:ee,onContextMenu:X,onMouseEnter:H,onMouseMove:U,onMouseLeave:Q,onKeyDown:E?Y:void 0,tabIndex:E?0:void 0,role:g.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":E?`${Ac}-${y}`:void 0,ref:L,...g.domAttributes,children:[!N&&a(k,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:D,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:P,sourceY:$,targetX:M,targetY:O,sourcePosition:z,targetPosition:V,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:Z,markerEnd:F,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),T&&a(Lm,{edge:g,isReconnectable:T,reconnectRadius:f,onReconnect:h,onReconnectStart:u,onReconnectEnd:p,sourceX:P,sourceY:$,targetX:M,targetY:O,sourcePosition:z,targetPosition:V,setUpdateHover:B,setReconnecting:b})]})})}var Bm=pe(zm);const Vm=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ol({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:l,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:u,onReconnectStart:p,onReconnectEnd:y,disableKeyboardA11y:_}){const{edgesFocusable:w,edgesReconnectable:m,elementsSelectable:S,onError:g}=le(Vm,he),x=Cm(t);return a("div",{className:"react-flow__edges",children:[a($m,{defaultColor:e,rfId:n}),x.map(C=>a(Bm,{id:C,edgesFocusable:w,edgesReconnectable:m,elementsSelectable:S,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:c,onMouseMove:d,onMouseLeave:l,onClick:f,reconnectRadius:h,onDoubleClick:u,onReconnectStart:p,onReconnectEnd:y,rfId:n,onError:g,edgeTypes:o,disableKeyboardA11y:_},C))]})}ol.displayName="EdgeRenderer";const Fm=pe(ol),Ms=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Um({children:e}){const t=de(),n=ne(null),[o]=J(()=>t.getState().transform);return Rc(()=>{let r=null;const i=()=>{const s=t.getState().transform;r&&s[0]===r[0]&&s[1]===r[1]&&s[2]===r[2]||(r=s,n.current&&(n.current.style.transform=Ms(s)))};return i(),t.subscribe(i)},[t]),a("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ms(o)},children:e})}function Wm(e){const t=qr(),n=ne(!1);oe(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Xm=e=>e.panZoom?.syncViewport;function Ym(e){const t=le(Xm),n=de();return oe(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Zm(e){return e.connection.inProgress?{...e.connection,to:wn(e.connection.to,e.transform)}:{...e.connection}}function qm(e){return Zm}function Gm(e){const t=qm();return le(t,he)}const Km=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Qm({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:c,inProgress:d}=le(Km,he);return!(i&&r&&d)?null:a("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:a("g",{className:ge(["react-flow__connection",ac(c)]),children:a(rl,{style:t,type:n,CustomComponent:o,isValid:c})})})}const rl=({style:e,type:t=dt.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:c,fromPosition:d,to:l,toNode:f,toHandle:h,toPosition:u,pointer:p}=Gm();if(!r)return;if(n)return a(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:c,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:d,toPosition:u,connectionStatus:ac(o),toNode:f,toHandle:h,pointer:p});let y="";const _={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:l.x,targetY:l.y,targetPosition:u};switch(t){case dt.Bezier:[y]=fc(_);break;case dt.SimpleBezier:[y]=Wc(_);break;case dt.Step:[y]=lr({..._,borderRadius:0});break;case dt.SmoothStep:[y]=lr(_);break;default:[y]=pc(_)}return a("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};rl.displayName="ConnectionLine";const Jm={};function As(e=Jm){ne(e),de(),oe(()=>{},[e])}function e0(){de(),ne(!1),oe(()=>{},[])}function il({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:l,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:u,onSelectionEnd:p,connectionLineType:y,connectionLineStyle:_,connectionLineComponent:w,connectionLineContainerStyle:m,selectionKeyCode:S,selectionOnDrag:g,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:E,deleteKeyCode:T,onlyRenderVisibleElements:D,elementsSelectable:L,defaultViewport:j,translateExtent:B,minZoom:N,maxZoom:b,preventScrolling:I,defaultMarkerColor:A,zoomOnScroll:P,zoomOnPinch:$,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:z,zoomOnDoubleClick:V,panOnDrag:Z,autoPanOnSelection:F,onPaneClick:G,onPaneMouseEnter:ee,onPaneMouseMove:X,onPaneMouseLeave:H,onPaneScroll:U,onPaneContextMenu:Q,paneClickDistance:Y,nodeClickDistance:W,onEdgeContextMenu:K,onEdgeMouseEnter:re,onEdgeMouseMove:ie,onEdgeMouseLeave:ce,reconnectRadius:me,onReconnect:$e,onReconnectStart:xe,onReconnectEnd:Ee,noDragClassName:be,noWheelClassName:Oe,noPanClassName:we,disableKeyboardA11y:ve,nodeExtent:Ce,rfId:je,viewport:Pe,onViewportChange:Je,nodesDraggable:pt}){return As(e),As(t),e0(),Wm(n),Ym(Pe),a(mm,{onPaneClick:G,onPaneMouseEnter:ee,onPaneMouseMove:X,onPaneMouseLeave:H,onPaneContextMenu:Q,onPaneScroll:U,paneClickDistance:Y,deleteKeyCode:T,selectionKeyCode:S,selectionOnDrag:g,selectionMode:x,onSelectionStart:u,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:k,zoomActivationKeyCode:E,elementsSelectable:L,zoomOnScroll:P,zoomOnPinch:$,zoomOnDoubleClick:V,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:z,panOnDrag:Z,autoPanOnSelection:F,defaultViewport:j,translateExtent:B,minZoom:N,maxZoom:b,onSelectionContextMenu:h,preventScrolling:I,noDragClassName:be,noWheelClassName:Oe,noPanClassName:we,disableKeyboardA11y:ve,onViewportChange:Je,isControlledViewport:!!Pe,children:a(Um,{children:[a(Fm,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:$e,onReconnectStart:xe,onReconnectEnd:Ee,onlyRenderVisibleElements:D,onEdgeContextMenu:K,onEdgeMouseEnter:re,onEdgeMouseMove:ie,onEdgeMouseLeave:ce,reconnectRadius:me,defaultMarkerColor:A,noPanClassName:we,disableKeyboardA11y:ve,rfId:je}),a(Qm,{style:_,type:y,component:w,containerStyle:m}),a("div",{className:"react-flow__edgelabel-renderer"}),a(Em,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:l,onNodeContextMenu:f,nodeClickDistance:W,onlyRenderVisibleElements:D,noPanClassName:we,noDragClassName:be,disableKeyboardA11y:ve,nodeExtent:Ce,rfId:je,nodesDraggable:pt}),a("div",{className:"react-flow__viewport-portal"})]})})}il.displayName="GraphView";const t0=pe(il),n0=rc(),$s=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:d=.5,maxZoom:l=2,nodeOrigin:f,nodeExtent:h,zIndexMode:u="basic"}={})=>{const p=new Map,y=new Map,_=new Map,w=new Map,m=o??t??[],S=n??e??[],g=f??[0,0],x=h??an;yc(_,w,m);const{nodesInitialized:C}=dr(S,p,y,{nodeOrigin:g,nodeExtent:x,zIndexMode:u});let k=[0,0,1];if(s&&r&&i){const E=_n(p,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:T,y:D,zoom:L}=Vr(E,r,i,d,l,c?.padding??.1);k=[T,D,L]}return{rfId:"1",width:r??0,height:i??0,transform:k,nodes:S,nodesInitialized:C,nodeLookup:p,parentLookup:y,edges:m,edgeLookup:w,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:d,maxZoom:l,translateExtent:an,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:g,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:c,fitViewResolver:null,connection:{...Qa},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:n0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ka,zIndexMode:u,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},o0=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:d,maxZoom:l,nodeOrigin:f,nodeExtent:h,zIndexMode:u})=>mg((p,y)=>{async function _(){const{nodeLookup:w,panZoom:m,fitViewOptions:S,fitViewResolver:g,width:x,height:C,minZoom:k,maxZoom:E}=y();m&&(await up({nodes:w,width:x,height:C,panZoom:m,minZoom:k,maxZoom:E},S),g?.resolve(!0),p({fitViewResolver:null}))}return{...$s({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:d,maxZoom:l,nodeOrigin:f,nodeExtent:h,defaultNodes:n,defaultEdges:o,zIndexMode:u}),setNodes:w=>{const{nodeLookup:m,parentLookup:S,nodeOrigin:g,nodeExtent:x,elevateNodesOnSelect:C,fitViewQueued:k,zIndexMode:E,nodesSelectionActive:T}=y(),{nodesInitialized:D,hasSelectedNodes:L}=dr(w,m,S,{nodeOrigin:g,nodeExtent:x,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:E}),j=T&&L;k&&D?(_(),p({nodes:w,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:j})):p({nodes:w,nodesInitialized:D,nodesSelectionActive:j})},setEdges:w=>{const{connectionLookup:m,edgeLookup:S}=y();yc(m,S,w),p({edges:w})},setDefaultNodesAndEdges:(w,m)=>{if(w){const{setNodes:S}=y();S(w),p({hasDefaultNodes:!0})}if(m){const{setEdges:S}=y();S(m),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:m,nodeLookup:S,parentLookup:g,domNode:x,nodeOrigin:C,nodeExtent:k,debug:E,fitViewQueued:T,zIndexMode:D}=y(),{changes:L,updatedInternals:j}=Tp(w,S,g,x,C,k,D);j&&(Mp(S,g,{nodeOrigin:C,nodeExtent:k,zIndexMode:D}),T?(_(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),L?.length>0&&(E&&console.log("React Flow: trigger node changes",L),m?.(L)))},updateNodePositions:(w,m=!1)=>{const S=[];let g=[];const{nodeLookup:x,triggerNodeChanges:C,connection:k,updateConnection:E,onNodesChangeMiddlewareMap:T}=y();for(const[D,L]of w){const j=x.get(D),B=!!(j?.expandParent&&j?.parentId&&L?.position),N={id:D,type:"position",position:B?{x:Math.max(0,L.position.x),y:Math.max(0,L.position.y)}:L.position,dragging:m};if(j&&k.inProgress&&k.fromNode.id===j.id){const b=kt(j,k.fromHandle,q.Left,!0);E({...k,from:b})}B&&j.parentId&&S.push({id:D,parentId:j.parentId,rect:{...L.internals.positionAbsolute,width:L.measured.width??0,height:L.measured.height??0}}),g.push(N)}if(S.length>0){const{parentLookup:D,nodeOrigin:L}=y(),j=Zr(S,x,D,L);g.push(...j)}for(const D of T.values())g=D(g);C(g)},triggerNodeChanges:w=>{const{onNodesChange:m,setNodes:S,nodes:g,hasDefaultNodes:x,debug:C}=y();if(w?.length){if(x){const k=Tc(w,g);S(k)}C&&console.log("React Flow: trigger node changes",w),m?.(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:m,setEdges:S,edges:g,hasDefaultEdges:x,debug:C}=y();if(w?.length){if(x){const k=jg(w,g);S(k)}C&&console.log("React Flow: trigger edge changes",w),m?.(w)}},addSelectedNodes:w=>{const{multiSelectionActive:m,edgeLookup:S,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:C}=y();if(m){const k=w.map(E=>gt(E,!0));x(k);return}x(It(g,new Set([...w]),!0)),C(It(S))},addSelectedEdges:w=>{const{multiSelectionActive:m,edgeLookup:S,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:C}=y();if(m){const k=w.map(E=>gt(E,!0));C(k);return}C(It(S,new Set([...w]))),x(It(g,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:m}={})=>{const{edges:S,nodes:g,nodeLookup:x,triggerNodeChanges:C,triggerEdgeChanges:k}=y(),E=w||g,T=m||S,D=[];for(const j of E){if(!j.selected)continue;const B=x.get(j.id);B&&(B.selected=!1),D.push(gt(j.id,!1))}const L=[];for(const j of T)j.selected&&L.push(gt(j.id,!1));C(D),k(L)},setMinZoom:w=>{const{panZoom:m,maxZoom:S}=y();m?.setScaleExtent([w,S]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:m,minZoom:S}=y();m?.setScaleExtent([S,w]),p({maxZoom:w})},setTranslateExtent:w=>{y().panZoom?.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:m,triggerNodeChanges:S,triggerEdgeChanges:g,elementsSelectable:x}=y();if(!x)return;const C=m.reduce((E,T)=>T.selected?[...E,gt(T.id,!1)]:E,[]),k=w.reduce((E,T)=>T.selected?[...E,gt(T.id,!1)]:E,[]);S(C),g(k)},setNodeExtent:w=>{const{nodes:m,nodeLookup:S,parentLookup:g,nodeOrigin:x,elevateNodesOnSelect:C,nodeExtent:k,zIndexMode:E}=y();w[0][0]===k[0][0]&&w[0][1]===k[0][1]&&w[1][0]===k[1][0]&&w[1][1]===k[1][1]||(dr(m,S,g,{nodeOrigin:x,nodeExtent:w,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:E}),p({nodeExtent:w}))},panBy:w=>{const{transform:m,width:S,height:g,panZoom:x,translateExtent:C}=y();return Dp({delta:w,panZoom:x,transform:m,translateExtent:C,width:S,height:g})},setCenter:async(w,m,S)=>{const{width:g,height:x,maxZoom:C,panZoom:k}=y();if(!k)return!1;const E=typeof S?.zoom<"u"?S.zoom:C;return await k.setViewport({x:g/2-w*E,y:x/2-m*E,zoom:E},{duration:S?.duration,ease:S?.ease,interpolate:S?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Qa}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...$s()})}},Object.is);function r0({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:c,initialFitViewOptions:d,fitView:l,nodeOrigin:f,nodeExtent:h,zIndexMode:u,children:p}){const[y]=J(()=>o0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:l,minZoom:s,maxZoom:c,fitViewOptions:d,nodeOrigin:f,nodeExtent:h,zIndexMode:u}));return a(yg,{value:y,children:a(Vg,{children:a(om,{children:p})})})}function i0({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:c,fitViewOptions:d,minZoom:l,maxZoom:f,nodeOrigin:h,nodeExtent:u,zIndexMode:p}){return st(vo)?a(ae,{children:e}):a(r0,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:c,initialFitViewOptions:d,initialMinZoom:l,initialMaxZoom:f,nodeOrigin:h,nodeExtent:u,zIndexMode:p,children:e})}const s0={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function a0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:c,onEdgeClick:d,onInit:l,onMove:f,onMoveStart:h,onMoveEnd:u,onConnect:p,onConnectStart:y,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:m,onNodeMouseEnter:S,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:C,onNodeDoubleClick:k,onNodeDragStart:E,onNodeDrag:T,onNodeDragStop:D,onNodesDelete:L,onEdgesDelete:j,onDelete:B,onSelectionChange:N,onSelectionDragStart:b,onSelectionDrag:I,onSelectionDragStop:A,onSelectionContextMenu:P,onSelectionStart:$,onSelectionEnd:M,onBeforeDelete:O,connectionMode:z,connectionLineType:V=dt.Bezier,connectionLineStyle:Z,connectionLineComponent:F,connectionLineContainerStyle:G,deleteKeyCode:ee="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:H=!1,selectionMode:U=cn.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:Y=un()?"Meta":"Control",zoomActivationKeyCode:W=un()?"Meta":"Control",snapToGrid:K,snapGrid:re,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:ce,nodesDraggable:me,autoPanOnNodeFocus:$e,nodesConnectable:xe,nodesFocusable:Ee,nodeOrigin:be=$c,edgesFocusable:Oe,edgesReconnectable:we,elementsSelectable:ve=!0,defaultViewport:Ce=Ag,minZoom:je=.5,maxZoom:Pe=2,translateExtent:Je=an,preventScrolling:pt=!0,nodeExtent:Vt,defaultMarkerColor:ko="#b1b1b7",zoomOnScroll:bn=!0,zoomOnPinch:Eo=!0,panOnScroll:Sn=!1,panOnScrollSpeed:Se=.5,panOnScrollMode:Co=_t.Free,zoomOnDoubleClick:Ft=!0,panOnDrag:kn=!0,onPaneClick:En,onPaneMouseEnter:Cn,onPaneMouseMove:No,onPaneMouseLeave:v,onPaneScroll:R,onPaneContextMenu:se,paneClickDistance:Te=1,nodeClickDistance:Ne=0,children:Io,onReconnect:yl,onReconnectStart:_l,onReconnectEnd:vl,onEdgeContextMenu:wl,onEdgeDoubleClick:xl,onEdgeMouseEnter:bl,onEdgeMouseMove:Sl,onEdgeMouseLeave:kl,reconnectRadius:El=10,onNodesChange:Cl,onEdgesChange:Nl,noDragClassName:Il="nodrag",noWheelClassName:Ml="nowheel",noPanClassName:Kr="nopan",fitView:Qr,fitViewOptions:Jr,connectOnClick:Al,attributionPosition:$l,proOptions:Pl,defaultEdgeOptions:Tl,elevateNodesOnSelect:Dl=!0,elevateEdgesOnSelect:Rl=!1,disableKeyboardA11y:ei=!1,autoPanOnConnect:Ol,autoPanOnNodeDrag:jl,autoPanOnSelection:Hl=!0,autoPanSpeed:Ll,connectionRadius:zl,isValidConnection:Bl,onError:Vl,style:Fl,id:ti,nodeDragThreshold:Ul,connectionDragThreshold:Wl,viewport:Xl,onViewportChange:Yl,width:Zl,height:ql,colorMode:Gl="light",debug:Kl,onScroll:ni,ariaLabelConfig:Ql,zIndexMode:oi="basic",...Jl},eu){const Mo=ti||"1",tu=Dg(Gl),nu=Me(ri=>{ri.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ni?.(ri)},[ni]);return a("div",{"data-testid":"rf__wrapper",...Jl,onScroll:nu,style:{...Fl,...s0},ref:eu,className:ge(["react-flow",r,tu]),id:ti,role:"application",children:a(i0,{nodes:e,edges:t,width:Zl,height:ql,fitView:Qr,fitViewOptions:Jr,minZoom:je,maxZoom:Pe,nodeOrigin:be,nodeExtent:Vt,zIndexMode:oi,children:[a(Tg,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:y,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:m,nodesDraggable:me,autoPanOnNodeFocus:$e,nodesConnectable:xe,nodesFocusable:Ee,edgesFocusable:Oe,edgesReconnectable:we,elementsSelectable:ve,elevateNodesOnSelect:Dl,elevateEdgesOnSelect:Rl,minZoom:je,maxZoom:Pe,nodeExtent:Vt,onNodesChange:Cl,onEdgesChange:Nl,snapToGrid:K,snapGrid:re,connectionMode:z,translateExtent:Je,connectOnClick:Al,defaultEdgeOptions:Tl,fitView:Qr,fitViewOptions:Jr,onNodesDelete:L,onEdgesDelete:j,onDelete:B,onNodeDragStart:E,onNodeDrag:T,onNodeDragStop:D,onSelectionDrag:I,onSelectionDragStart:b,onSelectionDragStop:A,onMove:f,onMoveStart:h,onMoveEnd:u,noPanClassName:Kr,nodeOrigin:be,rfId:Mo,autoPanOnConnect:Ol,autoPanOnNodeDrag:jl,autoPanSpeed:Ll,onError:Vl,connectionRadius:zl,isValidConnection:Bl,selectNodesOnDrag:ce,nodeDragThreshold:Ul,connectionDragThreshold:Wl,onBeforeDelete:O,debug:Kl,ariaLabelConfig:Ql,zIndexMode:oi}),a(t0,{onInit:l,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:S,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:C,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:Z,connectionLineComponent:F,connectionLineContainerStyle:G,selectionKeyCode:X,selectionOnDrag:H,selectionMode:U,deleteKeyCode:ee,multiSelectionKeyCode:Y,panActivationKeyCode:Q,zoomActivationKeyCode:W,onlyRenderVisibleElements:ie,defaultViewport:Ce,translateExtent:Je,minZoom:je,maxZoom:Pe,preventScrolling:pt,zoomOnScroll:bn,zoomOnPinch:Eo,zoomOnDoubleClick:Ft,panOnScroll:Sn,panOnScrollSpeed:Se,panOnScrollMode:Co,panOnDrag:kn,autoPanOnSelection:Hl,onPaneClick:En,onPaneMouseEnter:Cn,onPaneMouseMove:No,onPaneMouseLeave:v,onPaneScroll:R,onPaneContextMenu:se,paneClickDistance:Te,nodeClickDistance:Ne,onSelectionContextMenu:P,onSelectionStart:$,onSelectionEnd:M,onReconnect:yl,onReconnectStart:_l,onReconnectEnd:vl,onEdgeContextMenu:wl,onEdgeDoubleClick:xl,onEdgeMouseEnter:bl,onEdgeMouseMove:Sl,onEdgeMouseLeave:kl,reconnectRadius:El,defaultMarkerColor:ko,noDragClassName:Il,noWheelClassName:Ml,noPanClassName:Kr,rfId:Mo,disableKeyboardA11y:ei,nodeExtent:Vt,viewport:Xl,onViewportChange:Yl,nodesDraggable:me}),a(Mg,{onSelectionChange:N}),Io,a(kg,{proOptions:Pl,position:$l}),a(Sg,{rfId:Mo,disableKeyboardA11y:ei})]})})}var c0=Dc(a0);function l0({dimensions:e,lineWidth:t,variant:n,className:o}){return a("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ge(["react-flow__background-pattern",n,o])})}function u0({radius:e,className:t}){return a("circle",{cx:e,cy:e,r:e,className:ge(["react-flow__background-pattern","dots",t])})}var ht;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ht||(ht={}));const d0={[ht.Dots]:1,[ht.Lines]:1,[ht.Cross]:6},f0=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sl({id:e,variant:t=ht.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:c,style:d,className:l,patternClassName:f}){const h=ne(null),{transform:u,patternId:p}=le(f0,he),y=o||d0[t],_=t===ht.Dots,w=t===ht.Cross,m=Array.isArray(n)?n:[n,n],S=[m[0]*u[2]||1,m[1]*u[2]||1],g=y*u[2],x=Array.isArray(i)?i:[i,i],C=w?[g,g]:S,k=[x[0]*u[2]+C[0]/2,x[1]*u[2]+C[1]/2],E=`${p}${e||""}`;return a("svg",{className:ge(["react-flow__background",l]),style:{...d,...xo,"--xy-background-color-props":c,"--xy-background-pattern-color-props":s},ref:h,"data-testid":"rf__background",children:[a("pattern",{id:E,x:u[0]%S[0],y:u[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:_?a(u0,{radius:g/2,className:f}):a(l0,{dimensions:C,lineWidth:r,variant:t,className:f})}),a("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}sl.displayName="Background";const h0=pe(sl);function p0(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function g0(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a("path",{d:"M0 0h32v4.2H0z"})})}function m0(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function y0(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function _0(){return a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function On({children:e,className:t,...n}){return a("button",{type:"button",className:ge(["react-flow__controls-button",t]),...n,children:e})}const v0=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function al({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:c,onInteractiveChange:d,className:l,children:f,position:h="bottom-left",orientation:u="vertical","aria-label":p}){const y=de(),{isInteractive:_,minZoomReached:w,maxZoomReached:m,ariaLabelConfig:S}=le(v0,he),{zoomIn:g,zoomOut:x,fitView:C}=qr(),k=()=>{g(),i?.()},E=()=>{x(),s?.()},T=()=>{C(r),c?.()},D=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),d?.(!_)};return a(wo,{className:ge(["react-flow__controls",u==="horizontal"?"horizontal":"vertical",l]),position:h,style:e,"data-testid":"rf__controls","aria-label":p??S["controls.ariaLabel"],children:[t&&a(ae,{children:[a(On,{onClick:k,className:"react-flow__controls-zoomin",title:S["controls.zoomIn.ariaLabel"],"aria-label":S["controls.zoomIn.ariaLabel"],disabled:m,children:a(p0,{})}),a(On,{onClick:E,className:"react-flow__controls-zoomout",title:S["controls.zoomOut.ariaLabel"],"aria-label":S["controls.zoomOut.ariaLabel"],disabled:w,children:a(g0,{})})]}),n&&a(On,{className:"react-flow__controls-fitview",onClick:T,title:S["controls.fitView.ariaLabel"],"aria-label":S["controls.fitView.ariaLabel"],children:a(m0,{})}),o&&a(On,{className:"react-flow__controls-interactive",onClick:D,title:S["controls.interactive.ariaLabel"],"aria-label":S["controls.interactive.ariaLabel"],children:_?a(_0,{}):a(y0,{})}),f]})}al.displayName="Controls";const w0=pe(al);function x0({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:c,strokeWidth:d,className:l,borderRadius:f,shapeRendering:h,selected:u,onClick:p}){const{background:y,backgroundColor:_}=i||{},w=s||y||_;return a("rect",{className:ge(["react-flow__minimap-node",{selected:u},l]),x:t,y:n,rx:f,ry:f,width:o,height:r,style:{fill:w,stroke:c,strokeWidth:d},shapeRendering:h,onClick:p?m=>p(m,e):void 0})}const b0=pe(x0),S0=e=>e.nodes.map(t=>t.id),Wo=e=>e instanceof Function?e:()=>e;function k0({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=b0,onClick:s}){const c=le(S0,he),d=Wo(t),l=Wo(e),f=Wo(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a(ae,{children:c.map(u=>a(C0,{id:u,nodeColorFunc:d,nodeStrokeColorFunc:l,nodeClassNameFunc:f,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:h},u))})}function E0({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:c,onClick:d}){const{node:l,x:f,y:h,width:u,height:p}=le(y=>{const _=y.nodeLookup.get(e);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const w=_.internals.userNode,{x:m,y:S}=_.internals.positionAbsolute,{width:g,height:x}=We(w);return{node:w,x:m,y:S,width:g,height:x}},he);return!l||l.hidden||!ic(l)?null:a(c,{x:f,y:h,width:u,height:p,style:l.style,selected:!!l.selected,className:o(l),color:t(l),borderRadius:r,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:d,id:l.id})}const C0=pe(E0);var N0=pe(k0);const I0=200,M0=150,A0=e=>!e.hidden,$0=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const o of e.nodeLookup.values())if(!o.hidden){n=!0;break}return{viewBB:t,boundingRect:n?nc(_n(e.nodeLookup,{filter:A0}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ps=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,P0=(e,t)=>Ps(e.viewBB,t.viewBB)&&Ps(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,T0="react-flow__minimap-desc";function cl({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:c,bgColor:d,maskColor:l,maskStrokeColor:f,maskStrokeWidth:h,position:u="bottom-right",onClick:p,onNodeClick:y,pannable:_=!1,zoomable:w=!1,ariaLabel:m,inversePan:S,zoomStep:g=1,offsetScale:x=5}){const C=de(),k=ne(null),{boundingRect:E,panZoom:T,viewBB:D,rfId:L,translateExtent:j,flowWidth:B,flowHeight:N,ariaLabelConfig:b}=le($0,P0),I=e?.width??I0,A=e?.height??M0,P=E.width/I,$=E.height/A,M=Math.max(P,$),O=M*I,z=M*A,V=x*M,Z=E.x-(O-E.width)/2-V,F=E.y-(z-E.height)/2-V,G=O+V*2,ee=z+V*2,X=`${T0}-${L}`,H=ne(0),U=ne();H.current=M,oe(()=>{const re=C.getState().panZoom;if(k.current&&re)return U.current=Fp({domNode:k.current,panZoom:re,getTransform:()=>C.getState().transform,getViewScale:()=>H.current}),()=>{U.current?.destroy()}},[T]),oe(()=>{U.current?.update({translateExtent:j,width:B,height:N,inversePan:S,pannable:_,zoomStep:g,zoomable:w})},[_,w,S,g,j,B,N]);const Q=p?re=>{const[ie,ce]=U.current?.pointer(re)||[0,0];p(re,{x:ie,y:ce})}:void 0,Y=Me((re,ie)=>{const ce=C.getState().nodeLookup.get(ie).internals.userNode;y?.(re,ce)},[y]),W=y?Y:void 0,K=m??b["minimap.ariaLabel"];return a(wo,{position:u,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*M:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ge(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a("svg",{width:I,height:A,viewBox:`${Z} ${F} ${G} ${ee}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:k,onClick:Q,children:[K&&a("title",{id:X,children:K}),a(N0,{onClick:W,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:c}),a("path",{className:"react-flow__minimap-mask",d:`M${Z-V},${F-V}h${G+V*2}v${ee+V*2}h${-G-V*2}z
|
|
7
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}cl.displayName="MiniMap";const D0=pe(cl),R0=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,O0={[Lt.Line]:"right",[Lt.Handle]:"bottom-right"};function j0({nodeId:e,position:t,variant:n=Lt.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:c=10,minHeight:d=10,maxWidth:l=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:u,autoScale:p=!0,shouldResize:y,onResizeStart:_,onResize:w,onResizeEnd:m}){const S=Lc(),g=typeof e=="string"?e:S,x=de(),C=ne(null),k=n===Lt.Handle,E=le(Me(R0(k&&p),[k,p]),he),T=ne(null),D=t??O0[n];oe(()=>{if(!(!C.current||!g))return T.current||(T.current=ng({domNode:C.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:j,transform:B,snapGrid:N,snapToGrid:b,nodeOrigin:I,domNode:A}=x.getState();return{nodeLookup:j,transform:B,snapGrid:N,snapToGrid:b,nodeOrigin:I,paneDomNode:A}},onChange:(j,B)=>{const{triggerNodeChanges:N,nodeLookup:b,parentLookup:I,nodeOrigin:A}=x.getState(),P=[],$={x:j.x,y:j.y},M=b.get(g);if(M&&M.expandParent&&M.parentId){const O=M.origin??A,z=j.width??M.measured.width??0,V=j.height??M.measured.height??0,Z={id:M.id,parentId:M.parentId,rect:{width:z,height:V,...sc({x:j.x??M.position.x,y:j.y??M.position.y},{width:z,height:V},M.parentId,b,O)}},F=Zr([Z],b,I,A);P.push(...F),$.x=j.x?Math.max(O[0]*z,j.x):void 0,$.y=j.y?Math.max(O[1]*V,j.y):void 0}if($.x!==void 0&&$.y!==void 0){const O={id:g,type:"position",position:{...$}};P.push(O)}if(j.width!==void 0&&j.height!==void 0){const z={id:g,type:"dimensions",resizing:!0,setAttributes:u?u==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};P.push(z)}for(const O of B){const z={...O,type:"position"};P.push(z)}N(P)},onEnd:({width:j,height:B})=>{const N={id:g,type:"dimensions",resizing:!1,dimensions:{width:j,height:B}};x.getState().triggerNodeChanges([N])}})),T.current.update({controlPosition:D,boundaries:{minWidth:c,minHeight:d,maxWidth:l,maxHeight:f},keepAspectRatio:h,resizeDirection:u,onResizeStart:_,onResize:w,onResizeEnd:m,shouldResize:y}),()=>{T.current?.destroy()}},[D,c,d,l,f,h,_,w,m,y]);const L=D.split("-");return a("div",{className:ge(["react-flow__resize-control","nodrag",...L,n,o]),ref:C,style:{...r,scale:E,...s&&{[k?"backgroundColor":"borderColor"]:s}},children:i})}pe(j0);function H0(e){let t=2166136261;for(const n of e)t=Math.imul(t^n.charCodeAt(0),16777619)>>>0;return"#"+[0,8,16].map(n=>(60+(t>>>n&255)%111).toString(16).padStart(2,"0")).join("")}const ll=e=>e.color||H0(e.id),pr=(e,t,n)=>n&&e.missions[n]?.color||ll(e.projects[t]||{id:t});function L0(e,t,n={},o){let r=[],i=[],s=0;const c=t.query.trim().toLowerCase(),d=(...g)=>g.join(" ").toLowerCase().includes(c),l=(g,x,C,k)=>r.push({id:g,type:"work",position:{x,y:C},data:k}),f=(g,x,C)=>i.push({id:`${g}:${x}`,source:g,target:x,type:"smoothstep",style:{stroke:C,strokeWidth:1.5}});for(const g of Object.values(e.projects).filter(x=>!x.archivedAt&&(t.project==="all"||x.id===t.project)).sort((x,C)=>x.name.localeCompare(C.name)||x.id.localeCompare(C.id))){const x=s,C=[];for(const k of Object.values(e.missions).filter(E=>E.projectId===g.id&&!E.archivedAt).sort((E,T)=>E.name.localeCompare(T.name)||E.id.localeCompare(T.id))){const E=Object.values(e.tasks).filter(N=>N.missionId===k.id),T=E.filter(N=>(t.agent==="all"||N.updatedBy===t.agent)&&(t.status==="all"||N.status===t.status)&&d(g.name,k.name,N.title,N.note)).sort((N,b)=>N.createdAt.localeCompare(b.createdAt)||N.id.localeCompare(b.id)),D=t.agent==="all"||Object.values(e.sessions).some(N=>N.agent===t.agent&&(N.missionId===k.id||N.missionIds?.includes(k.id)));if(!T.length&&!(E.length===0&&t.status==="all"&&D&&d(g.name,k.name)))continue;const L=s,j=pr(e,g.id,k.id);for(const N of T)l(N.id,800,s*170,{label:N.title,kind:"Task",status:N.status,color:j,href:`#/tasks/${encodeURIComponent(N.id)}`,summary:`${N.updatedBy} · ${N.status==="completed"?"100%":N.status==="todo"?"0%":N.progress!==void 0?`${N.progress}%`:"Progress not reported"}`}),f(k.id,N.id,j),s++;T.length||s++;const B=(L+s-1)*85;l(k.id,400,B,{label:k.name,kind:"Mission",status:k.status,color:j,href:`#/missions/${encodeURIComponent(k.id)}`,summary:`${T.length} ${t.status==="all"&&t.agent==="all"&&!c?"":"matching "}tasks`}),C.push(k.id),f(g.id,k.id,j),s+=.35}!C.length&&!(t.agent==="all"&&t.status==="all"&&d(g.name)&&!Object.values(e.missions).some(k=>k.projectId===g.id&&!k.archivedAt))||(C.length||s++,l(g.id,0,(x+s-1)*85,{label:g.name,kind:"Project",status:"active",color:pr(e,g.id),href:`#/projects/${encodeURIComponent(g.id)}`,summary:`${C.length} missions`}),s++)}const h={projects:r.filter(g=>g.data.kind==="Project").length,missions:r.filter(g=>g.data.kind==="Mission").length,tasks:r.filter(g=>g.data.kind==="Task").length},u=i,p=new Set(o?.projects),y=new Set(o?.missions);for(const g of r)g.data.childCount=u.filter(x=>x.source===g.id).length,g.data.expanded=!o||(g.data.kind==="Project"?p.has(g.id):y.has(g.id));if(o){const g=new Set(r.filter(E=>E.data.kind==="Project").map(E=>E.id)),x=new Set(u.filter(E=>g.has(E.source)&&p.has(E.source)).map(E=>E.target)),C=new Set(u.filter(E=>x.has(E.source)&&y.has(E.source)).map(E=>E.target));r=r.filter(E=>g.has(E.id)||x.has(E.id)||C.has(E.id));const k=new Set(r.map(E=>E.id));i=i.filter(E=>k.has(E.source)&&k.has(E.target))}const _=new Map(r.map(g=>[g.id,g])),w=g=>i.filter(x=>x.source===g).map(x=>_.get(x.target));let m=0;for(const g of r.filter(x=>x.data.kind==="Project")){const x=w(g.id),C=x.some(L=>w(L.id).length>0),k=Math.min(C?2:3,Math.max(1,x.length)),E=C?540:260,T=k*E;g.position={x:m+(T-220)/2,y:0};let D=180;for(let L=0;L<x.length;L+=k){const j=x.slice(L,L+k);let B=0;for(const[N,b]of j.entries()){const I=w(b.id),A=Math.min(2,Math.max(1,I.length)),P=m+N*E;b.position={x:P+(E-220)/2,y:D};const $=P+(E-(A===2?480:220))/2;for(const[M,O]of I.entries())O.position={x:$+M%2*260,y:D+160+Math.floor(M/2)*150};B=Math.max(B,Math.ceil(I.length/2))}D+=B?160+B*150+50:156}m+=T+70}o&&p.size===0&&r.filter(g=>g.data.kind==="Project").forEach((g,x)=>{g.position={x:x%3*260,y:Math.floor(x/3)*156}});const S=[...Object.values(n)];for(const g of r)if(n[g.id])g.position=n[g.id];else{for(;S.some(x=>Math.abs(x.x-g.position.x)<240&&Math.abs(x.y-g.position.y)<136);)g.position={x:g.position.x,y:g.position.y+156};S.push(g.position)}return{nodes:r,edges:i,counts:h}}const ul={active:"Active",planned:"Planned",running:"Running",todo:"To do",in_progress:"In progress",blocked:"Blocked",completed:"Completed",failed:"Failed",cancelled:"Cancelled"},gr="angine-graph-manual-positions-compact-v5";function z0(){try{const e=JSON.parse(localStorage.getItem(gr)||"{}");return Object.fromEntries(Object.entries(e).filter(([,t])=>t&&Number.isFinite(t.x)&&Number.isFinite(t.y)))}catch{return{}}}function B0({data:e}){return a("div",{class:"graph-card",style:{borderInlineStart:`4px solid ${e.color}`},children:[a(zt,{type:"target",position:q.Top,isConnectable:!1}),a("div",{class:"graph-card-top",children:[a("span",{children:e.kind}),a("span",{class:`badge ${e.status}`,children:ul[e.status]||e.status})]}),a("a",{class:"nodrag",href:e.href,title:e.label,children:[e.label,a("span",{"aria-hidden":"true",children:" ↗"})]}),a("p",{children:e.summary}),!!e.childCount&&e.toggle&&a("button",{class:"nodrag graph-expand","aria-expanded":e.expanded,onClick:e.toggle,children:[e.expanded?"− Hide":"+ Show"," ",e.kind==="Project"?"missions":"tasks"]}),a(zt,{type:"source",position:q.Bottom,isConnectable:!1})]})}const V0={work:B0};function F0({state:e,filters:t,setFilters:n,reset:o}){const r=ne(z0()),i=ne({...r.current}),[s,c]=J([]),[d,l]=J(null),[f,h]=J(0),u=ne(""),[p,y]=J([]),[_,w]=J([]),m=!!(t.query||t.project!=="all"||t.agent!=="all"||t.status!=="all"),S=(N,b)=>{u.current=b==="Project"?N:e.missions[N]?.projectId||"",(b==="Project"?y:w)(A=>A.includes(N)?A.filter(P=>P!==N):[...A,N]),i.current={...r.current},c([]),h(A=>A+1)},g=()=>{u.current="",r.current={},y([]),w([]),i.current={},c([]),h(N=>N+1),o()},x=ne(""),C=()=>{const N=s.find(I=>I.id===u.current)||s.find(I=>I.data.kind==="Project")||s[0],b=document.querySelector(".graph-canvas")?.clientWidth||1e3;if(!p.length&&!m){d?.fitView({padding:.15,minZoom:.65,maxZoom:.9,duration:250});return}N&&d?.setViewport({x:b/2-(N.position.x+110)*.9,y:45-N.position.y*.9,zoom:.9},{duration:250})},k=()=>{d?.fitView({padding:.2,minZoom:.65,maxZoom:1,duration:250})};oe(()=>{const N=JSON.stringify([t.project,t.agent,t.status,t.query,f,p,_]);d&&s.length&&x.current!==N&&(x.current=N,requestAnimationFrame(C)),s.length||(x.current="")},[d,s.length,t.project,t.agent,t.status,t.query,f,p,_]);const E=_e(()=>L0(e,t,i.current,{projects:m?Object.keys(e.projects):p,missions:m?Object.keys(e.missions):_}),[e,t.project,t.agent,t.status,t.query,f,p,_]),T=()=>{try{localStorage.setItem(gr,JSON.stringify(r.current))}catch{}};oe(()=>{c(N=>{const b=new Map(N.map(I=>[I.id,I]));return E.nodes.map(I=>{const A=b.get(I.id)?.position||I.position;return i.current[I.id]=A,{...b.get(I.id),...I,position:A,data:{...I.data,toggle:m?void 0:()=>S(I.id,I.data.kind)}}})})},[E]),oe(()=>{for(const N of s)i.current[N.id]=N.position;T()},[s]);const D=Object.values(e.projects).filter(N=>!N.archivedAt).sort((N,b)=>N.name.localeCompare(b.name)),L=[...new Set([...Object.values(e.sessions).map(N=>N.agent),...Object.values(e.tasks).map(N=>N.updatedBy)])].sort(),j=!!(t.query||t.project!=="all"||t.agent!=="all"||t.status!=="all");return a("section",{class:"graph-view",children:[a("div",{class:"graph-heading",children:[a("div",{children:[a("h1",{children:"Work graph"}),a("p",{children:"Projects → Missions → Tasks · Live from agent reports"})]}),a("div",{class:"graph-actions",children:[a("button",{class:"secondary-button",onClick:k,children:"Fit view"}),a("button",{class:"secondary-button",onClick:g,children:"All projects"}),a("button",{class:"secondary-button",onClick:()=>{i.current={...r.current},c([]),y(Object.keys(e.projects)),w(Object.keys(e.missions)),h(N=>N+1)},children:"Expand all"}),a("button",{class:"secondary-button",onClick:()=>{r.current={},i.current={};try{localStorage.removeItem(gr)}catch{}c([]),h(N=>N+1)},children:"Auto arrange"})]})]}),a("div",{class:"toolbar graph-toolbar",children:[a("label",{class:"search",children:[a("span",{"aria-hidden":"true",children:"⌕"}),a("input",{"aria-label":"Search graph",placeholder:"Search projects, missions, tasks…",value:t.query,onInput:N=>n({query:N.currentTarget.value})})]}),a("label",{class:"filter-label",children:[a("span",{children:"Project"}),a("select",{"aria-label":"Graph project",value:t.project,onChange:N=>n({project:N.currentTarget.value}),children:[a("option",{value:"all",children:"All projects"}),D.map(N=>a("option",{value:N.id,children:N.name},N.id))]})]}),a("label",{class:"filter-label",children:[a("span",{children:"Agent"}),a("select",{"aria-label":"Graph agent",value:t.agent,onChange:N=>n({agent:N.currentTarget.value}),children:[a("option",{value:"all",children:"All agents"}),L.map(N=>a("option",{value:N,children:N},N))]})]}),a("label",{class:"filter-label",children:[a("span",{children:"Task status"}),a("select",{"aria-label":"Graph task status",value:t.status,onChange:N=>n({status:N.currentTarget.value}),children:[a("option",{value:"all",children:"All statuses"}),["todo","in_progress","blocked","completed","failed","cancelled"].map(N=>a("option",{value:N,children:ul[N]},N))]})]}),j&&a("button",{class:"clear-filters",onClick:o,children:"Reset"})]}),a("div",{class:"graph-meta",children:[a("span",{children:[E.counts.projects," projects · ",E.counts.missions," missions · ",E.counts.tasks," tasks · ",E.nodes.length," nodes shown"]}),a("span",{children:"Show missions and tasks to explore · Drag to arrange · Scroll to zoom"})]}),a("div",{class:"graph-canvas",role:"region","aria-label":"Interactive project mission and task graph",children:E.nodes.length?a(c0,{nodes:s,edges:E.edges,nodeTypes:V0,onNodesChange:N=>c(b=>Tc(N,b)),onNodeDragStop:(N,b)=>{i.current[b.id]=b.position,r.current[b.id]=b.position,T()},onInit:l,defaultViewport:{x:40,y:40,zoom:.9},minZoom:.3,maxZoom:2,nodesConnectable:!1,edgesReconnectable:!1,deleteKeyCode:null,children:[a(h0,{gap:22,size:1}),a(w0,{showInteractive:!1,showFitView:!1}),a(D0,{pannable:!0,zoomable:!0,nodeColor:N=>String(N.data.color||"#94a3b8")})]}):a("div",{class:"empty",children:[a("h2",{children:j?"No work matches these filters":"Your graph will grow here"}),a("p",{children:j?"Try another project, agent, or task status.":"Ask a connected agent to report a mission. Its project and tasks will appear automatically."}),j?a("button",{class:"secondary-button",onClick:o,children:"Clear filters"}):a("a",{href:"#/agents",children:"Check agent connections"})]})})]})}const Xt=(e,t,n)=>e?{borderInlineStart:`3px solid ${pr(e,t,n)}`}:void 0;function U0({project:e,mission:t,mutate:n}){const[o,r]=J(!1),i=t?{missionId:t.id}:{projectId:e.id},s=async d=>{r(!0);try{await n("color",{...i,color:d})}finally{r(!1)}},c=t?t.color:e.color;return a("div",{class:"color-control",children:[a("label",{children:[a("span",{children:t?"Mission color":"Project color"}),a("input",{type:"color","aria-label":t?"Choose mission color override":"Choose project color",value:c||ll(e),disabled:o,onChange:d=>{s(d.currentTarget.value)}})]}),a("p",{children:t?c?"Custom color for this mission and its tasks.":"Inherits the project color.":"Used by all missions and tasks without an override."}),c&&a("button",{class:"text-button",disabled:o,onClick:()=>{s(null)},children:t?"Use project color":"Reset to automatic"}),o&&a("span",{role:"status",children:"Saving…"})]})}function Ts(){return Object.fromEntries([["claude","Other"],["codex","Other"],["antigravity","Other"],["grok","Other"]].map(([e,t])=>{const n=`${e}-default`,o={id:`profile_${n}`,key:n,name:`${e[0].toUpperCase()+e.slice(1)} / ${t}`,agent:e,context:t,isDefault:!0};return[o.id,o]}))}function en(e,t=60,n=Date.now()){return t>0&&["running","in_progress","blocked"].includes(e.status)&&n-Date.parse(e.updatedAt)>=t*6e4}function W0(e,t){return!e||t.seq<=e.seq?[]:Object.values(t.tasks).filter(n=>{const o=e.tasks[n.id];return o&&o.status!==n.status&&["completed","blocked"].includes(n.status)&&!t.projects[n.projectId]?.archivedAt&&!t.missions?.[n.missionId]?.archivedAt})}const X0=e=>`prj_${e}`,Ds=e=>e?.path.split(/[\\/]/).filter(Boolean).pop()||"Project";function Y0(e,t,n){return JSON.parse(JSON.stringify({id:e.projectId,key:n?.key||Ds(t),workspaceId:e.workspaceId,name:n?.name||Ds(t),description:n?.description,color:n?.color,status:"active",createdAt:n&&n.createdAt<e.createdAt?n.createdAt:e.createdAt,updatedAt:n&&n.updatedAt>e.updatedAt?n.updatedAt:e.updatedAt,archivedAt:n?.archivedAt,latestUpdate:n?.latestUpdate,latestMonitoring:n?.latestMonitoring}))}function Z0(e){if(e.schemaVersion!==void 0&&e.schemaVersion!==1&&e.schemaVersion!==2)throw new Error("Unsupported Angine state version");if(e.schemaVersion===2)return{...e,missions:e.missions||{},profiles:e.profiles||Ts()};const t={},n={},o=e.workspaces||{};for(const s of Object.values(e.projects||{})){const c={...s,projectId:X0(s.workspaceId)};t[c.id]=c,n[c.projectId]=Y0(c,o[c.workspaceId],n[c.projectId])}const r={};for(const s of Object.values(e.tasks||{})){const c=t[s.projectId];r[s.id]={...s,missionId:s.missionId||s.projectId,projectId:c?.projectId||s.projectId}}const i={};for(const s of Object.values(e.sessions||{})){const c=s.missionIds||s.projectIds||[s.projectId];i[s.id]={...s,missionId:s.missionId||s.projectId,missionIds:c,projectId:t[s.projectId]?.projectId||s.projectId,projectIds:[...new Set(c.map(d=>t[d]?.projectId||d))]}}return{schemaVersion:2,seq:e.seq||0,workspaces:o,projects:n,missions:t,tasks:r,sessions:i,profiles:e.profiles||Ts()}}function dl(e,t){return!!(e.projects[t.projectId]?.archivedAt||e.missions?.[t.missionId]?.archivedAt)}const q0=3,G0=75e3;function xn(e,t=Date.now()){return!e.closedAt&&t-Date.parse(e.lastSeenAt)<G0?"connected":"disconnected"}function fl(e,t){return t?e?.reporters.find(n=>n.id===t):void 0}function K0(e,t=Date.now()){const n=new Map;for(const o of e){const r=JSON.stringify([o.agent,o.profileId||o.profileKey||"default"]);let i=n.get(r);i||(i={id:r,agent:o.agent,profileId:o.profileId,profileKey:o.profileKey,reporters:[],connected:0,sentUpdates:0,connectedOnly:0,issues:0},n.set(r,i)),i.reporters.push(o);const s=xn(o,t)==="connected";s&&i.connected++,o.successfulReports>0?i.sentUpdates++:s&&i.connectedOnly++,o.issue&&i.issues++}return[...n.values()].map(o=>({...o,reporters:o.reporters.sort((r,i)=>+!!i.issue-+!!r.issue||+(i.successfulReports>0)-+(r.successfulReports>0)||(i.lastReportAt||"").localeCompare(r.lastReportAt||"")||i.startedAt.localeCompare(r.startedAt))})).sort((o,r)=>r.issues-o.issues||o.agent.localeCompare(r.agent))}function hl(e,t,n,o,r=Date.now()){return t.filter(i=>!e.projects[i.projectId]?.archivedAt&&!e.missions?.[i.missionId]?.archivedAt).flatMap(i=>{if(i.status==="blocked")return[{task:i,reason:i.blocker?.nextStep||i.blocker?.reason||"Blocked — open for details"}];if(i.status==="failed")return[{task:i,reason:"Agent reported failure"}];if(i.status!=="in_progress")return[];const s=fl(n,e.sessions[i.updatedBySessionId||""]?.reporterId);return s?.issue?[{task:i,reason:"Reporter needs attention"}]:s&&xn(s,r)==="disconnected"?[{task:i,reason:"Reporter disconnected — task status unconfirmed"}]:en(i,o,r)?[{task:i,reason:"No recent task update"}]:[]})}const Xo=e=>e[0].toUpperCase()+e.slice(1),mr=e=>e?new Date(e).toLocaleString():"No reports yet";function Q0(){const[e,t]=J(null),[n,o]=J("checking");return oe(()=>{let r=!1,i=!1;const s=new AbortController,c=async()=>{if(!i){i=!0;try{const l=await fetch("/api/health",{signal:s.signal});if(r)return;if(l.status===404){o("outdated"),t(null);return}if(!l.ok)throw new Error;const f=await l.json();if(r)return;t(f),o(f.protocolVersion===q0?"ready":"outdated")}catch{r||(o("unavailable"),t(null))}finally{i=!1}}};c();const d=setInterval(()=>{c()},15e3);return()=>{r=!0,s.abort(),clearInterval(d)}},[]),{health:e,compatibility:n}}function J0({compatibility:e}){return e!=="outdated"?null:a("div",{class:"server-notice",role:"status",children:[a("strong",{children:"Update the running server"}),a("span",{children:["Run ",a("code",{children:"angine restart"}),", refresh this page, then restart your agent sessions. New controls need the updated server."]})]})}function pl({reporter:e}){const t=e?xn(e):"unknown";return a("span",{class:`reporter-health ${t}`,title:"This describes the Angine reporter connection, not whether the agent is currently working.",children:[a("span",{}),t==="connected"?"Reporter connected":t==="disconnected"?"Reporter disconnected":"Connection not tracked"]})}function ey({health:e,session:t}){const n=fl(e,t.reporterId);return a("div",{class:"reporting-details",children:[a(pl,{reporter:n}),a("p",{children:["Last task report: ",mr(t.lastSeenAt)]}),n&&a("p",{children:[n.successfulReports," accepted · ",n.failedReports," rejected reports since server start"]}),a("p",{children:"Task status is agent reported. A connection heartbeat does not confirm task progress."})]})}const ty=e=>e.issue==="profile_missing"?"Profile not found. Check the configured profile key.":e.issue==="reporter_outdated"?"Restart this agent session to load the updated reporter.":e.issue==="report_rejected"?"A report was rejected. Check its profile and task keys; the next accepted report clears this warning.":"";function ny({health:e,compatibility:t,profile:n,profiles:o={}}){const[r,i]=J(!1),s=(e?.reporters||[]).filter(h=>!n||h.profileId===n.id||h.profileKey===n.key&&h.agent===n.agent).sort((h,u)=>u.lastSeenAt.localeCompare(h.lastSeenAt)),c=K0(s),d=s.filter(h=>xn(h)==="connected").length,l=n?["mcp","--agent",n.agent,"--profile",n.key]:void 0,f=n?JSON.stringify({command:"angine",args:l},null,2):"angine setup";return a("section",{class:"panel connection-panel",children:[a("div",{class:"panel-heading",children:[a("h2",{children:"Connections"}),a("span",{children:t==="ready"?`${d} connected`:t==="outdated"?"Server update needed":t==="checking"?"Checking…":"Unable to check"})]}),a("p",{class:"muted",children:"Connected means the integration is reachable. “Sent updates” counts reporters that submitted work since the server started; “connected only” means no work updates in that time. Neither confirms the agent is currently working."}),c.map(h=>a("details",{class:"connection-group",children:[a("summary",{children:[a("span",{children:[a("strong",{children:[o[h.profileId||""]?.name||Xo(h.agent),!h.profileId&&h.profileKey?` · ${h.profileKey}`:""]}),a("span",{children:[h.connected," connected · ",h.sentUpdates," sent updates · ",h.connectedOnly," connected only"]})]}),a("span",{class:h.issues?"connection-issue":"connection-group-expand",children:h.issues?`${h.issues} need attention`:`${h.reporters.length} reporters`})]}),a("div",{class:"connection-group-rows",children:h.reporters.map(u=>a("div",{class:"connection-row",children:[a("div",{children:[a("strong",{children:[Xo(u.agent)," · ",u.id.slice(0,8)]}),a(pl,{reporter:u}),a("span",{children:u.lastReportAt?`Last known report: ${mr(u.lastReportAt)}`:"No task updates received in this server session"}),u.issue&&a("p",{class:"connection-issue",children:ty(u)})]}),a("details",{children:[a("summary",{children:"Details"}),a("dl",{children:[a("dt",{children:"Profile"}),a("dd",{children:o[u.profileId||""]?.name||u.profileKey||"Agent default"}),a("dt",{children:"Reporter version"}),a("dd",{children:u.version||"Unknown"}),a("dt",{children:"Last heartbeat"}),a("dd",{children:mr(u.lastSeenAt)}),a("dt",{children:"Accepted since server start"}),a("dd",{children:u.successfulReports}),a("dt",{children:"Rejected since server start"}),a("dd",{children:u.failedReports}),a("dt",{children:"Reporter ID"}),a("dd",{children:u.id}),u.sourceSessionId&&a(ae,{children:[a("dt",{children:"Agent session"}),a("dd",{children:u.sourceSessionId})]})]})]})]},u.id))})]},h.id)),!s.length&&a("p",{class:"muted",children:["No tracked connections ",n?"for this profile ":"","yet. Restart your configured agent session to load the updated reporter."]}),a("details",{class:"connect-instructions",children:[a("summary",{children:n?"Connect this profile":"Connect an agent"}),a("p",{children:n?"Use this configuration for the agent’s Angine MCP connection. The profile key assigns its reports here.":"Run setup once, then restart Claude or Codex sessions. Setup registers their local MCP reporter."}),a("pre",{children:f}),a("button",{class:"secondary-button",onClick:async()=>{try{await navigator.clipboard.writeText(f),i(!0)}catch{i(!1)}},children:r?"Copied":"Copy setup"}),a("p",{class:"muted",children:"After reconnecting, ask the agent to use Angine’s check_connection tool. A successful check confirms the reporter and profile; reports will appear when the agent sends work updates."}),n?.isDefault&&a("p",{class:"muted",children:["This is the default profile for ",Xo(n.agent),". Existing connections without an explicit profile key use it automatically."]})]})]})}function oy({state:e,tasks:t,health:n,staleMinutes:o}){const r=hl(e,t,n,o),i=t.filter(s=>s.status==="in_progress").length;return a("details",{class:`attention-summary ${r.length?"has-attention":""}`,children:[a("summary",{children:[a("span",{children:[a("strong",{children:r.length?`${r.length} need attention`:"No tasks need attention"}),a("span",{children:[i," in progress · Based on the current filters"]})]}),a("span",{class:"attention-expand",children:"View details"})]}),a("div",{class:"attention-items",children:[r.slice(0,10).map(({task:s,reason:c})=>a("a",{href:`#/tasks/${encodeURIComponent(s.id)}`,children:[a("strong",{children:s.title}),a("span",{class:"attention-context",children:[a("b",{children:"Project:"})," ",e.projects[s.projectId]?.name||"Unknown project"," ",a("span",{"aria-hidden":"true",children:" / "}),a("b",{children:"Mission:"})," ",e.missions[s.missionId]?.name||"Unknown mission"]}),a("span",{class:"attention-reason",children:c})]},s.id)),!r.length&&a("p",{class:"muted",children:"No blocked, failed, stale, or tracked disconnected tasks in this view. This is based on reports received, not independent verification of the work."}),r.length>10&&a("p",{class:"muted",children:"Showing the first 10. Use the task filters to review the remaining work."})]})]})}const Yo={agent:"all",status:"all",project:"all",mission:"all",profile:"all",query:"",staleOnly:!1},tn=e=>({codex:"Codex",claude:"Claude",antigravity:"Antigravity",grok:"Grok",external:"External"})[(e||"external").trim()]||e||"External",Re=(e,t)=>`#/${e}${t?`/${encodeURIComponent(t)}`:""}`;function gl(e,t){try{return JSON.parse(localStorage.getItem(e)||"null")??t}catch{return t}}function ml(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function ry(e){const[t,n]=J(()=>gl("angine-filters-v1",{}));oe(()=>ml("angine-filters-v1",t),[t]);const o={...Yo,...t[e]},r=i=>n(s=>({...s,[e]:{...Yo,...s[e],...i}}));return{filters:o,set:r,reset:()=>r({...Yo}),resetAll:()=>n({})}}function iy(){const[e,t]=J(()=>{const n=gl("angine-preferences-v1",{staleMinutes:60,notifications:!1});return{staleMinutes:[0,15,60,240,1440].includes(n.staleMinutes)?n.staleMinutes:60,notifications:n.notifications===!0}});return oe(()=>ml("angine-preferences-v1",e),[e]),{preferences:e,setPreferences:t}}function sy(e,t){const n=ne(null);oe(()=>{if(!e)return;const o=W0(n.current,e);if(n.current=e,!t||!o.length||typeof Notification>"u"||Notification.permission!=="granted")return;const r=o.filter(d=>d.status==="completed").length,i=o.length-r,s=o.length===1?`Angine · Task ${o[0].status}`:"Angine · Work updated",c=o.length===1?o[0].title:[r?`${r} completed`:"",i?`${i} blocked`:""].filter(Boolean).join(" · ");try{const d=new Notification(s,{body:c,tag:"angine-work-update"});d.onclick=()=>{window.focus(),location.hash=Re("tasks",o[0].id).slice(1),d.close()}}catch{}},[e,t])}async function ay(e,t){if(!(await fetch("/api/dashboard/session")).ok)throw new Error("Run angine restart in your terminal to load the new dashboard controls, then refresh this page and save again.");const o=await fetch(`/api/dashboard/${e}`,{method:"POST",headers:{"Content-Type":"application/json","X-Angine-UI":"1"},body:JSON.stringify(t)}),r=await o.json();if(!o.ok)throw new Error(r.error||"Could not save the change.");return r.state}function So(e,t){if(t)return t?.profileId?e.profiles?.[t.profileId]:Object.values(e.profiles||{}).find(n=>n.isDefault&&n.agent===(t?.agent||"external"))}function yr(e,t){return So(e,e.sessions[t.updatedBySessionId||""])||Object.values(e.profiles||{}).find(n=>n.isDefault&&n.agent===(t.updatedBy||"external"))}function jn({item:e,minutes:t}){return t>0&&en(e,t)?a("span",{class:"stale-tag",title:`No reported update since ${new Date(e.updatedAt).toLocaleString()}`,children:"Stale"}):null}function cy({profile:e,mutate:t,close:n}){const[o,r]=J(()=>e||{agent:"external",context:"Personal",isDefault:!0}),[i,s]=J(!1),c={name:"A name you recognise in Angine, such as Team Agent or Development Agent.",agent:"The agent reporting the work: claude, codex, grok, or another agent name. Use external for a generic reporter. This must match the reporter’s agent type.",key:"A unique ID for this profile, such as team-agent. Use this key in the reporter’s --profile setting to link its reports here. It cannot be changed after saving.",context:"What you use this agent for, such as Work or Personal. This label helps you identify and filter its work.",ownerName:"Optional. The person using this agent. Enter the name yourself; Angine does not read it from the agent account.",ownerEmail:"Optional. The owner’s email for identifying whose work this is. It is not used to sign in or send email.",accountLabel:"Optional. A nickname for the account, such as Company account or Personal account. Enter a label, never a password or API key.",description:"Optional. A short note explaining what this profile is used for, such as development and code reviews."},d=(l,f,h=!1,u=160)=>a("label",{children:[f,a("input",{type:l==="ownerEmail"?"email":"text",required:h,readOnly:!!(e&&(l==="agent"||l==="key")),maxLength:u,value:String(o[l]??""),"aria-describedby":`profile-help-${l}`,onInput:p=>r({...o,[l]:p.currentTarget.value})}),a("span",{class:"field-help",id:`profile-help-${l}`,children:c[l]})]});return a("form",{class:"panel profile-form",onSubmit:async l=>{l.preventDefault(),s(!0);const f=await t("profiles",o);s(!1),f&&n()},children:[a("div",{class:"panel-heading",children:[a("h2",{children:e?"Edit profile":"New agent profile"}),a("button",{type:"button",class:"text-button",onClick:n,children:"Close"})]}),a("div",{class:"form-grid",children:[d("name","Profile name",!0),d("agent","Agent type",!0,80),d("key","Stable profile key",!0),d("context","Context (Work, Personal…)",!0,80),d("ownerName","Owner name"),d("ownerEmail","Owner email"),d("accountLabel","Account label"),d("description","Description",!1,500)]}),a("label",{class:"check-label",children:[a("input",{type:"checkbox","aria-describedby":"profile-help-default",checked:o.isDefault===!0,onChange:l=>r({...o,isDefault:l.currentTarget.checked})}),"Default profile for this agent type"]}),a("p",{class:"field-help",id:"profile-help-default",children:"Reports from this agent type use this profile when no profile key is specified. For example, making this the Claude default labels Claude reports with this profile. Only one profile can be the default for each agent type."}),a("p",{class:"muted",children:"Saving creates the profile. To link reports, make it the default or configure the agent’s Angine reporter with this profile key. Saving does not start or configure an agent."}),a("button",{class:"primary-button",disabled:i,children:i?"Saving…":"Save profile"})]})}function ly({state:e,profileId:t,mutate:n,taskRow:o,health:r,compatibility:i}){const[s,c]=J(null),d=Object.values(e.profiles||{}).sort((_,w)=>_.name.localeCompare(w.name)),l=t?e.profiles?.[t]:void 0,f=_=>Object.values(e.sessions).filter(w=>So(e,w)?.id===_.id),h=_=>Object.values(e.tasks).filter(w=>yr(e,w)?.id===_.id&&!dl(e,w)),u=_=>{const w=new Set([...h(_).map(m=>m.projectId),...f(_).flatMap(m=>m.projectIds||[m.projectId])]);return Object.values(e.projects).filter(m=>w.has(m.id)&&!m.archivedAt)},p=_=>{const w=new Set([...h(_).map(m=>m.missionId),...f(_).flatMap(m=>m.missionIds||[m.missionId])]);return Object.values(e.missions).filter(m=>w.has(m.id)&&!m.archivedAt&&!e.projects[m.projectId]?.archivedAt)},y=_=>{const w=f(_).sort((C,k)=>k.lastSeenAt.localeCompare(C.lastSeenAt)),m=C=>w.find(k=>k.id!==C.id&&C.parentAgentId===k.agentId&&C.sourceSessionId&&k.sourceSessionId===C.sourceSessionId&&k.workspaceId===C.workspaceId),S=[],g=new Set,x=(C,k)=>{g.has(C.id)||(g.add(C.id),S.push({session:C,depth:k}),w.filter(E=>m(E)?.id===C.id).forEach(E=>x(E,k+1)))};return w.filter(C=>!m(C)).forEach(C=>x(C,0)),w.forEach(C=>x(C,0)),S};return t&&!l?a("div",{class:"empty",children:[a("h2",{children:"Profile not found"}),a("a",{href:Re("agents"),children:"All agents"})]}):a(ae,{children:[a("div",{class:"view-heading",children:[a("div",{children:[a("h1",{children:l?.name||"Agents & sessions"}),a("p",{children:l?`${l.context} · ${tn(l.agent)}`:"Profiles, collaboration, and reported agent sessions."})]}),a("button",{class:"primary-button",onClick:()=>c(l||"new"),children:l?"Edit profile":"Add profile"})]}),s&&a(cy,{profile:s==="new"?void 0:s,mutate:n,close:()=>c(null)},s==="new"?"new":s.id),a(ny,{profiles:e.profiles,health:r,compatibility:i,profile:l}),l?a(ae,{children:[a("nav",{class:"breadcrumbs",children:[a("a",{href:Re("agents"),children:"Agents"}),a("span",{children:"/"}),a("span",{children:l.name})]}),a("div",{class:"profile-summary panel",children:[a("span",{children:[u(l).length," projects"]}),a("span",{children:[p(l).length," missions"]}),a("span",{children:[h(l).length," tasks"]}),a("span",{children:[f(l).length," sessions"]}),l.ownerName&&a("span",{children:["Owner: ",l.ownerName]}),l.ownerEmail&&a("span",{children:l.ownerEmail}),l.accountLabel&&a("span",{children:["Account: ",l.accountLabel]})]}),a("section",{class:"panel",children:[a("h2",{children:"Projects"}),a("div",{class:"linked-projects",children:[u(l).map(_=>a("a",{href:Re("projects",_.id),children:[_.name,a("span",{children:_.status})]})),!u(l).length&&a("p",{class:"muted",children:"No projects reported for this profile yet."})]})]}),a("section",{class:"panel",children:[a("h2",{children:"Missions"}),a("div",{class:"linked-projects",children:[p(l).map(_=>a("a",{href:Re("missions",_.id),children:[_.name,a("span",{children:[e.projects[_.projectId]?.name," · ",_.status]})]},_.id)),!p(l).length&&a("p",{class:"muted",children:"No missions reported for this profile yet."})]})]}),a("section",{class:"panel",children:[a("h2",{children:"Tasks"}),a("div",{class:"task-table",children:h(l).map(o)})]}),a("section",{class:"panel",children:[a("h2",{children:"Sessions & child agents"}),a("div",{class:"sessions-view",children:[y(l).map(({session:_,depth:w})=>a("div",{class:"session-card",style:{marginLeft:`${Math.min(w,4)*20}px`},children:[a("strong",{children:_.agentId||tn(_.agent)}),a("span",{children:[_.parentAgentId?`Child of ${_.parentAgentId}`:"Reporter session"," · Last report ",new Date(_.lastSeenAt).toLocaleString()]}),a("dl",{children:[a("dt",{children:"Angine session"}),a("dd",{children:_.id}),_.sourceSessionId&&a(ae,{children:[a("dt",{children:"Agent session"}),a("dd",{children:_.sourceSessionId})]}),a("dt",{children:"Projects"}),a("dd",{children:(_.projectIds||[_.projectId]).map(m=>a("a",{class:"session-project",href:Re("projects",m),children:e.projects[m]?.name||m}))}),a("dt",{children:"Missions"}),a("dd",{children:(_.missionIds||[_.missionId]).map(m=>a("a",{class:"session-project",href:Re("missions",m),children:e.missions[m]?.name||m}))}),a("dt",{children:"Latest task reports"}),a("dd",{children:Object.values(e.tasks).filter(m=>m.updatedBySessionId===_.id).map(m=>a("a",{class:"session-project",href:Re("tasks",m.id),children:m.title}))})]})]},_.id)),!f(l).length&&a("p",{class:"muted",children:"Sessions appear when this agent reports work. Child links require reported parent IDs."})]})]})]}):a("div",{class:"profile-grid",children:d.map(_=>a("article",{class:"panel profile-card",children:[a("div",{class:"panel-heading",children:[a("a",{href:Re("agents",_.id),children:a("h2",{children:_.name})}),a("button",{class:"text-button",onClick:()=>c(_),children:"Edit"})]}),a("div",{class:"profile-labels",children:[a("span",{children:tn(_.agent)}),a("span",{children:_.context}),_.isDefault&&a("span",{children:"Default"})]}),_.description&&a("p",{class:"muted",children:_.description}),_.ownerName&&a("p",{class:"muted",children:[_.ownerName,_.ownerEmail?` · ${_.ownerEmail}`:""]}),a("a",{class:"profile-counts",href:Re("agents",_.id),children:[a("span",{children:[u(_).length," projects"]}),a("span",{children:[p(_).length," missions"]}),a("span",{children:[h(_).length," tasks"]}),a("span",{children:[f(_).length," sessions ↗"]})]})]},_.id))})]})}function uy({task:e,state:t,mutate:n}){const[o,r]=J(e.blocker?.reason||""),[i,s]=J(e.blocker?.nextStep||""),[c,d]=J(e.blocker?.owner||""),[l,f]=J(e.relatedTaskKeys||[]),[h,u]=J(!1),[p,y]=J(!1),_=Object.values(t.tasks).filter(m=>m.missionId===e.missionId&&m.id!==e.id),w=_.filter(m=>l.includes(m.key)||m.relatedTaskKeys?.includes(e.key));return a("section",{class:"panel",children:[a("h2",{children:e.status==="blocked"?"Blocker & related work":"Related work"}),w.length?a("div",{class:"related-links",children:w.map(m=>a("a",{href:Re("tasks",m.id),children:[m.title,a("span",{children:[tn(m.updatedBy)," · ",m.status.replaceAll("_"," ")]})]}))}):a("p",{class:"muted",children:"Link related tasks from any agent working in this mission."}),a("form",{class:"workflow-form",onSubmit:async m=>{m.preventDefault(),u(!0);const S=await n("task-details",{taskId:e.id,relatedTaskKeys:l,...e.status==="blocked"?{blocker:o.trim()?{reason:o,nextStep:i,owner:c}:null}:{}});u(!1),y(S)},children:[e.status==="blocked"&&a(ae,{children:[a("label",{children:["What is blocking this task?",a("textarea",{maxLength:500,value:o,onInput:m=>{r(m.currentTarget.value),y(!1)},placeholder:e.note||"Describe the blocker…"})]}),a("label",{children:["What needs to happen next?",a("textarea",{maxLength:500,value:i,onInput:m=>{s(m.currentTarget.value),y(!1)}})]}),a("label",{children:["Who can unblock it?",a("input",{maxLength:160,value:c,onInput:m=>{d(m.currentTarget.value),y(!1)}})]})]}),a("label",{children:["Related tasks",a("select",{multiple:!0,onChange:m=>{f(Array.from(m.currentTarget.selectedOptions).map(S=>S.value)),y(!1)},size:Math.min(5,Math.max(2,_.length)),children:_.map(m=>a("option",{value:m.key,selected:l.includes(m.key),children:[m.title," · ",tn(m.updatedBy)]}))})]}),a("p",{class:"muted",children:"Select related tasks; use ⌘ or Ctrl to select more than one. Shared project and mission keys link work across agents automatically."}),a("button",{class:"primary-button",disabled:h,children:h?"Saving…":"Save details"}),p&&a("span",{class:"saved-message",children:"Saved"})]})]})}function dy({state:e,mutate:t}){const n=[...Object.values(e.projects).filter(o=>o.archivedAt).map(o=>({...o,kind:"projects"})),...Object.values(e.missions).filter(o=>o.archivedAt).map(o=>({...o,kind:"missions"}))].sort((o,r)=>r.archivedAt.localeCompare(o.archivedAt));return a(ae,{children:[a("div",{class:"view-heading",children:a("div",{children:[a("h1",{children:["Archive ",a("span",{class:"section-count",children:n.length})]}),a("p",{children:"Projects and missions hidden from the main views. Tasks and history are preserved."})]})}),a("div",{class:"panel archive-list",children:[n.map(o=>a("div",{children:[a("a",{href:Re(o.kind,o.id),children:[a("strong",{children:o.name}),a("span",{children:[o.kind==="missions"?`Mission · ${e.projects[o.projectId]?.name||""}`:"Project"," · Archived ",new Date(o.archivedAt).toLocaleString()]}),o.kind==="missions"&&e.projects[o.projectId]?.archivedAt&&a("span",{children:"Restore the parent project to make this mission visible."})]}),a("button",{class:"secondary-button",onClick:()=>t("archive",{projectId:o.id,archived:!1}),children:"Restore"})]},o.id)),!n.length&&a("p",{class:"muted",children:"No archived projects or missions."})]})]})}function fy({preferences:e,setPreferences:t,resetFilters:n}){const[o,r]=J("");return a(ae,{children:[a("div",{class:"view-heading",children:a("div",{children:[a("h1",{children:"Preferences"}),a("p",{children:"Activity indicators, saved filters, and optional alerts."})]})}),a("section",{class:"panel settings-panel",children:[a("h2",{children:"Stale activity"}),a("label",{children:["Flag active work after no reported update for",a("select",{value:e.staleMinutes,onChange:i=>t({...e,staleMinutes:Number(i.currentTarget.value)}),children:[a("option",{value:0,children:"Off"}),a("option",{value:15,children:"15 minutes"}),a("option",{value:60,children:"1 hour"}),a("option",{value:240,children:"4 hours"}),a("option",{value:1440,children:"1 day"})]})]}),a("p",{class:"muted",children:"Stale describes reporting activity. It does not change a task's status."})]}),a("section",{class:"panel settings-panel",children:[a("h2",{children:"Saved filters"}),a("p",{class:"muted",children:"Project, mission, agent, profile, status, and search selections are remembered separately for each view on this device."}),a("button",{class:"secondary-button",onClick:()=>{n(),r("Saved filters reset.")},children:"Reset saved filters"})]}),a("section",{class:"panel settings-panel",children:[a("h2",{children:"Desktop notifications"}),a("p",{class:"muted",children:"Optional alerts for tasks that finish or become blocked. The dashboard must remain open."}),a("button",{class:"secondary-button",onClick:async()=>{if(e.notifications){t({...e,notifications:!1}),r("Notifications disabled.");return}if(typeof Notification>"u"){r("This browser does not support desktop notifications.");return}try{await Notification.requestPermission()==="granted"?(t({...e,notifications:!0}),r("Notifications enabled.")):r("Notification permission was not granted.")}catch{r("Notifications are unavailable in this browser.")}},children:e.notifications?"Disable notifications":"Enable notifications"}),a("p",{class:"muted",role:"status",children:o})]})]})}const Ye={todo:"To do",in_progress:"In progress",blocked:"Blocked",completed:"Completed",failed:"Failed",cancelled:"Cancelled",planned:"Planned",running:"Running",active:"Active"},Xn={request:"Request",implementation:"Implementation",deployment:"Deployment",monitoring:"Monitoring",blocker:"Blocker"},De=e=>e?.trim()||"external",Ze=e=>({codex:"Codex",claude:"Claude",antigravity:"Antigravity",grok:"Grok",external:"External"})[De(e)]||De(e),ft=e=>{const t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/6e4));return t<1?"Just now":t<60?`${t}m ago`:t<1440?`${Math.floor(t/60)}h ago`:`${Math.floor(t/1440)}d ago`},Zo=e=>e.status==="completed"?100:e.status==="todo"?0:e.progress,ye=(e,t)=>`#/${e}${t?`/${encodeURIComponent(t)}`:""}`;function Mt({status:e}){return a("span",{class:`badge ${e}`,children:[a("span",{class:"status-dot"}),Ye[e]||e]})}function hy({update:e,state:t}){const n=e.missionId?t.missions[e.missionId]:void 0;return a("section",{class:"panel work-update-card",children:[a("div",{class:"panel-heading",children:[a("h2",{children:"Latest agent update"}),a(Mt,{status:e.status})]}),a("div",{class:"work-update-meta",children:[a("strong",{children:Xn[e.phase]||e.phase}),a("span",{children:[Ze(e.updatedBy)," · ",ft(e.reportedAt),e.environment?` · ${e.environment}`:""]}),n&&a("a",{href:ye("missions",n.id),children:n.name})]}),a("p",{children:e.summary}),e.nextStep&&a("div",{class:"work-update-next",children:[a("strong",{children:"Next"}),a("span",{children:e.nextStep})]}),a("small",{children:"Agent reported · Angine does not independently verify deployments or production health."})]})}function Rs({updates:e,state:t}){return e.length?a("section",{class:"monitoring-panel","aria-label":"Monitoring checkpoints",children:[a("div",{class:"monitoring-heading",children:[a("span",{class:"monitoring-mark","aria-hidden":"true",children:"◉"}),a("div",{children:[a("h2",{children:"Monitoring"}),a("span",{children:"Latest reported checks"})]}),a("strong",{children:e.length})]}),a("div",{class:"monitoring-list",children:e.map(n=>{const o=n.missionId?t.missions[n.missionId]:void 0,r=t.projects[n.projectId],i=o?ye("missions",o.id):ye("projects",n.projectId);return a("a",{class:"monitoring-row",href:i,children:[a("span",{class:"monitoring-copy",children:[a("span",{class:"monitoring-location",children:[r?.name||"Project",o?` · ${o.name}`:""]}),a("strong",{children:n.summary}),n.nextStep&&a("span",{class:"monitoring-next",children:["Next: ",n.nextStep]}),a("span",{class:"monitoring-byline",children:[Ze(n.updatedBy)," · ",ft(n.reportedAt)]})]}),a("span",{class:"monitoring-state",children:[a(Mt,{status:n.status}),n.environment&&a("span",{class:"monitoring-environment",children:n.environment})]}),a("span",{class:"row-arrow",children:"↗"})]},n.id)})})]}):null}function Hn({value:e,caption:t="Progress"}){return a("div",{class:"progress",children:[a("div",{class:"progress-label",children:[a("span",{children:t}),a("strong",{children:e==null?"Not reported":`${Math.round(e)}%`})]}),a("div",{class:`track ${e==null?"unknown":""}`,role:e==null?void 0:"progressbar","aria-label":t,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,children:e!=null&&a("span",{style:{width:`${e}%`}})})]})}function py({session:e,state:t,health:n}){const o=So(t,e);return a("div",{class:"reporter",children:[a("div",{class:"reporter-title",children:[a("span",{class:"avatar",children:Ze(e.agent).slice(0,1)}),a("div",{children:[a("strong",{children:o?.name||Ze(e.agent)}),a("span",{children:[e.agentId||"Reporter"," · ",ft(e.lastSeenAt)]})]})]}),a("dl",{children:[o&&a(ae,{children:[a("dt",{children:"Profile"}),a("dd",{children:a("a",{href:ye("agents",o.id),children:o.name})})]}),o?.ownerName&&a(ae,{children:[a("dt",{children:"Owner"}),a("dd",{children:[o.ownerName,o.ownerEmail?` · ${o.ownerEmail}`:""]})]}),a("dt",{children:"Worktree / workspace"}),a("dd",{children:[t.workspaces[e.workspaceId]?.path,t.workspaces[e.workspaceId]?.branch&&a("span",{children:[" · ",t.workspaces[e.workspaceId].branch]})]}),a("dt",{children:"Angine session"}),a("dd",{children:e.id}),e.sourceSessionId&&a(ae,{children:[a("dt",{children:"Agent session"}),a("dd",{children:e.sourceSessionId})]}),e.parentAgentId&&a(ae,{children:[a("dt",{children:"Parent agent"}),a("dd",{children:e.parentAgentId})]}),e.accountLabel&&a(ae,{children:[a("dt",{children:"Account"}),a("dd",{children:e.accountLabel})]})]}),a(ey,{health:n,session:e})]})}function Os({status:e,items:t,kind:n,limit:o,row:r}){const i=ne(null),[s,c]=J(),d=t.length>o;return it(()=>{const l=i.current;if(!l||!d){c(void 0);return}const f=Array.from(l.children).slice(0,o),h=()=>c(Math.ceil(f.reduce((p,y)=>p+y.getBoundingClientRect().height,0)));h();const u=new ResizeObserver(h);return u.observe(l),f.forEach(p=>u.observe(p)),()=>u.disconnect()},[t,o,d]),a("section",{class:"project-status-section","aria-labelledby":`${n}-${e}`,children:[a("div",{class:"status-section-heading",children:[a("h2",{id:`${n}-${e}`,children:[a("span",{class:`section-status-dot ${e}`}),Ye[e],a("span",{class:"section-count",children:t.length})]}),a("span",{children:d?`Latest ${o} shown · Scroll for ${t.length-o} more`:"Newest updates first"})]}),a("div",{class:"project-list panel",children:[a("div",{class:n==="tasks"?"task-list-head":"project-list-head","aria-hidden":"true",children:[a("span",{children:n==="tasks"?"Task":n==="missions"?"Mission":"Project"}),a("span",{children:"Status"}),a("span",{children:"Progress"}),n!=="tasks"&&a("span",{children:"Agent"}),a("span",{children:"Updated"}),a("span",{})]}),a("div",{class:`project-scroll ${d?"has-overflow":""}`,ref:i,style:d&&s?{maxHeight:`${s}px`}:void 0,tabIndex:d?0:void 0,role:d?"region":void 0,"aria-label":d?`${Ye[e]} ${n}, scroll to see all ${t.length}`:void 0,children:t.length?t.map(r):a("div",{class:"status-section-empty",children:["No ",Ye[e].toLowerCase()," ",n," in this view."]})})]})]})}function gy(){const[e,t]=J(null),[n,o]=J(location.hash.slice(1)||"/projects"),[r="projects",i]=n.split("/").filter(Boolean);let s="";try{s=decodeURIComponent(i||"")}catch{}const{filters:c,set:d,reset:l,resetAll:f}=ry(r),{agent:h,status:u,project:p,mission:y,profile:_,query:w,staleOnly:m}=c,{preferences:S,setPreferences:g}=iy(),{health:x,compatibility:C}=Q0();sy(e,S.notifications);const[k,E]=J(""),[T,D]=J([]),[L,j]=J(!1),B=ne(null),[N,b]=J(),[,I]=J(0),A=v=>t(R=>R&&R.seq>v.seq?R:Z0(v)),P=async(v,R)=>{E("");try{return A(await ay(v,R)),!0}catch(se){return E(se.message),!1}};oe(()=>{const v=()=>{o(location.hash.slice(1)||"/projects"),window.scrollTo(0,0)};return window.addEventListener("hashchange",v),()=>window.removeEventListener("hashchange",v)},[]),oe(()=>{fetch("/api/state").then(se=>{if(!se.ok)throw new Error;return se.json()}).then(A).catch(()=>j(!1));const v=new EventSource("/api/events");v.addEventListener("state",se=>{A(JSON.parse(se.data)),j(!0)}),v.onerror=()=>j(!1);const R=setInterval(()=>I(se=>se+1),3e4);return()=>{v.close(),clearInterval(R)}},[]),it(()=>{const v=B.current;if(r!=="board"||!v)return;const R=()=>b(Math.max(260,window.innerHeight-v.getBoundingClientRect().top-24));R();const se=new ResizeObserver(R);return v.parentElement&&se.observe(v.parentElement),window.addEventListener("resize",R),()=>{se.disconnect(),window.removeEventListener("resize",R)}},[r,!!e]);const $=r==="tasks"&&s?e?.tasks[s]:void 0,M=$?e?.missions[$.missionId]:(r==="missions"||r==="projects")&&s?e?.missions[s]:void 0,O=M?e?.projects[M.projectId]:r==="projects"&&s?e?.projects[e?.projectAliases?.[s]||s]:void 0,z=M?`missions/${encodeURIComponent(M.id)}`:O?`projects/${encodeURIComponent(O.id)}`:"";oe(()=>{if(D([]),!z)return;let v=!0;return fetch(`/api/${z}/events`).then(R=>{if(!R.ok)throw new Error;return R.json()}).then(R=>{v&&D(R)}).catch(()=>{}),()=>{v=!1}},[z,e?.seq]);const V=v=>v.sort((R,se)=>se.updatedAt.localeCompare(R.updatedAt)),Z=V(Object.values(e?.tasks||{})),F=V(Object.values(e?.missions||{})),G=V(Object.values(e?.projects||{})).filter(v=>!v.archivedAt),ee=F.filter(v=>!v.archivedAt&&!e?.projects[v.projectId]?.archivedAt),X=Z.filter(v=>e?.missions[v.missionId]&&!dl(e,v)),H=Object.values(e?.sessions||{}),U=[...new Set([...H.map(v=>De(v.agent)),...X.map(v=>De(v.updatedBy))])].sort(),Q=v=>[...new Set([...v.workspaceIds||[v.workspaceId],...H.filter(R=>R.missionId===v.id||R.missionIds?.includes(v.id)).map(R=>R.workspaceId)])].map(R=>e?.workspaces[R]).filter(Boolean),Y=v=>Z.filter(R=>R.missionId===v),W=v=>ee.filter(R=>R.projectId===v),K=v=>X.filter(R=>R.projectId===v),re=v=>[...new Set([...Y(v).map(R=>De(R.updatedBy)),...H.filter(R=>R.missionId===v||R.missionIds?.includes(v)).map(R=>De(R.agent)),...e?.missions[v]?.latestUpdate?[De(e.missions[v].latestUpdate?.updatedBy)]:[]])],ie=v=>[...new Set([...Z.filter(R=>R.projectId===v).map(R=>De(R.updatedBy)),...H.filter(R=>R.projectId===v||R.projectIds?.includes(v)).map(R=>De(R.agent)),...e?.projects[v]?.latestUpdate?[De(e.projects[v].latestUpdate?.updatedBy)]:[]])],ce=(v,R)=>[...new Set([...v.map(se=>e?yr(e,se)?.id:void 0),...R.map(se=>e?So(e,se)?.id:void 0)])],me=v=>ce(Z.filter(R=>R.projectId===v),H.filter(R=>R.projectId===v||R.projectIds?.includes(v))),$e=v=>ce(Y(v),H.filter(R=>R.missionId===v||R.missionIds?.includes(v))),xe=G.filter(v=>(h==="all"||ie(v.id).includes(h))&&(_==="all"||me(v.id).includes(_))),Ee=ee.filter(v=>(p==="all"||v.projectId===p)&&(h==="all"||re(v.id).includes(h))&&(_==="all"||$e(v.id).includes(_)));oe(()=>{if(e){if(e.projectAliases?.[p]){d({project:e.projectAliases[p]});return}if(e.missions[p]){d({project:e.missions[p].projectId,mission:p});return}if(p!=="all"&&!xe.some(v=>v.id===p)){d({project:"all",mission:"all"});return}y!=="all"&&!Ee.some(v=>v.id===y)&&d({mission:"all"}),r==="projects"&&!["all","active"].includes(u)&&d({status:"all"})}},[e,r,h,_,p,y,u]);const be=(...v)=>v.join(" ").toLowerCase().includes(w.toLowerCase().trim()),Oe=ee.filter(v=>(p==="all"||v.projectId===p)&&(y==="all"||v.id===y)&&(h==="all"||re(v.id).includes(h))&&(_==="all"||$e(v.id).includes(_))&&(!m||en(v,S.staleMinutes))&&(r!=="missions"||u==="all"||v.status===u)&&be(v.name,v.description,e?.projects[v.projectId]?.name)),we=xe.filter(v=>(p==="all"||v.id===p)&&(!m||W(v.id).some(R=>en(R,S.staleMinutes)))&&(be(v.name,v.description,e?.workspaces[v.workspaceId]?.path)||W(v.id).some(R=>be(R.name,R.description)))),ve=X.filter(v=>(p==="all"||v.projectId===p)&&(y==="all"||v.missionId===y)&&(h==="all"||De(v.updatedBy)===h)&&(_==="all"||e&&yr(e,v)?.id===_)&&(!m||en(v,S.staleMinutes))&&(u==="all"||v.status===u)&&be(v.title,v.note,e?.missions[v.missionId]?.name,e?.projects[v.projectId]?.name)),Ce=r==="projects"?X.filter(v=>we.some(R=>R.id===v.projectId)):r==="missions"?X.filter(v=>Oe.some(R=>R.id===v.missionId)):ve,je=[...we.map(v=>v.latestMonitoring),...Oe.map(v=>v.latestMonitoring)].filter(v=>!!v&&v.phase==="monitoring"&&(h==="all"||De(v.updatedBy)===h)).filter((v,R,se)=>se.findIndex(Te=>Te.id===v.id)===R).sort((v,R)=>R.reportedAt.localeCompare(v.reportedAt)),Pe=v=>{const R=v.filter(se=>se.status!=="cancelled");return R.length?Math.round(R.filter(se=>se.status==="completed").length/R.length*100):0},Je=v=>d({agent:v,...v!=="all"&&_!=="all"&&e?.profiles[_]?.agent!==v?{profile:"all"}:{}}),pt=v=>a("a",{class:"task-row",style:Xt(e,v.projectId,v.missionId),href:ye("tasks",v.id),children:[a("div",{class:"task-row-main",children:[a("span",{class:`task-status ${v.status}`}),a("div",{children:[a("strong",{children:v.title}),a("span",{children:[e?.projects[v.projectId]?.name," / ",e?.missions[v.missionId]?.name," · ",Ze(v.updatedBy)," ",a(jn,{item:v,minutes:S.staleMinutes})]})]})]}),a(Mt,{status:v.status}),a(Hn,{value:Zo(v)}),a("span",{class:"row-time",children:ft(v.updatedAt)}),a("span",{class:"row-arrow",children:"↗"})]},v.id),Vt=v=>a("a",{class:"project-row",style:Xt(e,v.projectId,v.id),href:ye("missions",v.id),children:[a("div",{class:"project-row-main",children:[a("strong",{children:[v.name," ",a(jn,{item:v,minutes:S.staleMinutes})]}),a("span",{children:[e?.projects[v.projectId]?.name,Q(v).some(R=>R?.branch)?` · ${[...new Set(Q(v).map(R=>R?.branch).filter(Boolean))].join(" · ")}`:""]}),v.latestUpdate&&a("p",{class:"work-update-line",children:["Latest ",Xn[v.latestUpdate.phase]||v.latestUpdate.phase," · ",v.latestUpdate.summary]}),v.description&&a("p",{children:v.description})]}),a(Mt,{status:v.status}),a(Hn,{value:Pe(Y(v.id)),caption:`${Y(v.id).filter(R=>R.status==="completed").length} / ${Y(v.id).filter(R=>R.status!=="cancelled").length} tasks`}),a("span",{class:"project-row-agents",children:re(v.id).map(Ze).join(" · ")||v.latestUpdate?.updatedBy||"External"}),a("span",{class:"row-time",children:ft(v.updatedAt)}),a("span",{class:"row-arrow",children:"↗"})]},v.id),ko=v=>{const R=W(v.id),se=R.filter(Ne=>Ne.status==="running").length,Te=e?hl(e,K(v.id),x,S.staleMinutes).length:0;return a("a",{class:"project-row",style:Xt(e,v.id),href:ye("projects",v.id),children:[a("div",{class:"project-row-main",children:[a("strong",{children:v.name}),a("span",{children:[R.length," missions · ",K(v.id).length," tasks",Te?` · ${Te} need attention`:""]}),v.latestUpdate&&a("p",{class:"work-update-line",children:["Latest ",v.latestUpdate.missionId?`${e?.missions[v.latestUpdate.missionId]?.name} · `:"","$",Xn[v.latestUpdate.phase]||v.latestUpdate.phase," · ",v.latestUpdate.summary]}),v.description&&a("p",{children:v.description})]}),a(Mt,{status:"active"}),a("div",{class:"project-mission-count",children:[a("strong",{children:[se," running"]}),a("span",{children:[R.filter(Ne=>Ne.status==="completed").length," completed missions"]})]}),a("span",{class:"project-row-agents",children:ie(v.id).map(Ze).join(" · ")||v.latestUpdate?.updatedBy||"External"}),a("span",{class:"row-time",children:ft(v.updatedAt)}),a("span",{class:"row-arrow",children:"↗"})]},v.id)},bn=(v,R="all")=>a("div",{class:"project-sections",children:["running","planned","blocked","completed","failed","cancelled"].filter(se=>(R==="all"||R===se)&&(!["planned","blocked"].includes(se)||v.some(Te=>Te.status===se)||R===se)).map(se=>a(Os,{status:se,kind:"missions",items:v.filter(Te=>Te.status===se),limit:se==="running"?10:5,row:Vt},se))}),Eo=v=>a("div",{class:"activity",children:v.length?v.slice(-40).reverse().map(R=>a("div",{children:[a("span",{class:"activity-dot"}),a("div",{children:[a("strong",{children:R.type==="work.update_reported"?`${Xn[String(R.payload.phase)]||"Work"} · ${Ye[String(R.payload.status)]||"Updated"}`:R.type.startsWith("task.")?R.type==="task.removed"?"Task removed":`${R.type==="task.created"?"Created · ":""}${Ye[String(R.payload.status)]||"Updated"}`:R.type.replace(R.type.startsWith("project.")&&R.payload.status!=="active"?"project.":"never.","mission.").replaceAll("."," ")}),(R.payload.summary||R.payload.note)&&a("p",{children:String(R.payload.summary||R.payload.note)}),a("span",{children:new Date(R.timestamp).toLocaleString()})]})]},R.seq)):a("p",{class:"muted",children:"No recorded activity yet."})}),Sn=!!s,Se=$||M||O,Co=O&&Se&&(r!=="tasks"||$)&&(r!=="missions"||M),Ft=$?void 0:M?M.latestMonitoring||(O?.latestMonitoring?.missionId?void 0:O?.latestMonitoring):O?.latestMonitoring,kn=$?H.filter(v=>v.id===$.updatedBySessionId):M?H.filter(v=>v.missionId===M.id||v.missionIds?.includes(M.id)):O?H.filter(v=>v.projectId===O.id||v.projectIds?.includes(O.id)):[],En=r==="projects"&&M?"missions":r,Cn=(v,R,se,Te)=>a("label",{class:"filter-label project-picker",children:[a("span",{children:v}),a("select",{"aria-label":`Filter by ${v.toLowerCase()}`,value:R,onChange:Ne=>Te(Ne.currentTarget.value),children:[a("option",{value:"all",children:["All ",v.toLowerCase(),"s"]}),[...se].sort((Ne,Io)=>Ne.name.localeCompare(Io.name)).map(Ne=>a("option",{value:Ne.id,children:Ne.name},Ne.id))]})]}),No=r==="projects"?["active"]:r==="missions"?["running","planned","blocked","completed","failed","cancelled"]:["todo","in_progress","blocked","completed","failed","cancelled"];return a("div",{class:"shell",children:[a("header",{class:"topbar",children:[a("a",{class:"brand",href:ye("projects"),children:[a("span",{class:"brand-mark"}),"Angine"]}),a("nav",{"aria-label":"Main navigation",children:["projects","missions","tasks","board","tree","agents","archive","settings"].map(v=>a("a",{href:ye(v),class:En===v?"active":"","aria-current":En===v?"page":void 0,children:v==="tree"?"Graph":v==="settings"?"Preferences":v[0].toUpperCase()+v.slice(1)},v))}),a("div",{class:"connection",children:[a("span",{class:L?"live-dot":"offline-dot"}),L?"Dashboard live":"Dashboard reconnecting"]})]}),a("main",{class:Sn?"detail-page":"overview-page",children:[a(J0,{compatibility:C}),k&&a("div",{class:"error-banner",role:"alert",children:[k,a("button",{class:"text-button",onClick:()=>E(""),children:"Dismiss"})]}),e?r==="agents"?a(ly,{health:x,compatibility:C,state:e,profileId:s||void 0,mutate:P,taskRow:pt}):r==="archive"?a(dy,{state:e,mutate:P}):r==="settings"?a(fy,{preferences:S,setPreferences:g,resetFilters:f}):r==="tree"?a(F0,{state:e,filters:c,setFilters:d,reset:l}):Sn?Co&&O&&Se?a(ae,{children:[a("nav",{class:"breadcrumbs","aria-label":"Breadcrumb",children:[a("a",{href:ye("projects"),children:"Projects"}),a("span",{children:"/"}),M?a(ae,{children:[a("a",{href:ye("projects",O.id),children:O.name}),a("span",{children:"/"}),$?a(ae,{children:[a("a",{href:ye("missions",M.id),children:M.name}),a("span",{children:"/"}),a("span",{children:"Task"})]}):a("span",{children:M.name})]}):a("span",{children:O.name})]}),a("div",{class:"page-heading detail-heading mission-heading",style:Xt(e,O.id,M?.id),children:[a("div",{children:[a("div",{class:"overline",children:[$?"TASK":M?"MISSION":"PROJECT"," ",a("span",{children:Se.key})]}),a("h1",{children:$?.title||M?.name||O.name}),a("div",{class:"heading-meta",children:[a(Mt,{status:Se.status}),a("span",{children:["Updated ",ft(Se.updatedAt)]}),M&&a(jn,{item:$||M,minutes:S.staleMinutes}),!$&&a("button",{class:"secondary-button",onClick:()=>P("archive",{projectId:Se.id,archived:!("archivedAt"in Se&&Se.archivedAt)}),children:["archivedAt"in Se&&Se.archivedAt?"Restore":"Archive"," ",M?"mission":"project"]}),(O.archivedAt||M?.archivedAt)&&a("span",{children:"Archived"})]})]}),M?a("div",{class:"heading-progress",children:a(Hn,{value:$?Zo($):Pe(Y(M.id)),caption:$?"Task progress":"Tasks completed"})}):a("div",{class:"project-overview-counts",children:[a("strong",{children:W(O.id).length}),a("span",{children:"missions"}),a("strong",{children:K(O.id).length}),a("span",{children:"tasks"})]})]}),a("div",{class:"detail-grid",children:[a("div",{class:"detail-main",children:[Ft&&a(Rs,{updates:[Ft],state:e}),!$&&(M?.latestUpdate||O.latestUpdate)&&(M?.latestUpdate||O.latestUpdate)?.id!==Ft?.id&&a(hy,{update:M?.latestUpdate||O.latestUpdate,state:e}),a("section",{class:"panel",children:[a("h2",{children:"Overview"}),$&&a("p",{class:"report-provenance",children:["Status reported by ",Ze($.updatedBy)," · ",new Date($.updatedAt).toLocaleString(),a("span",{children:"Completion is agent reported; test results are not independently verified."})]}),a("p",{class:"description",children:Se.description||(M?"No description provided.":"Missions collect the goals and tasks for this project. Completing a mission does not close the project.")}),$?.note&&a("div",{class:"latest-update",children:[a("div",{class:"overline",children:"LATEST UPDATE"}),a("p",{children:$.note})]})]}),!M&&a("section",{children:[a("div",{class:"panel-heading",children:[a("h2",{children:"Missions"}),a("span",{children:W(O.id).length})]}),bn(O.archivedAt?F.filter(v=>v.projectId===O.id):W(O.id))]}),$&&a(uy,{task:$,state:e,mutate:P},$.id),M&&(!$||Y(M.id).some(v=>v.parentKey===$.key))&&a("section",{class:"panel",children:[a("div",{class:"panel-heading",children:[a("h2",{children:$?"Subtasks":"Tasks"}),a("span",{children:($?Y(M.id).filter(v=>v.parentKey===$.key):Y(M.id)).length})]}),a("div",{class:"task-table",children:($?Y(M.id).filter(v=>v.parentKey===$.key):Y(M.id)).map(pt)})]}),a("section",{class:"panel",children:[a("h2",{children:"Activity"}),Eo(T.filter(v=>$?v.taskId===$.id:!v.type.startsWith("session.")))]})]}),a("div",{class:"detail-info",children:[a("section",{class:"panel",children:[a("h2",{children:"Details"}),!$&&a(U0,{project:O,mission:M,mutate:P}),a("dl",{children:[a("dt",{children:"Project"}),a("dd",{children:a("a",{href:ye("projects",O.id),children:O.name})}),M&&a(ae,{children:[a("dt",{children:"Mission"}),a("dd",{children:a("a",{href:ye("missions",M.id),children:M.name})})]}),a("dt",{children:M?"Worktrees / workspaces":"Workspace"}),a("dd",{children:M?Q(M).map(v=>a("div",{children:[v.path,v.branch&&a("strong",{children:[" · ",v.branch]})]},v.id)):e.workspaces[O.workspaceId]?.repositoryPath||e.workspaces[O.workspaceId]?.path}),a("dt",{children:"Created"}),a("dd",{children:new Date(Se.createdAt).toLocaleString()}),$?.parentKey&&a(ae,{children:[a("dt",{children:"Parent task"}),a("dd",{children:Y($.missionId).find(v=>v.key===$.parentKey)?a("a",{href:ye("tasks",Y($.missionId).find(v=>v.key===$.parentKey).id),children:$.parentKey}):$.parentKey})]})]})]}),a("section",{class:"panel",children:[a("h2",{children:$?"Reporting agent":"Reporter sessions"}),kn.map(v=>a(py,{session:v,state:e,health:x},v.id)),!kn.length&&a("p",{class:"muted",children:"No reporter session available for this item."})]})]})]})]}):a("div",{class:"empty",children:[a("h2",{children:"This page is unavailable"}),a("a",{href:ye("projects"),children:"Return to projects"})]}):a(ae,{children:[a("div",{class:"overview-toolbar",children:[a("div",{class:"stats",children:r==="projects"?a(ae,{children:[a("div",{children:[a("strong",{children:we.length}),a("span",{children:"Projects"})]}),a("div",{children:[a("strong",{children:ee.filter(v=>we.some(R=>R.id===v.projectId)&&v.status==="running").length}),a("span",{children:"Running missions"})]}),a("div",{children:[a("strong",{children:ee.filter(v=>we.some(R=>R.id===v.projectId)&&v.status==="completed").length}),a("span",{children:"Completed missions"})]})]}):["all",r==="missions"?"running":"in_progress","blocked","completed","failed","cancelled"].map(v=>a("div",{children:[a("strong",{children:r==="missions"?v==="all"?Oe.length:Oe.filter(R=>R.status===v).length:v==="all"?ve.length:ve.filter(R=>R.status===v).length}),a("span",{children:v==="all"?"Total":Ye[v]})]},v))}),a("div",{class:"toolbar",children:[a("label",{class:"search",children:[a("span",{"aria-hidden":"true",children:"⌕"}),a("input",{"aria-label":"Search work",placeholder:"Search projects, missions, tasks…",value:w,onInput:v=>d({query:v.currentTarget.value})})]}),a("label",{class:"filter-label",children:[a("span",{children:"Agent"}),a("select",{"aria-label":"Filter by agent",value:h,onChange:v=>Je(v.currentTarget.value),children:[a("option",{value:"all",children:"All agents"}),U.map(v=>a("option",{value:v,children:Ze(v)},v))]})]}),r!=="projects"&&Cn("Project",p,xe,v=>d({project:v,mission:"all"})),["tasks","board"].includes(r)&&Cn("Mission",y,Ee,v=>d({mission:v})),r!=="projects"&&a("label",{class:"filter-label",children:[a("span",{children:"Status"}),a("select",{"aria-label":"Filter by status",value:u,onChange:v=>d({status:v.currentTarget.value}),children:[a("option",{value:"all",children:"All statuses"}),No.map(v=>a("option",{value:v,children:Ye[v]},v))]})]}),a("details",{class:"more-filters",children:[a("summary",{children:["More filters",_!=="all"||m?" · On":""]}),a("div",{class:"extra-filters",children:[a("label",{class:"filter-label",children:[a("span",{children:"Profile"}),a("select",{"aria-label":"Filter by profile",value:_,onChange:v=>d({profile:v.currentTarget.value}),children:[a("option",{value:"all",children:"All profiles"}),Object.values(e.profiles).filter(v=>h==="all"||v.agent===h).map(v=>a("option",{value:v.id,children:v.name},v.id))]})]}),a("label",{class:"filter-label",children:[a("span",{children:"Activity"}),a("select",{"aria-label":"Filter stale activity",value:m?"stale":"all",onChange:v=>d({staleOnly:v.currentTarget.value==="stale"}),children:[a("option",{value:"all",children:"All activity"}),a("option",{value:"stale",children:"Stale only"})]})]})]})]}),(w||h!=="all"||u!=="all"||_!=="all"||m||p!=="all"||y!=="all")&&a("button",{class:"clear-filters",onClick:l,children:"Reset"})]})]}),a(Rs,{updates:je,state:e}),a(oy,{state:e,tasks:Ce,health:x,staleMinutes:S.staleMinutes}),r==="board"?a("div",{class:"board",ref:B,style:N?{height:`${N}px`}:void 0,children:["todo","in_progress","blocked","completed","failed","cancelled"].map(v=>a("section",{class:"board-column",children:[a("div",{class:"column-heading",children:[a("span",{class:`task-status ${v}`}),a("h2",{children:Ye[v]}),a("span",{children:ve.filter(R=>R.status===v).length})]}),a("div",{class:"board-stack",tabIndex:0,role:"region","aria-label":`${Ye[v]} tasks, scroll this column`,children:[ve.filter(R=>R.status===v).map(R=>a("a",{class:"board-card",style:Xt(e,R.projectId,R.missionId),href:ye("tasks",R.id),children:[a("span",{class:"board-project",children:[e.projects[R.projectId]?.name," / ",e.missions[R.missionId]?.name]}),a("strong",{children:[R.title," ",a(jn,{item:R,minutes:S.staleMinutes})]}),R.blocker?.nextStep&&a("p",{class:"blocker-next",children:["Next: ",R.blocker.nextStep]}),R.note&&a("p",{children:R.note}),a(Hn,{value:Zo(R)}),a("div",{class:"board-footer",children:[a("span",{children:Ze(R.updatedBy)}),a("span",{children:ft(R.updatedAt)})]})]},R.id)),!ve.some(R=>R.status===v)&&a("div",{class:"column-empty",children:"No tasks"})]})]},v))}):r==="tasks"?a("div",{class:"project-sections",children:["in_progress","todo","blocked","completed","failed","cancelled"].filter(v=>(u==="all"||u===v)&&(!["todo","blocked"].includes(v)||ve.some(R=>R.status===v)||u===v)).map(v=>a(Os,{status:v,kind:"tasks",items:ve.filter(R=>R.status===v),limit:v==="in_progress"?10:5,row:pt},v))}):r==="missions"?bn(Oe,u):a("div",{class:"project-list panel",children:[a("div",{class:"project-list-head","aria-hidden":"true",children:[a("span",{children:"Project"}),a("span",{children:"Status"}),a("span",{children:"Missions"}),a("span",{children:"Agents"}),a("span",{children:"Updated"}),a("span",{})]}),we.length?we.map(ko):Object.keys(e.projects).length===0&&!w&&h==="all"&&_==="all"&&!m&&a("div",{class:"status-section-empty onboarding-state",children:[a("strong",{children:x?.reporters.length?x.reporters.some(v=>xn(v)==="connected")?"Agent connected; waiting for its first project report.":"No agent is currently connected.":"No project reports yet."}),a("span",{children:x?.reporters.length?"Restart an agent session to connect it and report work.":"Connect an agent and start a session to see its reported work here."}),a("a",{href:ye("agents"),children:"Check agent connections"}),a("span",{children:["New to Angine? Run ",a("code",{children:"angine setup"}),", then restart your agent session."]})]})||a("div",{class:"status-section-empty",children:"No projects match these filters. Try resetting the filters or search."})]})]}):a("div",{class:"empty",children:a("h2",{children:"Loading your work…"})}),a("footer",{class:"footer",children:[a("span",{children:"Angine"}),a("span",{children:"Stored locally on this device"})]})]})]})}Pt(a(gy,{}),document.getElementById("app"));
|