import{b as _a,n as Sa,at as Ea,v as Na,r as b,C as Wo,c as Rt,ah as $a,g as qo,R as L,j as G,aP as Yt,aA as Ma,ac as Ta,m as Vr,F as ge,k as Aa,z as ka,B as Ia,E as Pa}from"./index-bf3ffc0f.js";import{g as Oa,P as Ra,c as La,b as Da,e as Va,T as Ba}from"./index-68d29b47.js";import{g as Ha,Z as za,a as Fa}from"./routes-17d4ed4d.js";const ln=e=>e?typeof e=="function"?e():e:null,ja=e=>{const{componentCls:t,popoverColor:n,titleMinWidth:r,fontWeightStrong:o,innerPadding:i,boxShadowSecondary:s,colorTextHeading:a,borderRadiusLG:c,zIndexPopup:u,titleMarginBottom:l,colorBgElevated:f,popoverBg:d,titleBorderBottom:h,innerContentPadding:y,titlePadding:p}=e;return[{[t]:Object.assign(Object.assign({},Na(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:u,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":f,"&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:d,backgroundClip:"padding-box",borderRadius:c,boxShadow:s,padding:i},[`${t}-title`]:{minWidth:r,marginBottom:l,color:a,fontWeight:o,borderBottom:h,padding:p},[`${t}-inner-content`]:{color:n,padding:y}})},Oa(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]},Ga=e=>{const{componentCls:t}=e;return{[t]:Ra.map(n=>{const r=e[`${n}6`];return{[`&${t}-${n}`]:{"--antd-arrow-background-color":r,[`${t}-inner`]:{backgroundColor:r},[`${t}-arrow`]:{background:"transparent"}}}})}},Ua=e=>{const{lineWidth:t,controlHeight:n,fontHeight:r,padding:o,wireframe:i,zIndexPopupBase:s,borderRadiusLG:a,marginXS:c,lineType:u,colorSplit:l,paddingSM:f}=e,d=n-r,h=d/2,y=d/2-t,p=o;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:s+30},La(e)),Da({contentRadius:a,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:c,titlePadding:i?`${h}px ${p}px ${y}px`:0,titleBorderBottom:i?`${t}px ${u} ${l}`:"none",innerContentPadding:i?`${f}px ${p}px`:0})},Ko=_a("Popover",e=>{const{colorBgElevated:t,colorText:n}=e,r=Sa(e,{popoverBg:t,popoverColor:n});return[ja(r),Ga(r),Ea(r,"zoom-big")]},Ua,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var Za=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{if(!(!t&&!n))return b.createElement(b.Fragment,null,t&&b.createElement("div",{className:`${e}-title`},ln(t)),b.createElement("div",{className:`${e}-inner-content`},ln(n)))},Xa=e=>{const{hashId:t,prefixCls:n,className:r,style:o,placement:i="top",title:s,content:a,children:c}=e;return b.createElement("div",{className:Rt(t,n,`${n}-pure`,`${n}-placement-${i}`,r),style:o},b.createElement("div",{className:`${n}-arrow`}),b.createElement(Va,Object.assign({},e,{className:t,prefixCls:n}),c||Ya(n,s,a)))},Wa=e=>{const{prefixCls:t,className:n}=e,r=Za(e,["prefixCls","className"]),{getPrefixCls:o}=b.useContext(Wo),i=o("popover",t),[s,a,c]=Ko(i);return s(b.createElement(Xa,Object.assign({},r,{prefixCls:i,hashId:a,className:Rt(n,c)})))},qa=Wa;var Ka=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o{let{title:t,content:n,prefixCls:r}=e;return b.createElement(b.Fragment,null,t&&b.createElement("div",{className:`${r}-title`},ln(t)),b.createElement("div",{className:`${r}-inner-content`},ln(n)))},Qo=b.forwardRef((e,t)=>{const{prefixCls:n,title:r,content:o,overlayClassName:i,placement:s="top",trigger:a="hover",mouseEnterDelay:c=.1,mouseLeaveDelay:u=.1,overlayStyle:l={}}=e,f=Ka(e,["prefixCls","title","content","overlayClassName","placement","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle"]),{getPrefixCls:d}=b.useContext(Wo),h=d("popover",n),[y,p,w]=Ko(h),m=d(),_=Rt(i,p,w);return y(b.createElement(Ba,Object.assign({placement:s,trigger:a,mouseEnterDelay:c,mouseLeaveDelay:u,overlayStyle:l},f,{prefixCls:h,overlayClassName:_,ref:t,overlay:r||o?b.createElement(Qa,{prefixCls:h,title:r,content:o}):null,transitionName:$a(m,"zoom-big",f.transitionName),"data-popover-inject":!0})))});Qo._InternalPanelDoNotUseOrYouWillBeFired=qa;const Ja=Qo;function me(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ac:sc;ni.useSyncExternalStore=ht.useSyncExternalStore!==void 0?ht.useSyncExternalStore:cc;ti.exports=ni;var lc=ti.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var bn=b,uc=lc;function fc(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dc=typeof Object.is=="function"?Object.is:fc,hc=uc.useSyncExternalStore,gc=bn.useRef,pc=bn.useEffect,mc=bn.useMemo,yc=bn.useDebugValue;ei.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=gc(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=mc(function(){function c(h){if(!u){if(u=!0,l=h,h=r(h),o!==void 0&&s.hasValue){var y=s.value;if(o(y,h))return f=y}return f=h}if(y=f,dc(l,h))return y;var p=r(h);return o!==void 0&&o(y,p)?y:(l=h,f=p)}var u=!1,l,f,d=n===void 0?null:n;return[function(){return c(t())},d===null?void 0:function(){return c(d())}]},[t,n,r,o]);var a=hc(e,i[0],i[1]);return pc(function(){s.hasValue=!0,s.value=a},[a]),yc(a),a};Jo.exports=ei;var vc=Jo.exports;const ri=qo(vc),Br=e=>{let t;const n=new Set,r=(c,u)=>{const l=typeof c=="function"?c(t):c;if(!Object.is(l,t)){const f=t;t=u??(typeof l!="object"||l===null)?l:Object.assign({},t,l),n.forEach(d=>d(t,f))}},o=()=>t,a={setState:r,getState:o,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}};return t=e(r,o,a),a},oi=e=>e?Br(e):Br,{useDebugValue:xc}=L,{useSyncExternalStoreWithSelector:wc}=ri;function ii(e,t=e.getState,n){const r=wc(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return xc(r),r}const Hr=(e,t)=>{const n=oi(e),r=(o,i=t)=>ii(n,o,i);return Object.assign(r,n),r},Cc=(e,t)=>e?Hr(e,t):Hr;function ue(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[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function _n(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}on.prototype=_n.prototype={constructor:on,on:function(e,t){var n=this._,r=_c(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(o),r=0,o,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Fr.hasOwnProperty(t)?{space:Fr[t],local:e}:e}function Ec(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wn&&t.documentElement.namespaceURI===Wn?t.createElement(e):t.createElementNS(n,e)}}function Nc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function si(e){var t=Sn(e);return(t.local?Nc:Ec)(t)}function $c(){}function fr(e){return e==null?$c:function(){return this.querySelector(e)}}function Mc(e){typeof e!="function"&&(e=fr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=$&&($=_+1);!(M=w[$])&&++$=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Jc(e){e||(e=el);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nl(){return Array.from(this)}function rl(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?gl:typeof t=="function"?ml:pl)(e,t,n??"")):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||fi(e).getComputedStyle(e,null).getPropertyValue(t)}function vl(e){return function(){delete this[e]}}function xl(e,t){return function(){this[e]=t}}function wl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Cl(e,t){return arguments.length>1?this.each((t==null?vl:typeof t=="function"?wl:xl)(e,t)):this.node()[e]}function di(e){return e.trim().split(/^|\s+/)}function dr(e){return e.classList||new hi(e)}function hi(e){this._node=e,this._names=di(e.getAttribute("class")||"")}hi.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 gi(e,t){for(var n=dr(e),r=-1,o=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Wl(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n()=>e;function qn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:l}){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:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}qn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function iu(e){return!e.ctrlKey&&!e.button}function su(){return this.parentNode}function au(e,t){return t??{x:e.x,y:e.y}}function cu(){return navigator.maxTouchPoints||"ontouchstart"in this}function lu(){var e=iu,t=su,n=au,r=cu,o={},i=_n("start","drag","end"),s=0,a,c,u,l,f=0;function d(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,ou).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,M){if(!(l||!e.call(this,v,M))){var O=$(this,t.call(this,v,M),v,M,"mouse");O&&(ve(v.view).on("mousemove.drag",y,Lt).on("mouseup.drag",p,Lt),vi(v.view),Bn(v),u=!1,a=v.clientX,c=v.clientY,O("start",v))}}function y(v){if(lt(v),!u){var M=v.clientX-a,O=v.clientY-c;u=M*M+O*O>f}o.mouse("drag",v)}function p(v){ve(v.view).on("mousemove.drag mouseup.drag",null),xi(v.view,u),lt(v),o.mouse("end",v)}function w(v,M){if(e.call(this,v,M)){var O=v.changedTouches,R=t.call(this,v,M),I=O.length,k,F;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Wt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Wt(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=fu.exec(e))?new le(t[1],t[2],t[3],1):(t=du.exec(e))?new le(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hu.exec(e))?Wt(t[1],t[2],t[3],t[4]):(t=gu.exec(e))?Wt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pu.exec(e))?Wr(t[1],t[2]/100,t[3]/100,1):(t=mu.exec(e))?Wr(t[1],t[2]/100,t[3]/100,t[4]):jr.hasOwnProperty(e)?Zr(jr[e]):e==="transparent"?new le(NaN,NaN,NaN,0):null}function Zr(e){return new le(e>>16&255,e>>8&255,e&255,1)}function Wt(e,t,n,r){return r<=0&&(e=t=n=NaN),new le(e,t,n,r)}function xu(e){return e instanceof Gt||(e=Bt(e)),e?(e=e.rgb(),new le(e.r,e.g,e.b,e.opacity)):new le}function Kn(e,t,n,r){return arguments.length===1?xu(e):new le(e,t,n,r??1)}function le(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}hr(le,Kn,wi(Gt,{brighter(e){return e=e==null?fn:Math.pow(fn,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new le(qe(this.r),qe(this.g),qe(this.b),dn(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:Yr,formatHex:Yr,formatHex8:wu,formatRgb:Xr,toString:Xr}));function Yr(){return`#${Xe(this.r)}${Xe(this.g)}${Xe(this.b)}`}function wu(){return`#${Xe(this.r)}${Xe(this.g)}${Xe(this.b)}${Xe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xr(){const e=dn(this.opacity);return`${e===1?"rgb(":"rgba("}${qe(this.r)}, ${qe(this.g)}, ${qe(this.b)}${e===1?")":`, ${e})`}`}function dn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xe(e){return e=qe(e),(e<16?"0":"")+e.toString(16)}function Wr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xe(e,t,n,r)}function Ci(e){if(e instanceof xe)return new xe(e.h,e.s,e.l,e.opacity);if(e instanceof Gt||(e=Bt(e)),!e)return new xe;if(e instanceof xe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n0&&c<1?0:s,new xe(s,a,c,e.opacity)}function Cu(e,t,n,r){return arguments.length===1?Ci(e):new xe(e,t,n,r??1)}function xe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}hr(xe,Cu,wi(Gt,{brighter(e){return e=e==null?fn:Math.pow(fn,e),new xe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new xe(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,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new le(Hn(e>=240?e-240:e+120,o,r),Hn(e,o,r),Hn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new xe(qr(this.h),qt(this.s),qt(this.l),dn(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=dn(this.opacity);return`${e===1?"hsl(":"hsla("}${qr(this.h)}, ${qt(this.s)*100}%, ${qt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function qr(e){return e=(e||0)%360,e<0?e+360:e}function qt(e){return Math.max(0,Math.min(1,e||0))}function Hn(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 bi=e=>()=>e;function bu(e,t){return function(n){return e+n*t}}function _u(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Su(e){return(e=+e)==1?_i:function(t,n){return n-t?_u(t,n,e):bi(isNaN(t)?n:t)}}function _i(e,t){var n=t-e;return n?bu(e,n):bi(isNaN(e)?t:e)}const Kr=function e(t){var n=Su(t);function r(o,i){var s=n((o=Kn(o)).r,(i=Kn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=_i(o.opacity,i.opacity);return function(l){return o.r=s(l),o.g=a(l),o.b=c(l),o.opacity=u(l),o+""}}return r.gamma=e,r}(1);function Oe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zn=new RegExp(Qn.source,"g");function Eu(e){return function(){return e}}function Nu(e){return function(t){return e(t)+""}}function $u(e,t){var n=Qn.lastIndex=zn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Qn.exec(e))&&(o=zn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:Oe(r,o)})),n=zn.lastIndex;return n180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Oe(u,l)})):l&&f.push(o(f)+"rotate("+l+r)}function a(u,l,f,d){u!==l?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Oe(u,l)}):l&&f.push(o(f)+"skewX("+l+r)}function c(u,l,f,d,h,y){if(u!==f||l!==d){var p=h.push(o(h)+"scale(",null,",",null,")");y.push({i:p-4,x:Oe(u,f)},{i:p-2,x:Oe(l,d)})}else(f!==1||d!==1)&&h.push(o(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=e(u),l=e(l),i(u.translateX,u.translateY,l.translateX,l.translateY,f,d),s(u.rotate,l.rotate,f,d),a(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var y=-1,p=d.length,w;++y=0&&e._call.call(void 0,t),e=e._next;--pt}function eo(){Ke=(gn=Ht.now())+En,pt=Pt=0;try{Du()}finally{pt=0,Bu(),Ke=0}}function Vu(){var e=Ht.now(),t=e-gn;t>Ni&&(En-=t,gn=e)}function Bu(){for(var e,t=hn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hn=n);Ot=e,er(r)}function er(e){if(!pt){Pt&&(Pt=clearTimeout(Pt));var t=e-Ke;t>24?(e<1/0&&(Pt=setTimeout(eo,e-Ht.now()-En)),$t&&($t=clearInterval($t))):($t||(gn=Ht.now(),$t=setInterval(Vu,Ni)),pt=1,$i(eo))}}function to(e,t,n){var r=new pn;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Hu=_n("start","end","cancel","interrupt"),zu=[],Ti=0,no=1,tr=2,sn=3,ro=4,nr=5,an=6;function Nn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Fu(e,n,{name:t,index:r,group:o,on:Hu,tween:zu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ti})}function pr(e,t){var n=we(e,t);if(n.state>Ti)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>sn)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Fu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Mi(i,0,n.time);function i(u){n.state=no,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var l,f,d,h;if(n.state!==no)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===sn)return to(s);h.state===ro?(h.state=an,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+ltr&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function v1(e,t,n){var r,o,i=y1(t)?pr:Ee;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function x1(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(v1(n,e,t))}function w1(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function C1(){return this.on("end.remove",w1(this._id))}function b1(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fr(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s()=>e;function Y1(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:r,enumerable:!0,configurable:!0},_:{value:o}})}function Me(e,t,n){this.k=e,this.x=t,this.y=n}Me.prototype={constructor:Me,scale:function(e){return e===1?this:new Me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Me(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 De=new Me(1,0,0);Me.prototype;function Fn(e){e.stopImmediatePropagation()}function Mt(e){e.preventDefault(),e.stopImmediatePropagation()}function X1(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function W1(){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 oo(){return this.__zoom||De}function q1(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function K1(){return navigator.maxTouchPoints||"ontouchstart"in this}function Q1(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=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(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function J1(){var e=X1,t=W1,n=Q1,r=q1,o=K1,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ru,u=_n("start","zoom","end"),l,f,d,h=500,y=150,p=0,w=10;function m(g){g.property("__zoom",oo).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",E).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(g,S,C,T){var P=g.selection?g.selection():g;P.property("__zoom",oo),g!==P?M(g,S,C,T):P.interrupt().each(function(){O(this,arguments).event(T).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},m.scaleBy=function(g,S,C,T){m.scaleTo(g,function(){var P=this.__zoom.k,x=typeof S=="function"?S.apply(this,arguments):S;return P*x},C,T)},m.scaleTo=function(g,S,C,T){m.transform(g,function(){var P=t.apply(this,arguments),x=this.__zoom,N=C==null?v(P):typeof C=="function"?C.apply(this,arguments):C,A=x.invert(N),V=typeof S=="function"?S.apply(this,arguments):S;return n($(_(x,V),N,A),P,s)},C,T)},m.translateBy=function(g,S,C,T){m.transform(g,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),s)},null,T)},m.translateTo=function(g,S,C,T,P){m.transform(g,function(){var x=t.apply(this,arguments),N=this.__zoom,A=T==null?v(x):typeof T=="function"?T.apply(this,arguments):T;return n(De.translate(A[0],A[1]).scale(N.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof C=="function"?-C.apply(this,arguments):-C),x,s)},T,P)};function _(g,S){return S=Math.max(i[0],Math.min(i[1],S)),S===g.k?g:new Me(S,g.x,g.y)}function $(g,S,C){var T=S[0]-C[0]*g.k,P=S[1]-C[1]*g.k;return T===g.x&&P===g.y?g:new Me(g.k,T,P)}function v(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function M(g,S,C,T){g.on("start.zoom",function(){O(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(T).end()}).tween("zoom",function(){var P=this,x=arguments,N=O(P,x).event(T),A=t.apply(P,x),V=C==null?v(A):typeof C=="function"?C.apply(P,x):C,B=Math.max(A[1][0]-A[0][0],A[1][1]-A[0][1]),H=P.__zoom,U=typeof S=="function"?S.apply(P,x):S,Y=c(H.invert(V).concat(B/H.k),U.invert(V).concat(B/U.k));return function(W){if(W===1)W=U;else{var q=Y(W),ee=B/q[2];W=new Me(ee,V[0]-q[0]*ee,V[1]-q[1]*ee)}N.zoom(null,W)}})}function O(g,S,C){return!C&&g.__zooming||new R(g,S)}function R(g,S){this.that=g,this.args=S,this.active=0,this.sourceEvent=null,this.extent=t.apply(g,S),this.taps=0}R.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,S){return this.mouse&&g!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var S=ve(this.that).datum();u.call(g,this.that,new Y1(g,{sourceEvent:this.sourceEvent,target:m,type:g,transform:this.that.__zoom,dispatch:u}),S)}};function I(g,...S){if(!e.apply(this,arguments))return;var C=O(this,S).event(g),T=this.__zoom,P=Math.max(i[0],Math.min(i[1],T.k*Math.pow(2,r.apply(this,arguments)))),x=_e(g);if(C.wheel)(C.mouse[0][0]!==x[0]||C.mouse[0][1]!==x[1])&&(C.mouse[1]=T.invert(C.mouse[0]=x)),clearTimeout(C.wheel);else{if(T.k===P)return;C.mouse=[x,T.invert(x)],cn(this),C.start()}Mt(g),C.wheel=setTimeout(N,y),C.zoom("mouse",n($(_(T,P),C.mouse[0],C.mouse[1]),C.extent,s));function N(){C.wheel=null,C.end()}}function k(g,...S){if(d||!e.apply(this,arguments))return;var C=g.currentTarget,T=O(this,S,!0).event(g),P=ve(g.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",B,!0),x=_e(g,C),N=g.clientX,A=g.clientY;vi(g.view),Fn(g),T.mouse=[x,this.__zoom.invert(x)],cn(this),T.start();function V(H){if(Mt(H),!T.moved){var U=H.clientX-N,Y=H.clientY-A;T.moved=U*U+Y*Y>p}T.event(H).zoom("mouse",n($(T.that.__zoom,T.mouse[0]=_e(H,C),T.mouse[1]),T.extent,s))}function B(H){P.on("mousemove.zoom mouseup.zoom",null),xi(H.view,T.moved),Mt(H),T.event(H).end()}}function F(g,...S){if(e.apply(this,arguments)){var C=this.__zoom,T=_e(g.changedTouches?g.changedTouches[0]:g,this),P=C.invert(T),x=C.k*(g.shiftKey?.5:2),N=n($(_(C,x),T,P),t.apply(this,S),s);Mt(g),a>0?ve(this).transition().duration(a).call(M,N,T,g):ve(this).call(m.transform,N,T,g)}}function D(g,...S){if(e.apply(this,arguments)){var C=g.touches,T=C.length,P=O(this,S,g.changedTouches.length===T).event(g),x,N,A,V;for(Fn(g),N=0;N"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,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.`},Pi=Ae.error001();function J(e,t){const n=b.useContext($n);if(n===null)throw new Error(Pi);return ii(n,e,t)}const oe=()=>{const e=b.useContext($n);if(e===null)throw new Error(Pi);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},tf=e=>e.userSelectionActive?"none":"all";function nf({position:e,children:t,className:n,style:r,...o}){const i=J(tf),s=`${e}`.split("-");return L.createElement("div",{className:me(["react-flow__panel",n,...s]),style:{...r,pointerEvents:i},...o},t)}function rf({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:L.createElement(nf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const of=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:u,...l})=>{const f=b.useRef(null),[d,h]=b.useState({x:0,y:0,width:0,height:0}),y=me(["react-flow__edge-textwrapper",u]);return b.useEffect(()=>{if(f.current){const p=f.current.getBBox();h({x:p.x,y:p.y,width:p.width,height:p.height})}},[n]),typeof n>"u"||!n?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:y,visibility:d.width?"visible":"hidden",...l},o&&L.createElement("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:r},n),c)};var sf=b.memo(of);const yr=e=>({width:e.offsetWidth,height:e.offsetHeight}),mt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),vr=(e={x:0,y:0},t)=>({x:mt(e.x,t[0][0],t[1][0]),y:mt(e.y,t[0][1],t[1][1])}),io=(e,t,n)=>en?-mt(Math.abs(e-n),1,50)/50:0,Oi=(e,t)=>{const n=io(e.x,35,t.width-35)*20,r=io(e.y,35,t.height-35)*20;return[n,r]},Ri=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},af=(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)}),xr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),cf=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),so=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),rr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},lf=e=>pe(e.width)&&pe(e.height)&&pe(e.x)&&pe(e.y),pe=e=>!isNaN(e)&&isFinite(e),re=Symbol.for("internals"),Li=["Enter"," ","Escape"],uf=(e,t)=>{},ff=e=>"nativeEvent"in e;function or(e){var o,i;const t=ff(e)?e.nativeEvent:e,n=((i=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Di=e=>"clientX"in e,Ve=(e,t)=>{var i,s;const n=Di(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},mn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ut=({id:e,path:t,labelX:n,labelY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:u,style:l,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:l,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),o&&pe(n)&&pe(r)?L.createElement(sf,{x:n,y:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:u}):null);Ut.displayName="BaseEdge";function Tt(e,t,n){return n===void 0?n:r=>{const o=t().edges.find(i=>i.id===e);o&&n(r,{...o})}}function Vi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n{const[w,m,_]=Hi({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i});return L.createElement(Ut,{path:w,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:p})});wr.displayName="SimpleBezierEdge";const co={[j.Left]:{x:-1,y:0},[j.Right]:{x:1,y:0},[j.Top]:{x:0,y:-1},[j.Bottom]:{x:0,y:1}},df=({source:e,sourcePosition:t=j.Bottom,target:n})=>t===j.Left||t===j.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hf({source:e,sourcePosition:t=j.Bottom,target:n,targetPosition:r=j.Top,center:o,offset:i}){const s=co[t],a=co[r],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},l=df({source:c,sourcePosition:t,target:u}),f=l.x!==0?"x":"y",d=l[f];let h=[],y,p;const w={x:0,y:0},m={x:0,y:0},[_,$,v,M]=Vi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*a[f]===-1){y=o.x||_,p=o.y||$;const R=[{x:y,y:c.y},{x:y,y:u.y}],I=[{x:c.x,y:p},{x:u.x,y:p}];s[f]===d?h=f==="x"?R:I:h=f==="x"?I:R}else{const R=[{x:c.x,y:u.y}],I=[{x:u.x,y:c.y}];if(f==="x"?h=s.x===d?I:R:h=s.y===d?R:I,t===r){const E=Math.abs(e[f]-n[f]);if(E<=i){const g=Math.min(i-1,i-E);s[f]===d?w[f]=(c[f]>e[f]?-1:1)*g:m[f]=(u[f]>n[f]?-1:1)*g}}if(t!==r){const E=f==="x"?"y":"x",g=s[f]===a[E],S=c[E]>u[E],C=c[E]=z?(y=(k.x+F.x)/2,p=h[0].y):(y=h[0].x,p=(k.y+F.y)/2)}return[[e,{x:c.x+w.x,y:c.y+w.y},...h,{x:u.x+m.x,y:u.y+m.y},n],y,p,v,M]}function gf(e,t,n,r){const o=Math.min(lo(e,t)/2,lo(t,n)/2,r),{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 u=e.x{let $="";return _>0&&_{const[m,_,$]=ir({sourceX:e,sourceY:t,sourcePosition:f,targetX:n,targetY:r,targetPosition:d,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset});return L.createElement(Ut,{path:m,labelX:_,labelY:$,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:u,style:l,markerEnd:h,markerStart:y,interactionWidth:w})});Mn.displayName="SmoothStepEdge";const Cr=b.memo(e=>{var t;return L.createElement(Mn,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Cr.displayName="StepEdge";function pf({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Vi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const br=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:u,style:l,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[y,p,w]=pf({sourceX:e,sourceY:t,targetX:n,targetY:r});return L.createElement(Ut,{path:y,labelX:p,labelY:w,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:u,style:l,markerEnd:f,markerStart:d,interactionWidth:h})});br.displayName="StraightEdge";function Jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function uo({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case j.Left:return[t-Jt(t-r,i),n];case j.Right:return[t+Jt(r-t,i),n];case j.Top:return[t,n-Jt(n-o,i)];case j.Bottom:return[t,n+Jt(o-n,i)]}}function zi({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:r,targetY:o,targetPosition:i=j.Top,curvature:s=.25}){const[a,c]=uo({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,l]=uo({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[f,d,h,y]=Bi({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${e},${t} C${a},${c} ${u},${l} ${r},${o}`,f,d,h,y]}const vn=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o=j.Bottom,targetPosition:i=j.Top,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,pathOptions:p,interactionWidth:w})=>{const[m,_,$]=zi({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i,curvature:p==null?void 0:p.curvature});return L.createElement(Ut,{path:m,labelX:_,labelY:$,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:w})});vn.displayName="BezierEdge";const _r=b.createContext(null),mf=_r.Provider;_r.Consumer;const yf=()=>b.useContext(_r),vf=e=>"id"in e&&"source"in e&&"target"in e,xf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,sr=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,wf=(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)),Fi=(e,t)=>{if(!e.source||!e.target)return t;let n;return vf(e)?n={...e}:n={...e,id:xf(e)},wf(n,t)?t:t.concat(n)},ar=({x:e,y:t},[n,r,o],i,[s,a])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?{x:s*Math.round(c.x/s),y:a*Math.round(c.y/a)}:c},ji=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r}),ft=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],o={x:e.position.x-n,y:e.position.y-r};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:o}},Sr=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const{x:i,y:s}=ft(o,t).positionAbsolute;return af(r,xr({x:i,y:s,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return cf(n)},Gi=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1,a=[0,0])=>{const c={x:(t.x-n)/o,y:(t.y-r)/o,width:t.width/o,height:t.height/o},u=[];return e.forEach(l=>{const{width:f,height:d,selectable:h=!0,hidden:y=!1}=l;if(s&&!h||y)return!1;const{positionAbsolute:p}=ft(l,a),w={x:p.x,y:p.y,width:f||0,height:d||0},m=rr(c,w),_=typeof f>"u"||typeof d>"u"||f===null||d===null,$=i&&m>0,v=(f||0)*(d||0);(_||$||m>=v||l.dragging)&&u.push(l)}),u},Ui=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},Zi=(e,t,n,r,o,i=.1)=>{const s=t/(e.width*(1+i)),a=n/(e.height*(1+i)),c=Math.min(s,a),u=mt(c,r,o),l=e.x+e.width/2,f=e.y+e.height/2,d=t/2-l*u,h=n/2-f*u;return{x:d,y:h,zoom:u}},Ye=(e,t=0)=>e.transition().duration(t);function fo(e,t,n,r){return(t[n]||[]).reduce((o,i)=>{var s,a;return`${e.id}-${i.id}-${n}`!==r&&o.push({id:i.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+i.x+i.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+i.y+i.height/2}),o},[])}function Cf(e,t,n,r,o,i){const{x:s,y:a}=Ve(e),u=t.elementsFromPoint(s,a).find(y=>y.classList.contains("react-flow__handle"));if(u){const y=u.getAttribute("data-nodeid");if(y){const p=Er(void 0,u),w=u.getAttribute("data-handleid"),m=i({nodeId:y,id:w,type:p});if(m){const _=o.find($=>$.nodeId===y&&$.type===p&&$.id===w);return{handle:{id:w,type:p,nodeId:y,x:(_==null?void 0:_.x)||n.x,y:(_==null?void 0:_.y)||n.y},validHandleResult:m}}}}let l=[],f=1/0;if(o.forEach(y=>{const p=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(p<=r){const w=i(y);p<=f&&(py.isValid),h=l.some(({handle:y})=>y.type==="target");return l.find(({handle:y,validHandleResult:p})=>h?y.type==="target":d?p.isValid:!0)||l[0]}const bf={source:null,target:null,sourceHandle:null,targetHandle:null},Yi=()=>({handleDomNode:null,isValid:!1,connection:bf,endHandle:null});function Xi(e,t,n,r,o,i,s){const a=o==="target",c=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...Yi(),handleDomNode:c};if(c){const l=Er(void 0,c),f=c.getAttribute("data-nodeid"),d=c.getAttribute("data-handleid"),h=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),p={source:a?f:n,sourceHandle:a?d:r,target:a?n:f,targetHandle:a?r:d};u.connection=p,h&&y&&(t===Qe.Strict?a&&l==="source"||!a&&l==="target":f!==n||d!==r)&&(u.endHandle={nodeId:f,handleId:d,type:l},u.isValid=i(p))}return u}function _f({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((o,i)=>{if(i[re]){const{handleBounds:s}=i[re];let a=[],c=[];s&&(a=fo(i,s,"source",`${t}-${n}-${r}`),c=fo(i,s,"target",`${t}-${n}-${r}`)),o.push(...a,...c)}return o},[])}function Er(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function jn(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Sf(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Wi({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:o,getState:i,setState:s,isValidConnection:a,edgeUpdaterType:c,onEdgeUpdateEnd:u}){const l=Ri(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:y,onConnectStart:p,panBy:w,getNodes:m,cancelConnection:_}=i();let $=0,v;const{x:M,y:O}=Ve(e),R=l==null?void 0:l.elementFromPoint(M,O),I=Er(c,R),k=d==null?void 0:d.getBoundingClientRect();if(!k||!I)return;let F,D=Ve(e,k),z=!1,E=null,g=!1,S=null;const C=_f({nodes:m(),nodeId:n,handleId:t,handleType:I}),T=()=>{if(!h)return;const[N,A]=Oi(D,k);w({x:N,y:A}),$=requestAnimationFrame(T)};s({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:I,connectionStartHandle:{nodeId:n,handleId:t,type:I},connectionEndHandle:null}),p==null||p(e,{nodeId:n,handleId:t,handleType:I});function P(N){const{transform:A}=i();D=Ve(N,k);const{handle:V,validHandleResult:B}=Cf(N,l,ar(D,A,!1,[1,1]),y,C,H=>Xi(H,f,n,t,o?"target":"source",a,l));if(v=V,z||(T(),z=!0),S=B.handleDomNode,E=B.connection,g=B.isValid,s({connectionPosition:v&&g?ji({x:v.x,y:v.y},A):D,connectionStatus:Sf(!!v,g),connectionEndHandle:B.endHandle}),!v&&!g&&!S)return jn(F);E.source!==E.target&&S&&(jn(F),F=S,S.classList.add("connecting","react-flow__handle-connecting"),S.classList.toggle("valid",g),S.classList.toggle("react-flow__handle-valid",g))}function x(N){var A,V;(v||S)&&E&&g&&(r==null||r(E)),(V=(A=i()).onConnectEnd)==null||V.call(A,N),c&&(u==null||u(N)),jn(F),_(),cancelAnimationFrame($),z=!1,g=!1,E=null,S=null,l.removeEventListener("mousemove",P),l.removeEventListener("mouseup",x),l.removeEventListener("touchmove",P),l.removeEventListener("touchend",x)}l.addEventListener("mousemove",P),l.addEventListener("mouseup",x),l.addEventListener("touchmove",P),l.addEventListener("touchend",x)}const ho=()=>!0,Ef=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Nf=(e,t,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:i,connectionClickStartHandle:s}=r;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},qi=b.forwardRef(({type:e="source",position:t=j.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:u,onMouseDown:l,onTouchStart:f,...d},h)=>{var k,F;const y=s||null,p=e==="target",w=oe(),m=yf(),{connectOnClick:_,noPanClassName:$}=J(Ef,ue),{connecting:v,clickConnecting:M}=J(Nf(m,y,e),ue);m||(F=(k=w.getState()).onError)==null||F.call(k,"010",Ae.error010());const O=D=>{const{defaultEdgeOptions:z,onConnect:E,hasDefaultEdges:g}=w.getState(),S={...z,...D};if(g){const{edges:C,setEdges:T}=w.getState();T(Fi(S,C))}E==null||E(S),a==null||a(S)},R=D=>{if(!m)return;const z=Di(D);o&&(z&&D.button===0||!z)&&Wi({event:D,handleId:y,nodeId:m,onConnect:O,isTarget:p,getState:w.getState,setState:w.setState,isValidConnection:n||w.getState().isValidConnection||ho}),z?l==null||l(D):f==null||f(D)},I=D=>{const{onClickConnectStart:z,onClickConnectEnd:E,connectionClickStartHandle:g,connectionMode:S,isValidConnection:C}=w.getState();if(!m||!g&&!o)return;if(!g){z==null||z(D,{nodeId:m,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:m,type:e,handleId:y}});return}const T=Ri(D.target),P=n||C||ho,{connection:x,isValid:N}=Xi({nodeId:m,id:y,type:e},S,g.nodeId,g.handleId||null,g.type,P,T);N&&O(x),E==null||E(D),w.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":y,"data-nodeid":m,"data-handlepos":t,"data-id":`${m}-${y}-${e}`,className:me(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",$,u,{source:!p,target:p,connectable:r,connectablestart:o,connectableend:i,connecting:M,connectionindicator:r&&(o&&!v||i&&v)}]),onMouseDown:R,onTouchStart:R,onClick:_?I:void 0,ref:h,...d},c)});qi.displayName="Handle";var yt=b.memo(qi);const Ki=({data:e,isConnectable:t,targetPosition:n=j.Top,sourcePosition:r=j.Bottom})=>L.createElement(L.Fragment,null,L.createElement(yt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,L.createElement(yt,{type:"source",position:r,isConnectable:t}));Ki.displayName="DefaultNode";var cr=b.memo(Ki);const Qi=({data:e,isConnectable:t,sourcePosition:n=j.Bottom})=>L.createElement(L.Fragment,null,e==null?void 0:e.label,L.createElement(yt,{type:"source",position:n,isConnectable:t}));Qi.displayName="InputNode";var Ji=b.memo(Qi);const es=({data:e,isConnectable:t,targetPosition:n=j.Top})=>L.createElement(L.Fragment,null,L.createElement(yt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);es.displayName="OutputNode";var ts=b.memo(es);const Nr=()=>null;Nr.displayName="GroupNode";const $f=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),en=e=>e.id;function Mf(e,t){return ue(e.selectedNodes.map(en),t.selectedNodes.map(en))&&ue(e.selectedEdges.map(en),t.selectedEdges.map(en))}const ns=b.memo(({onSelectionChange:e})=>{const t=oe(),{selectedNodes:n,selectedEdges:r}=J($f,Mf);return b.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChange.forEach(i=>i(o))},[n,r,e]),null});ns.displayName="SelectionListener";const Tf=e=>!!e.onSelectionChange;function Af({onSelectionChange:e}){const t=J(Tf);return e||t?L.createElement(ns,{onSelectionChange:e}):null}const kf=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function rt(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function X(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const If=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:i,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:c,nodesDraggable:u,nodesConnectable:l,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:y,minZoom:p,maxZoom:w,nodeExtent:m,onNodesChange:_,onEdgesChange:$,elementsSelectable:v,connectionMode:M,snapGrid:O,snapToGrid:R,translateExtent:I,connectOnClick:k,defaultEdgeOptions:F,fitView:D,fitViewOptions:z,onNodesDelete:E,onEdgesDelete:g,onNodeDrag:S,onNodeDragStart:C,onNodeDragStop:T,onSelectionDrag:P,onSelectionDragStart:x,onSelectionDragStop:N,noPanClassName:A,nodeOrigin:V,rfId:B,autoPanOnConnect:H,autoPanOnNodeDrag:U,onError:Y,connectionRadius:W,isValidConnection:q,nodeDragThreshold:ee})=>{const{setNodes:te,setEdges:ae,setDefaultNodesAndEdges:ye,setMinZoom:Ce,setMaxZoom:ne,setTranslateExtent:Q,setNodeExtent:ce,reset:fe}=J(kf,ue),Z=oe();return b.useEffect(()=>{const Be=r==null?void 0:r.map(He=>({...He,...F}));return ye(n,Be),()=>{fe()}},[]),X("defaultEdgeOptions",F,Z.setState),X("connectionMode",M,Z.setState),X("onConnect",o,Z.setState),X("onConnectStart",i,Z.setState),X("onConnectEnd",s,Z.setState),X("onClickConnectStart",a,Z.setState),X("onClickConnectEnd",c,Z.setState),X("nodesDraggable",u,Z.setState),X("nodesConnectable",l,Z.setState),X("nodesFocusable",f,Z.setState),X("edgesFocusable",d,Z.setState),X("edgesUpdatable",h,Z.setState),X("elementsSelectable",v,Z.setState),X("elevateNodesOnSelect",y,Z.setState),X("snapToGrid",R,Z.setState),X("snapGrid",O,Z.setState),X("onNodesChange",_,Z.setState),X("onEdgesChange",$,Z.setState),X("connectOnClick",k,Z.setState),X("fitViewOnInit",D,Z.setState),X("fitViewOnInitOptions",z,Z.setState),X("onNodesDelete",E,Z.setState),X("onEdgesDelete",g,Z.setState),X("onNodeDrag",S,Z.setState),X("onNodeDragStart",C,Z.setState),X("onNodeDragStop",T,Z.setState),X("onSelectionDrag",P,Z.setState),X("onSelectionDragStart",x,Z.setState),X("onSelectionDragStop",N,Z.setState),X("noPanClassName",A,Z.setState),X("nodeOrigin",V,Z.setState),X("rfId",B,Z.setState),X("autoPanOnConnect",H,Z.setState),X("autoPanOnNodeDrag",U,Z.setState),X("onError",Y,Z.setState),X("connectionRadius",W,Z.setState),X("isValidConnection",q,Z.setState),X("nodeDragThreshold",ee,Z.setState),rt(e,te),rt(t,ae),rt(p,Ce),rt(w,ne),rt(I,Q),rt(m,ce),null},go={display:"none"},Pf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},rs="react-flow__node-desc",os="react-flow__edge-desc",Of="react-flow__aria-live",Rf=e=>e.ariaLiveMessage;function Lf({rfId:e}){const t=J(Rf);return L.createElement("div",{id:`${Of}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Pf},t)}function Df({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${rs}-${e}`,style:go},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${os}-${e}`,style:go},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(Lf,{rfId:e}))}var Ft=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),o=b.useRef(!1),i=b.useRef(new Set([])),[s,a]=b.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),l=u.reduce((f,d)=>f.concat(...d),[]);return[u,l]}return[[],[]]},[e]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||c;if(e!==null){const l=h=>{if(o.current=h.ctrlKey||h.metaKey||h.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&or(h))return!1;const p=mo(h.code,a);i.current.add(h[p]),po(s,i.current,!1)&&(h.preventDefault(),r(!0))},f=h=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&or(h))return!1;const p=mo(h.code,a);po(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[p]),h.key==="Meta"&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",l),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{u==null||u.removeEventListener("keydown",l),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,r]),n};function po(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function mo(e,t){return t.includes(e)?"code":"key"}function is(e,t,n,r){var s,a;if(!e.parentNode)return n;const o=t.get(e.parentNode),i=ft(o,r);return is(o,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((s=o[re])==null?void 0:s.z)??0)>(n.z??0)?((a=o[re])==null?void 0:a.z)??0:n.z??0},r)}function ss(e,t,n){e.forEach(r=>{var o;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:i,y:s,z:a}=is(r,e,{...r.position,z:((o=r[re])==null?void 0:o.z)??0},t);r.positionAbsolute={x:i,y:s},r[re].z=a,n!=null&&n[r.id]&&(r[re].isParent=!0)}})}function Gn(e,t,n,r){const o=new Map,i={},s=r?1e3:0;return e.forEach(a=>{var f;const c=(pe(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),l={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(l.parentNode=a.parentNode,i[a.parentNode]=!0),Object.defineProperty(l,re,{enumerable:!1,value:{handleBounds:(f=u==null?void 0:u[re])==null?void 0:f.handleBounds,z:c}}),o.set(a.id,l)}),ss(o,n,i),o}function as(e,t={}){const{getNodes:n,width:r,height:o,minZoom:i,maxZoom:s,d3Zoom:a,d3Selection:c,fitViewOnInitDone:u,fitViewOnInit:l,nodeOrigin:f}=e(),d=t.initial&&!u&&l;if(a&&c&&(d||!t.initial)){const y=n().filter(w=>{var _;const m=t.includeHiddenNodes?w.width&&w.height:!w.hidden;return(_=t.nodes)!=null&&_.length?m&&t.nodes.some($=>$.id===w.id):m}),p=y.every(w=>w.width&&w.height);if(y.length>0&&p){const w=Sr(y,f),{x:m,y:_,zoom:$}=Zi(w,r,o,t.minZoom??i,t.maxZoom??s,t.padding??.1),v=De.translate(m,_).scale($);return typeof t.duration=="number"&&t.duration>0?a.transform(Ye(c,t.duration),v):a.transform(c,v),!0}}return!1}function Vf(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[re]:r[re],selected:n.selected})}),new Map(t)}function Bf(e,t){return t.map(n=>{const r=e.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function tn({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:o,edges:i,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:c,hasDefaultEdges:u}=n();e!=null&&e.length&&(c&&r({nodeInternals:Vf(e,o)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:Bf(t,i)}),a==null||a(t))}const ot=()=>{},Hf={zoomIn:ot,zoomOut:ot,zoomTo:ot,getZoom:()=>1,setViewport:ot,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ot,fitBounds:ot,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},zf=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Ff=()=>{const e=oe(),{d3Zoom:t,d3Selection:n}=J(zf,ue);return b.useMemo(()=>n&&t?{zoomIn:o=>t.scaleBy(Ye(n,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(Ye(n,o==null?void 0:o.duration),1/1.2),zoomTo:(o,i)=>t.scaleTo(Ye(n,i==null?void 0:i.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,i)=>{const[s,a,c]=e.getState().transform,u=De.translate(o.x??s,o.y??a).scale(o.zoom??c);t.transform(Ye(n,i==null?void 0:i.duration),u)},getViewport:()=>{const[o,i,s]=e.getState().transform;return{x:o,y:i,zoom:s}},fitView:o=>as(e.getState,o),setCenter:(o,i,s)=>{const{width:a,height:c,maxZoom:u}=e.getState(),l=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,f=a/2-o*l,d=c/2-i*l,h=De.translate(f,d).scale(l);t.transform(Ye(n,s==null?void 0:s.duration),h)},fitBounds:(o,i)=>{const{width:s,height:a,minZoom:c,maxZoom:u}=e.getState(),{x:l,y:f,zoom:d}=Zi(o,s,a,c,u,(i==null?void 0:i.padding)??.1),h=De.translate(l,f).scale(d);t.transform(Ye(n,i==null?void 0:i.duration),h)},project:o=>{const{transform:i,snapToGrid:s,snapGrid:a}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),ar(o,i,s,a)},screenToFlowPosition:o=>{const{transform:i,snapToGrid:s,snapGrid:a,domNode:c}=e.getState();if(!c)return o;const{x:u,y:l}=c.getBoundingClientRect(),f={x:o.x-u,y:o.y-l};return ar(f,i,s,a)},flowToScreenPosition:o=>{const{transform:i,domNode:s}=e.getState();if(!s)return o;const{x:a,y:c}=s.getBoundingClientRect(),u=ji(o,i);return{x:u.x+a,y:u.y+c}},viewportInitialized:!0}:Hf,[t,n])};function cs(){const e=Ff(),t=oe(),n=b.useCallback(()=>t.getState().getNodes().map(p=>({...p})),[]),r=b.useCallback(p=>t.getState().nodeInternals.get(p),[]),o=b.useCallback(()=>{const{edges:p=[]}=t.getState();return p.map(w=>({...w}))},[]),i=b.useCallback(p=>{const{edges:w=[]}=t.getState();return w.find(m=>m.id===p)},[]),s=b.useCallback(p=>{const{getNodes:w,setNodes:m,hasDefaultNodes:_,onNodesChange:$}=t.getState(),v=w(),M=typeof p=="function"?p(v):p;if(_)m(M);else if($){const O=M.length===0?v.map(R=>({type:"remove",id:R.id})):M.map(R=>({item:R,type:"reset"}));$(O)}},[]),a=b.useCallback(p=>{const{edges:w=[],setEdges:m,hasDefaultEdges:_,onEdgesChange:$}=t.getState(),v=typeof p=="function"?p(w):p;if(_)m(v);else if($){const M=v.length===0?w.map(O=>({type:"remove",id:O.id})):v.map(O=>({item:O,type:"reset"}));$(M)}},[]),c=b.useCallback(p=>{const w=Array.isArray(p)?p:[p],{getNodes:m,setNodes:_,hasDefaultNodes:$,onNodesChange:v}=t.getState();if($){const O=[...m(),...w];_(O)}else if(v){const M=w.map(O=>({item:O,type:"add"}));v(M)}},[]),u=b.useCallback(p=>{const w=Array.isArray(p)?p:[p],{edges:m=[],setEdges:_,hasDefaultEdges:$,onEdgesChange:v}=t.getState();if($)_([...m,...w]);else if(v){const M=w.map(O=>({item:O,type:"add"}));v(M)}},[]),l=b.useCallback(()=>{const{getNodes:p,edges:w=[],transform:m}=t.getState(),[_,$,v]=m;return{nodes:p().map(M=>({...M})),edges:w.map(M=>({...M})),viewport:{x:_,y:$,zoom:v}}},[]),f=b.useCallback(({nodes:p,edges:w})=>{const{nodeInternals:m,getNodes:_,edges:$,hasDefaultNodes:v,hasDefaultEdges:M,onNodesDelete:O,onEdgesDelete:R,onNodesChange:I,onEdgesChange:k}=t.getState(),F=(p||[]).map(S=>S.id),D=(w||[]).map(S=>S.id),z=_().reduce((S,C)=>{const T=!F.includes(C.id)&&C.parentNode&&S.find(x=>x.id===C.parentNode);return(typeof C.deletable=="boolean"?C.deletable:!0)&&(F.includes(C.id)||T)&&S.push(C),S},[]),E=$.filter(S=>typeof S.deletable=="boolean"?S.deletable:!0),g=E.filter(S=>D.includes(S.id));if(z||g){const S=Ui(z,E),C=[...g,...S],T=C.reduce((P,x)=>(P.includes(x.id)||P.push(x.id),P),[]);if((M||v)&&(M&&t.setState({edges:$.filter(P=>!T.includes(P.id))}),v&&(z.forEach(P=>{m.delete(P.id)}),t.setState({nodeInternals:new Map(m)}))),T.length>0&&(R==null||R(C),k&&k(T.map(P=>({id:P,type:"remove"})))),z.length>0&&(O==null||O(z),I)){const P=z.map(x=>({id:x.id,type:"remove"}));I(P)}}},[]),d=b.useCallback(p=>{const w=lf(p),m=w?null:t.getState().nodeInternals.get(p.id);return[w?p:so(m),m,w]},[]),h=b.useCallback((p,w=!0,m)=>{const[_,$,v]=d(p);return _?(m||t.getState().getNodes()).filter(M=>{if(!v&&(M.id===$.id||!M.positionAbsolute))return!1;const O=so(M),R=rr(O,_);return w&&R>0||R>=_.width*_.height}):[]},[]),y=b.useCallback((p,w,m=!0)=>{const[_]=d(p);if(!_)return!1;const $=rr(_,w);return m&&$>0||$>=_.width*_.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:o,getEdge:i,setNodes:s,setEdges:a,addNodes:c,addEdges:u,toObject:l,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:y}),[e,n,r,o,i,s,a,c,u,l,f,h,y])}const jf={actInsideInputWithModifier:!1};var Gf=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=oe(),{deleteElements:r}=cs(),o=Ft(e,jf),i=Ft(t);b.useEffect(()=>{if(o){const{edges:s,getNodes:a}=n.getState(),c=a().filter(l=>l.selected),u=s.filter(l=>l.selected);r({nodes:c,edges:u}),n.setState({nodesSelectionActive:!1})}},[o]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function Uf(e){const t=oe();b.useEffect(()=>{let n;const r=()=>{var i,s;if(!e.current)return;const o=yr(e.current);(o.height===0||o.width===0)&&((s=(i=t.getState()).onError)==null||s.call(i,"004",Ae.error004())),t.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const $r={position:"absolute",width:"100%",height:"100%",top:0,left:0},Zf=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nn=e=>({x:e.x,y:e.y,zoom:e.k}),it=(e,t)=>e.target.closest(`.${t}`),yo=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),vo=e=>{const t=e.ctrlKey&&mn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Yf=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Xf=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:c=We.Free,zoomOnDoubleClick:u=!0,elementsSelectable:l,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:y,maxZoom:p,zoomActivationKeyCode:w,preventScrolling:m=!0,children:_,noWheelClassName:$,noPanClassName:v})=>{const M=b.useRef(),O=oe(),R=b.useRef(!1),I=b.useRef(!1),k=b.useRef(null),F=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:z,d3ZoomHandler:E,userSelectionActive:g}=J(Yf,ue),S=Ft(w),C=b.useRef(0),T=b.useRef(!1),P=b.useRef();return Uf(k),b.useEffect(()=>{if(k.current){const x=k.current.getBoundingClientRect(),N=J1().scaleExtent([y,p]).translateExtent(h),A=ve(k.current).call(N),V=De.translate(d.x,d.y).scale(mt(d.zoom,y,p)),B=[[0,0],[x.width,x.height]],H=N.constrain()(V,B,h);N.transform(A,H),N.wheelDelta(vo),O.setState({d3Zoom:N,d3Selection:A,d3ZoomHandler:A.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:k.current.closest(".react-flow")})}},[]),b.useEffect(()=>{z&&D&&(s&&!S&&!g?z.on("wheel.zoom",x=>{if(it(x,$))return!1;x.preventDefault(),x.stopImmediatePropagation();const N=z.property("__zoom").k||1,A=mn();if(x.ctrlKey&&i&&A){const ee=_e(x),te=vo(x),ae=N*Math.pow(2,te);D.scaleTo(z,ae,ee,x);return}const V=x.deltaMode===1?20:1;let B=c===We.Vertical?0:x.deltaX*V,H=c===We.Horizontal?0:x.deltaY*V;!A&&x.shiftKey&&c!==We.Vertical&&(B=x.deltaY*V,H=0),D.translateBy(z,-(B/N)*a,-(H/N)*a,{internal:!0});const U=nn(z.property("__zoom")),{onViewportChangeStart:Y,onViewportChange:W,onViewportChangeEnd:q}=O.getState();clearTimeout(P.current),T.current||(T.current=!0,t==null||t(x,U),Y==null||Y(U)),T.current&&(e==null||e(x,U),W==null||W(U),P.current=setTimeout(()=>{n==null||n(x,U),q==null||q(U),T.current=!1},150))},{passive:!1}):typeof E<"u"&&z.on("wheel.zoom",function(x,N){if(!m||it(x,$))return null;x.preventDefault(),E.call(this,x,N)},{passive:!1}))},[g,s,c,z,D,E,S,i,m,$,t,e,n]),b.useEffect(()=>{D&&D.on("start",x=>{var V,B;if(!x.sourceEvent||x.sourceEvent.internal)return null;C.current=(V=x.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:N}=O.getState(),A=nn(x.transform);R.current=!0,F.current=A,((B=x.sourceEvent)==null?void 0:B.type)==="mousedown"&&O.setState({paneDragging:!0}),N==null||N(A),t==null||t(x.sourceEvent,A)})},[D,t]),b.useEffect(()=>{D&&(g&&!R.current?D.on("zoom",null):g||D.on("zoom",x=>{var A;const{onViewportChange:N}=O.getState();if(O.setState({transform:[x.transform.x,x.transform.y,x.transform.k]}),I.current=!!(r&&yo(f,C.current??0)),(e||N)&&!((A=x.sourceEvent)!=null&&A.internal)){const V=nn(x.transform);N==null||N(V),e==null||e(x.sourceEvent,V)}}))},[g,D,e,f,r]),b.useEffect(()=>{D&&D.on("end",x=>{if(!x.sourceEvent||x.sourceEvent.internal)return null;const{onViewportChangeEnd:N}=O.getState();if(R.current=!1,O.setState({paneDragging:!1}),r&&yo(f,C.current??0)&&!I.current&&r(x.sourceEvent),I.current=!1,(n||N)&&Zf(F.current,x.transform)){const A=nn(x.transform);F.current=A,clearTimeout(M.current),M.current=setTimeout(()=>{N==null||N(A),n==null||n(x.sourceEvent,A)},s?150:0)}})},[D,s,f,n,r]),b.useEffect(()=>{D&&D.filter(x=>{const N=S||o,A=i&&x.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&x.button===1&&x.type==="mousedown"&&(it(x,"react-flow__node")||it(x,"react-flow__edge")))return!0;if(!f&&!N&&!s&&!u&&!i||g||!u&&x.type==="dblclick"||it(x,$)&&x.type==="wheel"||it(x,v)&&(x.type!=="wheel"||s&&x.type==="wheel"&&!S)||!i&&x.ctrlKey&&x.type==="wheel"||!N&&!s&&!A&&x.type==="wheel"||!f&&(x.type==="mousedown"||x.type==="touchstart")||Array.isArray(f)&&!f.includes(x.button)&&(x.type==="mousedown"||x.type==="touchstart"))return!1;const V=Array.isArray(f)&&f.includes(x.button)||!x.button||x.button<=1;return(!x.ctrlKey||x.type==="wheel")&&V})},[g,D,o,i,s,u,f,l,S]),L.createElement("div",{className:"react-flow__renderer",ref:k,style:$r},_)},Wf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function qf(){const{userSelectionActive:e,userSelectionRect:t}=J(Wf,ue);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function xo(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,o=t.position.y+t.height-n.height;if(r>0||o>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),o>0&&(n.style.height+=o),t.position.x<0){const i=Math.abs(t.position.x);n.position.x=n.position.x-i,n.style.width+=i,t.position.x=0}if(t.position.y<0){const i=Math.abs(t.position.y);n.position.y=n.position.y-i,n.style.height+=i,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function ls(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,o)=>{const i=e.filter(a=>a.id===o.id);if(i.length===0)return r.push(o),r;const s={...o};for(const a of i)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&xo(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&xo(r,s);break}case"remove":return r}return r.push(s),r},n)}function us(e,t){return ls(e,t)}function Kf(e,t){return ls(e,t)}const Re=(e,t)=>({id:e,type:"select",selected:t});function ct(e,t){return e.reduce((n,r)=>{const o=t.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(Re(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(Re(r.id,!1))),n},[])}const Un=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Qf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),fs=b.memo(({isSelecting:e,selectionMode:t=zt.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:c,onPaneMouseMove:u,onPaneMouseLeave:l,children:f})=>{const d=b.useRef(null),h=oe(),y=b.useRef(0),p=b.useRef(0),w=b.useRef(),{userSelectionActive:m,elementsSelectable:_,dragging:$}=J(Qf,ue),v=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,p.current=0},M=E=>{i==null||i(E),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},O=E=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){E.preventDefault();return}s==null||s(E)},R=a?E=>a(E):void 0,I=E=>{const{resetSelectedElements:g,domNode:S}=h.getState();if(w.current=S==null?void 0:S.getBoundingClientRect(),!_||!e||E.button!==0||E.target!==d.current||!w.current)return;const{x:C,y:T}=Ve(E,w.current);g(),h.setState({userSelectionRect:{width:0,height:0,startX:C,startY:T,x:C,y:T}}),r==null||r(E)},k=E=>{const{userSelectionRect:g,nodeInternals:S,edges:C,transform:T,onNodesChange:P,onEdgesChange:x,nodeOrigin:N,getNodes:A}=h.getState();if(!e||!w.current||!g)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Ve(E,w.current),B=g.startX??0,H=g.startY??0,U={...g,x:V.xte.id),ee=W.map(te=>te.id);if(y.current!==ee.length){y.current=ee.length;const te=ct(Y,ee);te.length&&(P==null||P(te))}if(p.current!==q.length){p.current=q.length;const te=ct(C,q);te.length&&(x==null||x(te))}h.setState({userSelectionRect:U})},F=E=>{if(E.button!==0)return;const{userSelectionRect:g}=h.getState();!m&&g&&E.target===d.current&&(M==null||M(E)),h.setState({nodesSelectionActive:y.current>0}),v(),o==null||o(E)},D=E=>{m&&(h.setState({nodesSelectionActive:y.current>0}),o==null||o(E)),v()},z=_&&(e||m);return L.createElement("div",{className:me(["react-flow__pane",{dragging:$,selection:e}]),onClick:z?void 0:Un(M,d),onContextMenu:Un(O,d),onWheel:Un(R,d),onMouseEnter:z?void 0:c,onMouseDown:z?I:void 0,onMouseMove:z?k:u,onMouseUp:z?F:void 0,onMouseLeave:z?D:l,ref:d,style:$r},f,L.createElement(qf,null))});fs.displayName="Pane";function ds(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:ds(n,t):!1}function wo(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Jf(e,t,n,r){return Array.from(e.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||!ds(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var i,s;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=o.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((s=o.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode,width:o.width,height:o.height,expandParent:o.expandParent}})}function ed(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function hs(e,t,n,r,o=[0,0],i){const s=ed(e,e.extent||r);let a=s;if(e.extent==="parent"&&!e.expandParent)if(e.parentNode&&e.width&&e.height){const l=n.get(e.parentNode),{x:f,y:d}=ft(l,o).positionAbsolute;a=l&&pe(f)&&pe(d)&&pe(l.width)&&pe(l.height)?[[f+e.width*o[0],d+e.height*o[1]],[f+l.width-e.width+e.width*o[0],d+l.height-e.height+e.height*o[1]]]:a}else i==null||i("005",Ae.error005()),a=s;else if(e.extent&&e.parentNode&&e.extent!=="parent"){const l=n.get(e.parentNode),{x:f,y:d}=ft(l,o).positionAbsolute;a=[[e.extent[0][0]+f,e.extent[0][1]+d],[e.extent[1][0]+f,e.extent[1][1]+d]]}let c={x:0,y:0};if(e.parentNode){const l=n.get(e.parentNode);c=ft(l,o).positionAbsolute}const u=a&&a!=="parent"?vr(t,a):t;return{position:{x:u.x-c.x,y:u.y-c.y},positionAbsolute:u}}function Zn({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?r.find(o=>o.id===e):r[0],r]}const Co=(e,t,n,r)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const i=Array.from(o),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return i.map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...yr(c)}})};function At(e,t,n){return n===void 0?n:r=>{const o=t().nodeInternals.get(e);o&&n(r,{...o})}}function lr({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:a,onError:c}=t.getState(),u=a.get(e);if(!u){c==null||c("012",Ae.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var l;return(l=r==null?void 0:r.current)==null?void 0:l.blur()})):o([e])}function td(){const e=oe();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:i}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,c={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:i?o[0]*Math.round(c.x/o[0]):c.x,ySnapped:i?o[1]*Math.round(c.y/o[1]):c.y,...c}},[])}function Yn(e){return(t,n,r)=>e==null?void 0:e(t,r)}function gs({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,selectNodesOnDrag:s}){const a=oe(),[c,u]=b.useState(!1),l=b.useRef([]),f=b.useRef({x:null,y:null}),d=b.useRef(0),h=b.useRef(null),y=b.useRef({x:0,y:0}),p=b.useRef(null),w=b.useRef(!1),m=b.useRef(!1),_=td();return b.useEffect(()=>{if(e!=null&&e.current){const $=ve(e.current),v=({x:R,y:I})=>{const{nodeInternals:k,onNodeDrag:F,onSelectionDrag:D,updateNodePositions:z,nodeExtent:E,snapGrid:g,snapToGrid:S,nodeOrigin:C,onError:T}=a.getState();f.current={x:R,y:I};let P=!1,x={x:0,y:0,x2:0,y2:0};if(l.current.length>1&&E){const A=Sr(l.current,C);x=xr(A)}if(l.current=l.current.map(A=>{const V={x:R-A.distance.x,y:I-A.distance.y};S&&(V.x=g[0]*Math.round(V.x/g[0]),V.y=g[1]*Math.round(V.y/g[1]));const B=[[E[0][0],E[0][1]],[E[1][0],E[1][1]]];l.current.length>1&&E&&!A.extent&&(B[0][0]=A.positionAbsolute.x-x.x+E[0][0],B[1][0]=A.positionAbsolute.x+(A.width??0)-x.x2+E[1][0],B[0][1]=A.positionAbsolute.y-x.y+E[0][1],B[1][1]=A.positionAbsolute.y+(A.height??0)-x.y2+E[1][1]);const H=hs(A,V,k,B,C,T);return P=P||A.position.x!==H.position.x||A.position.y!==H.position.y,A.position=H.position,A.positionAbsolute=H.positionAbsolute,A}),!P)return;z(l.current,!0,!0),u(!0);const N=o?F:Yn(D);if(N&&p.current){const[A,V]=Zn({nodeId:o,dragItems:l.current,nodeInternals:k});N(p.current,A,V)}},M=()=>{if(!h.current)return;const[R,I]=Oi(y.current,h.current);if(R!==0||I!==0){const{transform:k,panBy:F}=a.getState();f.current.x=(f.current.x??0)-R/k[2],f.current.y=(f.current.y??0)-I/k[2],F({x:R,y:I})&&v(f.current)}d.current=requestAnimationFrame(M)},O=R=>{var C;const{nodeInternals:I,multiSelectionActive:k,nodesDraggable:F,unselectNodesAndEdges:D,onNodeDragStart:z,onSelectionDragStart:E}=a.getState();m.current=!0;const g=o?z:Yn(E);(!s||!i)&&!k&&o&&((C=I.get(o))!=null&&C.selected||D()),o&&i&&s&&lr({id:o,store:a,nodeRef:e});const S=_(R);if(f.current=S,l.current=Jf(I,F,S,o),g&&l.current){const[T,P]=Zn({nodeId:o,dragItems:l.current,nodeInternals:I});g(R.sourceEvent,T,P)}};if(t)$.on(".drag",null);else{const R=lu().on("start",I=>{const{domNode:k,nodeDragThreshold:F}=a.getState();F===0&&O(I);const D=_(I);f.current=D,h.current=(k==null?void 0:k.getBoundingClientRect())||null,y.current=Ve(I.sourceEvent,h.current)}).on("drag",I=>{var z,E;const k=_(I),{autoPanOnNodeDrag:F,nodeDragThreshold:D}=a.getState();if(!w.current&&m.current&&F&&(w.current=!0,M()),!m.current){const g=k.xSnapped-(((z=f==null?void 0:f.current)==null?void 0:z.x)??0),S=k.ySnapped-(((E=f==null?void 0:f.current)==null?void 0:E.y)??0);Math.sqrt(g*g+S*S)>D&&O(I)}(f.current.x!==k.xSnapped||f.current.y!==k.ySnapped)&&l.current&&m.current&&(p.current=I.sourceEvent,y.current=Ve(I.sourceEvent,h.current),v(k))}).on("end",I=>{if(m.current&&(u(!1),w.current=!1,m.current=!1,cancelAnimationFrame(d.current),l.current)){const{updateNodePositions:k,nodeInternals:F,onNodeDragStop:D,onSelectionDragStop:z}=a.getState(),E=o?D:Yn(z);if(k(l.current,!1,!1),E){const[g,S]=Zn({nodeId:o,dragItems:l.current,nodeInternals:F});E(I.sourceEvent,g,S)}}}).filter(I=>{const k=I.target;return!I.button&&(!n||!wo(k,`.${n}`,e))&&(!r||wo(k,r,e))});return $.call(R),()=>{$.on(".drag",null)}}}},[e,t,n,r,i,a,o,s,_]),c}function ps(){const e=oe();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:i,getNodes:s,snapToGrid:a,snapGrid:c,onError:u,nodesDraggable:l}=e.getState(),f=s().filter(_=>_.selected&&(_.draggable||l&&typeof _.draggable>"u")),d=a?c[0]:5,h=a?c[1]:5,y=n.isShiftPressed?4:1,p=n.x*d*y,w=n.y*h*y,m=f.map(_=>{if(_.positionAbsolute){const $={x:_.positionAbsolute.x+p,y:_.positionAbsolute.y+w};a&&($.x=c[0]*Math.round($.x/c[0]),$.y=c[1]*Math.round($.y/c[1]));const{positionAbsolute:v,position:M}=hs(_,$,r,o,void 0,u);_.position=M,_.positionAbsolute=v}return _});i(m,!0,!1)},[])}const dt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var kt=e=>{const t=({id:n,type:r,data:o,xPos:i,yPos:s,xPosOrigin:a,yPosOrigin:c,selected:u,onClick:l,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:y,onDoubleClick:p,style:w,className:m,isDraggable:_,isSelectable:$,isConnectable:v,isFocusable:M,selectNodesOnDrag:O,sourcePosition:R,targetPosition:I,hidden:k,resizeObserver:F,dragHandle:D,zIndex:z,isParent:E,noDragClassName:g,noPanClassName:S,initialized:C,disableKeyboardA11y:T,ariaLabel:P,rfId:x})=>{const N=oe(),A=b.useRef(null),V=b.useRef(R),B=b.useRef(I),H=b.useRef(r),U=$||_||l||f||d||h,Y=ps(),W=At(n,N.getState,f),q=At(n,N.getState,d),ee=At(n,N.getState,h),te=At(n,N.getState,y),ae=At(n,N.getState,p),ye=Q=>{const{nodeDragThreshold:ce}=N.getState();if($&&(!O||!_||ce>0)&&lr({id:n,store:N,nodeRef:A}),l){const fe=N.getState().nodeInternals.get(n);fe&&l(Q,{...fe})}},Ce=Q=>{if(!or(Q))if(Li.includes(Q.key)&&$){const ce=Q.key==="Escape";lr({id:n,store:N,unselect:ce,nodeRef:A})}else!T&&_&&u&&Object.prototype.hasOwnProperty.call(dt,Q.key)&&(N.setState({ariaLiveMessage:`Moved selected node ${Q.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),Y({x:dt[Q.key].x,y:dt[Q.key].y,isShiftPressed:Q.shiftKey}))};b.useEffect(()=>{if(A.current&&!k){const Q=A.current;return F==null||F.observe(Q),()=>F==null?void 0:F.unobserve(Q)}},[k]),b.useEffect(()=>{const Q=H.current!==r,ce=V.current!==R,fe=B.current!==I;A.current&&(Q||ce||fe)&&(Q&&(H.current=r),ce&&(V.current=R),fe&&(B.current=I),N.getState().updateNodeDimensions([{id:n,nodeElement:A.current,forceUpdate:!0}]))},[n,r,R,I]);const ne=gs({nodeRef:A,disabled:k||!_,noDragClassName:g,handleSelector:D,nodeId:n,isSelectable:$,selectNodesOnDrag:O});return k?null:L.createElement("div",{className:me(["react-flow__node",`react-flow__node-${r}`,{[S]:_},m,{selected:u,selectable:$,parent:E,dragging:ne}]),ref:A,style:{zIndex:z,transform:`translate(${a}px,${c}px)`,pointerEvents:U?"all":"none",visibility:C?"visible":"hidden",...w},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:W,onMouseMove:q,onMouseLeave:ee,onContextMenu:te,onClick:ye,onDoubleClick:ae,onKeyDown:M?Ce:void 0,tabIndex:M?0:void 0,role:M?"button":void 0,"aria-describedby":T?void 0:`${rs}-${x}`,"aria-label":P},L.createElement(mf,{value:n},L.createElement(e,{id:n,data:o,type:r,xPos:i,yPos:s,selected:u,isConnectable:v,sourcePosition:R,targetPosition:I,dragging:ne,dragHandle:D,zIndex:z})))};return t.displayName="NodeWrapper",b.memo(t)};const nd=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Sr(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function rd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=oe(),{width:o,height:i,x:s,y:a,transformString:c,userSelectionActive:u}=J(nd,ue),l=ps(),f=b.useRef(null);if(b.useEffect(()=>{var y;n||(y=f.current)==null||y.focus({preventScroll:!0})},[n]),gs({nodeRef:f}),u||!o||!i)return null;const d=e?y=>{const p=r.getState().getNodes().filter(w=>w.selected);e(y,p)}:void 0,h=y=>{Object.prototype.hasOwnProperty.call(dt,y.key)&&l({x:dt[y.key].x,y:dt[y.key].y,isShiftPressed:y.shiftKey})};return L.createElement("div",{className:me(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:o,height:i,top:a,left:s}}))}var od=b.memo(rd);const id=e=>e.nodesSelectionActive,ms=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:a,onMove:c,onMoveStart:u,onMoveEnd:l,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:y,onSelectionEnd:p,multiSelectionKeyCode:w,panActivationKeyCode:m,zoomActivationKeyCode:_,elementsSelectable:$,zoomOnScroll:v,zoomOnPinch:M,panOnScroll:O,panOnScrollSpeed:R,panOnScrollMode:I,zoomOnDoubleClick:k,panOnDrag:F,defaultViewport:D,translateExtent:z,minZoom:E,maxZoom:g,preventScrolling:S,onSelectionContextMenu:C,noWheelClassName:T,noPanClassName:P,disableKeyboardA11y:x})=>{const N=J(id),A=Ft(f),V=Ft(m),B=V||F,H=V||O,U=A||d&&B!==!0;return Gf({deleteKeyCode:a,multiSelectionKeyCode:w}),L.createElement(Xf,{onMove:c,onMoveStart:u,onMoveEnd:l,onPaneContextMenu:i,elementsSelectable:$,zoomOnScroll:v,zoomOnPinch:M,panOnScroll:H,panOnScrollSpeed:R,panOnScrollMode:I,zoomOnDoubleClick:k,panOnDrag:!A&&B,defaultViewport:D,translateExtent:z,minZoom:E,maxZoom:g,zoomActivationKeyCode:_,preventScrolling:S,noWheelClassName:T,noPanClassName:P},L.createElement(fs,{onSelectionStart:y,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:B,isSelecting:!!U,selectionMode:h},e,N&&L.createElement(od,{onSelectionContextMenu:C,noPanClassName:P,disableKeyboardA11y:x})))};ms.displayName="FlowRenderer";var sd=b.memo(ms);function ad(e){return J(b.useCallback(n=>e?Gi(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function cd(e){const t={input:kt(e.input||Ji),default:kt(e.default||cr),output:kt(e.output||ts),group:kt(e.group||Nr)},n={},r=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,i)=>(o[i]=kt(e[i]||cr),o),n);return{...t,...r}}const ld=({x:e,y:t,width:n,height:r,origin:o})=>!n||!r?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-n*o[0],y:t-r*o[1]},ud=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ys=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:i,onError:s}=J(ud,ue),a=ad(e.onlyRenderVisibleElements),c=b.useRef(),u=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const l=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));i(d)});return c.current=l,l},[]);return b.useEffect(()=>()=>{var l;(l=c==null?void 0:c.current)==null||l.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:$r},a.map(l=>{var M,O;let f=l.type||"default";e.nodeTypes[f]||(s==null||s("003",Ae.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(l.draggable||t&&typeof l.draggable>"u"),y=!!(l.selectable||o&&typeof l.selectable>"u"),p=!!(l.connectable||n&&typeof l.connectable>"u"),w=!!(l.focusable||r&&typeof l.focusable>"u"),m=e.nodeExtent?vr(l.positionAbsolute,e.nodeExtent):l.positionAbsolute,_=(m==null?void 0:m.x)??0,$=(m==null?void 0:m.y)??0,v=ld({x:_,y:$,width:l.width??0,height:l.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:l.id,id:l.id,className:l.className,style:l.style,type:f,data:l.data,sourcePosition:l.sourcePosition||j.Bottom,targetPosition:l.targetPosition||j.Top,hidden:l.hidden,xPos:_,yPos:$,xPosOrigin:v.x,yPosOrigin:v.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!l.selected,isDraggable:h,isSelectable:y,isConnectable:p,isFocusable:w,resizeObserver:u,dragHandle:l.dragHandle,zIndex:((M=l[re])==null?void 0:M.z)??0,isParent:!!((O=l[re])!=null&&O.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!l.width&&!!l.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:l.ariaLabel})}))};ys.displayName="NodeRenderer";var fd=b.memo(ys);const dd=(e,t,n)=>n===j.Left?e-t:n===j.Right?e+t:e,hd=(e,t,n)=>n===j.Top?e-t:n===j.Bottom?e+t:e,bo="react-flow__edgeupdater",_o=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a})=>L.createElement("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:me([bo,`${bo}-${a}`]),cx:dd(t,r,e),cy:hd(n,r,e),r,stroke:"transparent",fill:"transparent"}),gd=()=>!0;var st=e=>{const t=({id:n,className:r,type:o,data:i,onClick:s,onEdgeDoubleClick:a,selected:c,animated:u,label:l,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:y,labelBgBorderRadius:p,style:w,source:m,target:_,sourceX:$,sourceY:v,targetX:M,targetY:O,sourcePosition:R,targetPosition:I,elementsSelectable:k,hidden:F,sourceHandleId:D,targetHandleId:z,onContextMenu:E,onMouseEnter:g,onMouseMove:S,onMouseLeave:C,edgeUpdaterRadius:T,onEdgeUpdate:P,onEdgeUpdateStart:x,onEdgeUpdateEnd:N,markerEnd:A,markerStart:V,rfId:B,ariaLabel:H,isFocusable:U,isUpdatable:Y,pathOptions:W,interactionWidth:q})=>{const ee=b.useRef(null),[te,ae]=b.useState(!1),[ye,Ce]=b.useState(!1),ne=oe(),Q=b.useMemo(()=>`url(#${sr(V,B)})`,[V,B]),ce=b.useMemo(()=>`url(#${sr(A,B)})`,[A,B]);if(F)return null;const fe=ie=>{var be;const{edges:de,addSelectedEdges:je,unselectNodesAndEdges:Ge,multiSelectionActive:Ue}=ne.getState(),Ne=de.find(Et=>Et.id===n);Ne&&(k&&(ne.setState({nodesSelectionActive:!1}),Ne.selected&&Ue?(Ge({nodes:[],edges:[Ne]}),(be=ee.current)==null||be.blur()):je([n])),s&&s(ie,Ne))},Z=Tt(n,ne.getState,a),Be=Tt(n,ne.getState,E),He=Tt(n,ne.getState,g),_t=Tt(n,ne.getState,S),et=Tt(n,ne.getState,C),ze=(ie,de)=>{if(ie.button!==0)return;const{edges:je,isValidConnection:Ge}=ne.getState(),Ue=de?_:m,Ne=(de?z:D)||null,be=de?"target":"source",Et=Ge||gd,Rn=de,Nt=je.find(Ze=>Ze.id===n);Ce(!0),x==null||x(ie,Nt,be);const Ln=Ze=>{Ce(!1),N==null||N(Ze,Nt,be)};Wi({event:ie,handleId:Ne,nodeId:Ue,onConnect:Ze=>P==null?void 0:P(Nt,Ze),isTarget:Rn,getState:ne.getState,setState:ne.setState,isValidConnection:Et,edgeUpdaterType:be,onEdgeUpdateEnd:Ln})},ke=ie=>ze(ie,!0),tt=ie=>ze(ie,!1),Ie=()=>ae(!0),Fe=()=>ae(!1),St=!k&&!s,nt=ie=>{var de;if(Li.includes(ie.key)&&k){const{unselectNodesAndEdges:je,addSelectedEdges:Ge,edges:Ue}=ne.getState();ie.key==="Escape"?((de=ee.current)==null||de.blur(),je({edges:[Ue.find(be=>be.id===n)]})):Ge([n])}};return L.createElement("g",{className:me(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:c,animated:u,inactive:St,updating:te}]),onClick:fe,onDoubleClick:Z,onContextMenu:Be,onMouseEnter:He,onMouseMove:_t,onMouseLeave:et,onKeyDown:U?nt:void 0,tabIndex:U?0:void 0,role:U?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":H===null?void 0:H||`Edge from ${m} to ${_}`,"aria-describedby":U?`${os}-${B}`:void 0,ref:ee},!ye&&L.createElement(e,{id:n,source:m,target:_,selected:c,animated:u,label:l,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:y,labelBgBorderRadius:p,data:i,style:w,sourceX:$,sourceY:v,targetX:M,targetY:O,sourcePosition:R,targetPosition:I,sourceHandleId:D,targetHandleId:z,markerStart:Q,markerEnd:ce,pathOptions:W,interactionWidth:q}),Y&&L.createElement(L.Fragment,null,(Y==="source"||Y===!0)&&L.createElement(_o,{position:R,centerX:$,centerY:v,radius:T,onMouseDown:ke,onMouseEnter:Ie,onMouseOut:Fe,type:"source"}),(Y==="target"||Y===!0)&&L.createElement(_o,{position:I,centerX:M,centerY:O,radius:T,onMouseDown:tt,onMouseEnter:Ie,onMouseOut:Fe,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function pd(e){const t={default:st(e.default||vn),straight:st(e.bezier||br),step:st(e.step||Cr),smoothstep:st(e.step||Mn),simplebezier:st(e.simplebezier||wr)},n={},r=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,i)=>(o[i]=st(e[i]||vn),o),n);return{...t,...r}}function So(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,o=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case j.Top:return{x:r+i/2,y:o};case j.Right:return{x:r+i,y:o+s/2};case j.Bottom:return{x:r+i/2,y:o+s};case j.Left:return{x:r,y:o+s/2}}}function Eo(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const md=(e,t,n,r,o,i)=>{const s=So(n,e,t),a=So(i,r,o);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function yd({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:i,width:s,height:a,transform:c}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+o),y2:Math.max(e.y+r,t.y+i)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const l=xr({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:s/c[2],height:a/c[2]}),f=Math.max(0,Math.min(l.x2,u.x2)-Math.max(l.x,u.x)),d=Math.max(0,Math.min(l.y2,u.y2)-Math.max(l.y,u.y));return Math.ceil(f*d)>0}function No(e){var r,o,i,s,a;const t=((r=e==null?void 0:e[re])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const vd=[{level:0,isMaxLevel:!0,edges:[]}];function xd(e,t,n=!1){let r=-1;const o=e.reduce((s,a)=>{var l,f;const c=pe(a.zIndex);let u=c?a.zIndex:0;if(n){const d=t.get(a.target),h=t.get(a.source),y=a.selected||(d==null?void 0:d.selected)||(h==null?void 0:h.selected),p=Math.max(((l=h==null?void 0:h[re])==null?void 0:l.z)||0,((f=d==null?void 0:d[re])==null?void 0:f.z)||0,1e3);u=(c?a.zIndex:0)+(y?p:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),i=Object.entries(o).map(([s,a])=>{const c=+s;return{edges:a,level:c,isMaxLevel:c===r}});return i.length===0?vd:i}function wd(e,t,n){const r=J(b.useCallback(o=>e?o.edges.filter(i=>{const s=t.get(i.source),a=t.get(i.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&yd({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return xd(r,t,n)}const Cd=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),bd=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),$o={[yn.Arrow]:Cd,[yn.ArrowClosed]:bd};function _d(e){const t=oe();return b.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call($o,e)?$o[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Ae.error009(e)),null)},[e])}const Sd=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=_d(t);return c?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0"},L.createElement(c,{color:n,strokeWidth:s})):null},Ed=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((o,i)=>([i.markerStart,i.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=sr(s,t);r.includes(a)||(o.push({id:a,color:s.color||e,...s}),r.push(a))}}),o),[]).sort((o,i)=>o.id.localeCompare(i.id))},vs=({defaultColor:e,rfId:t})=>{const n=J(b.useCallback(Ed({defaultColor:e,rfId:t}),[e,t]),(r,o)=>!(r.length!==o.length||r.some((i,s)=>i.id!==o[s].id)));return L.createElement("defs",null,n.map(r=>L.createElement(Sd,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};vs.displayName="MarkerDefinitions";var Nd=b.memo(vs);const $d=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),xs=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:i,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:f,edgeUpdaterRadius:d,onEdgeDoubleClick:h,onEdgeUpdateStart:y,onEdgeUpdateEnd:p,children:w})=>{const{edgesFocusable:m,edgesUpdatable:_,elementsSelectable:$,width:v,height:M,connectionMode:O,nodeInternals:R,onError:I}=J($d,ue),k=wd(t,R,n);return v?L.createElement(L.Fragment,null,k.map(({level:F,edges:D,isMaxLevel:z})=>L.createElement("svg",{key:F,style:{zIndex:F},width:v,height:M,className:"react-flow__edges react-flow__container"},z&&L.createElement(Nd,{defaultColor:e,rfId:r}),L.createElement("g",null,D.map(E=>{const[g,S,C]=No(R.get(E.source)),[T,P,x]=No(R.get(E.target));if(!C||!x)return null;let N=E.type||"default";o[N]||(I==null||I("011",Ae.error011(N)),N="default");const A=o[N]||o.default,V=O===Qe.Strict?P.target:(P.target??[]).concat(P.source??[]),B=Eo(S.source,E.sourceHandle),H=Eo(V,E.targetHandle),U=(B==null?void 0:B.position)||j.Bottom,Y=(H==null?void 0:H.position)||j.Top,W=!!(E.focusable||m&&typeof E.focusable>"u"),q=typeof s<"u"&&(E.updatable||_&&typeof E.updatable>"u");if(!B||!H)return I==null||I("008",Ae.error008(B,E)),null;const{sourceX:ee,sourceY:te,targetX:ae,targetY:ye}=md(g,B,U,T,H,Y);return L.createElement(A,{key:E.id,id:E.id,className:me([E.className,i]),type:N,data:E.data,selected:!!E.selected,animated:!!E.animated,hidden:!!E.hidden,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,style:E.style,source:E.source,target:E.target,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerEnd:E.markerEnd,markerStart:E.markerStart,sourceX:ee,sourceY:te,targetX:ae,targetY:ye,sourcePosition:U,targetPosition:Y,elementsSelectable:$,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:c,onMouseMove:u,onMouseLeave:l,onClick:f,edgeUpdaterRadius:d,onEdgeDoubleClick:h,onEdgeUpdateStart:y,onEdgeUpdateEnd:p,rfId:r,ariaLabel:E.ariaLabel,isFocusable:W,isUpdatable:q,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth})})))),w):null};xs.displayName="EdgeRenderer";var Md=b.memo(xs);const Td=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ad({children:e}){const t=J(Td);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function kd(e){const t=cs(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Id={[j.Left]:j.Right,[j.Right]:j.Left,[j.Top]:j.Bottom,[j.Bottom]:j.Top},ws=({nodeId:e,handleType:t,style:n,type:r=Le.Bezier,CustomComponent:o,connectionStatus:i})=>{var O,R,I;const{fromNode:s,handleId:a,toX:c,toY:u,connectionMode:l}=J(b.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),ue),f=(O=s==null?void 0:s[re])==null?void 0:O.handleBounds;let d=f==null?void 0:f[t];if(l===Qe.Loose&&(d=d||(f==null?void 0:f[t==="source"?"target":"source"])),!s||!d)return null;const h=a?d.find(k=>k.id===a):d[0],y=h?h.x+h.width/2:(s.width??0)/2,p=h?h.y+h.height/2:s.height??0,w=(((R=s.positionAbsolute)==null?void 0:R.x)??0)+y,m=(((I=s.positionAbsolute)==null?void 0:I.y)??0)+p,_=h==null?void 0:h.position,$=_?Id[_]:null;if(!_||!$)return null;if(o)return L.createElement(o,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:w,fromY:m,toX:c,toY:u,fromPosition:_,toPosition:$,connectionStatus:i});let v="";const M={sourceX:w,sourceY:m,sourcePosition:_,targetX:c,targetY:u,targetPosition:$};return r===Le.Bezier?[v]=zi(M):r===Le.Step?[v]=ir({...M,borderRadius:0}):r===Le.SmoothStep?[v]=ir(M):r===Le.SimpleBezier?[v]=Hi(M):v=`M${w},${m} ${c},${u}`,L.createElement("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};ws.displayName="ConnectionLine";const Pd=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Od({containerStyle:e,style:t,type:n,component:r}){const{nodeId:o,handleType:i,nodesConnectable:s,width:a,height:c,connectionStatus:u}=J(Pd,ue);return!(o&&i&&a&&s)?null:L.createElement("svg",{style:e,width:a,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:me(["react-flow__connection",u])},L.createElement(ws,{nodeId:o,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:u})))}function Mo(e,t){return b.useRef(null),oe(),b.useMemo(()=>t(e),[e])}const Cs=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:i,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:c,onEdgeDoubleClick:u,onNodeMouseEnter:l,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:y,onSelectionStart:p,onSelectionEnd:w,connectionLineType:m,connectionLineStyle:_,connectionLineComponent:$,connectionLineContainerStyle:v,selectionKeyCode:M,selectionOnDrag:O,selectionMode:R,multiSelectionKeyCode:I,panActivationKeyCode:k,zoomActivationKeyCode:F,deleteKeyCode:D,onlyRenderVisibleElements:z,elementsSelectable:E,selectNodesOnDrag:g,defaultViewport:S,translateExtent:C,minZoom:T,maxZoom:P,preventScrolling:x,defaultMarkerColor:N,zoomOnScroll:A,zoomOnPinch:V,panOnScroll:B,panOnScrollSpeed:H,panOnScrollMode:U,zoomOnDoubleClick:Y,panOnDrag:W,onPaneClick:q,onPaneMouseEnter:ee,onPaneMouseMove:te,onPaneMouseLeave:ae,onPaneScroll:ye,onPaneContextMenu:Ce,onEdgeUpdate:ne,onEdgeContextMenu:Q,onEdgeMouseEnter:ce,onEdgeMouseMove:fe,onEdgeMouseLeave:Z,edgeUpdaterRadius:Be,onEdgeUpdateStart:He,onEdgeUpdateEnd:_t,noDragClassName:et,noWheelClassName:ze,noPanClassName:ke,elevateEdgesOnSelect:tt,disableKeyboardA11y:Ie,nodeOrigin:Fe,nodeExtent:St,rfId:nt})=>{const ie=Mo(e,cd),de=Mo(t,pd);return kd(i),L.createElement(sd,{onPaneClick:q,onPaneMouseEnter:ee,onPaneMouseMove:te,onPaneMouseLeave:ae,onPaneContextMenu:Ce,onPaneScroll:ye,deleteKeyCode:D,selectionKeyCode:M,selectionOnDrag:O,selectionMode:R,onSelectionStart:p,onSelectionEnd:w,multiSelectionKeyCode:I,panActivationKeyCode:k,zoomActivationKeyCode:F,elementsSelectable:E,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:A,zoomOnPinch:V,zoomOnDoubleClick:Y,panOnScroll:B,panOnScrollSpeed:H,panOnScrollMode:U,panOnDrag:W,defaultViewport:S,translateExtent:C,minZoom:T,maxZoom:P,onSelectionContextMenu:y,preventScrolling:x,noDragClassName:et,noWheelClassName:ze,noPanClassName:ke,disableKeyboardA11y:Ie},L.createElement(Ad,null,L.createElement(Md,{edgeTypes:de,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:ne,onlyRenderVisibleElements:z,onEdgeContextMenu:Q,onEdgeMouseEnter:ce,onEdgeMouseMove:fe,onEdgeMouseLeave:Z,onEdgeUpdateStart:He,onEdgeUpdateEnd:_t,edgeUpdaterRadius:Be,defaultMarkerColor:N,noPanClassName:ke,elevateEdgesOnSelect:!!tt,disableKeyboardA11y:Ie,rfId:nt},L.createElement(Od,{style:_,type:m,component:$,containerStyle:v})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(fd,{nodeTypes:ie,onNodeClick:s,onNodeDoubleClick:c,onNodeMouseEnter:l,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:g,onlyRenderVisibleElements:z,noPanClassName:ke,noDragClassName:et,disableKeyboardA11y:Ie,nodeOrigin:Fe,nodeExtent:St,rfId:nt})))};Cs.displayName="GraphView";var Rd=b.memo(Cs);const ur=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Pe={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:ur,nodeExtent:ur,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Qe.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:uf,isValidConnection:void 0},Ld=()=>Cc((e,t)=>({...Pe,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:i}=t();e({nodeInternals:Gn(n,r,o,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",i=typeof r<"u",s=o?Gn(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:i?r:[],hasDefaultNodes:o,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:c,nodeOrigin:u}=t(),l=c==null?void 0:c.querySelector(".react-flow__viewport");if(!l)return;const f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=n.reduce((p,w)=>{const m=o.get(w.id);if(m){const _=yr(w.nodeElement);!!(_.width&&_.height&&(m.width!==_.width||m.height!==_.height||w.forceUpdate))&&(o.set(m.id,{...m,[re]:{...m[re],handleBounds:{source:Co(".source",w.nodeElement,d,u),target:Co(".target",w.nodeElement,d,u)}},..._}),p.push({id:m.id,type:"dimensions",dimensions:_}))}return p},[]);ss(o,u);const y=s||i&&!s&&as(t,{initial:!0,...a});e({nodeInternals:new Map(o),fitViewOnInitDone:y}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:i}=t(),s=n.map(a=>{const c={id:a.id,type:"position",dragging:o};return r&&(c.positionAbsolute=a.positionAbsolute,c.position=a.position),c});i(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:i,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:c}=t();if(n!=null&&n.length){if(i){const u=us(n,a()),l=Gn(u,o,s,c);e({nodeInternals:l})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,a=null;r?s=n.map(c=>Re(c,!0)):(s=ct(i(),n),a=ct(o,[])),tn({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let s,a=null;r?s=n.map(c=>Re(c,!0)):(s=ct(o,n),a=ct(i(),[])),tn({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:i}=t(),s=n||i(),a=r||o,c=s.map(l=>(l.selected=!1,Re(l.id,!1))),u=a.map(l=>Re(l.id,!1));tn({changedNodes:c,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=t();r==null||r.scaleExtent([n,o]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=t();r==null||r.scaleExtent([o,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),i=r().filter(a=>a.selected).map(a=>Re(a.id,!1)),s=n.filter(a=>a.selected).map(a=>Re(a.id,!1));tn({changedNodes:i,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(o=>{o.positionAbsolute=vr(o.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:i,d3Zoom:s,d3Selection:a,translateExtent:c}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=De.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),l=[[0,0],[o,i]],f=s==null?void 0:s.constrain()(u,l,c);return s.transform(a,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>e({connectionNodeId:Pe.connectionNodeId,connectionHandleId:Pe.connectionHandleId,connectionHandleType:Pe.connectionHandleType,connectionStatus:Pe.connectionStatus,connectionStartHandle:Pe.connectionStartHandle,connectionEndHandle:Pe.connectionEndHandle}),reset:()=>e({...Pe})}),Object.is),bs=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=Ld()),L.createElement(ef,{value:t.current},e)};bs.displayName="ReactFlowProvider";const _s=({children:e})=>b.useContext($n)?L.createElement(L.Fragment,null,e):L.createElement(bs,null,e);_s.displayName="ReactFlowWrapper";const Dd={input:Ji,default:cr,output:ts,group:Nr},Vd={default:vn,straight:br,step:Cr,smoothstep:Mn,simplebezier:wr},Bd=[0,0],Hd=[15,15],zd={x:0,y:0,zoom:1},Fd={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},jd=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i=Dd,edgeTypes:s=Vd,onNodeClick:a,onEdgeClick:c,onInit:u,onMove:l,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:y,onConnectEnd:p,onClickConnectStart:w,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:$,onNodeMouseLeave:v,onNodeContextMenu:M,onNodeDoubleClick:O,onNodeDragStart:R,onNodeDrag:I,onNodeDragStop:k,onNodesDelete:F,onEdgesDelete:D,onSelectionChange:z,onSelectionDragStart:E,onSelectionDrag:g,onSelectionDragStop:S,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:P,connectionMode:x=Qe.Strict,connectionLineType:N=Le.Bezier,connectionLineStyle:A,connectionLineComponent:V,connectionLineContainerStyle:B,deleteKeyCode:H="Backspace",selectionKeyCode:U="Shift",selectionOnDrag:Y=!1,selectionMode:W=zt.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:ee=mn()?"Meta":"Control",zoomActivationKeyCode:te=mn()?"Meta":"Control",snapToGrid:ae=!1,snapGrid:ye=Hd,onlyRenderVisibleElements:Ce=!1,selectNodesOnDrag:ne=!0,nodesDraggable:Q,nodesConnectable:ce,nodesFocusable:fe,nodeOrigin:Z=Bd,edgesFocusable:Be,edgesUpdatable:He,elementsSelectable:_t,defaultViewport:et=zd,minZoom:ze=.5,maxZoom:ke=2,translateExtent:tt=ur,preventScrolling:Ie=!0,nodeExtent:Fe,defaultMarkerColor:St="#b1b1b7",zoomOnScroll:nt=!0,zoomOnPinch:ie=!0,panOnScroll:de=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Ge=We.Free,zoomOnDoubleClick:Ue=!0,panOnDrag:Ne=!0,onPaneClick:be,onPaneMouseEnter:Et,onPaneMouseMove:Rn,onPaneMouseLeave:Nt,onPaneScroll:Ln,onPaneContextMenu:Or,children:Ze,onEdgeUpdate:Ys,onEdgeContextMenu:Xs,onEdgeDoubleClick:Ws,onEdgeMouseEnter:qs,onEdgeMouseMove:Ks,onEdgeMouseLeave:Qs,onEdgeUpdateStart:Js,onEdgeUpdateEnd:ea,edgeUpdaterRadius:ta=10,onNodesChange:na,onEdgesChange:ra,noDragClassName:oa="nodrag",noWheelClassName:ia="nowheel",noPanClassName:Rr="nopan",fitView:sa=!1,fitViewOptions:aa,connectOnClick:ca=!0,attributionPosition:la,proOptions:ua,defaultEdgeOptions:fa,elevateNodesOnSelect:da=!0,elevateEdgesOnSelect:ha=!1,disableKeyboardA11y:Lr=!1,autoPanOnConnect:ga=!0,autoPanOnNodeDrag:pa=!0,connectionRadius:ma=20,isValidConnection:ya,onError:va,style:xa,id:Dr,nodeDragThreshold:wa,...Ca},ba)=>{const Dn=Dr||"1";return L.createElement("div",{...Ca,style:{...xa,...Fd},ref:ba,className:me(["react-flow",o]),"data-testid":"rf__wrapper",id:Dr},L.createElement(_s,null,L.createElement(Rd,{onInit:u,onMove:l,onMoveStart:f,onMoveEnd:d,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:_,onNodeMouseMove:$,onNodeMouseLeave:v,onNodeContextMenu:M,onNodeDoubleClick:O,nodeTypes:i,edgeTypes:s,connectionLineType:N,connectionLineStyle:A,connectionLineComponent:V,connectionLineContainerStyle:B,selectionKeyCode:U,selectionOnDrag:Y,selectionMode:W,deleteKeyCode:H,multiSelectionKeyCode:ee,panActivationKeyCode:q,zoomActivationKeyCode:te,onlyRenderVisibleElements:Ce,selectNodesOnDrag:ne,defaultViewport:et,translateExtent:tt,minZoom:ze,maxZoom:ke,preventScrolling:Ie,zoomOnScroll:nt,zoomOnPinch:ie,zoomOnDoubleClick:Ue,panOnScroll:de,panOnScrollSpeed:je,panOnScrollMode:Ge,panOnDrag:Ne,onPaneClick:be,onPaneMouseEnter:Et,onPaneMouseMove:Rn,onPaneMouseLeave:Nt,onPaneScroll:Ln,onPaneContextMenu:Or,onSelectionContextMenu:C,onSelectionStart:T,onSelectionEnd:P,onEdgeUpdate:Ys,onEdgeContextMenu:Xs,onEdgeDoubleClick:Ws,onEdgeMouseEnter:qs,onEdgeMouseMove:Ks,onEdgeMouseLeave:Qs,onEdgeUpdateStart:Js,onEdgeUpdateEnd:ea,edgeUpdaterRadius:ta,defaultMarkerColor:St,noDragClassName:oa,noWheelClassName:ia,noPanClassName:Rr,elevateEdgesOnSelect:ha,rfId:Dn,disableKeyboardA11y:Lr,nodeOrigin:Z,nodeExtent:Fe}),L.createElement(If,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:p,onClickConnectStart:w,onClickConnectEnd:m,nodesDraggable:Q,nodesConnectable:ce,nodesFocusable:fe,edgesFocusable:Be,edgesUpdatable:He,elementsSelectable:_t,elevateNodesOnSelect:da,minZoom:ze,maxZoom:ke,nodeExtent:Fe,onNodesChange:na,onEdgesChange:ra,snapToGrid:ae,snapGrid:ye,connectionMode:x,translateExtent:tt,connectOnClick:ca,defaultEdgeOptions:fa,fitView:sa,fitViewOptions:aa,onNodesDelete:F,onEdgesDelete:D,onNodeDragStart:R,onNodeDrag:I,onNodeDragStop:k,onSelectionDrag:g,onSelectionDragStart:E,onSelectionDragStop:S,noPanClassName:Rr,nodeOrigin:Z,rfId:Dn,autoPanOnConnect:ga,autoPanOnNodeDrag:pa,onError:va,connectionRadius:ma,isValidConnection:ya,nodeDragThreshold:wa}),L.createElement(Af,{onSelectionChange:z}),Ze,L.createElement(rf,{proOptions:ua,position:la}),L.createElement(Df,{rfId:Dn,disableKeyboardA11y:Lr})))});jd.displayName="ReactFlow";function I7(){const e=oe();return b.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),i=(Array.isArray(t)?t:[t]).reduce((s,a)=>{const c=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);return c&&s.push({id:a,nodeElement:c,forceUpdate:!0}),s},[]);requestAnimationFrame(()=>r(i))},[])}const Gd=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(n=>e.includeHiddenNodes?!0:!n.hidden).every(n=>{var r;return((r=n[re])==null?void 0:r.handleBounds)!==void 0}),Ud={includeHiddenNodes:!1};function P7(e=Ud){return J(Gd(e))}let Mr="";const Zd=e=>Mr=e,Ss=()=>Mr,Es=()=>`https://huggingface.co/${Tr}/raw/main/.integrity`,O7=()=>`${Ss()}/store/v1`;let rn=null;const R7=async e=>{if(!rn){if(e){const r=await fetch(`${Mr}/users.json`);if(!r.ok)return console.error(`Failed to fetch users. Status: ${r.status}`),null;rn=(await r.json()).results}const t=await fetch(`${Es()}/users.json`);if(!t.ok)return console.error(`Failed to fetch users. Status: ${t.status}`),null;rn=(await t.json()).results}return rn},L7=async e=>{e.startsWith("/")&&(e=e.slice(1));const t=`${Es()}/${e}`;return await fetch(t,{})},D7=async e=>e.endsWith(".node")||e.endsWith(".governance")?await fetch(e):(Zd(e),e.endsWith("integrity.json")||(e=`${Ss()}/integrity.json`),await fetch(e));let Tr="";const V7=e=>Tr=e,B7=()=>Tr,Yd=({className:e})=>G.jsx("svg",{className:`${e}`,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:G.jsx("path",{d:"M7 6.41667C8.45833 6.41667 9.69792 6.18819 10.7188 5.73125C11.7396 5.27431 12.25 4.725 12.25 4.08333C12.25 3.44167 11.7396 2.89236 10.7188 2.43542C9.69792 1.97847 8.45833 1.75 7 1.75C5.54167 1.75 4.30208 1.97847 3.28125 2.43542C2.26042 2.89236 1.75 3.44167 1.75 4.08333C1.75 4.725 2.26042 5.27431 3.28125 5.73125C4.30208 6.18819 5.54167 6.41667 7 6.41667ZM7 7.875C7.39861 7.875 7.89688 7.83368 8.49479 7.75104C9.09271 7.6684 9.66875 7.53472 10.2229 7.35C10.7771 7.16528 11.2535 6.92465 11.6521 6.62813C12.0507 6.3316 12.25 5.96944 12.25 5.54167V7C12.25 7.42778 12.0507 7.78993 11.6521 8.08646C11.2535 8.38299 10.7771 8.62361 10.2229 8.80833C9.66875 8.99306 9.09271 9.12674 8.49479 9.20938C7.89688 9.29201 7.39861 9.33333 7 9.33333C6.60139 9.33333 6.10313 9.29201 5.50521 9.20938C4.90729 9.12674 4.33125 8.99306 3.77708 8.80833C3.22292 8.62361 2.74653 8.38299 2.34792 8.08646C1.94931 7.78993 1.75 7.42778 1.75 7V5.54167C1.75 5.96944 1.94931 6.3316 2.34792 6.62813C2.74653 6.92465 3.22292 7.16528 3.77708 7.35C4.33125 7.53472 4.90729 7.6684 5.50521 7.75104C6.10313 7.83368 6.60139 7.875 7 7.875ZM7 10.7917C7.39861 10.7917 7.89688 10.7503 8.49479 10.6677C9.09271 10.5851 9.66875 10.4514 10.2229 10.2667C10.7771 10.0819 11.2535 9.84132 11.6521 9.54479C12.0507 9.24826 12.25 8.88611 12.25 8.45833V9.91667C12.25 10.3444 12.0507 10.7066 11.6521 11.0031C11.2535 11.2997 10.7771 11.5403 10.2229 11.725C9.66875 11.9097 9.09271 12.0434 8.49479 12.126C7.89688 12.2087 7.39861 12.25 7 12.25C6.60139 12.25 6.10313 12.2087 5.50521 12.126C4.90729 12.0434 4.33125 11.9097 3.77708 11.725C3.22292 11.5403 2.74653 11.2997 2.34792 11.0031C1.94931 10.7066 1.75 10.3444 1.75 9.91667V8.45833C1.75 8.88611 1.94931 9.24826 2.34792 9.54479C2.74653 9.84132 3.22292 10.0819 3.77708 10.2667C4.33125 10.4514 4.90729 10.5851 5.50521 10.6677C6.10313 10.7503 6.60139 10.7917 7 10.7917Z",fill:"black"})}),Xd=({className:e})=>G.jsx("svg",{className:`${e} w-14 h-14`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M6.41667 12.6729L2.33333 10.325C2.14861 10.2181 2.00521 10.0771 1.90313 9.90208C1.80104 9.72708 1.75 9.53264 1.75 9.31875V4.68125C1.75 4.46736 1.80104 4.27291 1.90313 4.09791C2.00521 3.92291 2.14861 3.78194 2.33333 3.675L6.41667 1.32708C6.60139 1.22014 6.79583 1.16666 7 1.16666C7.20417 1.16666 7.39861 1.22014 7.58333 1.32708L11.6667 3.675C11.8514 3.78194 11.9948 3.92291 12.0969 4.09791C12.199 4.27291 12.25 4.46736 12.25 4.68125V9.31875C12.25 9.53264 12.199 9.72708 12.0969 9.90208C11.9948 10.0771 11.8514 10.2181 11.6667 10.325L7.58333 12.6729C7.39861 12.7799 7.20417 12.8333 7 12.8333C6.79583 12.8333 6.60139 12.7799 6.41667 12.6729ZM6.41667 7.33541V11.3312L7 11.6667L7.58333 11.3312V7.33541L11.0833 5.30833V4.69583L10.4563 4.33125L7 6.32916L3.54375 4.33125L2.91667 4.69583V5.30833L6.41667 7.33541Z",fill:"black"})}),Wd=({className:e})=>G.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M3.49999 12.8333C3.17916 12.8333 2.90451 12.7191 2.67604 12.4906C2.44756 12.2622 2.33333 11.9875 2.33333 11.6667V2.33333C2.33333 2.0125 2.44756 1.73785 2.67604 1.50938C2.90451 1.2809 3.17916 1.16667 3.49999 1.16667H7.68541C7.84097 1.16667 7.98923 1.19583 8.1302 1.25417C8.27117 1.3125 8.39513 1.39514 8.50208 1.50208L11.3312 4.33125C11.4382 4.4382 11.5208 4.56215 11.5792 4.70313C11.6375 4.8441 11.6667 4.99236 11.6667 5.14792V11.6667C11.6667 11.9875 11.5524 12.2622 11.324 12.4906C11.0955 12.7191 10.8208 12.8333 10.5 12.8333H3.49999ZM7.58333 4.66667C7.58333 4.83195 7.63923 4.97049 7.75104 5.08229C7.86284 5.1941 8.00138 5.25 8.16666 5.25H10.5L7.58333 2.33333V4.66667Z",fill:"black"})}),qd=({className:e})=>G.jsx("svg",{className:`${e} `,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 11 11",children:G.jsx("path",{d:"M3.75 6.66667V4.33333C3.75 4.16806 3.8059 4.02951 3.91771 3.91771C4.02951 3.8059 4.16806 3.75 4.33333 3.75H6.66667C6.83194 3.75 6.97049 3.8059 7.08229 3.91771C7.1941 4.02951 7.25 4.16806 7.25 4.33333V6.66667C7.25 6.83194 7.1941 6.97049 7.08229 7.08229C6.97049 7.1941 6.83194 7.25 6.66667 7.25H4.33333C4.16806 7.25 4.02951 7.1941 3.91771 7.08229C3.8059 6.97049 3.75 6.83194 3.75 6.66667ZM3.75 10.1667V9.58333H2.58333C2.2625 9.58333 1.98785 9.4691 1.75937 9.24063C1.5309 9.01215 1.41667 8.7375 1.41667 8.41667V7.25H0.833333C0.668056 7.25 0.529514 7.1941 0.417708 7.08229C0.305903 6.97049 0.25 6.83194 0.25 6.66667C0.25 6.50139 0.305903 6.36285 0.417708 6.25104C0.529514 6.13924 0.668056 6.08333 0.833333 6.08333H1.41667V4.91667H0.833333C0.668056 4.91667 0.529514 4.86076 0.417708 4.74896C0.305903 4.63715 0.25 4.49861 0.25 4.33333C0.25 4.16806 0.305903 4.02951 0.417708 3.91771C0.529514 3.8059 0.668056 3.75 0.833333 3.75H1.41667V2.58333C1.41667 2.2625 1.5309 1.98785 1.75937 1.75937C1.98785 1.5309 2.2625 1.41667 2.58333 1.41667H3.75V0.833333C3.75 0.668056 3.8059 0.529514 3.91771 0.417708C4.02951 0.305903 4.16806 0.25 4.33333 0.25C4.49861 0.25 4.63715 0.305903 4.74896 0.417708C4.86076 0.529514 4.91667 0.668056 4.91667 0.833333V1.41667H6.08333V0.833333C6.08333 0.668056 6.13924 0.529514 6.25104 0.417708C6.36285 0.305903 6.50139 0.25 6.66667 0.25C6.83194 0.25 6.97049 0.305903 7.08229 0.417708C7.1941 0.529514 7.25 0.668056 7.25 0.833333V1.41667H8.41667C8.7375 1.41667 9.01215 1.5309 9.24063 1.75937C9.4691 1.98785 9.58333 2.2625 9.58333 2.58333V3.75H10.1667C10.3319 3.75 10.4705 3.8059 10.5823 3.91771C10.6941 4.02951 10.75 4.16806 10.75 4.33333C10.75 4.49861 10.6941 4.63715 10.5823 4.74896C10.4705 4.86076 10.3319 4.91667 10.1667 4.91667H9.58333V6.08333H10.1667C10.3319 6.08333 10.4705 6.13924 10.5823 6.25104C10.6941 6.36285 10.75 6.50139 10.75 6.66667C10.75 6.83194 10.6941 6.97049 10.5823 7.08229C10.4705 7.1941 10.3319 7.25 10.1667 7.25H9.58333V8.41667C9.58333 8.7375 9.4691 9.01215 9.24063 9.24063C9.01215 9.4691 8.7375 9.58333 8.41667 9.58333H7.25V10.1667C7.25 10.3319 7.1941 10.4705 7.08229 10.5823C6.97049 10.6941 6.83194 10.75 6.66667 10.75C6.50139 10.75 6.36285 10.6941 6.25104 10.5823C6.13924 10.4705 6.08333 10.3319 6.08333 10.1667V9.58333H4.91667V10.1667C4.91667 10.3319 4.86076 10.4705 4.74896 10.5823C4.63715 10.6941 4.49861 10.75 4.33333 10.75C4.16806 10.75 4.02951 10.6941 3.91771 10.5823C3.8059 10.4705 3.75 10.3319 3.75 10.1667ZM8.41667 8.41667V2.58333H2.58333V8.41667H8.41667Z",fill:"black"})}),Kd=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M3.90834 11.2583L4.75417 12.6875C4.83195 12.8139 4.93889 12.899 5.075 12.9427C5.21111 12.9865 5.34722 12.9792 5.48334 12.9208L7 12.2792L8.51667 12.9208C8.65278 12.9792 8.78889 12.9865 8.925 12.9427C9.06111 12.899 9.16806 12.8139 9.24584 12.6875L10.0917 11.2583L11.6958 10.9083C11.8417 10.8792 11.9583 10.8038 12.0458 10.6823C12.1333 10.5608 12.1674 10.4271 12.1479 10.2812L11.9875 8.63333L13.0813 7.37916C13.1785 7.27221 13.2271 7.14583 13.2271 6.99999C13.2271 6.85416 13.1785 6.72777 13.0813 6.62083L11.9875 5.36666L12.1479 3.71874C12.1674 3.57291 12.1333 3.43923 12.0458 3.3177C11.9583 3.19617 11.8417 3.12083 11.6958 3.09166L10.0917 2.74166L9.24584 1.31249C9.16806 1.1861 9.06111 1.10103 8.925 1.05728C8.78889 1.01353 8.65278 1.02083 8.51667 1.07916L7 1.72083L5.48334 1.07916C5.34722 1.02083 5.21111 1.01353 5.075 1.05728C4.93889 1.10103 4.83195 1.1861 4.75417 1.31249L3.90834 2.74166L2.30417 3.09166C2.15834 3.12083 2.04167 3.19617 1.95417 3.3177C1.86667 3.43923 1.83264 3.57291 1.85209 3.71874L2.0125 5.36666L0.918752 6.62083C0.82153 6.72777 0.772919 6.85416 0.772919 6.99999C0.772919 7.14583 0.82153 7.27221 0.918752 7.37916L2.0125 8.63333L1.85209 10.2812C1.83264 10.4271 1.86667 10.5608 1.95417 10.6823C2.04167 10.8038 2.15834 10.8792 2.30417 10.9083L3.90834 11.2583Z",fill:"black"})}),Qd=({className:e})=>G.jsx("svg",{className:e,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:G.jsx("path",{d:"M7.47254 9.26664C7.75031 9.54442 8.10031 9.67498 8.52254 9.65831C8.94476 9.64164 9.25031 9.48887 9.4392 9.19998L12.2559 4.98331C12.3559 4.82775 12.342 4.68609 12.2142 4.55831C12.0864 4.43053 11.9448 4.41664 11.7892 4.51664L7.57254 7.33331C7.28365 7.53331 7.12531 7.83609 7.09754 8.24164C7.06976 8.6472 7.19476 8.98887 7.47254 9.26664ZM3.90587 12.2666C3.66142 12.2666 3.43642 12.2139 3.23087 12.1083C3.02531 12.0028 2.86142 11.8444 2.7392 11.6333C2.45031 11.1111 2.22809 10.5694 2.07254 10.0083C1.91698 9.4472 1.8392 8.86664 1.8392 8.26664C1.8392 7.34442 2.0142 6.47775 2.3642 5.66664C2.7142 4.85553 3.1892 4.14998 3.7892 3.54998C4.3892 2.94998 5.09476 2.47498 5.90587 2.12498C6.71698 1.77498 7.58365 1.59998 8.50587 1.59998C9.41698 1.59998 10.2725 1.7722 11.0725 2.11664C11.8725 2.46109 12.5725 2.93053 13.1725 3.52498C13.7725 4.11942 14.2503 4.81386 14.6059 5.60831C14.9614 6.40275 15.1448 7.25553 15.1559 8.16664C15.167 8.77775 15.0975 9.37498 14.9475 9.95831C14.7975 10.5416 14.567 11.1 14.2559 11.6333C14.1336 11.8444 13.9698 12.0028 13.7642 12.1083C13.5586 12.2139 13.3336 12.2666 13.0892 12.2666H3.90587Z",fill:"white"})}),Jd=({className:e})=>G.jsxs("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:[G.jsx("path",{d:"M5.68451 8.71817C5.91785 8.9515 6.21185 9.06117 6.56652 9.04717C6.92118 9.03317 7.17785 8.90483 7.33652 8.66217L9.70252 5.12017C9.78652 4.9895 9.77485 4.8705 9.66752 4.76317C9.56018 4.65583 9.44118 4.64417 9.31052 4.72817L5.76852 7.09417C5.52585 7.26217 5.39285 7.5165 5.36952 7.85717C5.34618 8.19783 5.45118 8.48483 5.68451 8.71817ZM2.68851 11.2382C2.48318 11.2382 2.29418 11.1938 2.12151 11.1052C1.94885 11.0165 1.81118 10.8835 1.70851 10.7062C1.46585 10.2675 1.27918 9.8125 1.14851 9.34117C1.01785 8.86983 0.952515 8.38217 0.952515 7.87817C0.952515 7.1035 1.09951 6.3755 1.39351 5.69417C1.68751 5.01283 2.08651 4.42017 2.59051 3.91617C3.09451 3.41217 3.68718 3.01317 4.36852 2.71917C5.04985 2.42517 5.77785 2.27817 6.55252 2.27817C7.31785 2.27817 8.03652 2.42283 8.70852 2.71217C9.38052 3.0015 9.96852 3.39583 10.4725 3.89517C10.9765 4.3945 11.3778 4.97783 11.6765 5.64517C11.9752 6.3125 12.1292 7.02883 12.1385 7.79417C12.1478 8.3075 12.0895 8.80917 11.9635 9.29917C11.8375 9.78917 11.6438 10.2582 11.3825 10.7062C11.2798 10.8835 11.1422 11.0165 10.9695 11.1052C10.7968 11.1938 10.6078 11.2382 10.4025 11.2382H2.68851Z",fill:"black"}),G.jsx("path",{d:"M11.6175 6.47817H13.5288V11.7218H9.24592V8.84977C9.24592 8.19363 9.47715 7.63433 9.93961 7.17186C10.4021 6.7094 10.9614 6.47817 11.6175 6.47817Z",fill:"white"}),G.jsx("path",{d:"M10.6689 11.2214C10.5345 11.2214 10.4218 11.1759 10.3309 11.085C10.24 10.9941 10.1946 10.8814 10.1946 10.7471V9.32409C10.1946 9.1897 10.24 9.07705 10.3309 8.98614C10.4218 8.89523 10.5345 8.84977 10.6689 8.84977V8.37545C10.6689 8.11458 10.7618 7.89125 10.9475 7.70547C11.1333 7.5197 11.3566 7.42681 11.6175 7.42681C11.8784 7.42681 12.1017 7.5197 12.2875 7.70547C12.4733 7.89125 12.5662 8.11458 12.5662 8.37545V8.84977C12.7005 8.84977 12.8132 8.89523 12.9041 8.98614C12.995 9.07705 13.0405 9.1897 13.0405 9.32409V10.7471C13.0405 10.8814 12.995 10.9941 12.9041 11.085C12.8132 11.1759 12.7005 11.2214 12.5662 11.2214H10.6689ZM11.1432 8.84977H12.0918V8.37545C12.0918 8.24106 12.0464 8.12841 11.9555 8.0375C11.8646 7.94659 11.7519 7.90113 11.6175 7.90113C11.4831 7.90113 11.3705 7.94659 11.2796 8.0375C11.1887 8.12841 11.1432 8.24106 11.1432 8.37545V8.84977Z",fill:"black"})]}),e0=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M6.99999 7.58333C6.51388 7.58333 6.10069 7.41319 5.76041 7.07291C5.42013 6.73264 5.24999 6.31944 5.24999 5.83333C5.24999 5.34722 5.42013 4.93403 5.76041 4.59375C6.10069 4.25347 6.51388 4.08333 6.99999 4.08333C7.48611 4.08333 7.8993 4.25347 8.23958 4.59375C8.57986 4.93403 8.74999 5.34722 8.74999 5.83333C8.74999 6.31944 8.57986 6.73264 8.23958 7.07291C7.8993 7.41319 7.48611 7.58333 6.99999 7.58333ZM6.99999 12.25L4.27291 13.1542C4.07847 13.2222 3.90104 13.1979 3.74062 13.0812C3.5802 12.9646 3.49999 12.809 3.49999 12.6146V8.91041C3.13055 8.50208 2.84374 8.03541 2.63958 7.51041C2.43541 6.98541 2.33333 6.42639 2.33333 5.83333C2.33333 4.53055 2.78541 3.42708 3.68958 2.52291C4.59374 1.61875 5.69722 1.16666 6.99999 1.16666C8.30277 1.16666 9.40624 1.61875 10.3104 2.52291C11.2146 3.42708 11.6667 4.53055 11.6667 5.83333C11.6667 6.42639 11.5646 6.98541 11.3604 7.51041C11.1562 8.03541 10.8694 8.50208 10.5 8.91041V12.6146C10.5 12.809 10.4198 12.9646 10.2594 13.0812C10.099 13.1979 9.92152 13.2222 9.72708 13.1542L6.99999 12.25ZM6.99999 9.33333C7.97222 9.33333 8.79861 8.99305 9.47916 8.3125C10.1597 7.63194 10.5 6.80555 10.5 5.83333C10.5 4.86111 10.1597 4.03472 9.47916 3.35416C8.79861 2.67361 7.97222 2.33333 6.99999 2.33333C6.02777 2.33333 5.20138 2.67361 4.52083 3.35416C3.84027 4.03472 3.49999 4.86111 3.49999 5.83333C3.49999 6.80555 3.84027 7.63194 4.52083 8.3125C5.20138 8.99305 6.02777 9.33333 6.99999 9.33333Z",fill:"black"})});function t0({className:e}){return G.jsx("svg",{className:`${e} w-14 h-14`,viewBox:"0 0 14 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:G.jsx("path",{d:"M5.31407 5.89587C5.52796 5.67226 5.77831 5.49483 6.06511 5.36358C6.35192 5.23233 6.66546 5.1667 7.00574 5.1667C7.34602 5.1667 7.65956 5.23233 7.94636 5.36358C8.23317 5.49483 8.48352 5.67226 8.6974 5.89587L11.6432 4.24795L7.57449 1.98753C7.39949 1.88059 7.2099 1.82712 7.00574 1.82712C6.80157 1.82712 6.61199 1.88059 6.43699 1.98753L2.36824 4.24795L5.31407 5.89587ZM6.4224 13.0125V9.76045C5.91685 9.62434 5.49879 9.34969 5.16824 8.93649C4.83768 8.5233 4.6724 8.04448 4.6724 7.50003C4.6724 7.39309 4.67727 7.29101 4.68699 7.19378C4.69671 7.09656 4.71615 7.0042 4.74532 6.9167L1.75574 5.23962V9.73129C1.75574 9.94517 1.80921 10.142 1.91615 10.3219C2.0231 10.5018 2.16893 10.6452 2.35365 10.7521L6.4224 13.0125ZM7.00574 8.6667C7.32657 8.6667 7.60122 8.55247 7.8297 8.32399C8.05817 8.09552 8.1724 7.82087 8.1724 7.50003C8.1724 7.1792 8.05817 6.90455 7.8297 6.67608C7.60122 6.4476 7.32657 6.33337 7.00574 6.33337C6.6849 6.33337 6.41025 6.4476 6.18178 6.67608C5.95331 6.90455 5.83907 7.1792 5.83907 7.50003C5.83907 7.82087 5.95331 8.09552 6.18178 8.32399C6.41025 8.55247 6.6849 8.6667 7.00574 8.6667ZM7.58907 13.0125L11.6578 10.7521C11.8425 10.6452 11.9884 10.5018 12.0953 10.3219C12.2023 10.142 12.2557 9.94517 12.2557 9.73129V5.23962L9.26615 6.9167C9.29532 7.01392 9.31477 7.10872 9.32449 7.20108C9.33421 7.29344 9.33907 7.39309 9.33907 7.50003C9.33907 8.04448 9.17379 8.5233 8.84324 8.93649C8.51268 9.34969 8.09463 9.62434 7.58907 9.76045V13.0125Z",fill:"black"})})}const n0=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M2.81458 7.01458L5.075 9.275C5.18194 9.38194 5.23541 9.51806 5.23541 9.68333C5.23541 9.84861 5.18194 9.98472 5.075 10.0917C4.96805 10.1986 4.83194 10.2521 4.66666 10.2521C4.50139 10.2521 4.36528 10.1986 4.25833 10.0917L1.575 7.40833C1.51666 7.35 1.47535 7.28681 1.45104 7.21875C1.42673 7.15069 1.41458 7.07778 1.41458 7C1.41458 6.92222 1.42673 6.84931 1.45104 6.78125C1.47535 6.71319 1.51666 6.65 1.575 6.59167L4.25833 3.90833C4.375 3.79167 4.51354 3.73333 4.67396 3.73333C4.83437 3.73333 4.97291 3.79167 5.08958 3.90833C5.20625 4.025 5.26458 4.16354 5.26458 4.32396C5.26458 4.48438 5.20625 4.62292 5.08958 4.73958L2.81458 7.01458ZM11.1854 6.98542L8.925 4.725C8.81805 4.61806 8.76458 4.48194 8.76458 4.31667C8.76458 4.15139 8.81805 4.01528 8.925 3.90833C9.03194 3.80139 9.16805 3.74792 9.33333 3.74792C9.49861 3.74792 9.63472 3.80139 9.74166 3.90833L12.425 6.59167C12.4833 6.65 12.5247 6.71319 12.549 6.78125C12.5733 6.84931 12.5854 6.92222 12.5854 7C12.5854 7.07778 12.5733 7.15069 12.549 7.21875C12.5247 7.28681 12.4833 7.35 12.425 7.40833L9.74166 10.0917C9.625 10.2083 9.48889 10.2642 9.33333 10.2594C9.17778 10.2545 9.04166 10.1938 8.925 10.0771C8.80833 9.96042 8.75 9.82188 8.75 9.66146C8.75 9.50104 8.80833 9.3625 8.925 9.24583L11.1854 6.98542Z",fill:"black"})}),r0=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M7 6.41667C8.45833 6.41667 9.69792 6.18819 10.7188 5.73125C11.7396 5.27431 12.25 4.725 12.25 4.08333C12.25 3.44167 11.7396 2.89236 10.7188 2.43542C9.69792 1.97847 8.45833 1.75 7 1.75C5.54167 1.75 4.30208 1.97847 3.28125 2.43542C2.26042 2.89236 1.75 3.44167 1.75 4.08333C1.75 4.725 2.26042 5.27431 3.28125 5.73125C4.30208 6.18819 5.54167 6.41667 7 6.41667ZM7 7.875C7.39861 7.875 7.89687 7.83368 8.49479 7.75104C9.09271 7.6684 9.66875 7.53472 10.2229 7.35C10.7771 7.16528 11.2535 6.92465 11.6521 6.62813C12.0507 6.3316 12.25 5.96944 12.25 5.54167V7C12.25 7.42778 12.0507 7.78993 11.6521 8.08646C11.2535 8.38299 10.7771 8.62361 10.2229 8.80833C9.66875 8.99306 9.09271 9.12674 8.49479 9.20937C7.89687 9.29201 7.39861 9.33333 7 9.33333C6.60139 9.33333 6.10313 9.29201 5.50521 9.20937C4.90729 9.12674 4.33125 8.99306 3.77708 8.80833C3.22292 8.62361 2.74653 8.38299 2.34792 8.08646C1.94931 7.78993 1.75 7.42778 1.75 7V5.54167C1.75 5.96944 1.94931 6.3316 2.34792 6.62813C2.74653 6.92465 3.22292 7.16528 3.77708 7.35C4.33125 7.53472 4.90729 7.6684 5.50521 7.75104C6.10313 7.83368 6.60139 7.875 7 7.875ZM7 10.7917C7.39861 10.7917 7.89687 10.7503 8.49479 10.6677C9.09271 10.5851 9.66875 10.4514 10.2229 10.2667C10.7771 10.0819 11.2535 9.84132 11.6521 9.54479C12.0507 9.24826 12.25 8.88611 12.25 8.45833V9.91667C12.25 10.3444 12.0507 10.7066 11.6521 11.0031C11.2535 11.2997 10.7771 11.5403 10.2229 11.725C9.66875 11.9097 9.09271 12.0434 8.49479 12.126C7.89687 12.2087 7.39861 12.25 7 12.25C6.60139 12.25 6.10313 12.2087 5.50521 12.126C4.90729 12.0434 4.33125 11.9097 3.77708 11.725C3.22292 11.5403 2.74653 11.2997 2.34792 11.0031C1.94931 10.7066 1.75 10.3444 1.75 9.91667V8.45833C1.75 8.88611 1.94931 9.24826 2.34792 9.54479C2.74653 9.84132 3.22292 10.0819 3.77708 10.2667C4.33125 10.4514 4.90729 10.5851 5.50521 10.6677C6.10313 10.7503 6.60139 10.7917 7 10.7917Z",fill:"black"})}),o0=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M4.66667 9.91667H5.83333C5.99861 9.91667 6.13715 9.86076 6.24896 9.74896C6.36076 9.63715 6.41667 9.49861 6.41667 9.33333V8.16667C6.41667 8.00139 6.36076 7.86285 6.24896 7.75104C6.13715 7.63924 5.99861 7.58333 5.83333 7.58333H4.66667C4.50139 7.58333 4.36285 7.63924 4.25104 7.75104C4.13924 7.86285 4.08333 8.00139 4.08333 8.16667V9.33333C4.08333 9.49861 4.13924 9.63715 4.25104 9.74896C4.36285 9.86076 4.50139 9.91667 4.66667 9.91667ZM8.16667 9.91667H9.33333C9.49861 9.91667 9.63715 9.86076 9.74896 9.74896C9.86076 9.63715 9.91667 9.49861 9.91667 9.33333V8.16667C9.91667 8.00139 9.86076 7.86285 9.74896 7.75104C9.63715 7.63924 9.49861 7.58333 9.33333 7.58333H8.16667C8.00139 7.58333 7.86285 7.63924 7.75104 7.75104C7.63924 7.86285 7.58333 8.00139 7.58333 8.16667V9.33333C7.58333 9.49861 7.63924 9.63715 7.75104 9.74896C7.86285 9.86076 8.00139 9.91667 8.16667 9.91667ZM4.66667 6.41667H5.83333C5.99861 6.41667 6.13715 6.36076 6.24896 6.24896C6.36076 6.13715 6.41667 5.99861 6.41667 5.83333V4.66667C6.41667 4.50139 6.36076 4.36285 6.24896 4.25104C6.13715 4.13924 5.99861 4.08333 5.83333 4.08333H4.66667C4.50139 4.08333 4.36285 4.13924 4.25104 4.25104C4.13924 4.36285 4.08333 4.50139 4.08333 4.66667V5.83333C4.08333 5.99861 4.13924 6.13715 4.25104 6.24896C4.36285 6.36076 4.50139 6.41667 4.66667 6.41667ZM8.16667 6.41667H9.33333C9.49861 6.41667 9.63715 6.36076 9.74896 6.24896C9.86076 6.13715 9.91667 5.99861 9.91667 5.83333V4.66667C9.91667 4.50139 9.86076 4.36285 9.74896 4.25104C9.63715 4.13924 9.49861 4.08333 9.33333 4.08333H8.16667C8.00139 4.08333 7.86285 4.13924 7.75104 4.25104C7.63924 4.36285 7.58333 4.50139 7.58333 4.66667V5.83333C7.58333 5.99861 7.63924 6.13715 7.75104 6.24896C7.86285 6.36076 8.00139 6.41667 8.16667 6.41667ZM2.91667 12.25C2.59583 12.25 2.32118 12.1358 2.09271 11.9073C1.86424 11.6788 1.75 11.4042 1.75 11.0833V2.91667C1.75 2.59583 1.86424 2.32118 2.09271 2.09271C2.32118 1.86424 2.59583 1.75 2.91667 1.75H11.0833C11.4042 1.75 11.6788 1.86424 11.9073 2.09271C12.1358 2.32118 12.25 2.59583 12.25 2.91667V11.0833C12.25 11.4042 12.1358 11.6788 11.9073 11.9073C11.6788 12.1358 11.4042 12.25 11.0833 12.25H2.91667Z",fill:"black"})}),i0=({className:e})=>G.jsx("svg",{className:`${e}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 14",fill:"none",children:G.jsx("path",{d:"M6.21251 9.1875L9.05626 7.36458C9.19237 7.27708 9.26042 7.15555 9.26042 7C9.26042 6.84444 9.19237 6.72291 9.05626 6.63541L6.21251 4.8125C6.06667 4.71528 5.91841 4.70798 5.76771 4.79062C5.61702 4.87326 5.54167 5.00208 5.54167 5.17708V8.82291C5.54167 8.99791 5.61702 9.12673 5.76771 9.20937C5.91841 9.29201 6.06667 9.28472 6.21251 9.1875ZM7.00001 12.8333C6.19306 12.8333 5.43473 12.6802 4.72501 12.374C4.01528 12.0677 3.39792 11.6521 2.87292 11.1271C2.34792 10.6021 1.9323 9.98472 1.62605 9.275C1.3198 8.56528 1.16667 7.80694 1.16667 7C1.16667 6.19305 1.3198 5.43472 1.62605 4.725C1.9323 4.01528 2.34792 3.39791 2.87292 2.87291C3.39792 2.34791 4.01528 1.93229 4.72501 1.62604C5.43473 1.31979 6.19306 1.16666 7.00001 1.16666C7.80695 1.16666 8.56528 1.31979 9.27501 1.62604C9.98473 1.93229 10.6021 2.34791 11.1271 2.87291C11.6521 3.39791 12.0677 4.01528 12.374 4.725C12.6802 5.43472 12.8333 6.19305 12.8333 7C12.8333 7.80694 12.6802 8.56528 12.374 9.275C12.0677 9.98472 11.6521 10.6021 11.1271 11.1271C10.6021 11.6521 9.98473 12.0677 9.27501 12.374C8.56528 12.6802 7.80695 12.8333 7.00001 12.8333Z",fill:"black"})}),s0="_container_jb5f6_5",a0="_containerIsPill_jb5f6_16",c0="_topBar_jb5f6_21",l0="_selectedNode_jb5f6_35",u0="_vcModeOn_jb5f6_39",f0="_isTrusted_jb5f6_43",d0="_labelContainer_jb5f6_46",h0="_nodeType_jb5f6_50",g0="_nodeLabel_jb5f6_56",p0="_nodeTypeLarge_jb5f6_61",m0="_topBarIsVCNone_jb5f6_79",y0="_badge_jb5f6_84",v0="_iconContainer_jb5f6_91",x0="_icon_jb5f6_91",w0="_displayType_jb5f6_113",C0="_clickableArea_jb5f6_118",b0="_flex_jb5f6_124",se={container:s0,containerIsPill:a0,topBar:c0,selectedNode:l0,vcModeOn:u0,isTrusted:f0,labelContainer:d0,nodeType:h0,nodeLabel:g0,nodeTypeLarge:p0,topBarIsVCNone:m0,badge:y0,iconContainer:v0,icon:x0,displayType:w0,clickableArea:C0,flex:b0};function _0(){this.__data__=[],this.size=0}var S0=_0;function E0(e,t){return e===t||e!==e&&t!==t}var Tn=E0,N0=Tn;function $0(e,t){for(var n=e.length;n--;)if(N0(e[n][0],t))return n;return-1}var An=$0,M0=An,T0=Array.prototype,A0=T0.splice;function k0(e){var t=this.__data__,n=M0(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():A0.call(t,n,1),--this.size,!0}var I0=k0,P0=An;function O0(e){var t=this.__data__,n=P0(t,e);return n<0?void 0:t[n][1]}var R0=O0,L0=An;function D0(e){return L0(this.__data__,e)>-1}var V0=D0,B0=An;function H0(e,t){var n=this.__data__,r=B0(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var z0=H0,F0=S0,j0=I0,G0=R0,U0=V0,Z0=z0;function vt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=ug}var Ds=fg,dg=Ar,hg=Ds;function gg(e){return e!=null&&hg(e.length)&&!dg(e)}var Pr=gg,pg=Pr,mg=Zt;function yg(e){return mg(e)&&pg(e)}var vg=yg,wn={exports:{}};function xg(){return!1}var wg=xg;wn.exports;(function(e,t){var n=xt,r=wg,o=t&&!t.nodeType&&t,i=o&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===o,a=s?n.Buffer:void 0,c=a?a.isBuffer:void 0,u=c||r;e.exports=u})(wn,wn.exports);var Vs=wn.exports,Cg=In,bg=Is,_g=Zt,Sg="[object Object]",Eg=Function.prototype,Ng=Object.prototype,Bs=Eg.toString,$g=Ng.hasOwnProperty,Mg=Bs.call(Object);function Tg(e){if(!_g(e)||Cg(e)!=Sg)return!1;var t=bg(e);if(t===null)return!0;var n=$g.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Bs.call(n)==Mg}var Ag=Tg,kg=In,Ig=Ds,Pg=Zt,Og="[object Arguments]",Rg="[object Array]",Lg="[object Boolean]",Dg="[object Date]",Vg="[object Error]",Bg="[object Function]",Hg="[object Map]",zg="[object Number]",Fg="[object Object]",jg="[object RegExp]",Gg="[object Set]",Ug="[object String]",Zg="[object WeakMap]",Yg="[object ArrayBuffer]",Xg="[object DataView]",Wg="[object Float32Array]",qg="[object Float64Array]",Kg="[object Int8Array]",Qg="[object Int16Array]",Jg="[object Int32Array]",ep="[object Uint8Array]",tp="[object Uint8ClampedArray]",np="[object Uint16Array]",rp="[object Uint32Array]",K={};K[Wg]=K[qg]=K[Kg]=K[Qg]=K[Jg]=K[ep]=K[tp]=K[np]=K[rp]=!0;K[Og]=K[Rg]=K[Yg]=K[Lg]=K[Xg]=K[Dg]=K[Vg]=K[Bg]=K[Hg]=K[zg]=K[Fg]=K[jg]=K[Gg]=K[Ug]=K[Zg]=!1;function op(e){return Pg(e)&&Ig(e.length)&&!!K[kg(e)]}var ip=op;function sp(e){return function(t){return e(t)}}var ap=sp,Cn={exports:{}};Cn.exports;(function(e,t){var n=Ns,r=t&&!t.nodeType&&t,o=r&&!0&&e&&!e.nodeType&&e,i=o&&o.exports===r,s=i&&n.process,a=function(){try{var c=o&&o.require&&o.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=a})(Cn,Cn.exports);var cp=Cn.exports,lp=ip,up=ap,Bo=cp,Ho=Bo&&Bo.isTypedArray,fp=Ho?up(Ho):lp,Hs=fp;function dp(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var zs=dp,hp=Ir,gp=Tn,pp=Object.prototype,mp=pp.hasOwnProperty;function yp(e,t,n){var r=e[t];(!(mp.call(e,t)&&gp(r,n))||n===void 0&&!(t in e))&&hp(e,t,n)}var vp=yp,xp=vp,wp=Ir;function Cp(e,t,n,r){var o=!n;n||(n={});for(var i=-1,s=t.length;++i-1&&e%1==0&&e0){if(++t>=O6)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var V6=D6,B6=P6,H6=V6,z6=H6(B6),F6=z6,j6=Us,G6=$6,U6=F6;function Z6(e,t){return U6(G6(e,t,j6),e+"")}var Y6=Z6,X6=Tn,W6=Pr,q6=Fs,K6=Je;function Q6(e,t,n){if(!K6(n))return!1;var r=typeof t;return(r=="number"?W6(n)&&q6(t,n.length):r=="string"&&t in n)?X6(n[t],e):!1}var J6=Q6,e7=Y6,t7=J6;function n7(e){return e7(function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&t7(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++r{const t=typeof e=="function"?oi(e):e,n=(r,o)=>f7(t,r,o);return Object.assign(n,t),n},d7=e=>e?Yo(e):Yo,h7=d7()((e,t)=>({graphName:"",nodes:[],edges:[],allNodes:[],graphState:"vc-off",governanceFilter:null,vcs:new Map,vcsToGraph:new Map,sinks:{},activeSink:null,showBenchmarks:!1,hasMeasured:!1,pretty:!0,setGraphName:n=>e({graphName:n}),setGovernanceFilter:n=>e({governanceFilter:n}),setAllNodes:n=>e({allNodes:n}),setNodes:n=>{const r=new Map(t().nodes.map(i=>[i.id,i]));let o=[];for(const i of n){let s=r.get(i.id);o.push(s?c7(i,s):i)}e({nodes:o})},setEdges:n=>e({edges:n}),setGraphState:n=>{e({graphState:n})},setVcs:n=>e({vcs:n}),setVcsToGraph:n=>e({vcsToGraph:n}),setSinkMap:n=>e({sinks:n}),setActiveSink:n=>e({activeSink:n}),setShowBenchmarks:n=>{e({showBenchmarks:n})},setPretty:n=>e({pretty:n}),setHasMeasured:n=>e({hasMeasured:n}),setGraph:n=>e({graph:n}),setNoBenchmarksGraph:n=>e({noBenchmarksGraph:n}),onNodesChange:n=>{const r=us(n,t().nodes);e({nodes:r})},onEdgesChange:n=>{e({edges:Kf(n,t().edges)})},onConnect:n=>{e({edges:Fi(n,t().edges)})},getNodeById:n=>t().nodes.find(r=>r.id===n),getNodeFromFullGraph:n=>t().allNodes.find(r=>r.id===n)})),g7=({className:e})=>G.jsx("svg",{className:`${e}`,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:G.jsx("path",{d:"M2.94604 11.3881H8.77938C8.94465 11.3881 9.0832 11.444 9.195 11.5558C9.30681 11.6676 9.36271 11.8061 9.36271 11.9714C9.36271 12.1367 9.30681 12.2752 9.195 12.387C9.0832 12.4988 8.94465 12.5548 8.77938 12.5548H2.94604C2.78076 12.5548 2.64222 12.4988 2.53042 12.387C2.41861 12.2752 2.36271 12.1367 2.36271 11.9714C2.36271 11.8061 2.41861 11.6676 2.53042 11.5558C2.64222 11.444 2.78076 11.3881 2.94604 11.3881ZM4.82729 8.89434L3.17938 7.24642C2.95576 7.02281 2.84153 6.74815 2.83667 6.42246C2.83181 6.09677 2.94118 5.82211 3.16479 5.5985L3.58771 5.17558L6.91271 8.47142L6.48979 8.89434C6.26618 9.11795 5.9891 9.22975 5.65854 9.22975C5.32799 9.22975 5.0509 9.11795 4.82729 8.89434ZM9.36271 6.02142L6.06688 2.69642L6.48979 2.2735C6.7134 2.04989 6.98806 1.94051 7.31375 1.94538C7.63945 1.95024 7.9141 2.06447 8.13771 2.28808L9.78563 3.936C10.0092 4.15961 10.121 4.4367 10.121 4.76725C10.121 5.09781 10.0092 5.37489 9.78563 5.5985L9.36271 6.02142ZM11.6377 11.5631L4.43354 4.35892L5.25021 3.54225L12.4544 10.7464C12.5613 10.8534 12.6148 10.9895 12.6148 11.1548C12.6148 11.32 12.5613 11.4561 12.4544 11.5631C12.3474 11.67 12.2113 11.7235 12.046 11.7235C11.8808 11.7235 11.7447 11.67 11.6377 11.5631Z",fill:"black"})}),p7="_titleContainer_1p5wf_1",m7="_title_1p5wf_1",y7="_closeButton_1p5wf_15",v7="_govButton_1p5wf_22",x7="_iconButton_1p5wf_28",w7="_icon_1p5wf_28",at={titleContainer:p7,title:m7,closeButton:y7,govButton:v7,iconButton:x7,icon:w7},C7=({governanceNodes:e,onGovernanceSelect:t,onGovernanceClose:n,governanceFilter:r})=>{const[o,i]=b.useState(!1),s=()=>{i(!o)},a=G.jsx("div",{children:e.map(f=>{var y;const h=(r==null?void 0:r.find(p=>p===f.id))?{backgroundColor:"#E2CCFF",color:"#000000"}:{};return G.jsx(Ma,{style:h,onClick:()=>{},className:at.govButton,type:"text",children:((y=f.data.enrichments.governance)==null?void 0:y.name)||f.data.label},f.id)})}),c=()=>{i(!1),n()},u=()=>{c()},l=()=>G.jsxs("div",{className:at.titleContainer,children:[G.jsx("span",{className:at.title,children:"Governance "}),G.jsx("button",{onClick:u,className:at.closeButton,children:G.jsx(Ta,{})})]});return G.jsx(Ja,{content:a,title:l,trigger:"click",open:o,getTooltipContainer:f=>f,children:G.jsx("div",{children:G.jsx("button",{className:at.iconButton,onClick:s,children:G.jsx(g7,{className:at.icon})})})})},Xo={untrusted:"#FFCCD5",none:"white",trusted:"#CEFFDC",unknown:"#E2E8F0",waiting:"orange"},H7={untrusted:"#FF6682",none:"black",trusted:"#26D958",unknown:"#a7a9b3",waiting:"orange"};function z7(e){let t="DataIcon",n="governance",r=null;switch(e?e.toLowerCase():""){case"attribution":t="AttributionIcon",r=ge.certificate,n="Attribution";break;case"benchmark":t="BenchmarkIcon",r=ge.benchmark,n="benchmark";break;case"benchmark_result":t="Benchmark_resultIcon",r=ge.benchmark,n="benchmark result";break;case"certificate":t="CertificateIcon",r=ge.certificate,n="certificate";break;case"database":t="DatabaseIcon",r=ge.data,n="database";break;case"dataset":t="DatasetIcon",r=ge.data,n="dataset";break;case"data":t="DataIcon",r=Vr.grey400,n="data";break;case"document":t="DocumentIcon",r=ge.data,n="document";break;case"media_file":t="Media_fileIcon",r=ge.data,n="media file";break;case"computation":t="ComputationIcon",r=ge.computation,n="computation";break;case"model":t="ModelIcon",r=ge.model,n="model";break;case"token":t="TokenIcon",r=ge.tokens,n="token";break;case"code":t="DataIcon",r=ge.code,n="code";break;case"governance":t="DataIcon",r=Vr.blue,n="Governance";break;default:r="#AAEEDD",n="Unknown"}return{iconId:t,color:r,displayType:n}}function b7(e,t){if(!t)return"waiting";const n=[];for(const[o,{nodes:i,vc:s}]of t)i.some(a=>a.node.id==e)&&n.push(s);const r=n.map(o=>o.issuerStatus);return Zs(r)}function F7(e,t){if(!t)return"waiting";const n=[];for(const[o,{edges:i,vc:s}]of t)i.some(a=>a.edge.id==e)&&n.push(s);const r=n.map(o=>o.issuerStatus);return Zs(r)}function Zs(e){let t="none";return e.some(r=>r.toLocaleLowerCase()==="trusted")?t="trusted":e.some(r=>r.toLocaleLowerCase()==="untrusted")?t="untrusted":e.some(r=>r.toLocaleLowerCase()==="unknown")&&(t="unknown"),t}const _7={DataIcon:Yd,ModelIcon:Xd,ComputationIcon:qd,DocumentIcon:Wd,TokenIcon:t0,AttributionIcon:Kd,BenchmarkIcon:Qd,Benchmark_resultIcon:Jd,CertificateIcon:e0,CodeIcon:n0,DatabaseIcon:r0,DatasetIcon:o0,Media_fileIcon:i0},S7=e=>_7[e]||null,E7=({top:e,bottom:t})=>({"--node-color-top":e,"--node-color-bottom":t}),N7=e=>e.transform[2]>=za,$7=e=>e.transform[2]>=Fa,M7=({id:e,data:t,...n})=>{const{nodeColor:r,label:o,icon:i,sourcePosition:s,displayType:a,typeLabel:c,governanceNodes:u,isSourceForConnection:l,isTargetForConnection:f}=t,d=Aa(),h=ka(),[y,p]=Ia(),w=h.nodeCid,{graphState:m,vcsToGraph:_,governanceFilter:$,setGovernanceFilter:v,sinks:M,activeSink:O,getNodeFromFullGraph:R}=h7(B=>({graphState:B.graphState,vcsToGraph:B.vcsToGraph,governanceFilter:B.governanceFilter,setGovernanceFilter:B.setGovernanceFilter,sinks:B.sinks,activeSink:B.activeSink,getNodeFromFullGraph:B.getNodeFromFullGraph})),I=w===e,k=O?M[O]:null,F=k?k.nodes.has(e)||O===e:!1,D=b7(e,_),z=B=>{var U;let H=1;if(k&&!w&&(H=F?1:.1),k&&w){const Y=R(w),W=(U=Y==null?void 0:Y.data.model)!=null&&U.id?`${Y.data.model.id}-benchmarks`:w;k.nodes.has(W)||O===W?F?W===B?H=1:H=.5:H=.1:H=W!==B?.1:1}return!k&&w&&(H=w!==B?.1:1),$?{opacity:$.find(W=>u.some(q=>q.id===W))?1:.2}:{opacity:H}},E=B=>{B.altKey?p(H=>({...H,sourceNode:e})):I||d(Ha(`${h.owner}/${h.repo}`)+"/"+e+`?${y.toString()}`)},g={"vc-off":{top:r,bottom:"white"},"vc-on":{top:Xo[D],bottom:Xo[D]}},S={...E7(g[m])},C=Rt(se.container,{[se.vcModeOn]:m==="vc-on",[se.selectedNode]:I}),T=Rt(se.topBar,{[se.topBarIsVCUnknown]:D==="unknown"&&m==="vc-on",[se.topBarIsVCNone]:D==="none"&&m==="vc-on",[se.isTrusted]:D==="trusted"&&m==="vc-on"}),P=S7(i),x=o,N=B=>{const H=[...$||[]],U=H.indexOf(B);U>-1?H.splice(U,1):H.push(B),H.length===0?v(null):v(H)},A=()=>{v(null)};b.useEffect(()=>{w&&v(null)},[w]);const V=J(N7);return J($7),G.jsxs(Pa.div,{style:S,className:C,animate:{...z(e)},initial:{opacity:0},transition:{duration:1},children:[G.jsx("div",{className:"popup-container"}),G.jsx("div",{className:se.badge,children:u.length>0&&G.jsx(C7,{governanceNodes:u,onGovernanceSelect:N,onGovernanceClose:A,governanceFilter:$})}),G.jsx("div",{className:se.clickableArea,onClick:E,children:G.jsxs("div",{className:T,children:[G.jsx("span",{className:se.iconContainer,children:P&&G.jsx(P,{className:se.icon})}),G.jsxs("div",{className:se.labelContainer,children:[G.jsx("div",{className:se.nodeType,style:{visibility:V?"visible":"hidden"},children:a}),G.jsx("div",{className:se.nodeLabel,style:{visibility:V?"visible":"hidden"},children:x}),G.jsx("div",{className:se.nodeTypeLarge,style:{display:V?"none":"flex"},children:a})]})]})}),G.jsx(yt,{type:"target",position:j.Left,id:"left",style:{opacity:f?1:0}}),G.jsx(yt,{type:"source",position:j.Right,id:"source",style:{opacity:l?1:0}})]})},j7=b.memo(M7);function G7(e,t){return e.startsWith(t)?e.slice(t.length):e}export{Kd as A,Qd as B,qd as C,Yd as D,H7 as E,R7 as F,C7 as G,yt as H,L7 as I,G7 as J,bs as K,Zd as L,Xd as M,Xo as N,O7 as O,j as P,D7 as Q,jd as R,B7 as S,t0 as T,S7 as U,Ss as a,V7 as b,me as c,I7 as d,h7 as e,b7 as f,Es as g,Wd as h,Jd as i,e0 as j,n0 as k,r0 as l,o0 as m,i0 as n,zi as o,F7 as p,Ut as q,Zs as r,ue as s,yn as t,J as u,cs as v,P7 as w,oe as x,j7 as y,z7 as z};