(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const l of u.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function i(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(a){if(a.ep)return;a.ep=!0;const u=i(a);fetch(a.href,u)}})();var ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hc={exports:{}},ko={},pc={exports:{}},Ie={};/** * @license React * react.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 m0;function RN(){if(m0)return Ie;m0=1;var e=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function m(P){return P===null||typeof P!="object"?null:(P=g&&P[g]||P["@@iterator"],typeof P=="function"?P:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,b={};function x(P,H,oe){this.props=P,this.context=H,this.refs=b,this.updater=oe||w}x.prototype.isReactComponent={},x.prototype.setState=function(P,H){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,H,"setState")},x.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function E(){}E.prototype=x.prototype;function C(P,H,oe){this.props=P,this.context=H,this.refs=b,this.updater=oe||w}var _=C.prototype=new E;_.constructor=C,S(_,x.prototype),_.isPureReactComponent=!0;var k=Array.isArray,R=Object.prototype.hasOwnProperty,M={current:null},T={key:!0,ref:!0,__self:!0,__source:!0};function O(P,H,oe){var D,Y={},X=null,re=null;if(H!=null)for(D in H.ref!==void 0&&(re=H.ref),H.key!==void 0&&(X=""+H.key),H)R.call(H,D)&&!T.hasOwnProperty(D)&&(Y[D]=H[D]);var ne=arguments.length-2;if(ne===1)Y.children=oe;else if(1>>1,H=j[P];if(0>>1;Pa(Y,K))Xa(re,Y)?(j[P]=re,j[X]=K,P=X):(j[P]=Y,j[D]=K,P=D);else if(Xa(re,K))j[P]=re,j[X]=K,P=X;else break e}}return F}function a(j,F){var K=j.sortIndex-F.sortIndex;return K!==0?K:j.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var d=[],h=[],p=1,g=null,m=3,w=!1,S=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(j){for(var F=i(h);F!==null;){if(F.callback===null)o(h);else if(F.startTime<=j)o(h),F.sortIndex=F.expirationTime,r(d,F);else break;F=i(h)}}function k(j){if(b=!1,_(j),!S)if(i(d)!==null)S=!0,V(R);else{var F=i(h);F!==null&&Z(k,F.startTime-j)}}function R(j,F){S=!1,b&&(b=!1,E(O),O=-1),w=!0;var K=m;try{for(_(F),g=i(d);g!==null&&(!(g.expirationTime>F)||j&&!L());){var P=g.callback;if(typeof P=="function"){g.callback=null,m=g.priorityLevel;var H=P(g.expirationTime<=F);F=e.unstable_now(),typeof H=="function"?g.callback=H:g===i(d)&&o(d),_(F)}else o(d);g=i(d)}if(g!==null)var oe=!0;else{var D=i(h);D!==null&&Z(k,D.startTime-F),oe=!1}return oe}finally{g=null,m=K,w=!1}}var M=!1,T=null,O=-1,z=5,W=-1;function L(){return!(e.unstable_now()-Wj||125P?(j.sortIndex=K,r(h,j),i(d)===null&&j===i(h)&&(b?(E(O),O=-1):b=!0,Z(k,K-P))):(j.sortIndex=H,r(d,j),S||w||(S=!0,V(R))),j},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(j){var F=m;return function(){var K=m;m=F;try{return j.apply(this,arguments)}finally{m=K}}}})(mc)),mc}var S0;function AN(){return S0||(S0=1,vc.exports=PN()),vc.exports}/** * @license React * react-dom.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 E0;function qN(){if(E0)return xt;E0=1;var e=Vo(),r=AN();function i(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},g={};function m(t){return d.call(g,t)?!0:d.call(p,t)?!1:h.test(t)?g[t]=!0:(p[t]=!0,!1)}function w(t,n,s,f){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return f?!1:s!==null?!s.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function S(t,n,s,f){if(n===null||typeof n>"u"||w(t,n,s,f))return!0;if(f)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function b(t,n,s,f,v,y,N){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=s,this.propertyName=t,this.type=n,this.sanitizeURL=y,this.removeEmptyString=N}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){x[t]=new b(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];x[n]=new b(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){x[t]=new b(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){x[t]=new b(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){x[t]=new b(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){x[t]=new b(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){x[t]=new b(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){x[t]=new b(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){x[t]=new b(t,5,!1,t.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function C(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var n=t.replace(E,C);x[n]=new b(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(E,C);x[n]=new b(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(E,C);x[n]=new b(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){x[t]=new b(t,1,!1,t.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){x[t]=new b(t,1,!1,t.toLowerCase(),null,!0,!0)});function _(t,n,s,f){var v=x.hasOwnProperty(n)?x[n]:null;(v!==null?v.type!==0:f||!(2q||v[N]!==y[q]){var B=` `+v[N].replace(" at new "," at ");return t.displayName&&B.includes("")&&(B=B.replace("",t.displayName)),B}while(1<=N&&0<=q);break}}}finally{oe=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?H(t):""}function Y(t){switch(t.tag){case 5:return H(t.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return t=D(t.type,!1),t;case 11:return t=D(t.type.render,!1),t;case 1:return t=D(t.type,!0),t;default:return""}}function X(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case M:return"Portal";case z:return"Profiler";case O:return"StrictMode";case Q:return"Suspense";case A:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case L:return(t.displayName||"Context")+".Consumer";case W:return(t._context.displayName||"Context")+".Provider";case $:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case G:return n=t.displayName||null,n!==null?n:X(t.type)||"Memo";case V:n=t._payload,t=t._init;try{return X(t(n))}catch{}}return null}function re(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(n);case 8:return n===O?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function ne(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function se(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function fe(t){var n=se(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),f=""+t[n];if(!t.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var v=s.get,y=s.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return v.call(this)},set:function(N){f=""+N,y.call(this,N)}}),Object.defineProperty(t,n,{enumerable:s.enumerable}),{getValue:function(){return f},setValue:function(N){f=""+N},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function ve(t){t._valueTracker||(t._valueTracker=fe(t))}function xe(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),f="";return t&&(f=se(t)?t.checked?"true":"false":t.value),t=f,t!==s?(n.setValue(t),!0):!1}function de(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ee(t,n){var s=n.checked;return K({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??t._wrapperState.initialChecked})}function ye(t,n){var s=n.defaultValue==null?"":n.defaultValue,f=n.checked!=null?n.checked:n.defaultChecked;s=ne(n.value!=null?n.value:s),t._wrapperState={initialChecked:f,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Ne(t,n){n=n.checked,n!=null&&_(t,"checked",n,!1)}function Se(t,n){Ne(t,n);var s=ne(n.value),f=n.type;if(s!=null)f==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+s):t.value!==""+s&&(t.value=""+s);else if(f==="submit"||f==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?We(t,n.type,s):n.hasOwnProperty("defaultValue")&&We(t,n.type,ne(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function Je(t,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var f=n.type;if(!(f!=="submit"&&f!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,s||n===t.value||(t.value=n),t.defaultValue=n}s=t.name,s!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,s!==""&&(t.name=s)}function We(t,n,s){(n!=="number"||de(t.ownerDocument)!==t)&&(s==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+s&&(t.defaultValue=""+s))}var ft=Array.isArray;function it(t,n,s,f){if(t=t.options,n){n={};for(var v=0;v"+n.valueOf().toString()+"",n=pt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function At(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var mn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jr=["Webkit","ms","Moz","O"];Object.keys(mn).forEach(function(t){jr.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),mn[n]=mn[t]})});function Et(t,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||mn.hasOwnProperty(t)&&mn[t]?(""+n).trim():n+"px"}function qt(t,n){t=t.style;for(var s in n)if(n.hasOwnProperty(s)){var f=s.indexOf("--")===0,v=Et(s,n[s],f);s==="float"&&(s="cssFloat"),f?t.setProperty(s,v):t[s]=v}}var Su=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qi(t,n){if(n){if(Su[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(i(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(i(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(i(61))}if(n.style!=null&&typeof n.style!="object")throw Error(i(62))}}function Li(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ji=null;function Oi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zi=null,Pn=null,An=null;function ra(t){if(t=lo(t)){if(typeof zi!="function")throw Error(i(280));var n=t.stateNode;n&&(n=Aa(n),zi(t.stateNode,t.type,n))}}function ia(t){Pn?An?An.push(t):An=[t]:Pn=t}function oa(){if(Pn){var t=Pn,n=An;if(An=Pn=null,ra(t),n)for(t=0;t>>=0,t===0?32:31-(Pu(t)/Au|0)|0}var Fr=64,$r=4194304;function sn(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Br(t,n){var s=t.pendingLanes;if(s===0)return 0;var f=0,v=t.suspendedLanes,y=t.pingedLanes,N=s&268435455;if(N!==0){var q=N&~v;q!==0?f=sn(q):(y&=N,y!==0&&(f=sn(y)))}else N=s&~v,N!==0?f=sn(N):y!==0&&(f=sn(y));if(f===0)return 0;if(n!==0&&n!==f&&(n&v)===0&&(v=f&-f,y=n&-n,v>=y||v===16&&(y&4194240)!==0))return n;if((f&4)!==0&&(f|=s&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=f;0s;s++)n.push(t);return n}function lr(t,n,s){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-bt(n),t[n]=s}function ma(t,n){var s=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var f=t.eventTimes;for(t=t.expirationTimes;0=eo),cm=" ",fm=!1;function dm(t,n){switch(t){case"keyup":return bC.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Gr=!1;function CC(t,n){switch(t){case"compositionend":return hm(n);case"keypress":return n.which!==32?null:(fm=!0,cm);case"textInput":return t=n.data,t===cm&&fm?null:t;default:return null}}function NC(t,n){if(Gr)return t==="compositionend"||!Wu&&dm(t,n)?(t=im(),Sa=$u=zn=null,Gr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-t};t=f}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=xm(s)}}function Sm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Sm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Em(){for(var t=window,n=de();n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=de(t.document)}return n}function Xu(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function jC(t){var n=Em(),s=t.focusedElem,f=t.selectionRange;if(n!==s&&s&&s.ownerDocument&&Sm(s.ownerDocument.documentElement,s)){if(f!==null&&Xu(s)){if(n=f.start,t=f.end,t===void 0&&(t=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(t,s.value.length);else if(t=(n=s.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var v=s.textContent.length,y=Math.min(f.start,v);f=f.end===void 0?y:Math.min(f.end,v),!t.extend&&y>f&&(v=f,f=y,y=v),v=_m(s,y);var N=_m(s,f);v&&N&&(t.rangeCount!==1||t.anchorNode!==v.node||t.anchorOffset!==v.offset||t.focusNode!==N.node||t.focusOffset!==N.offset)&&(n=n.createRange(),n.setStart(v.node,v.offset),t.removeAllRanges(),y>f?(t.addRange(n),t.extend(N.node,N.offset)):(n.setEnd(N.node,N.offset),t.addRange(n)))}}for(n=[],t=s;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Wr=null,Qu=null,io=null,Zu=!1;function bm(t,n,s){var f=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Zu||Wr==null||Wr!==de(f)||(f=Wr,"selectionStart"in f&&Xu(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),io&&ro(io,f)||(io=f,f=Ma(Qu,"onSelect"),0Zr||(t.current=cl[Zr],cl[Zr]=null,Zr--)}function Ae(t,n){Zr++,cl[Zr]=t.current,t.current=n}var Bn={},st=$n(Bn),gt=$n(!1),fr=Bn;function Jr(t,n){var s=t.type.contextTypes;if(!s)return Bn;var f=t.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===n)return f.__reactInternalMemoizedMaskedChildContext;var v={},y;for(y in s)v[y]=n[y];return f&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=v),v}function vt(t){return t=t.childContextTypes,t!=null}function qa(){Le(gt),Le(st)}function Dm(t,n,s){if(st.current!==Bn)throw Error(i(168));Ae(st,n),Ae(gt,s)}function Fm(t,n,s){var f=t.stateNode;if(n=n.childContextTypes,typeof f.getChildContext!="function")return s;f=f.getChildContext();for(var v in f)if(!(v in n))throw Error(i(108,re(t)||"Unknown",v));return K({},s,f)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Bn,fr=st.current,Ae(st,t),Ae(gt,gt.current),!0}function $m(t,n,s){var f=t.stateNode;if(!f)throw Error(i(169));s?(t=Fm(t,n,fr),f.__reactInternalMemoizedMergedChildContext=t,Le(gt),Le(st),Ae(st,t)):Le(gt),Ae(gt,s)}var wn=null,ja=!1,fl=!1;function Bm(t){wn===null?wn=[t]:wn.push(t)}function YC(t){ja=!0,Bm(t)}function Hn(){if(!fl&&wn!==null){fl=!0;var t=0,n=Pe;try{var s=wn;for(Pe=1;t>=N,v-=N,xn=1<<32-bt(n)+v|s<Ce?(rt=ke,ke=null):rt=ke.sibling;var Te=ae(J,ke,ee[Ce],ce);if(Te===null){ke===null&&(ke=rt);break}t&&ke&&Te.alternate===null&&n(J,ke),U=y(Te,U,Ce),be===null?we=Te:be.sibling=Te,be=Te,ke=rt}if(Ce===ee.length)return s(J,ke),je&&hr(J,Ce),we;if(ke===null){for(;CeCe?(rt=ke,ke=null):rt=ke.sibling;var Zn=ae(J,ke,Te.value,ce);if(Zn===null){ke===null&&(ke=rt);break}t&&ke&&Zn.alternate===null&&n(J,ke),U=y(Zn,U,Ce),be===null?we=Zn:be.sibling=Zn,be=Zn,ke=rt}if(Te.done)return s(J,ke),je&&hr(J,Ce),we;if(ke===null){for(;!Te.done;Ce++,Te=ee.next())Te=le(J,Te.value,ce),Te!==null&&(U=y(Te,U,Ce),be===null?we=Te:be.sibling=Te,be=Te);return je&&hr(J,Ce),we}for(ke=f(J,ke);!Te.done;Ce++,Te=ee.next())Te=he(ke,J,Ce,Te.value,ce),Te!==null&&(t&&Te.alternate!==null&&ke.delete(Te.key===null?Ce:Te.key),U=y(Te,U,Ce),be===null?we=Te:be.sibling=Te,be=Te);return t&&ke.forEach(function(IN){return n(J,IN)}),je&&hr(J,Ce),we}function Ge(J,U,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===T&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case R:e:{for(var we=ee.key,be=U;be!==null;){if(be.key===we){if(we=ee.type,we===T){if(be.tag===7){s(J,be.sibling),U=v(be,ee.props.children),U.return=J,J=U;break e}}else if(be.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===V&&Ym(we)===be.type){s(J,be.sibling),U=v(be,ee.props),U.ref=co(J,be,ee),U.return=J,J=U;break e}s(J,be);break}else n(J,be);be=be.sibling}ee.type===T?(U=_r(ee.props.children,J.mode,ce,ee.key),U.return=J,J=U):(ce=cs(ee.type,ee.key,ee.props,null,J.mode,ce),ce.ref=co(J,U,ee),ce.return=J,J=ce)}return N(J);case M:e:{for(be=ee.key;U!==null;){if(U.key===be)if(U.tag===4&&U.stateNode.containerInfo===ee.containerInfo&&U.stateNode.implementation===ee.implementation){s(J,U.sibling),U=v(U,ee.children||[]),U.return=J,J=U;break e}else{s(J,U);break}else n(J,U);U=U.sibling}U=uc(ee,J.mode,ce),U.return=J,J=U}return N(J);case V:return be=ee._init,Ge(J,U,be(ee._payload),ce)}if(ft(ee))return ge(J,U,ee,ce);if(F(ee))return me(J,U,ee,ce);Fa(J,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"?(ee=""+ee,U!==null&&U.tag===6?(s(J,U.sibling),U=v(U,ee),U.return=J,J=U):(s(J,U),U=sc(ee,J.mode,ce),U.return=J,J=U),N(J)):s(J,U)}return Ge}var ri=Km(!0),Xm=Km(!1),$a=$n(null),Ba=null,ii=null,ml=null;function yl(){ml=ii=Ba=null}function wl(t){var n=$a.current;Le($a),t._currentValue=n}function xl(t,n,s){for(;t!==null;){var f=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,f!==null&&(f.childLanes|=n)):f!==null&&(f.childLanes&n)!==n&&(f.childLanes|=n),t===s)break;t=t.return}}function oi(t,n){Ba=t,ml=ii=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(mt=!0),t.firstContext=null)}function zt(t){var n=t._currentValue;if(ml!==t)if(t={context:t,memoizedValue:n,next:null},ii===null){if(Ba===null)throw Error(i(308));ii=t,Ba.dependencies={lanes:0,firstContext:t}}else ii=ii.next=t;return n}var pr=null;function _l(t){pr===null?pr=[t]:pr.push(t)}function Qm(t,n,s,f){var v=n.interleaved;return v===null?(s.next=s,_l(n)):(s.next=v.next,v.next=s),n.interleaved=s,Sn(t,f)}function Sn(t,n){t.lanes|=n;var s=t.alternate;for(s!==null&&(s.lanes|=n),s=t,t=t.return;t!==null;)t.childLanes|=n,s=t.alternate,s!==null&&(s.childLanes|=n),s=t,t=t.return;return s.tag===3?s.stateNode:null}var Vn=!1;function Sl(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zm(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function En(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function Un(t,n,s){var f=t.updateQueue;if(f===null)return null;if(f=f.shared,(Me&2)!==0){var v=f.pending;return v===null?n.next=n:(n.next=v.next,v.next=n),f.pending=n,Sn(t,s)}return v=f.interleaved,v===null?(n.next=n,_l(f)):(n.next=v.next,v.next=n),f.interleaved=n,Sn(t,s)}function Ha(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var f=n.lanes;f&=t.pendingLanes,s|=f,n.lanes=s,ju(t,s)}}function Jm(t,n){var s=t.updateQueue,f=t.alternate;if(f!==null&&(f=f.updateQueue,s===f)){var v=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var N={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};y===null?v=y=N:y=y.next=N,s=s.next}while(s!==null);y===null?v=y=n:y=y.next=n}else v=y=n;s={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:y,shared:f.shared,effects:f.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}function Va(t,n,s,f){var v=t.updateQueue;Vn=!1;var y=v.firstBaseUpdate,N=v.lastBaseUpdate,q=v.shared.pending;if(q!==null){v.shared.pending=null;var B=q,te=B.next;B.next=null,N===null?y=te:N.next=te,N=B;var ue=t.alternate;ue!==null&&(ue=ue.updateQueue,q=ue.lastBaseUpdate,q!==N&&(q===null?ue.firstBaseUpdate=te:q.next=te,ue.lastBaseUpdate=B))}if(y!==null){var le=v.baseState;N=0,ue=te=B=null,q=y;do{var ae=q.lane,he=q.eventTime;if((f&ae)===ae){ue!==null&&(ue=ue.next={eventTime:he,lane:0,tag:q.tag,payload:q.payload,callback:q.callback,next:null});e:{var ge=t,me=q;switch(ae=n,he=s,me.tag){case 1:if(ge=me.payload,typeof ge=="function"){le=ge.call(he,le,ae);break e}le=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=me.payload,ae=typeof ge=="function"?ge.call(he,le,ae):ge,ae==null)break e;le=K({},le,ae);break e;case 2:Vn=!0}}q.callback!==null&&q.lane!==0&&(t.flags|=64,ae=v.effects,ae===null?v.effects=[q]:ae.push(q))}else he={eventTime:he,lane:ae,tag:q.tag,payload:q.payload,callback:q.callback,next:null},ue===null?(te=ue=he,B=le):ue=ue.next=he,N|=ae;if(q=q.next,q===null){if(q=v.shared.pending,q===null)break;ae=q,q=ae.next,ae.next=null,v.lastBaseUpdate=ae,v.shared.pending=null}}while(!0);if(ue===null&&(B=le),v.baseState=B,v.firstBaseUpdate=te,v.lastBaseUpdate=ue,n=v.shared.interleaved,n!==null){v=n;do N|=v.lane,v=v.next;while(v!==n)}else y===null&&(v.shared.lanes=0);mr|=N,t.lanes=N,t.memoizedState=le}}function ey(t,n,s){if(t=n.effects,n.effects=null,t!==null)for(n=0;ns?s:4,t(!0);var f=Nl.transition;Nl.transition={};try{t(!1),n()}finally{Pe=s,Nl.transition=f}}function wy(){return Dt().memoizedState}function ZC(t,n,s){var f=Kn(t);if(s={lane:f,action:s,hasEagerState:!1,eagerState:null,next:null},xy(t))_y(n,s);else if(s=Qm(t,n,s,f),s!==null){var v=ht();Qt(s,t,f,v),Sy(s,n,f)}}function JC(t,n,s){var f=Kn(t),v={lane:f,action:s,hasEagerState:!1,eagerState:null,next:null};if(xy(t))_y(n,v);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=n.lastRenderedReducer,y!==null))try{var N=n.lastRenderedState,q=y(N,s);if(v.hasEagerState=!0,v.eagerState=q,Gt(q,N)){var B=n.interleaved;B===null?(v.next=v,_l(n)):(v.next=B.next,B.next=v),n.interleaved=v;return}}catch{}finally{}s=Qm(t,n,v,f),s!==null&&(v=ht(),Qt(s,t,f,v),Sy(s,n,f))}}function xy(t){var n=t.alternate;return t===He||n!==null&&n===He}function _y(t,n){go=Wa=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function Sy(t,n,s){if((s&4194240)!==0){var f=n.lanes;f&=t.pendingLanes,s|=f,n.lanes=s,ju(t,s)}}var Xa={readContext:zt,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useInsertionEffect:ut,useLayoutEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useMutableSource:ut,useSyncExternalStore:ut,useId:ut,unstable_isNewReconciler:!1},eN={readContext:zt,useCallback:function(t,n){return cn().memoizedState=[t,n===void 0?null:n],t},useContext:zt,useEffect:fy,useImperativeHandle:function(t,n,s){return s=s!=null?s.concat([t]):null,Ya(4194308,4,py.bind(null,n,t),s)},useLayoutEffect:function(t,n){return Ya(4194308,4,t,n)},useInsertionEffect:function(t,n){return Ya(4,2,t,n)},useMemo:function(t,n){var s=cn();return n=n===void 0?null:n,t=t(),s.memoizedState=[t,n],t},useReducer:function(t,n,s){var f=cn();return n=s!==void 0?s(n):n,f.memoizedState=f.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},f.queue=t,t=t.dispatch=ZC.bind(null,He,t),[f.memoizedState,t]},useRef:function(t){var n=cn();return t={current:t},n.memoizedState=t},useState:ly,useDebugValue:ql,useDeferredValue:function(t){return cn().memoizedState=t},useTransition:function(){var t=ly(!1),n=t[0];return t=QC.bind(null,t[1]),cn().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,s){var f=He,v=cn();if(je){if(s===void 0)throw Error(i(407));s=s()}else{if(s=n(),nt===null)throw Error(i(349));(vr&30)!==0||iy(f,n,s)}v.memoizedState=s;var y={value:s,getSnapshot:n};return v.queue=y,fy(ay.bind(null,f,y,t),[t]),f.flags|=2048,yo(9,oy.bind(null,f,y,s,n),void 0,null),s},useId:function(){var t=cn(),n=nt.identifierPrefix;if(je){var s=_n,f=xn;s=(f&~(1<<32-bt(f)-1)).toString(32)+s,n=":"+n+"R"+s,s=vo++,0<\/script>",t=t.removeChild(t.firstChild)):typeof f.is=="string"?t=N.createElement(s,{is:f.is}):(t=N.createElement(s),s==="select"&&(N=t,f.multiple?N.multiple=!0:f.size&&(N.size=f.size))):t=N.createElementNS(t,s),t[un]=n,t[uo]=f,By(t,n,!1,!1),n.stateNode=t;e:{switch(N=Li(s,f),s){case"dialog":qe("cancel",t),qe("close",t),v=f;break;case"iframe":case"object":case"embed":qe("load",t),v=f;break;case"video":case"audio":for(v=0;vci&&(n.flags|=128,f=!0,wo(y,!1),n.lanes=4194304)}else{if(!f)if(t=Ua(N),t!==null){if(n.flags|=128,f=!0,s=t.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),wo(y,!0),y.tail===null&&y.tailMode==="hidden"&&!N.alternate&&!je)return lt(n),null}else 2*$e()-y.renderingStartTime>ci&&s!==1073741824&&(n.flags|=128,f=!0,wo(y,!1),n.lanes=4194304);y.isBackwards?(N.sibling=n.child,n.child=N):(s=y.last,s!==null?s.sibling=N:n.child=N,y.last=N)}return y.tail!==null?(n=y.tail,y.rendering=n,y.tail=n.sibling,y.renderingStartTime=$e(),n.sibling=null,s=Be.current,Ae(Be,f?s&1|2:s&1),n):(lt(n),null);case 22:case 23:return ic(),f=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==f&&(n.flags|=8192),f&&(n.mode&1)!==0?(It&1073741824)!==0&&(lt(n),n.subtreeFlags&6&&(n.flags|=8192)):lt(n),null;case 24:return null;case 25:return null}throw Error(i(156,n.tag))}function uN(t,n){switch(hl(n),n.tag){case 1:return vt(n.type)&&qa(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ai(),Le(gt),Le(st),Cl(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return bl(n),null;case 13:if(Le(Be),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));ni()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Le(Be),null;case 4:return ai(),null;case 10:return wl(n.type._context),null;case 22:case 23:return ic(),null;case 24:return null;default:return null}}var es=!1,ct=!1,lN=typeof WeakSet=="function"?WeakSet:Set,pe=null;function ui(t,n){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(f){Ue(t,n,f)}else s.current=null}function Gl(t,n,s){try{s()}catch(f){Ue(t,n,f)}}var Uy=!1;function cN(t,n){if(il=xa,t=Em(),Xu(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var f=s.getSelection&&s.getSelection();if(f&&f.rangeCount!==0){s=f.anchorNode;var v=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{s.nodeType,y.nodeType}catch{s=null;break e}var N=0,q=-1,B=-1,te=0,ue=0,le=t,ae=null;t:for(;;){for(var he;le!==s||v!==0&&le.nodeType!==3||(q=N+v),le!==y||f!==0&&le.nodeType!==3||(B=N+f),le.nodeType===3&&(N+=le.nodeValue.length),(he=le.firstChild)!==null;)ae=le,le=he;for(;;){if(le===t)break t;if(ae===s&&++te===v&&(q=N),ae===y&&++ue===f&&(B=N),(he=le.nextSibling)!==null)break;le=ae,ae=le.parentNode}le=he}s=q===-1||B===-1?null:{start:q,end:B}}else s=null}s=s||{start:0,end:0}}else s=null;for(ol={focusedElem:t,selectionRange:s},xa=!1,pe=n;pe!==null;)if(n=pe,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,pe=t;else for(;pe!==null;){n=pe;try{var ge=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var me=ge.memoizedProps,Ge=ge.memoizedState,J=n.stateNode,U=J.getSnapshotBeforeUpdate(n.elementType===n.type?me:Yt(n.type,me),Ge);J.__reactInternalSnapshotBeforeUpdate=U}break;case 3:var ee=n.stateNode.containerInfo;ee.nodeType===1?ee.textContent="":ee.nodeType===9&&ee.documentElement&&ee.removeChild(ee.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(ce){Ue(n,n.return,ce)}if(t=n.sibling,t!==null){t.return=n.return,pe=t;break}pe=n.return}return ge=Uy,Uy=!1,ge}function xo(t,n,s){var f=n.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&t)===t){var y=v.destroy;v.destroy=void 0,y!==void 0&&Gl(n,s,y)}v=v.next}while(v!==f)}}function ts(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&t)===t){var f=s.create;s.destroy=f()}s=s.next}while(s!==n)}}function Wl(t){var n=t.ref;if(n!==null){var s=t.stateNode;switch(t.tag){case 5:t=s;break;default:t=s}typeof n=="function"?n(t):n.current=t}}function Gy(t){var n=t.alternate;n!==null&&(t.alternate=null,Gy(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[un],delete n[uo],delete n[ll],delete n[GC],delete n[WC])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Wy(t){return t.tag===5||t.tag===3||t.tag===4}function Yy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Wy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yl(t,n,s){var f=t.tag;if(f===5||f===6)t=t.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(t,n):s.insertBefore(t,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(t,s)):(n=s,n.appendChild(t)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=Pa));else if(f!==4&&(t=t.child,t!==null))for(Yl(t,n,s),t=t.sibling;t!==null;)Yl(t,n,s),t=t.sibling}function Kl(t,n,s){var f=t.tag;if(f===5||f===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(f!==4&&(t=t.child,t!==null))for(Kl(t,n,s),t=t.sibling;t!==null;)Kl(t,n,s),t=t.sibling}var ot=null,Kt=!1;function Gn(t,n,s){for(s=s.child;s!==null;)Ky(t,n,s),s=s.sibling}function Ky(t,n,s){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(ur,s)}catch{}switch(s.tag){case 5:ct||ui(s,n);case 6:var f=ot,v=Kt;ot=null,Gn(t,n,s),ot=f,Kt=v,ot!==null&&(Kt?(t=ot,s=s.stateNode,t.nodeType===8?t.parentNode.removeChild(s):t.removeChild(s)):ot.removeChild(s.stateNode));break;case 18:ot!==null&&(Kt?(t=ot,s=s.stateNode,t.nodeType===8?ul(t.parentNode,s):t.nodeType===1&&ul(t,s),Qi(t)):ul(ot,s.stateNode));break;case 4:f=ot,v=Kt,ot=s.stateNode.containerInfo,Kt=!0,Gn(t,n,s),ot=f,Kt=v;break;case 0:case 11:case 14:case 15:if(!ct&&(f=s.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var y=v,N=y.destroy;y=y.tag,N!==void 0&&((y&2)!==0||(y&4)!==0)&&Gl(s,n,N),v=v.next}while(v!==f)}Gn(t,n,s);break;case 1:if(!ct&&(ui(s,n),f=s.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=s.memoizedProps,f.state=s.memoizedState,f.componentWillUnmount()}catch(q){Ue(s,n,q)}Gn(t,n,s);break;case 21:Gn(t,n,s);break;case 22:s.mode&1?(ct=(f=ct)||s.memoizedState!==null,Gn(t,n,s),ct=f):Gn(t,n,s);break;default:Gn(t,n,s)}}function Xy(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new lN),n.forEach(function(f){var v=wN.bind(null,t,f);s.has(f)||(s.add(f),f.then(v,v))})}}function Xt(t,n){var s=n.deletions;if(s!==null)for(var f=0;fv&&(v=N),f&=~y}if(f=v,f=$e()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*dN(f/1960))-f,10t?16:t,Yn===null)var f=!1;else{if(t=Yn,Yn=null,as=0,(Me&6)!==0)throw Error(i(331));var v=Me;for(Me|=4,pe=t.current;pe!==null;){var y=pe,N=y.child;if((pe.flags&16)!==0){var q=y.deletions;if(q!==null){for(var B=0;B$e()-Zl?wr(t,0):Ql|=s),wt(t,n)}function l0(t,n){n===0&&((t.mode&1)===0?n=1:(n=$r,$r<<=1,($r&130023424)===0&&($r=4194304)));var s=ht();t=Sn(t,n),t!==null&&(lr(t,n,s),wt(t,s))}function yN(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),l0(t,s)}function wN(t,n){var s=0;switch(t.tag){case 13:var f=t.stateNode,v=t.memoizedState;v!==null&&(s=v.retryLane);break;case 19:f=t.stateNode;break;default:throw Error(i(314))}f!==null&&f.delete(n),l0(t,s)}var c0;c0=function(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps||gt.current)mt=!0;else{if((t.lanes&s)===0&&(n.flags&128)===0)return mt=!1,aN(t,n,s);mt=(t.flags&131072)!==0}else mt=!1,je&&(n.flags&1048576)!==0&&Hm(n,za,n.index);switch(n.lanes=0,n.tag){case 2:var f=n.type;Ja(t,n),t=n.pendingProps;var v=Jr(n,st.current);oi(n,s),v=Rl(null,n,f,t,v,s);var y=Ml();return n.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,vt(f)?(y=!0,La(n)):y=!1,n.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Sl(n),v.updater=Qa,n.stateNode=v,v._reactInternals=n,jl(n,f,t,s),n=Fl(null,n,f,!0,y,s)):(n.tag=0,je&&y&&dl(n),dt(null,n,v,s),n=n.child),n;case 16:f=n.elementType;e:{switch(Ja(t,n),t=n.pendingProps,v=f._init,f=v(f._payload),n.type=f,v=n.tag=_N(f),t=Yt(f,t),v){case 0:n=Dl(null,n,f,t,s);break e;case 1:n=jy(null,n,f,t,s);break e;case 11:n=Ty(null,n,f,t,s);break e;case 14:n=Py(null,n,f,Yt(f.type,t),s);break e}throw Error(i(306,f,""))}return n;case 0:return f=n.type,v=n.pendingProps,v=n.elementType===f?v:Yt(f,v),Dl(t,n,f,v,s);case 1:return f=n.type,v=n.pendingProps,v=n.elementType===f?v:Yt(f,v),jy(t,n,f,v,s);case 3:e:{if(Oy(n),t===null)throw Error(i(387));f=n.pendingProps,y=n.memoizedState,v=y.element,Zm(t,n),Va(n,f,null,s);var N=n.memoizedState;if(f=N.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},n.updateQueue.baseState=y,n.memoizedState=y,n.flags&256){v=si(Error(i(423)),n),n=zy(t,n,f,s,v);break e}else if(f!==v){v=si(Error(i(424)),n),n=zy(t,n,f,s,v);break e}else for(Nt=Fn(n.stateNode.containerInfo.firstChild),Ct=n,je=!0,Wt=null,s=Xm(n,null,f,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ni(),f===v){n=bn(t,n,s);break e}dt(t,n,f,s)}n=n.child}return n;case 5:return ty(n),t===null&&gl(n),f=n.type,v=n.pendingProps,y=t!==null?t.memoizedProps:null,N=v.children,al(f,v)?N=null:y!==null&&al(f,y)&&(n.flags|=32),Ly(t,n),dt(t,n,N,s),n.child;case 6:return t===null&&gl(n),null;case 13:return Dy(t,n,s);case 4:return El(n,n.stateNode.containerInfo),f=n.pendingProps,t===null?n.child=ri(n,null,f,s):dt(t,n,f,s),n.child;case 11:return f=n.type,v=n.pendingProps,v=n.elementType===f?v:Yt(f,v),Ty(t,n,f,v,s);case 7:return dt(t,n,n.pendingProps,s),n.child;case 8:return dt(t,n,n.pendingProps.children,s),n.child;case 12:return dt(t,n,n.pendingProps.children,s),n.child;case 10:e:{if(f=n.type._context,v=n.pendingProps,y=n.memoizedProps,N=v.value,Ae($a,f._currentValue),f._currentValue=N,y!==null)if(Gt(y.value,N)){if(y.children===v.children&&!gt.current){n=bn(t,n,s);break e}}else for(y=n.child,y!==null&&(y.return=n);y!==null;){var q=y.dependencies;if(q!==null){N=y.child;for(var B=q.firstContext;B!==null;){if(B.context===f){if(y.tag===1){B=En(-1,s&-s),B.tag=2;var te=y.updateQueue;if(te!==null){te=te.shared;var ue=te.pending;ue===null?B.next=B:(B.next=ue.next,ue.next=B),te.pending=B}}y.lanes|=s,B=y.alternate,B!==null&&(B.lanes|=s),xl(y.return,s,n),q.lanes|=s;break}B=B.next}}else if(y.tag===10)N=y.type===n.type?null:y.child;else if(y.tag===18){if(N=y.return,N===null)throw Error(i(341));N.lanes|=s,q=N.alternate,q!==null&&(q.lanes|=s),xl(N,s,n),N=y.sibling}else N=y.child;if(N!==null)N.return=y;else for(N=y;N!==null;){if(N===n){N=null;break}if(y=N.sibling,y!==null){y.return=N.return,N=y;break}N=N.return}y=N}dt(t,n,v.children,s),n=n.child}return n;case 9:return v=n.type,f=n.pendingProps.children,oi(n,s),v=zt(v),f=f(v),n.flags|=1,dt(t,n,f,s),n.child;case 14:return f=n.type,v=Yt(f,n.pendingProps),v=Yt(f.type,v),Py(t,n,f,v,s);case 15:return Ay(t,n,n.type,n.pendingProps,s);case 17:return f=n.type,v=n.pendingProps,v=n.elementType===f?v:Yt(f,v),Ja(t,n),n.tag=1,vt(f)?(t=!0,La(n)):t=!1,oi(n,s),by(n,f,v),jl(n,f,v,s),Fl(null,n,f,!0,t,s);case 19:return $y(t,n,s);case 22:return qy(t,n,s)}throw Error(i(156,n.tag))};function f0(t,n){return fa(t,n)}function xN(t,n,s,f){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(t,n,s,f){return new xN(t,n,s,f)}function ac(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _N(t){if(typeof t=="function")return ac(t)?1:0;if(t!=null){if(t=t.$$typeof,t===$)return 11;if(t===G)return 14}return 2}function Qn(t,n){var s=t.alternate;return s===null?(s=$t(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function cs(t,n,s,f,v,y){var N=2;if(f=t,typeof t=="function")ac(t)&&(N=1);else if(typeof t=="string")N=5;else e:switch(t){case T:return _r(s.children,v,y,n);case O:N=8,v|=8;break;case z:return t=$t(12,s,n,v|2),t.elementType=z,t.lanes=y,t;case Q:return t=$t(13,s,n,v),t.elementType=Q,t.lanes=y,t;case A:return t=$t(19,s,n,v),t.elementType=A,t.lanes=y,t;case Z:return fs(s,v,y,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case W:N=10;break e;case L:N=9;break e;case $:N=11;break e;case G:N=14;break e;case V:N=16,f=null;break e}throw Error(i(130,t==null?t:typeof t,""))}return n=$t(N,s,n,v),n.elementType=t,n.type=f,n.lanes=y,n}function _r(t,n,s,f){return t=$t(7,t,f,n),t.lanes=s,t}function fs(t,n,s,f){return t=$t(22,t,f,n),t.elementType=Z,t.lanes=s,t.stateNode={isHidden:!1},t}function sc(t,n,s){return t=$t(6,t,null,n),t.lanes=s,t}function uc(t,n,s){return n=$t(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function SN(t,n,s,f,v){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gi(0),this.expirationTimes=Gi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gi(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function lc(t,n,s,f,v,y,N,q,B){return t=new SN(t,n,s,q,B),n===1?(n=1,y===!0&&(n|=8)):n=0,y=$t(3,null,null,n),t.current=y,y.stateNode=t,y.memoizedState={element:f,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sl(y),t}function EN(t,n,s){var f=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),gc.exports=qN(),gc.exports}var k0;function LN(){if(k0)return ws;k0=1;var e=iE();return ws.createRoot=e.createRoot,ws.hydrateRoot=e.hydrateRoot,ws}var jN=LN();const ON=Gs(jN);function Ke(e){if(typeof e=="string"||typeof e=="number")return""+e;let r="";if(Array.isArray(e))for(let i=0,o;i{}};function Ws(){for(var e=0,r=arguments.length,i={},o;e=0&&(o=i.slice(a+1),i=i.slice(0,a)),i&&!r.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:o}})}Rs.prototype=Ws.prototype={constructor:Rs,on:function(e,r){var i=this._,o=DN(e+"",i),a,u=-1,l=o.length;if(arguments.length<2){for(;++u0)for(var i=new Array(a),o=0,a,u;o=0&&(r=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),N0.hasOwnProperty(r)?{space:N0[r],local:e}:e}function $N(e){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===Xg&&r.documentElement.namespaceURI===Xg?r.createElement(e):r.createElementNS(i,e)}}function BN(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function oE(e){var r=Ys(e);return(r.local?BN:$N)(r)}function HN(){}function fv(e){return e==null?HN:function(){return this.querySelector(e)}}function VN(e){typeof e!="function"&&(e=fv(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=_&&(_=C+1);!(R=x[_])&&++_=0;)(l=o[a])&&(u&&l.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(l,u),u=l);return this}function gI(e){e||(e=vI);function r(g,m){return g&&m?e(g.__data__,m.__data__):!g-!m}for(var i=this._groups,o=i.length,a=new Array(o),u=0;ur?1:e>=r?0:NaN}function mI(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yI(){return Array.from(this)}function wI(){for(var e=this._groups,r=0,i=e.length;r1?this.each((r==null?MI:typeof r=="function"?PI:TI)(e,r,i??"")):wi(this.node(),e)}function wi(e,r){return e.style.getPropertyValue(r)||cE(e).getComputedStyle(e,null).getPropertyValue(r)}function qI(e){return function(){delete this[e]}}function LI(e,r){return function(){this[e]=r}}function jI(e,r){return function(){var i=r.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function OI(e,r){return arguments.length>1?this.each((r==null?qI:typeof r=="function"?jI:LI)(e,r)):this.node()[e]}function fE(e){return e.trim().split(/^|\s+/)}function dv(e){return e.classList||new dE(e)}function dE(e){this._node=e,this._names=fE(e.getAttribute("class")||"")}dE.prototype={add:function(e){var r=this._names.indexOf(e);r<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var r=this._names.indexOf(e);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function hE(e,r){for(var i=dv(e),o=-1,a=r.length;++o=0&&(i=r.slice(o+1),r=r.slice(0,o)),{type:r,name:i}})}function fR(e){return function(){var r=this.__on;if(r){for(var i=0,o=-1,a=r.length,u;i()=>e;function Qg(e,{sourceEvent:r,subject:i,target:o,identifier:a,active:u,x:l,y:c,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}Qg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _R(e){return!e.ctrlKey&&!e.button}function SR(){return this.parentNode}function ER(e,r){return r??{x:e.x,y:e.y}}function bR(){return navigator.maxTouchPoints||"ontouchstart"in this}function wE(){var e=_R,r=SR,i=ER,o=bR,a={},u=Ws("start","drag","end"),l=0,c,d,h,p,g=0;function m(k){k.on("mousedown.drag",w).filter(o).on("touchstart.drag",x).on("touchmove.drag",E,xR).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(k,R){if(!(p||!e.call(this,k,R))){var M=_(this,r.call(this,k,R),k,R,"mouse");M&&(Rt(k.view).on("mousemove.drag",S,Lo).on("mouseup.drag",b,Lo),mE(k.view),yc(k),h=!1,c=k.clientX,d=k.clientY,M("start",k))}}function S(k){if(vi(k),!h){var R=k.clientX-c,M=k.clientY-d;h=R*R+M*M>g}a.mouse("drag",k)}function b(k){Rt(k.view).on("mousemove.drag mouseup.drag",null),yE(k.view,h),vi(k),a.mouse("end",k)}function x(k,R){if(e.call(this,k,R)){var M=k.changedTouches,T=r.call(this,k,R),O=M.length,z,W;for(z=0;z>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):i===8?_s(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):i===4?_s(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=CR.exec(e))?new _t(r[1],r[2],r[3],1):(r=NR.exec(e))?new _t(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=IR.exec(e))?_s(r[1],r[2],r[3],r[4]):(r=RR.exec(e))?_s(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=MR.exec(e))?q0(r[1],r[2]/100,r[3]/100,1):(r=TR.exec(e))?q0(r[1],r[2]/100,r[3]/100,r[4]):I0.hasOwnProperty(e)?T0(I0[e]):e==="transparent"?new _t(NaN,NaN,NaN,0):null}function T0(e){return new _t(e>>16&255,e>>8&255,e&255,1)}function _s(e,r,i,o){return o<=0&&(e=r=i=NaN),new _t(e,r,i,o)}function qR(e){return e instanceof Go||(e=Cr(e)),e?(e=e.rgb(),new _t(e.r,e.g,e.b,e.opacity)):new _t}function Zg(e,r,i,o){return arguments.length===1?qR(e):new _t(e,r,i,o??1)}function _t(e,r,i,o){this.r=+e,this.g=+r,this.b=+i,this.opacity=+o}hv(_t,Zg,xE(Go,{brighter(e){return e=e==null?Ls:Math.pow(Ls,e),new _t(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?jo:Math.pow(jo,e),new _t(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _t(br(this.r),br(this.g),br(this.b),js(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:P0,formatHex:P0,formatHex8:LR,formatRgb:A0,toString:A0}));function P0(){return`#${Er(this.r)}${Er(this.g)}${Er(this.b)}`}function LR(){return`#${Er(this.r)}${Er(this.g)}${Er(this.b)}${Er((isNaN(this.opacity)?1:this.opacity)*255)}`}function A0(){const e=js(this.opacity);return`${e===1?"rgb(":"rgba("}${br(this.r)}, ${br(this.g)}, ${br(this.b)}${e===1?")":`, ${e})`}`}function js(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function br(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Er(e){return e=br(e),(e<16?"0":"")+e.toString(16)}function q0(e,r,i,o){return o<=0?e=r=i=NaN:i<=0||i>=1?e=r=NaN:r<=0&&(e=NaN),new Jt(e,r,i,o)}function _E(e){if(e instanceof Jt)return new Jt(e.h,e.s,e.l,e.opacity);if(e instanceof Go||(e=Cr(e)),!e)return new Jt;if(e instanceof Jt)return e;e=e.rgb();var r=e.r/255,i=e.g/255,o=e.b/255,a=Math.min(r,i,o),u=Math.max(r,i,o),l=NaN,c=u-a,d=(u+a)/2;return c?(r===u?l=(i-o)/c+(i0&&d<1?0:l,new Jt(l,c,d,e.opacity)}function jR(e,r,i,o){return arguments.length===1?_E(e):new Jt(e,r,i,o??1)}function Jt(e,r,i,o){this.h=+e,this.s=+r,this.l=+i,this.opacity=+o}hv(Jt,jR,xE(Go,{brighter(e){return e=e==null?Ls:Math.pow(Ls,e),new Jt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?jo:Math.pow(jo,e),new Jt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,o=i+(i<.5?i:1-i)*r,a=2*i-o;return new _t(wc(e>=240?e-240:e+120,a,o),wc(e,a,o),wc(e<120?e+240:e-120,a,o),this.opacity)},clamp(){return new Jt(L0(this.h),Ss(this.s),Ss(this.l),js(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=js(this.opacity);return`${e===1?"hsl(":"hsla("}${L0(this.h)}, ${Ss(this.s)*100}%, ${Ss(this.l)*100}%${e===1?")":`, ${e})`}`}}));function L0(e){return e=(e||0)%360,e<0?e+360:e}function Ss(e){return Math.max(0,Math.min(1,e||0))}function wc(e,r,i){return(e<60?r+(i-r)*e/60:e<180?i:e<240?r+(i-r)*(240-e)/60:r)*255}const pv=e=>()=>e;function OR(e,r){return function(i){return e+i*r}}function zR(e,r,i){return e=Math.pow(e,i),r=Math.pow(r,i)-e,i=1/i,function(o){return Math.pow(e+o*r,i)}}function DR(e){return(e=+e)==1?SE:function(r,i){return i-r?zR(r,i,e):pv(isNaN(r)?i:r)}}function SE(e,r){var i=r-e;return i?OR(e,i):pv(isNaN(e)?r:e)}const Os=(function e(r){var i=DR(r);function o(a,u){var l=i((a=Zg(a)).r,(u=Zg(u)).r),c=i(a.g,u.g),d=i(a.b,u.b),h=SE(a.opacity,u.opacity);return function(p){return a.r=l(p),a.g=c(p),a.b=d(p),a.opacity=h(p),a+""}}return o.gamma=e,o})(1);function FR(e,r){r||(r=[]);var i=e?Math.min(r.length,e.length):0,o=r.slice(),a;return function(u){for(a=0;ai&&(u=r.slice(i,u),c[l]?c[l]+=u:c[++l]=u),(o=o[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,d.push({i:l,x:dn(o,a)})),i=xc.lastIndex;return i180?p+=360:p-h>180&&(h+=360),m.push({i:g.push(a(g)+"rotate(",null,o)-2,x:dn(h,p)})):p&&g.push(a(g)+"rotate("+p+o)}function c(h,p,g,m){h!==p?m.push({i:g.push(a(g)+"skewX(",null,o)-2,x:dn(h,p)}):p&&g.push(a(g)+"skewX("+p+o)}function d(h,p,g,m,w,S){if(h!==g||p!==m){var b=w.push(a(w)+"scale(",null,",",null,")");S.push({i:b-4,x:dn(h,g)},{i:b-2,x:dn(p,m)})}else(g!==1||m!==1)&&w.push(a(w)+"scale("+g+","+m+")")}return function(h,p){var g=[],m=[];return h=e(h),p=e(p),u(h.translateX,h.translateY,p.translateX,p.translateY,g,m),l(h.rotate,p.rotate,g,m),c(h.skewX,p.skewX,g,m),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,g,m),h=p=null,function(w){for(var S=-1,b=m.length,x;++S=0&&e._call.call(void 0,r),e=e._next;--xi}function z0(){Nr=(Ds=zo.now())+Ks,xi=Io=0;try{tM()}finally{xi=0,rM(),Nr=0}}function nM(){var e=zo.now(),r=e-Ds;r>CE&&(Ks-=r,Ds=e)}function rM(){for(var e,r=zs,i,o=1/0;r;)r._call?(o>r._time&&(o=r._time),e=r,r=r._next):(i=r._next,r._next=null,r=e?e._next=i:zs=i);Ro=e,tv(o)}function tv(e){if(!xi){Io&&(Io=clearTimeout(Io));var r=e-Nr;r>24?(e<1/0&&(Io=setTimeout(z0,e-zo.now()-Ks)),Co&&(Co=clearInterval(Co))):(Co||(Ds=zo.now(),Co=setInterval(nM,CE)),xi=1,NE(z0))}}function D0(e,r,i){var o=new Fs;return r=r==null?0:+r,o.restart(a=>{o.stop(),e(a+r)},r,i),o}var iM=Ws("start","end","cancel","interrupt"),oM=[],RE=0,F0=1,nv=2,Ts=3,$0=4,rv=5,Ps=6;function Xs(e,r,i,o,a,u){var l=e.__transition;if(!l)e.__transition={};else if(i in l)return;aM(e,i,{name:r,index:o,group:a,on:iM,tween:oM,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:RE})}function vv(e,r){var i=rn(e,r);if(i.state>RE)throw new Error("too late; already scheduled");return i}function gn(e,r){var i=rn(e,r);if(i.state>Ts)throw new Error("too late; already running");return i}function rn(e,r){var i=e.__transition;if(!i||!(i=i[r]))throw new Error("transition not found");return i}function aM(e,r,i){var o=e.__transition,a;o[r]=i,i.timer=IE(u,0,i.time);function u(h){i.state=F0,i.timer.restart(l,i.delay,i.time),i.delay<=h&&l(h-i.delay)}function l(h){var p,g,m,w;if(i.state!==F0)return d();for(p in o)if(w=o[p],w.name===i.name){if(w.state===Ts)return D0(l);w.state===$0?(w.state=Ps,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete o[p]):+pnv&&o.state=0&&(r=r.slice(0,i)),!r||r==="start"})}function jM(e,r,i){var o,a,u=LM(r)?vv:gn;return function(){var l=u(this,e),c=l.on;c!==o&&(a=(o=c).copy()).on(r,i),l.on=a}}function OM(e,r){var i=this._id;return arguments.length<2?rn(this.node(),i).on.on(e):this.each(jM(i,e,r))}function zM(e){return function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==e)return;r&&r.removeChild(this)}}function DM(){return this.on("end.remove",zM(this._id))}function FM(e){var r=this._name,i=this._id;typeof e!="function"&&(e=fv(e));for(var o=this._groups,a=o.length,u=new Array(a),l=0;l()=>e;function fT(e,{sourceEvent:r,target:i,transform:o,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:a}})}function Nn(e,r,i){this.k=e,this.x=r,this.y=i}Nn.prototype={constructor:Nn,scale:function(e){return e===1?this:new Nn(this.k*e,this.x,this.y)},translate:function(e,r){return e===0&r===0?this:new Nn(this.k,this.x+this.k*e,this.y+this.k*r)},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 Qs=new Nn(1,0,0);AE.prototype=Nn.prototype;function AE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qs;return e.__zoom}function _c(e){e.stopImmediatePropagation()}function No(e){e.preventDefault(),e.stopImmediatePropagation()}function dT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function hT(){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 B0(){return this.__zoom||Qs}function pT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gT(){return navigator.maxTouchPoints||"ontouchstart"in this}function vT(e,r,i){var o=e.invertX(r[0][0])-i[0][0],a=e.invertX(r[1][0])-i[1][0],u=e.invertY(r[0][1])-i[0][1],l=e.invertY(r[1][1])-i[1][1];return e.translate(a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a),l>u?(u+l)/2:Math.min(0,u)||Math.max(0,l))}function qE(){var e=dT,r=hT,i=vT,o=pT,a=gT,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,d=Ms,h=Ws("start","zoom","end"),p,g,m,w=500,S=150,b=0,x=10;function E(A){A.property("__zoom",B0).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",W).filter(a).on("touchstart.zoom",L).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(A,G,V,Z){var j=A.selection?A.selection():A;j.property("__zoom",B0),A!==j?R(A,G,V,Z):j.interrupt().each(function(){M(this,arguments).event(Z).start().zoom(null,typeof G=="function"?G.apply(this,arguments):G).end()})},E.scaleBy=function(A,G,V,Z){E.scaleTo(A,function(){var j=this.__zoom.k,F=typeof G=="function"?G.apply(this,arguments):G;return j*F},V,Z)},E.scaleTo=function(A,G,V,Z){E.transform(A,function(){var j=r.apply(this,arguments),F=this.__zoom,K=V==null?k(j):typeof V=="function"?V.apply(this,arguments):V,P=F.invert(K),H=typeof G=="function"?G.apply(this,arguments):G;return i(_(C(F,H),K,P),j,l)},V,Z)},E.translateBy=function(A,G,V,Z){E.transform(A,function(){return i(this.__zoom.translate(typeof G=="function"?G.apply(this,arguments):G,typeof V=="function"?V.apply(this,arguments):V),r.apply(this,arguments),l)},null,Z)},E.translateTo=function(A,G,V,Z,j){E.transform(A,function(){var F=r.apply(this,arguments),K=this.__zoom,P=Z==null?k(F):typeof Z=="function"?Z.apply(this,arguments):Z;return i(Qs.translate(P[0],P[1]).scale(K.k).translate(typeof G=="function"?-G.apply(this,arguments):-G,typeof V=="function"?-V.apply(this,arguments):-V),F,l)},Z,j)};function C(A,G){return G=Math.max(u[0],Math.min(u[1],G)),G===A.k?A:new Nn(G,A.x,A.y)}function _(A,G,V){var Z=G[0]-V[0]*A.k,j=G[1]-V[1]*A.k;return Z===A.x&&j===A.y?A:new Nn(A.k,Z,j)}function k(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function R(A,G,V,Z){A.on("start.zoom",function(){M(this,arguments).event(Z).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(Z).end()}).tween("zoom",function(){var j=this,F=arguments,K=M(j,F).event(Z),P=r.apply(j,F),H=V==null?k(P):typeof V=="function"?V.apply(j,F):V,oe=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),D=j.__zoom,Y=typeof G=="function"?G.apply(j,F):G,X=d(D.invert(H).concat(oe/D.k),Y.invert(H).concat(oe/Y.k));return function(re){if(re===1)re=Y;else{var ne=X(re),se=oe/ne[2];re=new Nn(se,H[0]-ne[0]*se,H[1]-ne[1]*se)}K.zoom(null,re)}})}function M(A,G,V){return!V&&A.__zooming||new T(A,G)}function T(A,G){this.that=A,this.args=G,this.active=0,this.sourceEvent=null,this.extent=r.apply(A,G),this.taps=0}T.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,G){return this.mouse&&A!=="mouse"&&(this.mouse[1]=G.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=G.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=G.invert(this.touch1[0])),this.that.__zoom=G,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var G=Rt(this.that).datum();h.call(A,this.that,new fT(A,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:h}),G)}};function O(A,...G){if(!e.apply(this,arguments))return;var V=M(this,G).event(A),Z=this.__zoom,j=Math.max(u[0],Math.min(u[1],Z.k*Math.pow(2,o.apply(this,arguments)))),F=Zt(A);if(V.wheel)(V.mouse[0][0]!==F[0]||V.mouse[0][1]!==F[1])&&(V.mouse[1]=Z.invert(V.mouse[0]=F)),clearTimeout(V.wheel);else{if(Z.k===j)return;V.mouse=[F,Z.invert(F)],As(this),V.start()}No(A),V.wheel=setTimeout(K,S),V.zoom("mouse",i(_(C(Z,j),V.mouse[0],V.mouse[1]),V.extent,l));function K(){V.wheel=null,V.end()}}function z(A,...G){if(m||!e.apply(this,arguments))return;var V=A.currentTarget,Z=M(this,G,!0).event(A),j=Rt(A.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",oe,!0),F=Zt(A,V),K=A.clientX,P=A.clientY;mE(A.view),_c(A),Z.mouse=[F,this.__zoom.invert(F)],As(this),Z.start();function H(D){if(No(D),!Z.moved){var Y=D.clientX-K,X=D.clientY-P;Z.moved=Y*Y+X*X>b}Z.event(D).zoom("mouse",i(_(Z.that.__zoom,Z.mouse[0]=Zt(D,V),Z.mouse[1]),Z.extent,l))}function oe(D){j.on("mousemove.zoom mouseup.zoom",null),yE(D.view,Z.moved),No(D),Z.event(D).end()}}function W(A,...G){if(e.apply(this,arguments)){var V=this.__zoom,Z=Zt(A.changedTouches?A.changedTouches[0]:A,this),j=V.invert(Z),F=V.k*(A.shiftKey?.5:2),K=i(_(C(V,F),Z,j),r.apply(this,G),l);No(A),c>0?Rt(this).transition().duration(c).call(R,K,Z,A):Rt(this).call(E.transform,K,Z,A)}}function L(A,...G){if(e.apply(this,arguments)){var V=A.touches,Z=V.length,j=M(this,G,A.changedTouches.length===Z).event(A),F,K,P,H;for(_c(A),K=0;K"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:r,sourceHandle:i,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:o}", edge id: ${r}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Do=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],LE=["Enter"," ","Escape"],jE={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:r,y:i})=>`Moved selected node ${e}. New position, x: ${r}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var _i;(function(e){e.Strict="strict",e.Loose="loose"})(_i||(_i={}));var kr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(kr||(kr={}));var Fo;(function(e){e.Partial="partial",e.Full="full"})(Fo||(Fo={}));const OE={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var tr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(tr||(tr={}));var $s;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($s||($s={}));var _e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(_e||(_e={}));const H0={[_e.Left]:_e.Right,[_e.Right]:_e.Left,[_e.Top]:_e.Bottom,[_e.Bottom]:_e.Top};function zE(e){return e===null?null:e?"valid":"invalid"}const DE=e=>"id"in e&&"source"in e&&"target"in e,mT=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),yv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Wo=(e,r=[0,0])=>{const{width:i,height:o}=Rn(e),a=e.origin??r,u=i*a[0],l=o*a[1];return{x:e.position.x-u,y:e.position.y-l}},yT=(e,r={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((o,a)=>{const u=typeof a=="string";let l=!r.nodeLookup&&!u?a:void 0;r.nodeLookup&&(l=u?r.nodeLookup.get(a):yv(a)?a:r.nodeLookup.get(a.id));const c=l?Bs(l,r.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Zs(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Js(i)},Yo=(e,r={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(a=>{(r.filter===void 0||r.filter(a))&&(i=Zs(i,Bs(a)),o=!0)}),o?Js(i):{x:0,y:0,width:0,height:0}},wv=(e,r,[i,o,a]=[0,0,1],u=!1,l=!1)=>{const c={...Xo(r,[i,o,a]),width:r.width/a,height:r.height/a},d=[];for(const h of e.values()){const{measured:p,selectable:g=!0,hidden:m=!1}=h;if(l&&!g||m)continue;const w=p.width??h.width??h.initialWidth??null,S=p.height??h.height??h.initialHeight??null,b=$o(c,Ei(h)),x=(w??0)*(S??0),E=u&&b>0;(!h.internals.handleBounds||E||b>=x||h.dragging)&&d.push(h)}return d},wT=(e,r)=>{const i=new Set;return e.forEach(o=>{i.add(o.id)}),r.filter(o=>i.has(o.source)||i.has(o.target))};function xT(e,r){const i=new Map,o=r!=null&&r.nodes?new Set(r.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&((r==null?void 0:r.includeHiddenNodes)||!a.hidden)&&(!o||o.has(a.id))&&i.set(a.id,a)}),i}async function _T({nodes:e,width:r,height:i,panZoom:o,minZoom:a,maxZoom:u},l){if(e.size===0)return Promise.resolve(!0);const c=xT(e,l),d=Yo(c),h=xv(d,r,i,(l==null?void 0:l.minZoom)??a,(l==null?void 0:l.maxZoom)??u,(l==null?void 0:l.padding)??.1);return await o.setViewport(h,{duration:l==null?void 0:l.duration,ease:l==null?void 0:l.ease,interpolate:l==null?void 0:l.interpolate}),Promise.resolve(!0)}function FE({nodeId:e,nextPosition:r,nodeLookup:i,nodeOrigin:o=[0,0],nodeExtent:a,onError:u}){const l=i.get(e),c=l.parentId?i.get(l.parentId):void 0,{x:d,y:h}=c?c.internals.positionAbsolute:{x:0,y:0},p=l.origin??o;let g=l.extent||a;if(l.extent==="parent"&&!l.expandParent)if(!c)u==null||u("005",pn.error005());else{const w=c.measured.width,S=c.measured.height;w&&S&&(g=[[d,h],[d+w,h+S]])}else c&&bi(l.extent)&&(g=[[l.extent[0][0]+d,l.extent[0][1]+h],[l.extent[1][0]+d,l.extent[1][1]+h]]);const m=bi(g)?Ir(r,g,l.measured):r;return(l.measured.width===void 0||l.measured.height===void 0)&&(u==null||u("015",pn.error015())),{position:{x:m.x-d+(l.measured.width??0)*p[0],y:m.y-h+(l.measured.height??0)*p[1]},positionAbsolute:m}}async function ST({nodesToRemove:e=[],edgesToRemove:r=[],nodes:i,edges:o,onBeforeDelete:a}){const u=new Set(e.map(m=>m.id)),l=[];for(const m of i){if(m.deletable===!1)continue;const w=u.has(m.id),S=!w&&m.parentId&&l.find(b=>b.id===m.parentId);(w||S)&&l.push(m)}const c=new Set(r.map(m=>m.id)),d=o.filter(m=>m.deletable!==!1),p=wT(l,d);for(const m of d)c.has(m.id)&&!p.find(S=>S.id===m.id)&&p.push(m);if(!a)return{edges:p,nodes:l};const g=await a({nodes:l,edges:p});return typeof g=="boolean"?g?{edges:p,nodes:l}:{edges:[],nodes:[]}:g}const Si=(e,r=0,i=1)=>Math.min(Math.max(e,r),i),Ir=(e={x:0,y:0},r,i)=>({x:Si(e.x,r[0][0],r[1][0]-((i==null?void 0:i.width)??0)),y:Si(e.y,r[0][1],r[1][1]-((i==null?void 0:i.height)??0))});function $E(e,r,i){const{width:o,height:a}=Rn(i),{x:u,y:l}=i.internals.positionAbsolute;return Ir(e,[[u,l],[u+o,l+a]],r)}const V0=(e,r,i)=>ei?-Si(Math.abs(e-i),1,r)/r:0,BE=(e,r,i=15,o=40)=>{const a=V0(e.x,o,r.width-o)*i,u=V0(e.y,o,r.height-o)*i;return[a,u]},Zs=(e,r)=>({x:Math.min(e.x,r.x),y:Math.min(e.y,r.y),x2:Math.max(e.x2,r.x2),y2:Math.max(e.y2,r.y2)}),iv=({x:e,y:r,width:i,height:o})=>({x:e,y:r,x2:e+i,y2:r+o}),Js=({x:e,y:r,x2:i,y2:o})=>({x:e,y:r,width:i-e,height:o-r}),Ei=(e,r=[0,0])=>{var a,u;const{x:i,y:o}=yv(e)?e.internals.positionAbsolute:Wo(e,r);return{x:i,y:o,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0}},Bs=(e,r=[0,0])=>{var a,u;const{x:i,y:o}=yv(e)?e.internals.positionAbsolute:Wo(e,r);return{x:i,y:o,x2:i+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:o+(((u=e.measured)==null?void 0:u.height)??e.height??e.initialHeight??0)}},HE=(e,r)=>Js(Zs(iv(e),iv(r))),$o=(e,r)=>{const i=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),o=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return Math.ceil(i*o)},U0=e=>en(e.width)&&en(e.height)&&en(e.x)&&en(e.y),en=e=>!isNaN(e)&&isFinite(e),ET=(e,r)=>{},Ko=(e,r=[1,1])=>({x:r[0]*Math.round(e.x/r[0]),y:r[1]*Math.round(e.y/r[1])}),Xo=({x:e,y:r},[i,o,a],u=!1,l=[1,1])=>{const c={x:(e-i)/a,y:(r-o)/a};return u?Ko(c,l):c},Hs=({x:e,y:r},[i,o,a])=>({x:e*a+i,y:r*a+o});function di(e,r){if(typeof e=="number")return Math.floor((r-r/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(r*i*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bT(e,r,i){if(typeof e=="string"||typeof e=="number"){const o=di(e,i),a=di(e,r);return{top:o,right:a,bottom:o,left:a,x:a*2,y:o*2}}if(typeof e=="object"){const o=di(e.top??e.y??0,i),a=di(e.bottom??e.y??0,i),u=di(e.left??e.x??0,r),l=di(e.right??e.x??0,r);return{top:o,right:l,bottom:a,left:u,x:u+l,y:o+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kT(e,r,i,o,a,u){const{x:l,y:c}=Hs(e,[r,i,o]),{x:d,y:h}=Hs({x:e.x+e.width,y:e.y+e.height},[r,i,o]),p=a-d,g=u-h;return{left:Math.floor(l),top:Math.floor(c),right:Math.floor(p),bottom:Math.floor(g)}}const xv=(e,r,i,o,a,u)=>{const l=bT(u,r,i),c=(r-l.x)/e.width,d=(i-l.y)/e.height,h=Math.min(c,d),p=Si(h,o,a),g=e.x+e.width/2,m=e.y+e.height/2,w=r/2-g*p,S=i/2-m*p,b=kT(e,w,S,p,r,i),x={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x:w-x.left+x.right,y:S-x.top+x.bottom,zoom:p}},Bo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function bi(e){return e!=null&&e!=="parent"}function Rn(e){var r,i;return{width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function VE(e){var r,i;return(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function UE(e,r={width:0,height:0},i,o,a){const u={...e},l=o.get(i);if(l){const c=l.origin||a;u.x+=l.internals.positionAbsolute.x-(r.width??0)*c[0],u.y+=l.internals.positionAbsolute.y-(r.height??0)*c[1]}return u}function G0(e,r){if(e.size!==r.size)return!1;for(const i of e)if(!r.has(i))return!1;return!0}function CT(){let e,r;return{promise:new Promise((o,a)=>{e=o,r=a}),resolve:e,reject:r}}function NT(e){return{...jE,...e||{}}}function qo(e,{snapGrid:r=[0,0],snapToGrid:i=!1,transform:o,containerBounds:a}){const{x:u,y:l}=tn(e),c=Xo({x:u-((a==null?void 0:a.left)??0),y:l-((a==null?void 0:a.top)??0)},o),{x:d,y:h}=i?Ko(c,r):c;return{xSnapped:d,ySnapped:h,...c}}const _v=e=>({width:e.offsetWidth,height:e.offsetHeight}),GE=e=>{var r;return((r=e==null?void 0:e.getRootNode)==null?void 0:r.call(e))||(window==null?void 0:window.document)},IT=["INPUT","SELECT","TEXTAREA"];function WE(e){var o,a;const r=((a=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:a[0])||e.target;return(r==null?void 0:r.nodeType)!==1?!1:IT.includes(r.nodeName)||r.hasAttribute("contenteditable")||!!r.closest(".nokey")}const YE=e=>"clientX"in e,tn=(e,r)=>{var u,l;const i=YE(e),o=i?e.clientX:(u=e.touches)==null?void 0:u[0].clientX,a=i?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:o-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)}},W0=(e,r,i,o,a)=>{const u=r.querySelectorAll(`.${e}`);return!u||!u.length?null:Array.from(u).map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:a,position:l.getAttribute("data-handlepos"),x:(c.left-i.left)/o,y:(c.top-i.top)/o,..._v(l)}})};function KE({sourceX:e,sourceY:r,targetX:i,targetY:o,sourceControlX:a,sourceControlY:u,targetControlX:l,targetControlY:c}){const d=e*.125+a*.375+l*.375+i*.125,h=r*.125+u*.375+c*.375+o*.125,p=Math.abs(d-e),g=Math.abs(h-r);return[d,h,p,g]}function ks(e,r){return e>=0?.5*e:r*25*Math.sqrt(-e)}function Y0({pos:e,x1:r,y1:i,x2:o,y2:a,c:u}){switch(e){case _e.Left:return[r-ks(r-o,u),i];case _e.Right:return[r+ks(o-r,u),i];case _e.Top:return[r,i-ks(i-a,u)];case _e.Bottom:return[r,i+ks(a-i,u)]}}function XE({sourceX:e,sourceY:r,sourcePosition:i=_e.Bottom,targetX:o,targetY:a,targetPosition:u=_e.Top,curvature:l=.25}){const[c,d]=Y0({pos:i,x1:e,y1:r,x2:o,y2:a,c:l}),[h,p]=Y0({pos:u,x1:o,y1:a,x2:e,y2:r,c:l}),[g,m,w,S]=KE({sourceX:e,sourceY:r,targetX:o,targetY:a,sourceControlX:c,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${r} C${c},${d} ${h},${p} ${o},${a}`,g,m,w,S]}function QE({sourceX:e,sourceY:r,targetX:i,targetY:o}){const a=Math.abs(i-e)/2,u=i0}const TT=({source:e,sourceHandle:r,target:i,targetHandle:o})=>`xy-edge__${e}${r||""}-${i}${o||""}`,PT=(e,r)=>r.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),AT=(e,r,i={})=>{if(!e.source||!e.target)return r;const o=i.getEdgeId||TT;let a;return DE(e)?a={...e}:a={...e,id:o(e)},PT(a,r)?r:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,r.concat(a))};function ZE({sourceX:e,sourceY:r,targetX:i,targetY:o}){const[a,u,l,c]=QE({sourceX:e,sourceY:r,targetX:i,targetY:o});return[`M ${e},${r}L ${i},${o}`,a,u,l,c]}const K0={[_e.Left]:{x:-1,y:0},[_e.Right]:{x:1,y:0},[_e.Top]:{x:0,y:-1},[_e.Bottom]:{x:0,y:1}},qT=({source:e,sourcePosition:r=_e.Bottom,target:i})=>r===_e.Left||r===_e.Right?e.xMath.sqrt(Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2));function LT({source:e,sourcePosition:r=_e.Bottom,target:i,targetPosition:o=_e.Top,center:a,offset:u,stepPosition:l}){const c=K0[r],d=K0[o],h={x:e.x+c.x*u,y:e.y+c.y*u},p={x:i.x+d.x*u,y:i.y+d.y*u},g=qT({source:h,sourcePosition:r,target:p}),m=g.x!==0?"x":"y",w=g[m];let S=[],b,x;const E={x:0,y:0},C={x:0,y:0},[,,_,k]=QE({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(c[m]*d[m]===-1){m==="x"?(b=a.x??h.x+(p.x-h.x)*l,x=a.y??(h.y+p.y)/2):(b=a.x??(h.x+p.x)/2,x=a.y??h.y+(p.y-h.y)*l);const M=[{x:b,y:h.y},{x:b,y:p.y}],T=[{x:h.x,y:x},{x:p.x,y:x}];c[m]===w?S=m==="x"?M:T:S=m==="x"?T:M}else{const M=[{x:h.x,y:p.y}],T=[{x:p.x,y:h.y}];if(m==="x"?S=c.x===w?T:M:S=c.y===w?M:T,r===o){const $=Math.abs(e[m]-i[m]);if($<=u){const Q=Math.min(u-1,u-$);c[m]===w?E[m]=(h[m]>e[m]?-1:1)*Q:C[m]=(p[m]>i[m]?-1:1)*Q}}if(r!==o){const $=m==="x"?"y":"x",Q=c[m]===d[$],A=h[$]>p[$],G=h[$]=L?(b=(O.x+z.x)/2,x=S[0].y):(b=S[0].x,x=(O.y+z.y)/2)}return[[e,{x:h.x+E.x,y:h.y+E.y},...S,{x:p.x+C.x,y:p.y+C.y},i],b,x,_,k]}function jT(e,r,i,o){const a=Math.min(X0(e,r)/2,X0(r,i)/2,o),{x:u,y:l}=r;if(e.x===u&&u===i.x||e.y===l&&l===i.y)return`L${u} ${l}`;if(e.y===l){const h=e.x{let k="";return _>0&&_i.id===r):e[0])||null}function av(e,r){return e?typeof e=="string"?e:`${r?`${r}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function zT(e,{id:r,defaultColor:i,defaultMarkerStart:o,defaultMarkerEnd:a}){const u=new Set;return e.reduce((l,c)=>([c.markerStart||o,c.markerEnd||a].forEach(d=>{if(d&&typeof d=="object"){const h=av(d,r);u.has(h)||(l.push({id:h,color:d.color||i,...d}),u.add(h))}}),l),[]).sort((l,c)=>l.id.localeCompare(c.id))}const JE=1e3,DT=10,Sv={nodeOrigin:[0,0],nodeExtent:Do,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},FT={...Sv,checkEquality:!0};function Ev(e,r){const i={...e};for(const o in r)r[o]!==void 0&&(i[o]=r[o]);return i}function $T(e,r,i){const o=Ev(Sv,i);for(const a of e.values())if(a.parentId)kv(a,e,r,o);else{const u=Wo(a,o.nodeOrigin),l=bi(a.extent)?a.extent:o.nodeExtent,c=Ir(u,l,Rn(a));a.internals.positionAbsolute=c}}function BT(e,r){if(!e.handles)return e.measured?r==null?void 0:r.internals.handleBounds:void 0;const i=[],o=[];for(const a of e.handles){const u={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?i.push(u):a.type==="target"&&o.push(u)}return{source:i,target:o}}function bv(e){return e==="manual"}function sv(e,r,i,o={}){var h,p;const a=Ev(FT,o),u={i:0},l=new Map(r),c=a!=null&&a.elevateNodesOnSelect&&!bv(a.zIndexMode)?JE:0;let d=e.length>0;r.clear(),i.clear();for(const g of e){let m=l.get(g.id);if(a.checkEquality&&g===(m==null?void 0:m.internals.userNode))r.set(g.id,m);else{const w=Wo(g,a.nodeOrigin),S=bi(g.extent)?g.extent:a.nodeExtent,b=Ir(w,S,Rn(g));m={...a.defaults,...g,measured:{width:(h=g.measured)==null?void 0:h.width,height:(p=g.measured)==null?void 0:p.height},internals:{positionAbsolute:b,handleBounds:BT(g,m),z:eb(g,c,a.zIndexMode),userNode:g}},r.set(g.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(d=!1),g.parentId&&kv(m,r,i,o,u)}return d}function HT(e,r){if(!e.parentId)return;const i=r.get(e.parentId);i?i.set(e.id,e):r.set(e.parentId,new Map([[e.id,e]]))}function kv(e,r,i,o,a){const{elevateNodesOnSelect:u,nodeOrigin:l,nodeExtent:c,zIndexMode:d}=Ev(Sv,o),h=e.parentId,p=r.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}HT(e,i),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*DT),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const g=u&&!bv(d)?JE:0,{x:m,y:w,z:S}=VT(e,p,l,c,g,d),{positionAbsolute:b}=e.internals,x=m!==b.x||w!==b.y;(x||S!==e.internals.z)&&r.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:m,y:w}:b,z:S}})}function eb(e,r,i){const o=en(e.zIndex)?e.zIndex:0;return bv(i)?o:o+(e.selected?r:0)}function VT(e,r,i,o,a,u){const{x:l,y:c}=r.internals.positionAbsolute,d=Rn(e),h=Wo(e,i),p=bi(e.extent)?Ir(h,e.extent,d):h;let g=Ir({x:l+p.x,y:c+p.y},o,d);e.extent==="parent"&&(g=$E(g,d,r));const m=eb(e,a,u),w=r.internals.z??0;return{x:g.x,y:g.y,z:w>=m?w+1:m}}function Cv(e,r,i,o=[0,0]){var l;const a=[],u=new Map;for(const c of e){const d=r.get(c.parentId);if(!d)continue;const h=((l=u.get(c.parentId))==null?void 0:l.expandedRect)??Ei(d),p=HE(h,c.rect);u.set(c.parentId,{expandedRect:p,parent:d})}return u.size>0&&u.forEach(({expandedRect:c,parent:d},h)=>{var _;const p=d.internals.positionAbsolute,g=Rn(d),m=d.origin??o,w=c.x0||S>0||E||C)&&(a.push({id:h,type:"position",position:{x:d.position.x-w+E,y:d.position.y-S+C}}),(_=i.get(h))==null||_.forEach(k=>{e.some(R=>R.id===k.id)||a.push({id:k.id,type:"position",position:{x:k.position.x+w,y:k.position.y+S}})})),(g.width0){const w=Cv(m,r,i,a);h.push(...w)}return{changes:h,updatedInternals:d}}async function GT({delta:e,panZoom:r,transform:i,translateExtent:o,width:a,height:u}){if(!r||!e.x&&!e.y)return Promise.resolve(!1);const l=await r.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[a,u]],o),c=!!l&&(l.x!==i[0]||l.y!==i[1]||l.k!==i[2]);return Promise.resolve(c)}function e1(e,r,i,o,a,u){let l=a;const c=o.get(l)||new Map;o.set(l,c.set(i,r)),l=`${a}-${e}`;const d=o.get(l)||new Map;if(o.set(l,d.set(i,r)),u){l=`${a}-${e}-${u}`;const h=o.get(l)||new Map;o.set(l,h.set(i,r))}}function tb(e,r,i){e.clear(),r.clear();for(const o of i){const{source:a,target:u,sourceHandle:l=null,targetHandle:c=null}=o,d={edgeId:o.id,source:a,target:u,sourceHandle:l,targetHandle:c},h=`${a}-${l}--${u}-${c}`,p=`${u}-${c}--${a}-${l}`;e1("source",d,p,e,a,l),e1("target",d,h,e,u,c),r.set(o.id,o)}}function nb(e,r){if(!e.parentId)return!1;const i=r.get(e.parentId);return i?i.selected?!0:nb(i,r):!1}function t1(e,r,i){var a;let o=e;do{if((a=o==null?void 0:o.matches)!=null&&a.call(o,r))return!0;if(o===i)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function WT(e,r,i,o){const a=new Map;for(const[u,l]of e)if((l.selected||l.id===o)&&(!l.parentId||!nb(l,e))&&(l.draggable||r&&typeof l.draggable>"u")){const c=e.get(u);c&&a.set(u,{id:u,position:c.position||{x:0,y:0},distance:{x:i.x-c.internals.positionAbsolute.x,y:i.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return a}function Sc({nodeId:e,dragItems:r,nodeLookup:i,dragging:o=!0}){var l,c,d;const a=[];for(const[h,p]of r){const g=(l=i.get(h))==null?void 0:l.internals.userNode;g&&a.push({...g,position:p.position,dragging:o})}if(!e)return[a[0],a];const u=(c=i.get(e))==null?void 0:c.internals.userNode;return[u?{...u,position:((d=r.get(e))==null?void 0:d.position)||u.position,dragging:o}:a[0],a]}function YT({dragItems:e,snapGrid:r,x:i,y:o}){const a=e.values().next().value;if(!a)return null;const u={x:i-a.distance.x,y:o-a.distance.y},l=Ko(u,r);return{x:l.x-u.x,y:l.y-u.y}}function KT({onNodeMouseDown:e,getStoreItems:r,onDragStart:i,onDrag:o,onDragStop:a}){let u={x:null,y:null},l=0,c=new Map,d=!1,h={x:0,y:0},p=null,g=!1,m=null,w=!1,S=!1,b=null;function x({noDragClassName:C,handleSelector:_,domNode:k,isSelectable:R,nodeId:M,nodeClickDistance:T=0}){m=Rt(k);function O({x:$,y:Q}){const{nodeLookup:A,nodeExtent:G,snapGrid:V,snapToGrid:Z,nodeOrigin:j,onNodeDrag:F,onSelectionDrag:K,onError:P,updateNodePositions:H}=r();u={x:$,y:Q};let oe=!1;const D=c.size>1,Y=D&&G?iv(Yo(c)):null,X=D&&Z?YT({dragItems:c,snapGrid:V,x:$,y:Q}):null;for(const[re,ne]of c){if(!A.has(re))continue;let se={x:$-ne.distance.x,y:Q-ne.distance.y};Z&&(se=X?{x:Math.round(se.x+X.x),y:Math.round(se.y+X.y)}:Ko(se,V));let fe=null;if(D&&G&&!ne.extent&&Y){const{positionAbsolute:de}=ne.internals,Ee=de.x-Y.x+G[0][0],ye=de.x+ne.measured.width-Y.x2+G[1][0],Ne=de.y-Y.y+G[0][1],Se=de.y+ne.measured.height-Y.y2+G[1][1];fe=[[Ee,Ne],[ye,Se]]}const{position:ve,positionAbsolute:xe}=FE({nodeId:re,nextPosition:se,nodeLookup:A,nodeExtent:fe||G,nodeOrigin:j,onError:P});oe=oe||ne.position.x!==ve.x||ne.position.y!==ve.y,ne.position=ve,ne.internals.positionAbsolute=xe}if(S=S||oe,!!oe&&(H(c,!0),b&&(o||F||!M&&K))){const[re,ne]=Sc({nodeId:M,dragItems:c,nodeLookup:A});o==null||o(b,c,re,ne),F==null||F(b,re,ne),M||K==null||K(b,ne)}}async function z(){if(!p)return;const{transform:$,panBy:Q,autoPanSpeed:A,autoPanOnNodeDrag:G}=r();if(!G){d=!1,cancelAnimationFrame(l);return}const[V,Z]=BE(h,p,A);(V!==0||Z!==0)&&(u.x=(u.x??0)-V/$[2],u.y=(u.y??0)-Z/$[2],await Q({x:V,y:Z})&&O(u)),l=requestAnimationFrame(z)}function W($){var D;const{nodeLookup:Q,multiSelectionActive:A,nodesDraggable:G,transform:V,snapGrid:Z,snapToGrid:j,selectNodesOnDrag:F,onNodeDragStart:K,onSelectionDragStart:P,unselectNodesAndEdges:H}=r();g=!0,(!F||!R)&&!A&&M&&((D=Q.get(M))!=null&&D.selected||H()),R&&F&&M&&(e==null||e(M));const oe=qo($.sourceEvent,{transform:V,snapGrid:Z,snapToGrid:j,containerBounds:p});if(u=oe,c=WT(Q,G,oe,M),c.size>0&&(i||K||!M&&P)){const[Y,X]=Sc({nodeId:M,dragItems:c,nodeLookup:Q});i==null||i($.sourceEvent,c,Y,X),K==null||K($.sourceEvent,Y,X),M||P==null||P($.sourceEvent,X)}}const L=wE().clickDistance(T).on("start",$=>{const{domNode:Q,nodeDragThreshold:A,transform:G,snapGrid:V,snapToGrid:Z}=r();p=(Q==null?void 0:Q.getBoundingClientRect())||null,w=!1,S=!1,b=$.sourceEvent,A===0&&W($),u=qo($.sourceEvent,{transform:G,snapGrid:V,snapToGrid:Z,containerBounds:p}),h=tn($.sourceEvent,p)}).on("drag",$=>{const{autoPanOnNodeDrag:Q,transform:A,snapGrid:G,snapToGrid:V,nodeDragThreshold:Z,nodeLookup:j}=r(),F=qo($.sourceEvent,{transform:A,snapGrid:G,snapToGrid:V,containerBounds:p});if(b=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||M&&!j.has(M))&&(w=!0),!w){if(!d&&Q&&g&&(d=!0,z()),!g){const K=tn($.sourceEvent,p),P=K.x-h.x,H=K.y-h.y;Math.sqrt(P*P+H*H)>Z&&W($)}(u.x!==F.xSnapped||u.y!==F.ySnapped)&&c&&g&&(h=tn($.sourceEvent,p),O(F))}}).on("end",$=>{if(!(!g||w)&&(d=!1,g=!1,cancelAnimationFrame(l),c.size>0)){const{nodeLookup:Q,updateNodePositions:A,onNodeDragStop:G,onSelectionDragStop:V}=r();if(S&&(A(c,!1),S=!1),a||G||!M&&V){const[Z,j]=Sc({nodeId:M,dragItems:c,nodeLookup:Q,dragging:!1});a==null||a($.sourceEvent,c,Z,j),G==null||G($.sourceEvent,Z,j),M||V==null||V($.sourceEvent,j)}}}).filter($=>{const Q=$.target;return!$.button&&(!C||!t1(Q,`.${C}`,k))&&(!_||t1(Q,_,k))});m.call(L)}function E(){m==null||m.on(".drag",null)}return{update:x,destroy:E}}function XT(e,r,i){const o=[],a={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const u of r.values())$o(a,Ei(u))>0&&o.push(u);return o}const QT=250;function ZT(e,r,i,o){var c,d;let a=[],u=1/0;const l=XT(e,i,r+QT);for(const h of l){const p=[...((c=h.internals.handleBounds)==null?void 0:c.source)??[],...((d=h.internals.handleBounds)==null?void 0:d.target)??[]];for(const g of p){if(o.nodeId===g.nodeId&&o.type===g.type&&o.id===g.id)continue;const{x:m,y:w}=Rr(h,g,g.position,!0),S=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(w-e.y,2));S>r||(S1){const h=o.type==="source"?"target":"source";return a.find(p=>p.type===h)??a[0]}return a[0]}function rb(e,r,i,o,a,u=!1){var h,p,g;const l=o.get(e);if(!l)return null;const c=a==="strict"?(h=l.internals.handleBounds)==null?void 0:h[r]:[...((p=l.internals.handleBounds)==null?void 0:p.source)??[],...((g=l.internals.handleBounds)==null?void 0:g.target)??[]],d=(i?c==null?void 0:c.find(m=>m.id===i):c==null?void 0:c[0])??null;return d&&u?{...d,...Rr(l,d,d.position,!0)}:d}function ib(e,r){return e||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function JT(e,r){let i=null;return r?i=!0:e&&!r&&(i=!1),i}const ob=()=>!0;function e4(e,{connectionMode:r,connectionRadius:i,handleId:o,nodeId:a,edgeUpdaterType:u,isTarget:l,domNode:c,nodeLookup:d,lib:h,autoPanOnConnect:p,flowId:g,panBy:m,cancelConnection:w,onConnectStart:S,onConnect:b,onConnectEnd:x,isValidConnection:E=ob,onReconnectEnd:C,updateConnection:_,getTransform:k,getFromHandle:R,autoPanSpeed:M,dragThreshold:T=1,handleDomNode:O}){const z=GE(e.target);let W=0,L;const{x:$,y:Q}=tn(e),A=ib(u,O),G=c==null?void 0:c.getBoundingClientRect();let V=!1;if(!G||!A)return;const Z=rb(a,A,o,d,r);if(!Z)return;let j=tn(e,G),F=!1,K=null,P=!1,H=null;function oe(){if(!p||!G)return;const[ve,xe]=BE(j,G,M);m({x:ve,y:xe}),W=requestAnimationFrame(oe)}const D={...Z,nodeId:a,type:A,position:Z.position},Y=d.get(a);let re={inProgress:!0,isValid:null,from:Rr(Y,D,_e.Left,!0),fromHandle:D,fromPosition:D.position,fromNode:Y,to:j,toHandle:null,toPosition:H0[D.position],toNode:null,pointer:j};function ne(){V=!0,_(re),S==null||S(e,{nodeId:a,handleId:o,handleType:A})}T===0&&ne();function se(ve){if(!V){const{x:Se,y:Je}=tn(ve),We=Se-$,ft=Je-Q;if(!(We*We+ft*ft>T*T))return;ne()}if(!R()||!D){fe(ve);return}const xe=k();j=tn(ve,G),L=ZT(Xo(j,xe,!1,[1,1]),i,d,D),F||(oe(),F=!0);const de=ab(ve,{handle:L,connectionMode:r,fromNodeId:a,fromHandleId:o,fromType:l?"target":"source",isValidConnection:E,doc:z,lib:h,flowId:g,nodeLookup:d});H=de.handleDomNode,K=de.connection,P=JT(!!L,de.isValid);const Ee=d.get(a),ye=Ee?Rr(Ee,D,_e.Left,!0):re.from,Ne={...re,from:ye,isValid:P,to:de.toHandle&&P?Hs({x:de.toHandle.x,y:de.toHandle.y},xe):j,toHandle:de.toHandle,toPosition:P&&de.toHandle?de.toHandle.position:H0[D.position],toNode:de.toHandle?d.get(de.toHandle.nodeId):null,pointer:j};_(Ne),re=Ne}function fe(ve){if(!("touches"in ve&&ve.touches.length>0)){if(V){(L||H)&&K&&P&&(b==null||b(K));const{inProgress:xe,...de}=re,Ee={...de,toPosition:re.toHandle?re.toPosition:null};x==null||x(ve,Ee),u&&(C==null||C(ve,Ee))}w(),cancelAnimationFrame(W),F=!1,P=!1,K=null,H=null,z.removeEventListener("mousemove",se),z.removeEventListener("mouseup",fe),z.removeEventListener("touchmove",se),z.removeEventListener("touchend",fe)}}z.addEventListener("mousemove",se),z.addEventListener("mouseup",fe),z.addEventListener("touchmove",se),z.addEventListener("touchend",fe)}function ab(e,{handle:r,connectionMode:i,fromNodeId:o,fromHandleId:a,fromType:u,doc:l,lib:c,flowId:d,isValidConnection:h=ob,nodeLookup:p}){const g=u==="target",m=r?l.querySelector(`.${c}-flow__handle[data-id="${d}-${r==null?void 0:r.nodeId}-${r==null?void 0:r.id}-${r==null?void 0:r.type}"]`):null,{x:w,y:S}=tn(e),b=l.elementFromPoint(w,S),x=b!=null&&b.classList.contains(`${c}-flow__handle`)?b:m,E={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const C=ib(void 0,x),_=x.getAttribute("data-nodeid"),k=x.getAttribute("data-handleid"),R=x.classList.contains("connectable"),M=x.classList.contains("connectableend");if(!_||!C)return E;const T={source:g?_:o,sourceHandle:g?k:a,target:g?o:_,targetHandle:g?a:k};E.connection=T;const z=R&&M&&(i===_i.Strict?g&&C==="source"||!g&&C==="target":_!==o||k!==a);E.isValid=z&&h(T),E.toHandle=rb(_,C,k,p,i,!0)}return E}const uv={onPointerDown:e4,isValid:ab};function t4({domNode:e,panZoom:r,getTransform:i,getViewScale:o}){const a=Rt(e);function u({translateExtent:c,width:d,height:h,zoomStep:p=1,pannable:g=!0,zoomable:m=!0,inversePan:w=!1}){const S=_=>{if(_.sourceEvent.type!=="wheel"||!r)return;const k=i(),R=_.sourceEvent.ctrlKey&&Bo()?10:1,M=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*p,T=k[2]*Math.pow(2,M*R);r.scaleTo(T)};let b=[0,0];const x=_=>{(_.sourceEvent.type==="mousedown"||_.sourceEvent.type==="touchstart")&&(b=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY])},E=_=>{const k=i();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!r)return;const R=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],M=[R[0]-b[0],R[1]-b[1]];b=R;const T=o()*Math.max(k[2],Math.log(k[2]))*(w?-1:1),O={x:k[0]-M[0]*T,y:k[1]-M[1]*T},z=[[0,0],[d,h]];r.setViewportConstrained({x:O.x,y:O.y,zoom:k[2]},z,c)},C=qE().on("start",x).on("zoom",g?E:null).on("zoom.wheel",m?S:null);a.call(C,{})}function l(){a.on("zoom",null)}return{update:u,destroy:l,pointer:Zt}}const eu=e=>({x:e.x,y:e.y,zoom:e.k}),Ec=({x:e,y:r,zoom:i})=>Qs.translate(e,r).scale(i),pi=(e,r)=>e.target.closest(`.${r}`),sb=(e,r)=>r===2&&Array.isArray(e)&&e.includes(2),n4=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bc=(e,r=0,i=n4,o=()=>{})=>{const a=typeof r=="number"&&r>0;return a||o(),a?e.transition().duration(r).ease(i).on("end",o):e},ub=e=>{const r=e.ctrlKey&&Bo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*r};function r4({zoomPanValues:e,noWheelClassName:r,d3Selection:i,d3Zoom:o,panOnScrollMode:a,panOnScrollSpeed:u,zoomOnPinch:l,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:h}){return p=>{if(pi(p,r))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const g=i.property("__zoom").k||1;if(p.ctrlKey&&l){const x=Zt(p),E=ub(p),C=g*Math.pow(2,E);o.scaleTo(i,C,x,p);return}const m=p.deltaMode===1?20:1;let w=a===kr.Vertical?0:p.deltaX*m,S=a===kr.Horizontal?0:p.deltaY*m;!Bo()&&p.shiftKey&&a!==kr.Vertical&&(w=p.deltaY*m,S=0),o.translateBy(i,-(w/g)*u,-(S/g)*u,{internal:!0});const b=eu(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(p,b),e.panScrollTimeout=setTimeout(()=>{h==null||h(p,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c==null||c(p,b))}}function i4({noWheelClassName:e,preventScrolling:r,d3ZoomHandler:i}){return function(o,a){const u=o.type==="wheel",l=!r&&u&&!o.ctrlKey,c=pi(o,e);if(o.ctrlKey&&u&&c&&o.preventDefault(),l||c)return null;o.preventDefault(),i.call(this,o,a)}}function o4({zoomPanValues:e,onDraggingChange:r,onPanZoomStart:i}){return o=>{var u,l,c;if((u=o.sourceEvent)!=null&&u.internal)return;const a=eu(o.transform);e.mouseButton=((l=o.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((c=o.sourceEvent)==null?void 0:c.type)==="mousedown"&&r(!0),i&&(i==null||i(o.sourceEvent,a))}}function a4({zoomPanValues:e,panOnDrag:r,onPaneContextMenu:i,onTransformChange:o,onPanZoom:a}){return u=>{var l,c;e.usedRightMouseButton=!!(i&&sb(r,e.mouseButton??0)),(l=u.sourceEvent)!=null&&l.sync||o([u.transform.x,u.transform.y,u.transform.k]),a&&!((c=u.sourceEvent)!=null&&c.internal)&&(a==null||a(u.sourceEvent,eu(u.transform)))}}function s4({zoomPanValues:e,panOnDrag:r,panOnScroll:i,onDraggingChange:o,onPanZoomEnd:a,onPaneContextMenu:u}){return l=>{var c;if(!((c=l.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,u&&sb(r,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&u(l.sourceEvent),e.usedRightMouseButton=!1,o(!1),a)){const d=eu(l.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(l.sourceEvent,d)},i?150:0)}}}function u4({zoomActivationKeyPressed:e,zoomOnScroll:r,zoomOnPinch:i,panOnDrag:o,panOnScroll:a,zoomOnDoubleClick:u,userSelectionActive:l,noWheelClassName:c,noPanClassName:d,lib:h,connectionInProgress:p}){return g=>{var x;const m=e||r,w=i&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(pi(g,`${h}-flow__node`)||pi(g,`${h}-flow__edge`)))return!0;if(!o&&!m&&!a&&!u&&!i||l||p&&!S||pi(g,c)&&S||pi(g,d)&&(!S||a&&S&&!e)||!i&&g.ctrlKey&&S)return!1;if(!i&&g.type==="touchstart"&&((x=g.touches)==null?void 0:x.length)>1)return g.preventDefault(),!1;if(!m&&!a&&!w&&S||!o&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(o)&&!o.includes(g.button)&&g.type==="mousedown")return!1;const b=Array.isArray(o)&&o.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&b}}function l4({domNode:e,minZoom:r,maxZoom:i,translateExtent:o,viewport:a,onPanZoom:u,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),g=qE().scaleExtent([r,i]).translateExtent(o),m=Rt(e).call(g);C({x:a.x,y:a.y,zoom:Si(a.zoom,r,i)},[[0,0],[p.width,p.height]],o);const w=m.on("wheel.zoom"),S=m.on("dblclick.zoom");g.wheelDelta(ub);function b(L,$){return m?new Promise(Q=>{g==null||g.interpolate(($==null?void 0:$.interpolate)==="linear"?Ao:Ms).transform(bc(m,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>Q(!0)),L)}):Promise.resolve(!1)}function x({noWheelClassName:L,noPanClassName:$,onPaneContextMenu:Q,userSelectionActive:A,panOnScroll:G,panOnDrag:V,panOnScrollMode:Z,panOnScrollSpeed:j,preventScrolling:F,zoomOnPinch:K,zoomOnScroll:P,zoomOnDoubleClick:H,zoomActivationKeyPressed:oe,lib:D,onTransformChange:Y,connectionInProgress:X,paneClickDistance:re,selectionOnDrag:ne}){A&&!h.isZoomingOrPanning&&E();const se=G&&!oe&&!A;g.clickDistance(ne?1/0:!en(re)||re<0?0:re);const fe=se?r4({zoomPanValues:h,noWheelClassName:L,d3Selection:m,d3Zoom:g,panOnScrollMode:Z,panOnScrollSpeed:j,zoomOnPinch:K,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:c}):i4({noWheelClassName:L,preventScrolling:F,d3ZoomHandler:w});if(m.on("wheel.zoom",fe,{passive:!1}),!A){const xe=o4({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:l});g.on("start",xe);const de=a4({zoomPanValues:h,panOnDrag:V,onPaneContextMenu:!!Q,onPanZoom:u,onTransformChange:Y});g.on("zoom",de);const Ee=s4({zoomPanValues:h,panOnDrag:V,panOnScroll:G,onPaneContextMenu:Q,onPanZoomEnd:c,onDraggingChange:d});g.on("end",Ee)}const ve=u4({zoomActivationKeyPressed:oe,panOnDrag:V,zoomOnScroll:P,panOnScroll:G,zoomOnDoubleClick:H,zoomOnPinch:K,userSelectionActive:A,noPanClassName:$,noWheelClassName:L,lib:D,connectionInProgress:X});g.filter(ve),H?m.on("dblclick.zoom",S):m.on("dblclick.zoom",null)}function E(){g.on("zoom",null)}async function C(L,$,Q){const A=Ec(L),G=g==null?void 0:g.constrain()(A,$,Q);return G&&await b(G),new Promise(V=>V(G))}async function _(L,$){const Q=Ec(L);return await b(Q,$),new Promise(A=>A(Q))}function k(L){if(m){const $=Ec(L),Q=m.property("__zoom");(Q.k!==L.zoom||Q.x!==L.x||Q.y!==L.y)&&(g==null||g.transform(m,$,null,{sync:!0}))}}function R(){const L=m?AE(m.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function M(L,$){return m?new Promise(Q=>{g==null||g.interpolate(($==null?void 0:$.interpolate)==="linear"?Ao:Ms).scaleTo(bc(m,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>Q(!0)),L)}):Promise.resolve(!1)}function T(L,$){return m?new Promise(Q=>{g==null||g.interpolate(($==null?void 0:$.interpolate)==="linear"?Ao:Ms).scaleBy(bc(m,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>Q(!0)),L)}):Promise.resolve(!1)}function O(L){g==null||g.scaleExtent(L)}function z(L){g==null||g.translateExtent(L)}function W(L){const $=!en(L)||L<0?0:L;g==null||g.clickDistance($)}return{update:x,destroy:E,setViewport:_,setViewportConstrained:C,getViewport:R,scaleTo:M,scaleBy:T,setScaleExtent:O,setTranslateExtent:z,syncViewport:k,setClickDistance:W}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function c4({width:e,prevWidth:r,height:i,prevHeight:o,affectsX:a,affectsY:u}){const l=e-r,c=i-o,d=[l>0?1:l<0?-1:0,c>0?1:c<0?-1:0];return l&&a&&(d[0]=d[0]*-1),c&&u&&(d[1]=d[1]*-1),d}function n1(e){const r=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),o=e.includes("left"),a=e.includes("top");return{isHorizontal:r,isVertical:i,affectsX:o,affectsY:a}}function Jn(e,r){return Math.max(0,r-e)}function er(e,r){return Math.max(0,e-r)}function Cs(e,r,i){return Math.max(0,r-e,e-i)}function r1(e,r){return e?!r:r}function f4(e,r,i,o,a,u,l,c){let{affectsX:d,affectsY:h}=r;const{isHorizontal:p,isVertical:g}=r,m=p&&g,{xSnapped:w,ySnapped:S}=i,{minWidth:b,maxWidth:x,minHeight:E,maxHeight:C}=o,{x:_,y:k,width:R,height:M,aspectRatio:T}=e;let O=Math.floor(p?w-e.pointerX:0),z=Math.floor(g?S-e.pointerY:0);const W=R+(d?-O:O),L=M+(h?-z:z),$=-u[0]*R,Q=-u[1]*M;let A=Cs(W,b,x),G=Cs(L,E,C);if(l){let j=0,F=0;d&&O<0?j=Jn(_+O+$,l[0][0]):!d&&O>0&&(j=er(_+W+$,l[1][0])),h&&z<0?F=Jn(k+z+Q,l[0][1]):!h&&z>0&&(F=er(k+L+Q,l[1][1])),A=Math.max(A,j),G=Math.max(G,F)}if(c){let j=0,F=0;d&&O>0?j=er(_+O,c[0][0]):!d&&O<0&&(j=Jn(_+W,c[1][0])),h&&z>0?F=er(k+z,c[0][1]):!h&&z<0&&(F=Jn(k+L,c[1][1])),A=Math.max(A,j),G=Math.max(G,F)}if(a){if(p){const j=Cs(W/T,E,C)*T;if(A=Math.max(A,j),l){let F=0;!d&&!h||d&&!h&&m?F=er(k+Q+W/T,l[1][1])*T:F=Jn(k+Q+(d?O:-O)/T,l[0][1])*T,A=Math.max(A,F)}if(c){let F=0;!d&&!h||d&&!h&&m?F=Jn(k+W/T,c[1][1])*T:F=er(k+(d?O:-O)/T,c[0][1])*T,A=Math.max(A,F)}}if(g){const j=Cs(L*T,b,x)/T;if(G=Math.max(G,j),l){let F=0;!d&&!h||h&&!d&&m?F=er(_+L*T+$,l[1][0])/T:F=Jn(_+(h?z:-z)*T+$,l[0][0])/T,G=Math.max(G,F)}if(c){let F=0;!d&&!h||h&&!d&&m?F=Jn(_+L*T,c[1][0])/T:F=er(_+(h?z:-z)*T,c[0][0])/T,G=Math.max(G,F)}}}z=z+(z<0?G:-G),O=O+(O<0?A:-A),a&&(m?W>L*T?z=(r1(d,h)?-O:O)/T:O=(r1(d,h)?-z:z)*T:p?(z=O/T,h=d):(O=z*T,d=h));const V=d?_+O:_,Z=h?k+z:k;return{width:R+(d?-O:O),height:M+(h?-z:z),x:u[0]*O*(d?-1:1)+V,y:u[1]*z*(h?-1:1)+Z}}const lb={width:0,height:0,x:0,y:0},d4={...lb,pointerX:0,pointerY:0,aspectRatio:1};function h4(e){return[[0,0],[e.measured.width,e.measured.height]]}function p4(e,r,i){const o=r.position.x+e.position.x,a=r.position.y+e.position.y,u=e.measured.width??0,l=e.measured.height??0,c=i[0]*u,d=i[1]*l;return[[o-c,a-d],[o+u-c,a+l-d]]}function g4({domNode:e,nodeId:r,getStoreItems:i,onChange:o,onEnd:a}){const u=Rt(e);let l={controlDirection:n1("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:h,boundaries:p,keepAspectRatio:g,resizeDirection:m,onResizeStart:w,onResize:S,onResizeEnd:b,shouldResize:x}){let E={...lb},C={...d4};l={boundaries:p,resizeDirection:m,keepAspectRatio:g,controlDirection:n1(h)};let _,k=null,R=[],M,T,O,z=!1;const W=wE().on("start",L=>{const{nodeLookup:$,transform:Q,snapGrid:A,snapToGrid:G,nodeOrigin:V,paneDomNode:Z}=i();if(_=$.get(r),!_)return;k=(Z==null?void 0:Z.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:F}=qo(L.sourceEvent,{transform:Q,snapGrid:A,snapToGrid:G,containerBounds:k});E={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},C={...E,pointerX:j,pointerY:F,aspectRatio:E.width/E.height},M=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(M=$.get(_.parentId),T=M&&_.extent==="parent"?h4(M):void 0),R=[],O=void 0;for(const[K,P]of $)if(P.parentId===r&&(R.push({id:K,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent)){const H=p4(P,_,P.origin??V);O?O=[[Math.min(H[0][0],O[0][0]),Math.min(H[0][1],O[0][1])],[Math.max(H[1][0],O[1][0]),Math.max(H[1][1],O[1][1])]]:O=H}w==null||w(L,{...E})}).on("drag",L=>{const{transform:$,snapGrid:Q,snapToGrid:A,nodeOrigin:G}=i(),V=qo(L.sourceEvent,{transform:$,snapGrid:Q,snapToGrid:A,containerBounds:k}),Z=[];if(!_)return;const{x:j,y:F,width:K,height:P}=E,H={},oe=_.origin??G,{width:D,height:Y,x:X,y:re}=f4(C,l.controlDirection,V,l.boundaries,l.keepAspectRatio,oe,T,O),ne=D!==K,se=Y!==P,fe=X!==j&&ne,ve=re!==F&&se;if(!fe&&!ve&&!ne&&!se)return;if((fe||ve||oe[0]===1||oe[1]===1)&&(H.x=fe?X:E.x,H.y=ve?re:E.y,E.x=H.x,E.y=H.y,R.length>0)){const ye=X-j,Ne=re-F;for(const Se of R)Se.position={x:Se.position.x-ye+oe[0]*(D-K),y:Se.position.y-Ne+oe[1]*(Y-P)},Z.push(Se)}if((ne||se)&&(H.width=ne&&(!l.resizeDirection||l.resizeDirection==="horizontal")?D:E.width,H.height=se&&(!l.resizeDirection||l.resizeDirection==="vertical")?Y:E.height,E.width=H.width,E.height=H.height),M&&_.expandParent){const ye=oe[0]*(H.width??0);H.x&&H.x{z&&(b==null||b(L,{...E}),a==null||a({...E}),z=!1)});u.call(W)}function d(){u.on(".drag",null)}return{update:c,destroy:d}}var kc={exports:{}},Cc={},Nc={exports:{}},Ic={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var i1;function v4(){if(i1)return Ic;i1=1;var e=Vo();function r(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var i=typeof Object.is=="function"?Object.is:r,o=e.useState,a=e.useEffect,u=e.useLayoutEffect,l=e.useDebugValue;function c(g,m){var w=m(),S=o({inst:{value:w,getSnapshot:m}}),b=S[0].inst,x=S[1];return u(function(){b.value=w,b.getSnapshot=m,d(b)&&x({inst:b})},[g,w,m]),a(function(){return d(b)&&x({inst:b}),g(function(){d(b)&&x({inst:b})})},[g]),l(w),w}function d(g){var m=g.getSnapshot;g=g.value;try{var w=m();return!i(g,w)}catch{return!0}}function h(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Ic.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Ic}var o1;function m4(){return o1||(o1=1,Nc.exports=v4()),Nc.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var a1;function y4(){if(a1)return Cc;a1=1;var e=Vo(),r=m4();function i(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var o=typeof Object.is=="function"?Object.is:i,a=r.useSyncExternalStore,u=e.useRef,l=e.useEffect,c=e.useMemo,d=e.useDebugValue;return Cc.useSyncExternalStoreWithSelector=function(h,p,g,m,w){var S=u(null);if(S.current===null){var b={hasValue:!1,value:null};S.current=b}else b=S.current;S=c(function(){function E(M){if(!C){if(C=!0,_=M,M=m(M),w!==void 0&&b.hasValue){var T=b.value;if(w(T,M))return k=T}return k=M}if(T=k,o(_,M))return T;var O=m(M);return w!==void 0&&w(T,O)?(_=M,T):(_=M,k=O)}var C=!1,_,k,R=g===void 0?null:g;return[function(){return E(p())},R===null?void 0:function(){return E(R())}]},[p,g,m,w]);var x=a(h,S[0],S[1]);return l(function(){b.hasValue=!0,b.value=x},[x]),d(x),x},Cc}var s1;function w4(){return s1||(s1=1,kc.exports=y4()),kc.exports}var x4=w4();const _4=Gs(x4),S4={},u1=e=>{let r;const i=new Set,o=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const w=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(S=>S(r,w))}},a=()=>r,d={setState:o,getState:a,getInitialState:()=>h,subscribe:p=>(i.add(p),()=>i.delete(p)),destroy:()=>{(S4?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},h=r=e(o,a,d);return d},E4=e=>e?u1(e):u1,{useDebugValue:b4}=hi,{useSyncExternalStoreWithSelector:k4}=_4,C4=e=>e;function cb(e,r=C4,i){const o=k4(e.subscribe,e.getState,e.getServerState||e.getInitialState,r,i);return b4(o),o}const l1=(e,r)=>{const i=E4(e),o=(a,u=r)=>cb(i,a,u);return Object.assign(o,i),o},N4=(e,r)=>e?l1(e,r):l1;function Oe(e,r){if(Object.is(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(const[o,a]of e)if(!Object.is(a,r.get(o)))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(const o of e)if(!r.has(o))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(r).length)return!1;for(const o of i)if(!Object.prototype.hasOwnProperty.call(r,o)||!Object.is(e[o],r[o]))return!1;return!0}iE();const tu=ie.createContext(null),I4=tu.Provider,fb=pn.error001();function Re(e,r){const i=ie.useContext(tu);if(i===null)throw new Error(fb);return cb(i,e,r)}function ze(){const e=ie.useContext(tu);if(e===null)throw new Error(fb);return ie.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const c1={display:"none"},R4={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},db="react-flow__node-desc",hb="react-flow__edge-desc",M4="react-flow__aria-live",T4=e=>e.ariaLiveMessage,P4=e=>e.ariaLabelConfig;function A4({rfId:e}){const r=Re(T4);return I.jsx("div",{id:`${M4}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:R4,children:r})}function q4({rfId:e,disableKeyboardA11y:r}){const i=Re(P4);return I.jsxs(I.Fragment,{children:[I.jsx("div",{id:`${db}-${e}`,style:c1,children:r?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),I.jsx("div",{id:`${hb}-${e}`,style:c1,children:i["edge.a11yDescription.default"]}),!r&&I.jsx(A4,{rfId:e})]})}const nu=ie.forwardRef(({position:e="top-left",children:r,className:i,style:o,...a},u)=>{const l=`${e}`.split("-");return I.jsx("div",{className:Ke(["react-flow__panel",i,...l]),style:o,ref:u,...a,children:r})});nu.displayName="Panel";function L4({proOptions:e,position:r="bottom-right"}){return e!=null&&e.hideAttribution?null:I.jsx(nu,{position:r,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:I.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const j4=e=>{const r=[],i=[];for(const[,o]of e.nodeLookup)o.selected&&r.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&i.push(o);return{selectedNodes:r,selectedEdges:i}},Ns=e=>e.id;function O4(e,r){return Oe(e.selectedNodes.map(Ns),r.selectedNodes.map(Ns))&&Oe(e.selectedEdges.map(Ns),r.selectedEdges.map(Ns))}function z4({onSelectionChange:e}){const r=ze(),{selectedNodes:i,selectedEdges:o}=Re(j4,O4);return ie.useEffect(()=>{const a={nodes:i,edges:o};e==null||e(a),r.getState().onSelectionChangeHandlers.forEach(u=>u(a))},[i,o,e]),null}const D4=e=>!!e.onSelectionChangeHandlers;function F4({onSelectionChange:e}){const r=Re(D4);return e||r?I.jsx(z4,{onSelectionChange:e}):null}const pb=[0,0],$4={x:0,y:0,zoom:1},B4=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],f1=[...B4,"rfId"],H4=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),d1={translateExtent:Do,nodeOrigin:pb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function V4(e){const{setNodes:r,setEdges:i,setMinZoom:o,setMaxZoom:a,setTranslateExtent:u,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:d}=Re(H4,Oe),h=ze();ie.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=d1,c()}),[]);const p=ie.useRef(d1);return ie.useEffect(()=>{for(const g of f1){const m=e[g],w=p.current[g];m!==w&&(typeof e[g]>"u"||(g==="nodes"?r(m):g==="edges"?i(m):g==="minZoom"?o(m):g==="maxZoom"?a(m):g==="translateExtent"?u(m):g==="nodeExtent"?l(m):g==="ariaLabelConfig"?h.setState({ariaLabelConfig:NT(m)}):g==="fitView"?h.setState({fitViewQueued:m}):g==="fitViewOptions"?h.setState({fitViewOptions:m}):h.setState({[g]:m})))}p.current=e},f1.map(g=>e[g])),null}function h1(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function U4(e){var o;const[r,i]=ie.useState(e==="system"?null:e);return ie.useEffect(()=>{if(e!=="system"){i(e);return}const a=h1(),u=()=>i(a!=null&&a.matches?"dark":"light");return u(),a==null||a.addEventListener("change",u),()=>{a==null||a.removeEventListener("change",u)}},[e]),r!==null?r:(o=h1())!=null&&o.matches?"dark":"light"}const p1=typeof document<"u"?document:null;function Ho(e=null,r={target:p1,actInsideInputWithModifier:!0}){const[i,o]=ie.useState(!1),a=ie.useRef(!1),u=ie.useRef(new Set([])),[l,c]=ie.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",` `).replace(` `,` +`).split(` `)),p=h.reduce((g,m)=>g.concat(...m),[]);return[h,p]}return[[],[]]},[e]);return ie.useEffect(()=>{const d=(r==null?void 0:r.target)??p1,h=(r==null?void 0:r.actInsideInputWithModifier)??!0;if(e!==null){const p=w=>{var x,E;if(a.current=w.ctrlKey||w.metaKey||w.shiftKey||w.altKey,(!a.current||a.current&&!h)&&WE(w))return!1;const b=v1(w.code,c);if(u.current.add(w[b]),g1(l,u.current,!1)){const C=((E=(x=w.composedPath)==null?void 0:x.call(w))==null?void 0:E[0])||w.target,_=(C==null?void 0:C.nodeName)==="BUTTON"||(C==null?void 0:C.nodeName)==="A";r.preventDefault!==!1&&(a.current||!_)&&w.preventDefault(),o(!0)}},g=w=>{const S=v1(w.code,c);g1(l,u.current,!0)?(o(!1),u.current.clear()):u.current.delete(w[S]),w.key==="Meta"&&u.current.clear(),a.current=!1},m=()=>{u.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",g),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",g),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,o]),i}function g1(e,r,i){return e.filter(o=>i||o.length===r.size).some(o=>o.every(a=>r.has(a)))}function v1(e,r){return r.includes(e)?"code":"key"}const G4=()=>{const e=ze();return ie.useMemo(()=>({zoomIn:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},zoomOut:r=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},zoomTo:(r,i)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(r,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(r,i)=>{const{transform:[o,a,u],panZoom:l}=e.getState();return l?(await l.setViewport({x:r.x??o,y:r.y??a,zoom:r.zoom??u},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[r,i,o]=e.getState().transform;return{x:r,y:i,zoom:o}},setCenter:async(r,i,o)=>e.getState().setCenter(r,i,o),fitBounds:async(r,i)=>{const{width:o,height:a,minZoom:u,maxZoom:l,panZoom:c}=e.getState(),d=xv(r,o,a,u,l,(i==null?void 0:i.padding)??.1);return c?(await c.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(r,i={})=>{const{transform:o,snapGrid:a,snapToGrid:u,domNode:l}=e.getState();if(!l)return r;const{x:c,y:d}=l.getBoundingClientRect(),h={x:r.x-c,y:r.y-d},p=i.snapGrid??a,g=i.snapToGrid??u;return Xo(h,o,g,p)},flowToScreenPosition:r=>{const{transform:i,domNode:o}=e.getState();if(!o)return r;const{x:a,y:u}=o.getBoundingClientRect(),l=Hs(r,i);return{x:l.x+a,y:l.y+u}}}),[])};function gb(e,r){const i=[],o=new Map,a=[];for(const u of e)if(u.type==="add"){a.push(u);continue}else if(u.type==="remove"||u.type==="replace")o.set(u.id,[u]);else{const l=o.get(u.id);l?l.push(u):o.set(u.id,[u])}for(const u of r){const l=o.get(u.id);if(!l){i.push(u);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){i.push({...l[0].item});continue}const c={...u};for(const d of l)W4(d,c);i.push(c)}return a.length&&a.forEach(u=>{u.index!==void 0?i.splice(u.index,0,{...u.item}):i.push({...u.item})}),i}function W4(e,r){switch(e.type){case"select":{r.selected=e.selected;break}case"position":{typeof e.position<"u"&&(r.position=e.position),typeof e.dragging<"u"&&(r.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(r.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(r.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(r.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(r.resizing=e.resizing);break}}}function Y4(e,r){return gb(e,r)}function K4(e,r){return gb(e,r)}function Sr(e,r){return{id:e,type:"select",selected:r}}function gi(e,r=new Set,i=!1){const o=[];for(const[a,u]of e){const l=r.has(a);!(u.selected===void 0&&!l)&&u.selected!==l&&(i&&(u.selected=l),o.push(Sr(u.id,l)))}return o}function m1({items:e=[],lookup:r}){var a;const i=[],o=new Map(e.map(u=>[u.id,u]));for(const[u,l]of e.entries()){const c=r.get(l.id),d=((a=c==null?void 0:c.internals)==null?void 0:a.userNode)??c;d!==void 0&&d!==l&&i.push({id:l.id,item:l,type:"replace"}),d===void 0&&i.push({item:l,type:"add",index:u})}for(const[u]of r)o.get(u)===void 0&&i.push({id:u,type:"remove"});return i}function y1(e){return{id:e.id,type:"remove"}}const w1=e=>mT(e),X4=e=>DE(e);function vb(e){return ie.forwardRef(e)}const Q4=typeof window<"u"?ie.useLayoutEffect:ie.useEffect;function x1(e){const[r,i]=ie.useState(BigInt(0)),[o]=ie.useState(()=>Z4(()=>i(a=>a+BigInt(1))));return Q4(()=>{const a=o.get();a.length&&(e(a),o.reset())},[r]),o}function Z4(e){let r=[];return{get:()=>r,reset:()=>{r=[]},push:i=>{r.push(i),e()}}}const mb=ie.createContext(null);function J4({children:e}){const r=ze(),i=ie.useCallback(c=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:p,onNodesChange:g,nodeLookup:m,fitViewQueued:w,onNodesChangeMiddlewareMap:S}=r.getState();let b=d;for(const E of c)b=typeof E=="function"?E(b):E;let x=m1({items:b,lookup:m});for(const E of S.values())x=E(x);p&&h(b),x.length>0?g==null||g(x):w&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:C,setNodes:_}=r.getState();E&&_(C)})},[]),o=x1(i),a=ie.useCallback(c=>{const{edges:d=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:g,edgeLookup:m}=r.getState();let w=d;for(const S of c)w=typeof S=="function"?S(w):S;p?h(w):g&&g(m1({items:w,lookup:m}))},[]),u=x1(a),l=ie.useMemo(()=>({nodeQueue:o,edgeQueue:u}),[]);return I.jsx(mb.Provider,{value:l,children:e})}function eP(){const e=ie.useContext(mb);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const tP=e=>!!e.panZoom;function Nv(){const e=G4(),r=ze(),i=eP(),o=Re(tP),a=ie.useMemo(()=>{const u=g=>r.getState().nodeLookup.get(g),l=g=>{i.nodeQueue.push(g)},c=g=>{i.edgeQueue.push(g)},d=g=>{var E,C;const{nodeLookup:m,nodeOrigin:w}=r.getState(),S=w1(g)?g:m.get(g.id),b=S.parentId?UE(S.position,S.measured,S.parentId,m,w):S.position,x={...S,position:b,width:((E=S.measured)==null?void 0:E.width)??S.width,height:((C=S.measured)==null?void 0:C.height)??S.height};return Ei(x)},h=(g,m,w={replace:!1})=>{l(S=>S.map(b=>{if(b.id===g){const x=typeof m=="function"?m(b):m;return w.replace&&w1(x)?x:{...b,...x}}return b}))},p=(g,m,w={replace:!1})=>{c(S=>S.map(b=>{if(b.id===g){const x=typeof m=="function"?m(b):m;return w.replace&&X4(x)?x:{...b,...x}}return b}))};return{getNodes:()=>r.getState().nodes.map(g=>({...g})),getNode:g=>{var m;return(m=u(g))==null?void 0:m.internals.userNode},getInternalNode:u,getEdges:()=>{const{edges:g=[]}=r.getState();return g.map(m=>({...m}))},getEdge:g=>r.getState().edgeLookup.get(g),setNodes:l,setEdges:c,addNodes:g=>{const m=Array.isArray(g)?g:[g];i.nodeQueue.push(w=>[...w,...m])},addEdges:g=>{const m=Array.isArray(g)?g:[g];i.edgeQueue.push(w=>[...w,...m])},toObject:()=>{const{nodes:g=[],edges:m=[],transform:w}=r.getState(),[S,b,x]=w;return{nodes:g.map(E=>({...E})),edges:m.map(E=>({...E})),viewport:{x:S,y:b,zoom:x}}},deleteElements:async({nodes:g=[],edges:m=[]})=>{const{nodes:w,edges:S,onNodesDelete:b,onEdgesDelete:x,triggerNodeChanges:E,triggerEdgeChanges:C,onDelete:_,onBeforeDelete:k}=r.getState(),{nodes:R,edges:M}=await ST({nodesToRemove:g,edgesToRemove:m,nodes:w,edges:S,onBeforeDelete:k}),T=M.length>0,O=R.length>0;if(T){const z=M.map(y1);x==null||x(M),C(z)}if(O){const z=R.map(y1);b==null||b(R),E(z)}return(O||T)&&(_==null||_({nodes:R,edges:M})),{deletedNodes:R,deletedEdges:M}},getIntersectingNodes:(g,m=!0,w)=>{const S=U0(g),b=S?g:d(g),x=w!==void 0;return b?(w||r.getState().nodes).filter(E=>{const C=r.getState().nodeLookup.get(E.id);if(C&&!S&&(E.id===g.id||!C.internals.positionAbsolute))return!1;const _=Ei(x?E:C),k=$o(_,b);return m&&k>0||k>=_.width*_.height||k>=b.width*b.height}):[]},isNodeIntersecting:(g,m,w=!0)=>{const b=U0(g)?g:d(g);if(!b)return!1;const x=$o(b,m);return w&&x>0||x>=m.width*m.height||x>=b.width*b.height},updateNode:h,updateNodeData:(g,m,w={replace:!1})=>{h(g,S=>{const b=typeof m=="function"?m(S):m;return w.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},w)},updateEdge:p,updateEdgeData:(g,m,w={replace:!1})=>{p(g,S=>{const b=typeof m=="function"?m(S):m;return w.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},w)},getNodesBounds:g=>{const{nodeLookup:m,nodeOrigin:w}=r.getState();return yT(g,{nodeLookup:m,nodeOrigin:w})},getHandleConnections:({type:g,id:m,nodeId:w})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${w}-${g}${m?`-${m}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:m,nodeId:w})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${w}${g?m?`-${g}-${m}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const m=r.getState().fitViewResolver??CT();return r.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:m}),i.nodeQueue.push(w=>[...w]),m.promise}}},[]);return ie.useMemo(()=>({...a,...e,viewportInitialized:o}),[o])}const _1=e=>e.selected,nP=typeof window<"u"?window:void 0;function rP({deleteKeyCode:e,multiSelectionKeyCode:r}){const i=ze(),{deleteElements:o}=Nv(),a=Ho(e,{actInsideInputWithModifier:!1}),u=Ho(r,{target:nP});ie.useEffect(()=>{if(a){const{edges:l,nodes:c}=i.getState();o({nodes:c.filter(_1),edges:l.filter(_1)}),i.setState({nodesSelectionActive:!1})}},[a]),ie.useEffect(()=>{i.setState({multiSelectionActive:u})},[u])}function iP(e){const r=ze();ie.useEffect(()=>{const i=()=>{var a,u,l,c;if(!e.current||!(((u=(a=e.current).checkVisibility)==null?void 0:u.call(a))??!0))return!1;const o=_v(e.current);(o.height===0||o.width===0)&&((c=(l=r.getState()).onError)==null||c.call(l,"004",pn.error004())),r.setState({width:o.width||500,height:o.height||500})};if(e.current){i(),window.addEventListener("resize",i);const o=new ResizeObserver(()=>i());return o.observe(e.current),()=>{window.removeEventListener("resize",i),o&&e.current&&o.unobserve(e.current)}}},[])}const ru={position:"absolute",width:"100%",height:"100%",top:0,left:0},oP=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function aP({onPaneContextMenu:e,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:o=!1,panOnScrollSpeed:a=.5,panOnScrollMode:u=kr.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:h,minZoom:p,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:w=!0,children:S,noWheelClassName:b,noPanClassName:x,onViewportChange:E,isControlledViewport:C,paneClickDistance:_,selectionOnDrag:k}){const R=ze(),M=ie.useRef(null),{userSelectionActive:T,lib:O,connectionInProgress:z}=Re(oP,Oe),W=Ho(m),L=ie.useRef();iP(M);const $=ie.useCallback(Q=>{E==null||E({x:Q[0],y:Q[1],zoom:Q[2]}),C||R.setState({transform:Q})},[E,C]);return ie.useEffect(()=>{if(M.current){L.current=l4({domNode:M.current,minZoom:p,maxZoom:g,translateExtent:h,viewport:d,onDraggingChange:V=>R.setState({paneDragging:V}),onPanZoomStart:(V,Z)=>{const{onViewportChangeStart:j,onMoveStart:F}=R.getState();F==null||F(V,Z),j==null||j(Z)},onPanZoom:(V,Z)=>{const{onViewportChange:j,onMove:F}=R.getState();F==null||F(V,Z),j==null||j(Z)},onPanZoomEnd:(V,Z)=>{const{onViewportChangeEnd:j,onMoveEnd:F}=R.getState();F==null||F(V,Z),j==null||j(Z)}});const{x:Q,y:A,zoom:G}=L.current.getViewport();return R.setState({panZoom:L.current,transform:[Q,A,G],domNode:M.current.closest(".react-flow")}),()=>{var V;(V=L.current)==null||V.destroy()}}},[]),ie.useEffect(()=>{var Q;(Q=L.current)==null||Q.update({onPaneContextMenu:e,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:o,panOnScrollSpeed:a,panOnScrollMode:u,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:W,preventScrolling:w,noPanClassName:x,userSelectionActive:T,noWheelClassName:b,lib:O,onTransformChange:$,connectionInProgress:z,selectionOnDrag:k,paneClickDistance:_})},[e,r,i,o,a,u,l,c,W,w,x,T,b,O,$,z,k,_]),I.jsx("div",{className:"react-flow__renderer",ref:M,style:ru,children:S})}const sP=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function uP(){const{userSelectionActive:e,userSelectionRect:r}=Re(sP,Oe);return e&&r?I.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}const Rc=(e,r)=>i=>{i.target===r.current&&(e==null||e(i))},lP=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function cP({isSelecting:e,selectionKeyPressed:r,selectionMode:i=Fo.Full,panOnDrag:o,paneClickDistance:a,selectionOnDrag:u,onSelectionStart:l,onSelectionEnd:c,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:w,children:S}){const b=ze(),{userSelectionActive:x,elementsSelectable:E,dragging:C,connectionInProgress:_}=Re(lP,Oe),k=E&&(e||x),R=ie.useRef(null),M=ie.useRef(),T=ie.useRef(new Set),O=ie.useRef(new Set),z=ie.useRef(!1),W=j=>{if(z.current||_){z.current=!1;return}d==null||d(j),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},L=j=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){j.preventDefault();return}h==null||h(j)},$=p?j=>p(j):void 0,Q=j=>{z.current&&(j.stopPropagation(),z.current=!1)},A=j=>{var Y,X;const{domNode:F}=b.getState();if(M.current=F==null?void 0:F.getBoundingClientRect(),!M.current)return;const K=j.target===R.current;if(!K&&!!j.target.closest(".nokey")||!e||!(u&&K||r)||j.button!==0||!j.isPrimary)return;(X=(Y=j.target)==null?void 0:Y.setPointerCapture)==null||X.call(Y,j.pointerId),z.current=!1;const{x:oe,y:D}=tn(j.nativeEvent,M.current);b.setState({userSelectionRect:{width:0,height:0,startX:oe,startY:D,x:oe,y:D}}),K||(j.stopPropagation(),j.preventDefault())},G=j=>{const{userSelectionRect:F,transform:K,nodeLookup:P,edgeLookup:H,connectionLookup:oe,triggerNodeChanges:D,triggerEdgeChanges:Y,defaultEdgeOptions:X,resetSelectedElements:re}=b.getState();if(!M.current||!F)return;const{x:ne,y:se}=tn(j.nativeEvent,M.current),{startX:fe,startY:ve}=F;if(!z.current){const Ne=r?0:a;if(Math.hypot(ne-fe,se-ve)<=Ne)return;re(),l==null||l(j)}z.current=!0;const xe={startX:fe,startY:ve,x:neNe.id)),O.current=new Set;const ye=(X==null?void 0:X.selectable)??!0;for(const Ne of T.current){const Se=oe.get(Ne);if(Se)for(const{edgeId:Je}of Se.values()){const We=H.get(Je);We&&(We.selectable??ye)&&O.current.add(Je)}}if(!G0(de,T.current)){const Ne=gi(P,T.current,!0);D(Ne)}if(!G0(Ee,O.current)){const Ne=gi(H,O.current);Y(Ne)}b.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},V=j=>{var F,K;j.button===0&&((K=(F=j.target)==null?void 0:F.releasePointerCapture)==null||K.call(F,j.pointerId),!x&&j.target===R.current&&b.getState().userSelectionRect&&(W==null||W(j)),b.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(c==null||c(j),b.setState({nodesSelectionActive:T.current.size>0})))},Z=o===!0||Array.isArray(o)&&o.includes(0);return I.jsxs("div",{className:Ke(["react-flow__pane",{draggable:Z,dragging:C,selection:e}]),onClick:k?void 0:Rc(W,R),onContextMenu:Rc(L,R),onWheel:Rc($,R),onPointerEnter:k?void 0:g,onPointerMove:k?G:m,onPointerUp:k?V:void 0,onPointerDownCapture:k?A:void 0,onClickCapture:k?Q:void 0,onPointerLeave:w,ref:R,style:ru,children:[S,I.jsx(uP,{})]})}function lv({id:e,store:r,unselect:i=!1,nodeRef:o}){const{addSelectedNodes:a,unselectNodesAndEdges:u,multiSelectionActive:l,nodeLookup:c,onError:d}=r.getState(),h=c.get(e);if(!h){d==null||d("012",pn.error012(e));return}r.setState({nodesSelectionActive:!1}),h.selected?(i||h.selected&&l)&&(u({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=o==null?void 0:o.current)==null?void 0:p.blur()})):a([e])}function yb({nodeRef:e,disabled:r=!1,noDragClassName:i,handleSelector:o,nodeId:a,isSelectable:u,nodeClickDistance:l}){const c=ze(),[d,h]=ie.useState(!1),p=ie.useRef();return ie.useEffect(()=>{p.current=KT({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{lv({id:g,store:c,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),ie.useEffect(()=>{var g,m;if(r)(g=p.current)==null||g.destroy();else if(e.current)return(m=p.current)==null||m.update({noDragClassName:i,handleSelector:o,domNode:e.current,isSelectable:u,nodeId:a,nodeClickDistance:l}),()=>{var w;(w=p.current)==null||w.destroy()}},[i,o,r,u,e,a]),d}const fP=e=>r=>r.selected&&(r.draggable||e&&typeof r.draggable>"u");function wb(){const e=ze();return ie.useCallback(i=>{const{nodeExtent:o,snapToGrid:a,snapGrid:u,nodesDraggable:l,onError:c,updateNodePositions:d,nodeLookup:h,nodeOrigin:p}=e.getState(),g=new Map,m=fP(l),w=a?u[0]:5,S=a?u[1]:5,b=i.direction.x*w*i.factor,x=i.direction.y*S*i.factor;for(const[,E]of h){if(!m(E))continue;let C={x:E.internals.positionAbsolute.x+b,y:E.internals.positionAbsolute.y+x};a&&(C=Ko(C,u));const{position:_,positionAbsolute:k}=FE({nodeId:E.id,nextPosition:C,nodeLookup:h,nodeExtent:o,nodeOrigin:p,onError:c});E.position=_,E.internals.positionAbsolute=k,g.set(E.id,E)}d(g)},[])}const Iv=ie.createContext(null),dP=Iv.Provider;Iv.Consumer;const xb=()=>ie.useContext(Iv),hP=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),pP=(e,r,i)=>o=>{const{connectionClickStartHandle:a,connectionMode:u,connection:l}=o,{fromHandle:c,toHandle:d,isValid:h}=l,p=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===r&&(d==null?void 0:d.type)===i;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===r&&(c==null?void 0:c.type)===i,connectingTo:p,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===r&&(a==null?void 0:a.type)===i,isPossibleEndHandle:u===_i.Strict?(c==null?void 0:c.type)!==i:e!==(c==null?void 0:c.nodeId)||r!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!a,valid:p&&h}};function gP({type:e="source",position:r=_e.Top,isValidConnection:i,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:u=!0,id:l,onConnect:c,children:d,className:h,onMouseDown:p,onTouchStart:g,...m},w){var G,V;const S=l||null,b=e==="target",x=ze(),E=xb(),{connectOnClick:C,noPanClassName:_,rfId:k}=Re(hP,Oe),{connectingFrom:R,connectingTo:M,clickConnecting:T,isPossibleEndHandle:O,connectionInProcess:z,clickConnectionInProcess:W,valid:L}=Re(pP(E,S,e),Oe);E||(V=(G=x.getState()).onError)==null||V.call(G,"010",pn.error010());const $=Z=>{const{defaultEdgeOptions:j,onConnect:F,hasDefaultEdges:K}=x.getState(),P={...j,...Z};if(K){const{edges:H,setEdges:oe}=x.getState();oe(AT(P,H))}F==null||F(P),c==null||c(P)},Q=Z=>{if(!E)return;const j=YE(Z.nativeEvent);if(a&&(j&&Z.button===0||!j)){const F=x.getState();uv.onPointerDown(Z.nativeEvent,{handleDomNode:Z.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:S,nodeId:E,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:F.onConnectEnd,updateConnection:F.updateConnection,onConnect:$,isValidConnection:i||F.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}j?p==null||p(Z):g==null||g(Z)},A=Z=>{const{onClickConnectStart:j,onClickConnectEnd:F,connectionClickStartHandle:K,connectionMode:P,isValidConnection:H,lib:oe,rfId:D,nodeLookup:Y,connection:X}=x.getState();if(!E||!K&&!a)return;if(!K){j==null||j(Z.nativeEvent,{nodeId:E,handleId:S,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:E,type:e,id:S}});return}const re=GE(Z.target),ne=i||H,{connection:se,isValid:fe}=uv.isValid(Z.nativeEvent,{handle:{nodeId:E,id:S,type:e},connectionMode:P,fromNodeId:K.nodeId,fromHandleId:K.id||null,fromType:K.type,isValidConnection:ne,flowId:D,doc:re,lib:oe,nodeLookup:Y});fe&&se&&$(se);const ve=structuredClone(X);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,F==null||F(Z,ve),x.setState({connectionClickStartHandle:null})};return I.jsx("div",{"data-handleid":S,"data-nodeid":E,"data-handlepos":r,"data-id":`${k}-${E}-${S}-${e}`,className:Ke(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",_,h,{source:!b,target:b,connectable:o,connectablestart:a,connectableend:u,clickconnecting:T,connectingfrom:R,connectingto:M,valid:L,connectionindicator:o&&(!z||O)&&(z||W?u:a)}]),onMouseDown:Q,onTouchStart:Q,onClick:C?A:void 0,ref:w,...m,children:d})}const Ci=ie.memo(vb(gP));function vP({data:e,isConnectable:r,sourcePosition:i=_e.Bottom}){return I.jsxs(I.Fragment,{children:[e==null?void 0:e.label,I.jsx(Ci,{type:"source",position:i,isConnectable:r})]})}function mP({data:e,isConnectable:r,targetPosition:i=_e.Top,sourcePosition:o=_e.Bottom}){return I.jsxs(I.Fragment,{children:[I.jsx(Ci,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label,I.jsx(Ci,{type:"source",position:o,isConnectable:r})]})}function yP(){return null}function wP({data:e,isConnectable:r,targetPosition:i=_e.Top}){return I.jsxs(I.Fragment,{children:[I.jsx(Ci,{type:"target",position:i,isConnectable:r}),e==null?void 0:e.label]})}const Vs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},S1={input:vP,default:mP,output:wP,group:yP};function xP(e){var r,i,o,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((r=e.style)==null?void 0:r.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const _P=e=>{const{width:r,height:i,x:o,y:a}=Yo(e.nodeLookup,{filter:u=>!!u.selected});return{width:en(r)?r:null,height:en(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${a}px)`}};function SP({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const o=ze(),{width:a,height:u,transformString:l,userSelectionActive:c}=Re(_P,Oe),d=wb(),h=ie.useRef(null);if(ie.useEffect(()=>{var m;i||(m=h.current)==null||m.focus({preventScroll:!0})},[i]),yb({nodeRef:h}),c||!a||!u)return null;const p=e?m=>{const w=o.getState().nodes.filter(S=>S.selected);e(m,w)}:void 0,g=m=>{Object.prototype.hasOwnProperty.call(Vs,m.key)&&(m.preventDefault(),d({direction:Vs[m.key],factor:m.shiftKey?4:1}))};return I.jsx("div",{className:Ke(["react-flow__nodesselection","react-flow__container",r]),style:{transform:l},children:I.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:i?void 0:-1,onKeyDown:i?void 0:g,style:{width:a,height:u}})})}const E1=typeof window<"u"?window:void 0,EP=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function _b({children:e,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:p,selectionMode:g,onSelectionStart:m,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:x,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:_,panOnScroll:k,panOnScrollSpeed:R,panOnScrollMode:M,zoomOnDoubleClick:T,panOnDrag:O,defaultViewport:z,translateExtent:W,minZoom:L,maxZoom:$,preventScrolling:Q,onSelectionContextMenu:A,noWheelClassName:G,noPanClassName:V,disableKeyboardA11y:Z,onViewportChange:j,isControlledViewport:F}){const{nodesSelectionActive:K,userSelectionActive:P}=Re(EP,Oe),H=Ho(h,{target:E1}),oe=Ho(b,{target:E1}),D=oe||O,Y=oe||k,X=p&&D!==!0,re=H||P||X;return rP({deleteKeyCode:d,multiSelectionKeyCode:S}),I.jsx(aP,{onPaneContextMenu:u,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:_,panOnScroll:Y,panOnScrollSpeed:R,panOnScrollMode:M,zoomOnDoubleClick:T,panOnDrag:!H&&D,defaultViewport:z,translateExtent:W,minZoom:L,maxZoom:$,zoomActivationKeyCode:x,preventScrolling:Q,noWheelClassName:G,noPanClassName:V,onViewportChange:j,isControlledViewport:F,paneClickDistance:c,selectionOnDrag:X,children:I.jsxs(cP,{onSelectionStart:m,onSelectionEnd:w,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:l,panOnDrag:D,isSelecting:!!re,selectionMode:g,selectionKeyPressed:H,paneClickDistance:c,selectionOnDrag:X,children:[e,K&&I.jsx(SP,{onSelectionContextMenu:A,noPanClassName:V,disableKeyboardA11y:Z})]})})}_b.displayName="FlowRenderer";const bP=ie.memo(_b),kP=e=>r=>e?wv(r.nodeLookup,{x:0,y:0,width:r.width,height:r.height},r.transform,!0).map(i=>i.id):Array.from(r.nodeLookup.keys());function CP(e){return Re(ie.useCallback(kP(e),[e]),Oe)}const NP=e=>e.updateNodeInternals;function IP(){const e=Re(NP),[r]=ie.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const o=new Map;i.forEach(a=>{const u=a.target.getAttribute("data-id");o.set(u,{id:u,nodeElement:a.target,force:!0})}),e(o)}));return ie.useEffect(()=>()=>{r==null||r.disconnect()},[r]),r}function RP({node:e,nodeType:r,hasDimensions:i,resizeObserver:o}){const a=ze(),u=ie.useRef(null),l=ie.useRef(null),c=ie.useRef(e.sourcePosition),d=ie.useRef(e.targetPosition),h=ie.useRef(r),p=i&&!!e.internals.handleBounds;return ie.useEffect(()=>{u.current&&!e.hidden&&(!p||l.current!==u.current)&&(l.current&&(o==null||o.unobserve(l.current)),o==null||o.observe(u.current),l.current=u.current)},[p,e.hidden]),ie.useEffect(()=>()=>{l.current&&(o==null||o.unobserve(l.current),l.current=null)},[]),ie.useEffect(()=>{if(u.current){const g=h.current!==r,m=c.current!==e.sourcePosition,w=d.current!==e.targetPosition;(g||m||w)&&(h.current=r,c.current=e.sourcePosition,d.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:u.current,force:!0}]])))}},[e.id,r,e.sourcePosition,e.targetPosition]),u}function MP({id:e,onClick:r,onMouseEnter:i,onMouseMove:o,onMouseLeave:a,onContextMenu:u,onDoubleClick:l,nodesDraggable:c,elementsSelectable:d,nodesConnectable:h,nodesFocusable:p,resizeObserver:g,noDragClassName:m,noPanClassName:w,disableKeyboardA11y:S,rfId:b,nodeTypes:x,nodeClickDistance:E,onError:C}){const{node:_,internals:k,isParent:R}=Re(ne=>{const se=ne.nodeLookup.get(e),fe=ne.parentLookup.has(e);return{node:se,internals:se.internals,isParent:fe}},Oe);let M=_.type||"default",T=(x==null?void 0:x[M])||S1[M];T===void 0&&(C==null||C("003",pn.error003(M)),M="default",T=(x==null?void 0:x.default)||S1.default);const O=!!(_.draggable||c&&typeof _.draggable>"u"),z=!!(_.selectable||d&&typeof _.selectable>"u"),W=!!(_.connectable||h&&typeof _.connectable>"u"),L=!!(_.focusable||p&&typeof _.focusable>"u"),$=ze(),Q=VE(_),A=RP({node:_,nodeType:M,hasDimensions:Q,resizeObserver:g}),G=yb({nodeRef:A,disabled:_.hidden||!O,noDragClassName:m,handleSelector:_.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:E}),V=wb();if(_.hidden)return null;const Z=Rn(_),j=xP(_),F=z||O||r||i||o||a,K=i?ne=>i(ne,{...k.userNode}):void 0,P=o?ne=>o(ne,{...k.userNode}):void 0,H=a?ne=>a(ne,{...k.userNode}):void 0,oe=u?ne=>u(ne,{...k.userNode}):void 0,D=l?ne=>l(ne,{...k.userNode}):void 0,Y=ne=>{const{selectNodesOnDrag:se,nodeDragThreshold:fe}=$.getState();z&&(!se||!O||fe>0)&&lv({id:e,store:$,nodeRef:A}),r&&r(ne,{...k.userNode})},X=ne=>{if(!(WE(ne.nativeEvent)||S)){if(LE.includes(ne.key)&&z){const se=ne.key==="Escape";lv({id:e,store:$,unselect:se,nodeRef:A})}else if(O&&_.selected&&Object.prototype.hasOwnProperty.call(Vs,ne.key)){ne.preventDefault();const{ariaLabelConfig:se}=$.getState();$.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),V({direction:Vs[ne.key],factor:ne.shiftKey?4:1})}}},re=()=>{var Ee;if(S||!((Ee=A.current)!=null&&Ee.matches(":focus-visible")))return;const{transform:ne,width:se,height:fe,autoPanOnNodeFocus:ve,setCenter:xe}=$.getState();if(!ve)return;wv(new Map([[e,_]]),{x:0,y:0,width:se,height:fe},ne,!0).length>0||xe(_.position.x+Z.width/2,_.position.y+Z.height/2,{zoom:ne[2]})};return I.jsx("div",{className:Ke(["react-flow__node",`react-flow__node-${M}`,{[w]:O},_.className,{selected:_.selected,selectable:z,parent:R,draggable:O,dragging:G}]),ref:A,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:Q?"visible":"hidden",..._.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:K,onMouseMove:P,onMouseLeave:H,onContextMenu:oe,onClick:Y,onDoubleClick:D,onKeyDown:L?X:void 0,tabIndex:L?0:void 0,onFocus:L?re:void 0,role:_.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${db}-${b}`,"aria-label":_.ariaLabel,..._.domAttributes,children:I.jsx(dP,{value:e,children:I.jsx(T,{id:e,data:_.data,type:M,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:_.selected??!1,selectable:z,draggable:O,deletable:_.deletable??!0,isConnectable:W,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:G,dragHandle:_.dragHandle,zIndex:k.z,parentId:_.parentId,...Z})})})}var TP=ie.memo(MP);const PP=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Sb(e){const{nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:a,onError:u}=Re(PP,Oe),l=CP(e.onlyRenderVisibleElements),c=IP();return I.jsx("div",{className:"react-flow__nodes",style:ru,children:l.map(d=>I.jsx(TP,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:r,nodesConnectable:i,nodesFocusable:o,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:u},d))})}Sb.displayName="NodeRenderer";const AP=ie.memo(Sb);function qP(e){return Re(ie.useCallback(i=>{if(!e)return i.edges.map(a=>a.id);const o=[];if(i.width&&i.height)for(const a of i.edges){const u=i.nodeLookup.get(a.source),l=i.nodeLookup.get(a.target);u&&l&&MT({sourceNode:u,targetNode:l,width:i.width,height:i.height,transform:i.transform})&&o.push(a.id)}return o},[e]),Oe)}const LP=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e}};return I.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},jP=({color:e="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...e&&{stroke:e,fill:e}};return I.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},b1={[$s.Arrow]:LP,[$s.ArrowClosed]:jP};function OP(e){const r=ze();return ie.useMemo(()=>{var a,u;return Object.prototype.hasOwnProperty.call(b1,e)?b1[e]:((u=(a=r.getState()).onError)==null||u.call(a,"009",pn.error009(e)),null)},[e])}const zP=({id:e,type:r,color:i,width:o=12.5,height:a=12.5,markerUnits:u="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const d=OP(r);return d?I.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:c,refX:"0",refY:"0",children:I.jsx(d,{color:i,strokeWidth:l})}):null},Eb=({defaultColor:e,rfId:r})=>{const i=Re(u=>u.edges),o=Re(u=>u.defaultEdgeOptions),a=ie.useMemo(()=>zT(i,{id:r,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[i,o,r,e]);return a.length?I.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:I.jsx("defs",{children:a.map(u=>I.jsx(zP,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};Eb.displayName="MarkerDefinitions";var DP=ie.memo(Eb);function bb({x:e,y:r,label:i,labelStyle:o,labelShowBg:a=!0,labelBgStyle:u,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:d,className:h,...p}){const[g,m]=ie.useState({x:1,y:0,width:0,height:0}),w=Ke(["react-flow__edge-textwrapper",h]),S=ie.useRef(null);return ie.useEffect(()=>{if(S.current){const b=S.current.getBBox();m({x:b.x,y:b.y,width:b.width,height:b.height})}},[i]),i?I.jsxs("g",{transform:`translate(${e-g.width/2} ${r-g.height/2})`,className:w,visibility:g.width?"visible":"hidden",...p,children:[a&&I.jsx("rect",{width:g.width+2*l[0],x:-l[0],y:-l[1],height:g.height+2*l[1],className:"react-flow__edge-textbg",style:u,rx:c,ry:c}),I.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:o,children:i}),d]}):null}bb.displayName="EdgeText";const FP=ie.memo(bb);function iu({path:e,labelX:r,labelY:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:h=20,...p}){return I.jsxs(I.Fragment,{children:[I.jsx("path",{...p,d:e,fill:"none",className:Ke(["react-flow__edge-path",p.className])}),h?I.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,o&&en(r)&&en(i)?I.jsx(FP,{x:r,y:i,label:o,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function k1({pos:e,x1:r,y1:i,x2:o,y2:a}){return e===_e.Left||e===_e.Right?[.5*(r+o),i]:[r,.5*(i+a)]}function kb({sourceX:e,sourceY:r,sourcePosition:i=_e.Bottom,targetX:o,targetY:a,targetPosition:u=_e.Top}){const[l,c]=k1({pos:i,x1:e,y1:r,x2:o,y2:a}),[d,h]=k1({pos:u,x1:o,y1:a,x2:e,y2:r}),[p,g,m,w]=KE({sourceX:e,sourceY:r,targetX:o,targetY:a,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${r} C${l},${c} ${d},${h} ${o},${a}`,p,g,m,w]}function Cb(e){return ie.memo(({id:r,sourceX:i,sourceY:o,targetX:a,targetY:u,sourcePosition:l,targetPosition:c,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:w,style:S,markerEnd:b,markerStart:x,interactionWidth:E})=>{const[C,_,k]=kb({sourceX:i,sourceY:o,sourcePosition:l,targetX:a,targetY:u,targetPosition:c}),R=e.isInternal?void 0:r;return I.jsx(iu,{id:R,path:C,labelX:_,labelY:k,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:w,style:S,markerEnd:b,markerStart:x,interactionWidth:E})})}const $P=Cb({isInternal:!1}),Nb=Cb({isInternal:!0});$P.displayName="SimpleBezierEdge";Nb.displayName="SimpleBezierEdgeInternal";function Ib(e){return ie.memo(({id:r,sourceX:i,sourceY:o,targetX:a,targetY:u,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:m,sourcePosition:w=_e.Bottom,targetPosition:S=_e.Top,markerEnd:b,markerStart:x,pathOptions:E,interactionWidth:C})=>{const[_,k,R]=ov({sourceX:i,sourceY:o,sourcePosition:w,targetX:a,targetY:u,targetPosition:S,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset,stepPosition:E==null?void 0:E.stepPosition}),M=e.isInternal?void 0:r;return I.jsx(iu,{id:M,path:_,labelX:k,labelY:R,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:b,markerStart:x,interactionWidth:C})})}const Rb=Ib({isInternal:!1}),Mb=Ib({isInternal:!0});Rb.displayName="SmoothStepEdge";Mb.displayName="SmoothStepEdgeInternal";function Tb(e){return ie.memo(({id:r,...i})=>{var a;const o=e.isInternal?void 0:r;return I.jsx(Rb,{...i,id:o,pathOptions:ie.useMemo(()=>{var u;return{borderRadius:0,offset:(u=i.pathOptions)==null?void 0:u.offset}},[(a=i.pathOptions)==null?void 0:a.offset])})})}const BP=Tb({isInternal:!1}),Pb=Tb({isInternal:!0});BP.displayName="StepEdge";Pb.displayName="StepEdgeInternal";function Ab(e){return ie.memo(({id:r,sourceX:i,sourceY:o,targetX:a,targetY:u,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:S,interactionWidth:b})=>{const[x,E,C]=ZE({sourceX:i,sourceY:o,targetX:a,targetY:u}),_=e.isInternal?void 0:r;return I.jsx(iu,{id:_,path:x,labelX:E,labelY:C,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:S,interactionWidth:b})})}const HP=Ab({isInternal:!1}),qb=Ab({isInternal:!0});HP.displayName="StraightEdge";qb.displayName="StraightEdgeInternal";function Lb(e){return ie.memo(({id:r,sourceX:i,sourceY:o,targetX:a,targetY:u,sourcePosition:l=_e.Bottom,targetPosition:c=_e.Top,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:w,style:S,markerEnd:b,markerStart:x,pathOptions:E,interactionWidth:C})=>{const[_,k,R]=XE({sourceX:i,sourceY:o,sourcePosition:l,targetX:a,targetY:u,targetPosition:c,curvature:E==null?void 0:E.curvature}),M=e.isInternal?void 0:r;return I.jsx(iu,{id:M,path:_,labelX:k,labelY:R,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:w,style:S,markerEnd:b,markerStart:x,interactionWidth:C})})}const VP=Lb({isInternal:!1}),jb=Lb({isInternal:!0});VP.displayName="BezierEdge";jb.displayName="BezierEdgeInternal";const C1={default:jb,straight:qb,step:Pb,smoothstep:Mb,simplebezier:Nb},N1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},UP=(e,r,i)=>i===_e.Left?e-r:i===_e.Right?e+r:e,GP=(e,r,i)=>i===_e.Top?e-r:i===_e.Bottom?e+r:e,I1="react-flow__edgeupdater";function R1({position:e,centerX:r,centerY:i,radius:o=10,onMouseDown:a,onMouseEnter:u,onMouseOut:l,type:c}){return I.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:l,className:Ke([I1,`${I1}-${c}`]),cx:UP(r,o,e),cy:GP(i,o,e),r:o,stroke:"transparent",fill:"transparent"})}function WP({isReconnectable:e,reconnectRadius:r,edge:i,sourceX:o,sourceY:a,targetX:u,targetY:l,sourcePosition:c,targetPosition:d,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,setReconnecting:m,setUpdateHover:w}){const S=ze(),b=(k,R)=>{if(k.button!==0)return;const{autoPanOnConnect:M,domNode:T,isValidConnection:O,connectionMode:z,connectionRadius:W,lib:L,onConnectStart:$,onConnectEnd:Q,cancelConnection:A,nodeLookup:G,rfId:V,panBy:Z,updateConnection:j}=S.getState(),F=R.type==="target",K=(oe,D)=>{m(!1),g==null||g(oe,i,R.type,D)},P=oe=>h==null?void 0:h(i,oe),H=(oe,D)=>{m(!0),p==null||p(k,i,R.type),$==null||$(oe,D)};uv.onPointerDown(k.nativeEvent,{autoPanOnConnect:M,connectionMode:z,connectionRadius:W,domNode:T,handleId:R.id,nodeId:R.nodeId,nodeLookup:G,isTarget:F,edgeUpdaterType:R.type,lib:L,flowId:V,cancelConnection:A,panBy:Z,isValidConnection:O,onConnect:P,onConnectStart:H,onConnectEnd:Q,onReconnectEnd:K,updateConnection:j,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},x=k=>b(k,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),E=k=>b(k,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),C=()=>w(!0),_=()=>w(!1);return I.jsxs(I.Fragment,{children:[(e===!0||e==="source")&&I.jsx(R1,{position:c,centerX:o,centerY:a,radius:r,onMouseDown:x,onMouseEnter:C,onMouseOut:_,type:"source"}),(e===!0||e==="target")&&I.jsx(R1,{position:d,centerX:u,centerY:l,radius:r,onMouseDown:E,onMouseEnter:C,onMouseOut:_,type:"target"})]})}function YP({id:e,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:o,onClick:a,onDoubleClick:u,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,reconnectRadius:p,onReconnect:g,onReconnectStart:m,onReconnectEnd:w,rfId:S,edgeTypes:b,noPanClassName:x,onError:E,disableKeyboardA11y:C}){let _=Re(xe=>xe.edgeLookup.get(e));const k=Re(xe=>xe.defaultEdgeOptions);_=k?{...k,..._}:_;let R=_.type||"default",M=(b==null?void 0:b[R])||C1[R];M===void 0&&(E==null||E("011",pn.error011(R)),R="default",M=(b==null?void 0:b.default)||C1.default);const T=!!(_.focusable||r&&typeof _.focusable>"u"),O=typeof g<"u"&&(_.reconnectable||i&&typeof _.reconnectable>"u"),z=!!(_.selectable||o&&typeof _.selectable>"u"),W=ie.useRef(null),[L,$]=ie.useState(!1),[Q,A]=ie.useState(!1),G=ze(),{zIndex:V,sourceX:Z,sourceY:j,targetX:F,targetY:K,sourcePosition:P,targetPosition:H}=Re(ie.useCallback(xe=>{const de=xe.nodeLookup.get(_.source),Ee=xe.nodeLookup.get(_.target);if(!de||!Ee)return{zIndex:_.zIndex,...N1};const ye=OT({id:e,sourceNode:de,targetNode:Ee,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:xe.connectionMode,onError:E});return{zIndex:RT({selected:_.selected,zIndex:_.zIndex,sourceNode:de,targetNode:Ee,elevateOnSelect:xe.elevateEdgesOnSelect,zIndexMode:xe.zIndexMode}),...ye||N1}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex]),Oe),oe=ie.useMemo(()=>_.markerStart?`url('#${av(_.markerStart,S)}')`:void 0,[_.markerStart,S]),D=ie.useMemo(()=>_.markerEnd?`url('#${av(_.markerEnd,S)}')`:void 0,[_.markerEnd,S]);if(_.hidden||Z===null||j===null||F===null||K===null)return null;const Y=xe=>{var Ne;const{addSelectedEdges:de,unselectNodesAndEdges:Ee,multiSelectionActive:ye}=G.getState();z&&(G.setState({nodesSelectionActive:!1}),_.selected&&ye?(Ee({nodes:[],edges:[_]}),(Ne=W.current)==null||Ne.blur()):de([e])),a&&a(xe,_)},X=u?xe=>{u(xe,{..._})}:void 0,re=l?xe=>{l(xe,{..._})}:void 0,ne=c?xe=>{c(xe,{..._})}:void 0,se=d?xe=>{d(xe,{..._})}:void 0,fe=h?xe=>{h(xe,{..._})}:void 0,ve=xe=>{var de;if(!C&&LE.includes(xe.key)&&z){const{unselectNodesAndEdges:Ee,addSelectedEdges:ye}=G.getState();xe.key==="Escape"?((de=W.current)==null||de.blur(),Ee({edges:[_]})):ye([e])}};return I.jsx("svg",{style:{zIndex:V},children:I.jsxs("g",{className:Ke(["react-flow__edge",`react-flow__edge-${R}`,_.className,x,{selected:_.selected,animated:_.animated,inactive:!z&&!a,updating:L,selectable:z}]),onClick:Y,onDoubleClick:X,onContextMenu:re,onMouseEnter:ne,onMouseMove:se,onMouseLeave:fe,onKeyDown:T?ve:void 0,tabIndex:T?0:void 0,role:_.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":_.ariaLabel===null?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":T?`${hb}-${S}`:void 0,ref:W,..._.domAttributes,children:[!Q&&I.jsx(M,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:z,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:Z,sourceY:j,targetX:F,targetY:K,sourcePosition:P,targetPosition:H,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:oe,markerEnd:D,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),O&&I.jsx(WP,{edge:_,isReconnectable:O,reconnectRadius:p,onReconnect:g,onReconnectStart:m,onReconnectEnd:w,sourceX:Z,sourceY:j,targetX:F,targetY:K,sourcePosition:P,targetPosition:H,setUpdateHover:$,setReconnecting:A})]})})}var KP=ie.memo(YP);const XP=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ob({defaultMarkerColor:e,onlyRenderVisibleElements:r,rfId:i,edgeTypes:o,noPanClassName:a,onReconnect:u,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:g,onEdgeDoubleClick:m,onReconnectStart:w,onReconnectEnd:S,disableKeyboardA11y:b}){const{edgesFocusable:x,edgesReconnectable:E,elementsSelectable:C,onError:_}=Re(XP,Oe),k=qP(r);return I.jsxs("div",{className:"react-flow__edges",children:[I.jsx(DP,{defaultColor:e,rfId:i}),k.map(R=>I.jsx(KP,{id:R,edgesFocusable:x,edgesReconnectable:E,elementsSelectable:C,noPanClassName:a,onReconnect:u,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:h,onClick:p,reconnectRadius:g,onDoubleClick:m,onReconnectStart:w,onReconnectEnd:S,rfId:i,onError:_,edgeTypes:o,disableKeyboardA11y:b},R))]})}Ob.displayName="EdgeRenderer";const QP=ie.memo(Ob),ZP=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function JP({children:e}){const r=Re(ZP);return I.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:r},children:e})}function e3(e){const r=Nv(),i=ie.useRef(!1);ie.useEffect(()=>{!i.current&&r.viewportInitialized&&e&&(setTimeout(()=>e(r),1),i.current=!0)},[e,r.viewportInitialized])}const t3=e=>{var r;return(r=e.panZoom)==null?void 0:r.syncViewport};function n3(e){const r=Re(t3),i=ze();return ie.useEffect(()=>{e&&(r==null||r(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,r]),null}function r3(e){return e.connection.inProgress?{...e.connection,to:Xo(e.connection.to,e.transform)}:{...e.connection}}function i3(e){return r3}function o3(e){const r=i3();return Re(r,Oe)}const a3=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function s3({containerStyle:e,style:r,type:i,component:o}){const{nodesConnectable:a,width:u,height:l,isValid:c,inProgress:d}=Re(a3,Oe);return!(u&&a&&d)?null:I.jsx("svg",{style:e,width:u,height:l,className:"react-flow__connectionline react-flow__container",children:I.jsx("g",{className:Ke(["react-flow__connection",zE(c)]),children:I.jsx(zb,{style:r,type:i,CustomComponent:o,isValid:c})})})}const zb=({style:e,type:r=tr.Bezier,CustomComponent:i,isValid:o})=>{const{inProgress:a,from:u,fromNode:l,fromHandle:c,fromPosition:d,to:h,toNode:p,toHandle:g,toPosition:m,pointer:w}=o3();if(!a)return;if(i)return I.jsx(i,{connectionLineType:r,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:u.x,fromY:u.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:m,connectionStatus:zE(o),toNode:p,toHandle:g,pointer:w});let S="";const b={sourceX:u.x,sourceY:u.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:m};switch(r){case tr.Bezier:[S]=XE(b);break;case tr.SimpleBezier:[S]=kb(b);break;case tr.Step:[S]=ov({...b,borderRadius:0});break;case tr.SmoothStep:[S]=ov(b);break;default:[S]=ZE(b)}return I.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};zb.displayName="ConnectionLine";const u3={};function M1(e=u3){ie.useRef(e),ze(),ie.useEffect(()=>{},[e])}function l3(){ze(),ie.useRef(!1),ie.useEffect(()=>{},[])}function Db({nodeTypes:e,edgeTypes:r,onInit:i,onNodeClick:o,onEdgeClick:a,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:w,connectionLineType:S,connectionLineStyle:b,connectionLineComponent:x,connectionLineContainerStyle:E,selectionKeyCode:C,selectionOnDrag:_,selectionMode:k,multiSelectionKeyCode:R,panActivationKeyCode:M,zoomActivationKeyCode:T,deleteKeyCode:O,onlyRenderVisibleElements:z,elementsSelectable:W,defaultViewport:L,translateExtent:$,minZoom:Q,maxZoom:A,preventScrolling:G,defaultMarkerColor:V,zoomOnScroll:Z,zoomOnPinch:j,panOnScroll:F,panOnScrollSpeed:K,panOnScrollMode:P,zoomOnDoubleClick:H,panOnDrag:oe,onPaneClick:D,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:re,onPaneScroll:ne,onPaneContextMenu:se,paneClickDistance:fe,nodeClickDistance:ve,onEdgeContextMenu:xe,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:ye,reconnectRadius:Ne,onReconnect:Se,onReconnectStart:Je,onReconnectEnd:We,noDragClassName:ft,noWheelClassName:it,noPanClassName:et,disableKeyboardA11y:Fe,nodeExtent:Vt,rfId:Tt,viewport:Ut,onViewportChange:Pt}){return M1(e),M1(r),l3(),e3(i),n3(Ut),I.jsx(bP,{onPaneClick:D,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:re,onPaneContextMenu:se,onPaneScroll:ne,paneClickDistance:fe,deleteKeyCode:O,selectionKeyCode:C,selectionOnDrag:_,selectionMode:k,onSelectionStart:m,onSelectionEnd:w,multiSelectionKeyCode:R,panActivationKeyCode:M,zoomActivationKeyCode:T,elementsSelectable:W,zoomOnScroll:Z,zoomOnPinch:j,zoomOnDoubleClick:H,panOnScroll:F,panOnScrollSpeed:K,panOnScrollMode:P,panOnDrag:oe,defaultViewport:L,translateExtent:$,minZoom:Q,maxZoom:A,onSelectionContextMenu:g,preventScrolling:G,noDragClassName:ft,noWheelClassName:it,noPanClassName:et,disableKeyboardA11y:Fe,onViewportChange:Pt,isControlledViewport:!!Ut,children:I.jsxs(JP,{children:[I.jsx(QP,{edgeTypes:r,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:Se,onReconnectStart:Je,onReconnectEnd:We,onlyRenderVisibleElements:z,onEdgeContextMenu:xe,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:ye,reconnectRadius:Ne,defaultMarkerColor:V,noPanClassName:et,disableKeyboardA11y:Fe,rfId:Tt}),I.jsx(s3,{style:b,type:S,component:x,containerStyle:E}),I.jsx("div",{className:"react-flow__edgelabel-renderer"}),I.jsx(AP,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:ve,onlyRenderVisibleElements:z,noPanClassName:et,noDragClassName:ft,disableKeyboardA11y:Fe,nodeExtent:Vt,rfId:Tt}),I.jsx("div",{className:"react-flow__viewport-portal"})]})})}Db.displayName="GraphView";const c3=ie.memo(Db),T1=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:a,height:u,fitView:l,fitViewOptions:c,minZoom:d=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:g,zIndexMode:m="basic"}={})=>{const w=new Map,S=new Map,b=new Map,x=new Map,E=o??r??[],C=i??e??[],_=p??[0,0],k=g??Do;tb(b,x,E);const R=sv(C,w,S,{nodeOrigin:_,nodeExtent:k,zIndexMode:m});let M=[0,0,1];if(l&&a&&u){const T=Yo(w,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:O,y:z,zoom:W}=xv(T,a,u,d,h,(c==null?void 0:c.padding)??.1);M=[O,z,W]}return{rfId:"1",width:a??0,height:u??0,transform:M,nodes:C,nodesInitialized:R,nodeLookup:w,parentLookup:S,edges:E,edgeLookup:x,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Do,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:_i.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...OE},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ET,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:jE,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},f3=({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:a,height:u,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:g,zIndexMode:m})=>N4((w,S)=>{async function b(){const{nodeLookup:x,panZoom:E,fitViewOptions:C,fitViewResolver:_,width:k,height:R,minZoom:M,maxZoom:T}=S();E&&(await _T({nodes:x,width:k,height:R,panZoom:E,minZoom:M,maxZoom:T},C),_==null||_.resolve(!0),w({fitViewResolver:null}))}return{...T1({nodes:e,edges:r,width:a,height:u,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:g,defaultNodes:i,defaultEdges:o,zIndexMode:m}),setNodes:x=>{const{nodeLookup:E,parentLookup:C,nodeOrigin:_,elevateNodesOnSelect:k,fitViewQueued:R,zIndexMode:M}=S(),T=sv(x,E,C,{nodeOrigin:_,nodeExtent:g,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:M});R&&T?(b(),w({nodes:x,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0})):w({nodes:x,nodesInitialized:T})},setEdges:x=>{const{connectionLookup:E,edgeLookup:C}=S();tb(E,C,x),w({edges:x})},setDefaultNodesAndEdges:(x,E)=>{if(x){const{setNodes:C}=S();C(x),w({hasDefaultNodes:!0})}if(E){const{setEdges:C}=S();C(E),w({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:E,nodeLookup:C,parentLookup:_,domNode:k,nodeOrigin:R,nodeExtent:M,debug:T,fitViewQueued:O,zIndexMode:z}=S(),{changes:W,updatedInternals:L}=UT(x,C,_,k,R,M,z);L&&($T(C,_,{nodeOrigin:R,nodeExtent:M,zIndexMode:z}),O?(b(),w({fitViewQueued:!1,fitViewOptions:void 0})):w({}),(W==null?void 0:W.length)>0&&(T&&console.log("React Flow: trigger node changes",W),E==null||E(W)))},updateNodePositions:(x,E=!1)=>{const C=[];let _=[];const{nodeLookup:k,triggerNodeChanges:R,connection:M,updateConnection:T,onNodesChangeMiddlewareMap:O}=S();for(const[z,W]of x){const L=k.get(z),$=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(W!=null&&W.position)),Q={id:z,type:"position",position:$?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:E};if(L&&M.inProgress&&M.fromNode.id===L.id){const A=Rr(L,M.fromHandle,_e.Left,!0);T({...M,from:A})}$&&L.parentId&&C.push({id:z,parentId:L.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),_.push(Q)}if(C.length>0){const{parentLookup:z,nodeOrigin:W}=S(),L=Cv(C,k,z,W);_.push(...L)}for(const z of O.values())_=z(_);R(_)},triggerNodeChanges:x=>{const{onNodesChange:E,setNodes:C,nodes:_,hasDefaultNodes:k,debug:R}=S();if(x!=null&&x.length){if(k){const M=Y4(x,_);C(M)}R&&console.log("React Flow: trigger node changes",x),E==null||E(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:E,setEdges:C,edges:_,hasDefaultEdges:k,debug:R}=S();if(x!=null&&x.length){if(k){const M=K4(x,_);C(M)}R&&console.log("React Flow: trigger edge changes",x),E==null||E(x)}},addSelectedNodes:x=>{const{multiSelectionActive:E,edgeLookup:C,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:R}=S();if(E){const M=x.map(T=>Sr(T,!0));k(M);return}k(gi(_,new Set([...x]),!0)),R(gi(C))},addSelectedEdges:x=>{const{multiSelectionActive:E,edgeLookup:C,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:R}=S();if(E){const M=x.map(T=>Sr(T,!0));R(M);return}R(gi(C,new Set([...x]))),k(gi(_,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:E}={})=>{const{edges:C,nodes:_,nodeLookup:k,triggerNodeChanges:R,triggerEdgeChanges:M}=S(),T=x||_,O=E||C,z=T.map(L=>{const $=k.get(L.id);return $&&($.selected=!1),Sr(L.id,!1)}),W=O.map(L=>Sr(L.id,!1));R(z),M(W)},setMinZoom:x=>{const{panZoom:E,maxZoom:C}=S();E==null||E.setScaleExtent([x,C]),w({minZoom:x})},setMaxZoom:x=>{const{panZoom:E,minZoom:C}=S();E==null||E.setScaleExtent([C,x]),w({maxZoom:x})},setTranslateExtent:x=>{var E;(E=S().panZoom)==null||E.setTranslateExtent(x),w({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:E,triggerNodeChanges:C,triggerEdgeChanges:_,elementsSelectable:k}=S();if(!k)return;const R=E.reduce((T,O)=>O.selected?[...T,Sr(O.id,!1)]:T,[]),M=x.reduce((T,O)=>O.selected?[...T,Sr(O.id,!1)]:T,[]);C(R),_(M)},setNodeExtent:x=>{const{nodes:E,nodeLookup:C,parentLookup:_,nodeOrigin:k,elevateNodesOnSelect:R,nodeExtent:M,zIndexMode:T}=S();x[0][0]===M[0][0]&&x[0][1]===M[0][1]&&x[1][0]===M[1][0]&&x[1][1]===M[1][1]||(sv(E,C,_,{nodeOrigin:k,nodeExtent:x,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:T}),w({nodeExtent:x}))},panBy:x=>{const{transform:E,width:C,height:_,panZoom:k,translateExtent:R}=S();return GT({delta:x,panZoom:k,transform:E,translateExtent:R,width:C,height:_})},setCenter:async(x,E,C)=>{const{width:_,height:k,maxZoom:R,panZoom:M}=S();if(!M)return Promise.resolve(!1);const T=typeof(C==null?void 0:C.zoom)<"u"?C.zoom:R;return await M.setViewport({x:_/2-x*T,y:k/2-E*T,zoom:T},{duration:C==null?void 0:C.duration,ease:C==null?void 0:C.ease,interpolate:C==null?void 0:C.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{w({connection:{...OE}})},updateConnection:x=>{w({connection:x})},reset:()=>w({...T1()})}},Object.is);function Fb({initialNodes:e,initialEdges:r,defaultNodes:i,defaultEdges:o,initialWidth:a,initialHeight:u,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:d,fitView:h,nodeOrigin:p,nodeExtent:g,zIndexMode:m,children:w}){const[S]=ie.useState(()=>f3({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,width:a,height:u,fitView:h,minZoom:l,maxZoom:c,fitViewOptions:d,nodeOrigin:p,nodeExtent:g,zIndexMode:m}));return I.jsx(I4,{value:S,children:I.jsx(J4,{children:w})})}function d3({children:e,nodes:r,edges:i,defaultNodes:o,defaultEdges:a,width:u,height:l,fitView:c,fitViewOptions:d,minZoom:h,maxZoom:p,nodeOrigin:g,nodeExtent:m,zIndexMode:w}){return ie.useContext(tu)?I.jsx(I.Fragment,{children:e}):I.jsx(Fb,{initialNodes:r,initialEdges:i,defaultNodes:o,defaultEdges:a,initialWidth:u,initialHeight:l,fitView:c,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:g,nodeExtent:m,zIndexMode:w,children:e})}const h3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function p3({nodes:e,edges:r,defaultNodes:i,defaultEdges:o,className:a,nodeTypes:u,edgeTypes:l,onNodeClick:c,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:g,onMoveEnd:m,onConnect:w,onConnectStart:S,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:E,onNodeMouseEnter:C,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:R,onNodeDoubleClick:M,onNodeDragStart:T,onNodeDrag:O,onNodeDragStop:z,onNodesDelete:W,onEdgesDelete:L,onDelete:$,onSelectionChange:Q,onSelectionDragStart:A,onSelectionDrag:G,onSelectionDragStop:V,onSelectionContextMenu:Z,onSelectionStart:j,onSelectionEnd:F,onBeforeDelete:K,connectionMode:P,connectionLineType:H=tr.Bezier,connectionLineStyle:oe,connectionLineComponent:D,connectionLineContainerStyle:Y,deleteKeyCode:X="Backspace",selectionKeyCode:re="Shift",selectionOnDrag:ne=!1,selectionMode:se=Fo.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:ve=Bo()?"Meta":"Control",zoomActivationKeyCode:xe=Bo()?"Meta":"Control",snapToGrid:de,snapGrid:Ee,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:Ne,nodesDraggable:Se,autoPanOnNodeFocus:Je,nodesConnectable:We,nodesFocusable:ft,nodeOrigin:it=pb,edgesFocusable:et,edgesReconnectable:Fe,elementsSelectable:Vt=!0,defaultViewport:Tt=$4,minZoom:Ut=.5,maxZoom:Pt=2,translateExtent:pt=Do,preventScrolling:ir=!0,nodeExtent:At,defaultMarkerColor:mn="#b1b1b7",zoomOnScroll:jr=!0,zoomOnPinch:Et=!0,panOnScroll:qt=!1,panOnScrollSpeed:Su=.5,panOnScrollMode:qi=kr.Free,zoomOnDoubleClick:Li=!0,panOnDrag:ji=!0,onPaneClick:Oi,onPaneMouseEnter:zi,onPaneMouseMove:Pn,onPaneMouseLeave:An,onPaneScroll:ra,onPaneContextMenu:ia,paneClickDistance:oa=1,nodeClickDistance:aa=0,children:sa,onReconnect:Di,onReconnectStart:ua,onReconnectEnd:or,onEdgeContextMenu:Fi,onEdgeDoubleClick:ar,onEdgeMouseEnter:Eu,onEdgeMouseMove:sr,onEdgeMouseLeave:Or,reconnectRadius:zr=10,onNodesChange:$i,onEdgesChange:bu,noDragClassName:ku="nodrag",noWheelClassName:Cu="nowheel",noPanClassName:an="nopan",fitView:Bi,fitViewOptions:Hi,connectOnClick:Nu,attributionPosition:la,proOptions:ca,defaultEdgeOptions:fa,elevateNodesOnSelect:da=!0,elevateEdgesOnSelect:Iu=!1,disableKeyboardA11y:ha=!1,autoPanOnConnect:$e,autoPanOnNodeDrag:Ru,autoPanSpeed:Vi,connectionRadius:pa,isValidConnection:Dr,onError:Mu,style:ga,id:ur,nodeDragThreshold:Lt,connectionDragThreshold:Tu,viewport:bt,onViewportChange:Pu,width:Au,height:qu,colorMode:Fr="light",debug:$r,onScroll:sn,ariaLabelConfig:Br,zIndexMode:va="basic",...Lu},Ui){const Hr=ur||"1",Gi=U4(Fr),lr=ie.useCallback(ma=>{ma.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),sn==null||sn(ma)},[sn]);return I.jsx("div",{"data-testid":"rf__wrapper",...Lu,onScroll:lr,style:{...ga,...h3},ref:Ui,className:Ke(["react-flow",a,Gi]),id:ur,role:"application",children:I.jsxs(d3,{nodes:e,edges:r,width:Au,height:qu,fitView:Bi,fitViewOptions:Hi,minZoom:Ut,maxZoom:Pt,nodeOrigin:it,nodeExtent:At,zIndexMode:va,children:[I.jsx(c3,{onInit:h,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:C,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:R,onNodeDoubleClick:M,nodeTypes:u,edgeTypes:l,connectionLineType:H,connectionLineStyle:oe,connectionLineComponent:D,connectionLineContainerStyle:Y,selectionKeyCode:re,selectionOnDrag:ne,selectionMode:se,deleteKeyCode:X,multiSelectionKeyCode:ve,panActivationKeyCode:fe,zoomActivationKeyCode:xe,onlyRenderVisibleElements:ye,defaultViewport:Tt,translateExtent:pt,minZoom:Ut,maxZoom:Pt,preventScrolling:ir,zoomOnScroll:jr,zoomOnPinch:Et,zoomOnDoubleClick:Li,panOnScroll:qt,panOnScrollSpeed:Su,panOnScrollMode:qi,panOnDrag:ji,onPaneClick:Oi,onPaneMouseEnter:zi,onPaneMouseMove:Pn,onPaneMouseLeave:An,onPaneScroll:ra,onPaneContextMenu:ia,paneClickDistance:oa,nodeClickDistance:aa,onSelectionContextMenu:Z,onSelectionStart:j,onSelectionEnd:F,onReconnect:Di,onReconnectStart:ua,onReconnectEnd:or,onEdgeContextMenu:Fi,onEdgeDoubleClick:ar,onEdgeMouseEnter:Eu,onEdgeMouseMove:sr,onEdgeMouseLeave:Or,reconnectRadius:zr,defaultMarkerColor:mn,noDragClassName:ku,noWheelClassName:Cu,noPanClassName:an,rfId:Hr,disableKeyboardA11y:ha,nodeExtent:At,viewport:bt,onViewportChange:Pu}),I.jsx(V4,{nodes:e,edges:r,defaultNodes:i,defaultEdges:o,onConnect:w,onConnectStart:S,onConnectEnd:b,onClickConnectStart:x,onClickConnectEnd:E,nodesDraggable:Se,autoPanOnNodeFocus:Je,nodesConnectable:We,nodesFocusable:ft,edgesFocusable:et,edgesReconnectable:Fe,elementsSelectable:Vt,elevateNodesOnSelect:da,elevateEdgesOnSelect:Iu,minZoom:Ut,maxZoom:Pt,nodeExtent:At,onNodesChange:$i,onEdgesChange:bu,snapToGrid:de,snapGrid:Ee,connectionMode:P,translateExtent:pt,connectOnClick:Nu,defaultEdgeOptions:fa,fitView:Bi,fitViewOptions:Hi,onNodesDelete:W,onEdgesDelete:L,onDelete:$,onNodeDragStart:T,onNodeDrag:O,onNodeDragStop:z,onSelectionDrag:G,onSelectionDragStart:A,onSelectionDragStop:V,onMove:p,onMoveStart:g,onMoveEnd:m,noPanClassName:an,nodeOrigin:it,rfId:Hr,autoPanOnConnect:$e,autoPanOnNodeDrag:Ru,autoPanSpeed:Vi,onError:Mu,connectionRadius:pa,isValidConnection:Dr,selectNodesOnDrag:Ne,nodeDragThreshold:Lt,connectionDragThreshold:Tu,onBeforeDelete:K,debug:$r,ariaLabelConfig:Br,zIndexMode:va}),I.jsx(F4,{onSelectionChange:Q}),sa,I.jsx(L4,{proOptions:ca,position:la}),I.jsx(q4,{rfId:Hr,disableKeyboardA11y:ha})]})})}var g3=vb(p3);function v3({dimensions:e,lineWidth:r,variant:i,className:o}){return I.jsx("path",{strokeWidth:r,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ke(["react-flow__background-pattern",i,o])})}function m3({radius:e,className:r}){return I.jsx("circle",{cx:e,cy:e,r:e,className:Ke(["react-flow__background-pattern","dots",r])})}var nr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nr||(nr={}));const y3={[nr.Dots]:1,[nr.Lines]:1,[nr.Cross]:6},w3=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function $b({id:e,variant:r=nr.Dots,gap:i=20,size:o,lineWidth:a=1,offset:u=0,color:l,bgColor:c,style:d,className:h,patternClassName:p}){const g=ie.useRef(null),{transform:m,patternId:w}=Re(w3,Oe),S=o||y3[r],b=r===nr.Dots,x=r===nr.Cross,E=Array.isArray(i)?i:[i,i],C=[E[0]*m[2]||1,E[1]*m[2]||1],_=S*m[2],k=Array.isArray(u)?u:[u,u],R=x?[_,_]:C,M=[k[0]*m[2]||1+R[0]/2,k[1]*m[2]||1+R[1]/2],T=`${w}${e||""}`;return I.jsxs("svg",{className:Ke(["react-flow__background",h]),style:{...d,...ru,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:g,"data-testid":"rf__background",children:[I.jsx("pattern",{id:T,x:m[0]%C[0],y:m[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`,children:b?I.jsx(m3,{radius:_/2,className:p}):I.jsx(v3,{dimensions:R,lineWidth:a,variant:r,className:p})}),I.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}$b.displayName="Background";const x3=ie.memo($b);function _3(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:I.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function S3(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:I.jsx("path",{d:"M0 0h32v4.2H0z"})})}function E3(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:I.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function b3(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function k3(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Is({children:e,className:r,...i}){return I.jsx("button",{type:"button",className:Ke(["react-flow__controls-button",r]),...i,children:e})}const C3=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Bb({style:e,showZoom:r=!0,showFitView:i=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:u,onZoomOut:l,onFitView:c,onInteractiveChange:d,className:h,children:p,position:g="bottom-left",orientation:m="vertical","aria-label":w}){const S=ze(),{isInteractive:b,minZoomReached:x,maxZoomReached:E,ariaLabelConfig:C}=Re(C3,Oe),{zoomIn:_,zoomOut:k,fitView:R}=Nv(),M=()=>{_(),u==null||u()},T=()=>{k(),l==null||l()},O=()=>{R(a),c==null||c()},z=()=>{S.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},W=m==="horizontal"?"horizontal":"vertical";return I.jsxs(nu,{className:Ke(["react-flow__controls",W,h]),position:g,style:e,"data-testid":"rf__controls","aria-label":w??C["controls.ariaLabel"],children:[r&&I.jsxs(I.Fragment,{children:[I.jsx(Is,{onClick:M,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:E,children:I.jsx(_3,{})}),I.jsx(Is,{onClick:T,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:x,children:I.jsx(S3,{})})]}),i&&I.jsx(Is,{className:"react-flow__controls-fitview",onClick:O,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:I.jsx(E3,{})}),o&&I.jsx(Is,{className:"react-flow__controls-interactive",onClick:z,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:b?I.jsx(k3,{}):I.jsx(b3,{})}),p]})}Bb.displayName="Controls";const N3=ie.memo(Bb);function I3({id:e,x:r,y:i,width:o,height:a,style:u,color:l,strokeColor:c,strokeWidth:d,className:h,borderRadius:p,shapeRendering:g,selected:m,onClick:w}){const{background:S,backgroundColor:b}=u||{},x=l||S||b;return I.jsx("rect",{className:Ke(["react-flow__minimap-node",{selected:m},h]),x:r,y:i,rx:p,ry:p,width:o,height:a,style:{fill:x,stroke:c,strokeWidth:d},shapeRendering:g,onClick:w?E=>w(E,e):void 0})}const R3=ie.memo(I3),M3=e=>e.nodes.map(r=>r.id),Mc=e=>e instanceof Function?e:()=>e;function T3({nodeStrokeColor:e,nodeColor:r,nodeClassName:i="",nodeBorderRadius:o=5,nodeStrokeWidth:a,nodeComponent:u=R3,onClick:l}){const c=Re(M3,Oe),d=Mc(r),h=Mc(e),p=Mc(i),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return I.jsx(I.Fragment,{children:c.map(m=>I.jsx(A3,{id:m,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:o,nodeStrokeWidth:a,NodeComponent:u,onClick:l,shapeRendering:g},m))})}function P3({id:e,nodeColorFunc:r,nodeStrokeColorFunc:i,nodeClassNameFunc:o,nodeBorderRadius:a,nodeStrokeWidth:u,shapeRendering:l,NodeComponent:c,onClick:d}){const{node:h,x:p,y:g,width:m,height:w}=Re(S=>{const{internals:b}=S.nodeLookup.get(e),x=b.userNode,{x:E,y:C}=b.positionAbsolute,{width:_,height:k}=Rn(x);return{node:x,x:E,y:C,width:_,height:k}},Oe);return!h||h.hidden||!VE(h)?null:I.jsx(c,{x:p,y:g,width:m,height:w,style:h.style,selected:!!h.selected,className:o(h),color:r(h),borderRadius:a,strokeColor:i(h),strokeWidth:u,shapeRendering:l,onClick:d,id:h.id})}const A3=ie.memo(P3);var q3=ie.memo(T3);const L3=200,j3=150,O3=e=>!e.hidden,z3=e=>{const r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:e.nodeLookup.size>0?HE(Yo(e.nodeLookup,{filter:O3}),r):r,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},D3="react-flow__minimap-desc";function Hb({style:e,className:r,nodeStrokeColor:i,nodeColor:o,nodeClassName:a="",nodeBorderRadius:u=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:d,maskColor:h,maskStrokeColor:p,maskStrokeWidth:g,position:m="bottom-right",onClick:w,onNodeClick:S,pannable:b=!1,zoomable:x=!1,ariaLabel:E,inversePan:C,zoomStep:_=1,offsetScale:k=5}){const R=ze(),M=ie.useRef(null),{boundingRect:T,viewBB:O,rfId:z,panZoom:W,translateExtent:L,flowWidth:$,flowHeight:Q,ariaLabelConfig:A}=Re(z3,Oe),G=(e==null?void 0:e.width)??L3,V=(e==null?void 0:e.height)??j3,Z=T.width/G,j=T.height/V,F=Math.max(Z,j),K=F*G,P=F*V,H=k*F,oe=T.x-(K-T.width)/2-H,D=T.y-(P-T.height)/2-H,Y=K+H*2,X=P+H*2,re=`${D3}-${z}`,ne=ie.useRef(0),se=ie.useRef();ne.current=F,ie.useEffect(()=>{if(M.current&&W)return se.current=t4({domNode:M.current,panZoom:W,getTransform:()=>R.getState().transform,getViewScale:()=>ne.current}),()=>{var de;(de=se.current)==null||de.destroy()}},[W]),ie.useEffect(()=>{var de;(de=se.current)==null||de.update({translateExtent:L,width:$,height:Q,inversePan:C,pannable:b,zoomStep:_,zoomable:x})},[b,x,C,_,L,$,Q]);const fe=w?de=>{var Ne;const[Ee,ye]=((Ne=se.current)==null?void 0:Ne.pointer(de))||[0,0];w(de,{x:Ee,y:ye})}:void 0,ve=S?ie.useCallback((de,Ee)=>{const ye=R.getState().nodeLookup.get(Ee).internals.userNode;S(de,ye)},[]):void 0,xe=E??A["minimap.ariaLabel"];return I.jsx(nu,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*F:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Ke(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:I.jsxs("svg",{width:G,height:V,viewBox:`${oe} ${D} ${Y} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":re,ref:M,onClick:fe,children:[xe&&I.jsx("title",{id:re,children:xe}),I.jsx(q3,{onClick:ve,nodeColor:o,nodeStrokeColor:i,nodeBorderRadius:u,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:c}),I.jsx("path",{className:"react-flow__minimap-mask",d:`M${oe-H},${D-H}h${Y+H*2}v${X+H*2}h${-Y-H*2}z M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Hb.displayName="MiniMap";const F3=ie.memo(Hb),$3=e=>r=>e?`${Math.max(1/r.transform[2],1)}`:void 0,B3={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function H3({nodeId:e,position:r,variant:i=ki.Handle,className:o,style:a=void 0,children:u,color:l,minWidth:c=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:m,autoScale:w=!0,shouldResize:S,onResizeStart:b,onResize:x,onResizeEnd:E}){const C=xb(),_=typeof e=="string"?e:C,k=ze(),R=ie.useRef(null),M=i===ki.Handle,T=Re(ie.useCallback($3(M&&w),[M,w]),Oe),O=ie.useRef(null),z=r??B3[i];ie.useEffect(()=>{if(!(!R.current||!_))return O.current||(O.current=g4({domNode:R.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:L,transform:$,snapGrid:Q,snapToGrid:A,nodeOrigin:G,domNode:V}=k.getState();return{nodeLookup:L,transform:$,snapGrid:Q,snapToGrid:A,nodeOrigin:G,paneDomNode:V}},onChange:(L,$)=>{const{triggerNodeChanges:Q,nodeLookup:A,parentLookup:G,nodeOrigin:V}=k.getState(),Z=[],j={x:L.x,y:L.y},F=A.get(_);if(F&&F.expandParent&&F.parentId){const K=F.origin??V,P=L.width??F.measured.width??0,H=L.height??F.measured.height??0,oe={id:F.id,parentId:F.parentId,rect:{width:P,height:H,...UE({x:L.x??F.position.x,y:L.y??F.position.y},{width:P,height:H},F.parentId,A,K)}},D=Cv([oe],A,G,V);Z.push(...D),j.x=L.x?Math.max(K[0]*P,L.x):void 0,j.y=L.y?Math.max(K[1]*H,L.y):void 0}if(j.x!==void 0&&j.y!==void 0){const K={id:_,type:"position",position:{...j}};Z.push(K)}if(L.width!==void 0&&L.height!==void 0){const P={id:_,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};Z.push(P)}for(const K of $){const P={...K,type:"position"};Z.push(P)}Q(Z)},onEnd:({width:L,height:$})=>{const Q={id:_,type:"dimensions",resizing:!1,dimensions:{width:L,height:$}};k.getState().triggerNodeChanges([Q])}})),O.current.update({controlPosition:z,boundaries:{minWidth:c,minHeight:d,maxWidth:h,maxHeight:p},keepAspectRatio:g,resizeDirection:m,onResizeStart:b,onResize:x,onResizeEnd:E,shouldResize:S}),()=>{var L;(L=O.current)==null||L.destroy()}},[z,c,d,h,p,g,b,x,E,S]);const W=z.split("-");return I.jsx("div",{className:Ke(["react-flow__resize-control","nodrag",...W,i,o]),ref:R,style:{...a,scale:T,...l&&{[M?"backgroundColor":"borderColor"]:l}},children:u})}ie.memo(H3);const P1=e=>{let r;const i=new Set,o=(h,p)=>{const g=typeof h=="function"?h(r):h;if(!Object.is(g,r)){const m=r;r=p??(typeof g!="object"||g===null)?g:Object.assign({},r,g),i.forEach(w=>w(r,m))}},a=()=>r,c={setState:o,getState:a,getInitialState:()=>d,subscribe:h=>(i.add(h),()=>i.delete(h))},d=r=e(o,a,c);return c},V3=(e=>e?P1(e):P1),U3=e=>e;function G3(e,r=U3){const i=hi.useSyncExternalStore(e.subscribe,hi.useCallback(()=>r(e.getState()),[e,r]),hi.useCallback(()=>r(e.getInitialState()),[e,r]));return hi.useDebugValue(i),i}const W3=e=>{const r=V3(e),i=o=>G3(r,o);return Object.assign(i,r),i},Y3=(e=>W3);function Vb(e,r){let i;try{i=e()}catch{return}return{getItem:a=>{var u;const l=d=>d===null?null:JSON.parse(d,void 0),c=(u=i.getItem(a))!=null?u:null;return c instanceof Promise?c.then(l):l(c)},setItem:(a,u)=>i.setItem(a,JSON.stringify(u,void 0)),removeItem:a=>i.removeItem(a)}}const cv=e=>r=>{try{const i=e(r);return i instanceof Promise?i:{then(o){return cv(o)(i)},catch(o){return this}}}catch(i){return{then(o){return this},catch(o){return cv(o)(i)}}}},K3=(e,r)=>(i,o,a)=>{let u={storage:Vb(()=>window.localStorage),partialize:x=>x,version:0,merge:(x,E)=>({...E,...x}),...r},l=!1,c=0;const d=new Set,h=new Set;let p=u.storage;if(!p)return e((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),i(...x)},o,a);const g=()=>{const x=u.partialize({...o()});return p.setItem(u.name,{state:x,version:u.version})},m=a.setState;a.setState=(x,E)=>(m(x,E),g());const w=e((...x)=>(i(...x),g()),o,a);a.getInitialState=()=>w;let S;const b=()=>{var x,E;if(!p)return;const C=++c;l=!1,d.forEach(k=>{var R;return k((R=o())!=null?R:w)});const _=((E=u.onRehydrateStorage)==null?void 0:E.call(u,(x=o())!=null?x:w))||void 0;return cv(p.getItem.bind(p))(u.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==u.version){if(u.migrate){const R=u.migrate(k.state,k.version);return R instanceof Promise?R.then(M=>[!0,M]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var R;if(C!==c)return;const[M,T]=k;if(S=u.merge(T,(R=o())!=null?R:w),i(S,!0),M)return g()}).then(()=>{C===c&&(_==null||_(S,void 0),S=o(),l=!0,h.forEach(k=>k(S)))}).catch(k=>{C===c&&(_==null||_(void 0,k))})};return a.persist={setOptions:x=>{u={...u,...x},x.storage&&(p=x.storage)},clearStorage:()=>{p==null||p.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>b(),hasHydrated:()=>l,onHydrate:x=>(d.add(x),()=>{d.delete(x)}),onFinishHydration:x=>(h.add(x),()=>{h.delete(x)})},u.skipHydration||b(),S||w},X3=K3,A1=["gateway","vlan","wifi","host_physical","host_vm","host_container","service","volume","mount","path"],Ii=Y3()(X3((e,r)=>({nodes:[],edges:[],selectedNodeId:null,viewMode:"full",orientation:"LR",searchQuery:"",typeFilters:A1,statusFilter:"all",leftPanelOpen:!0,rightPanelOpen:!0,lastUpdated:null,isLoading:!1,networkInfo:null,hosts:[],setNodes:i=>e({nodes:i}),setEdges:i=>e({edges:i}),setSelectedNode:i=>e({selectedNodeId:i}),setViewMode:i=>e({viewMode:i}),setOrientation:i=>e({orientation:i}),setSearchQuery:i=>e({searchQuery:i}),toggleTypeFilter:i=>e(o=>({typeFilters:o.typeFilters.includes(i)?o.typeFilters.filter(u=>u!==i):[...o.typeFilters,i]})),setStatusFilter:i=>e({statusFilter:i}),toggleLeftPanel:()=>e(i=>({leftPanelOpen:!i.leftPanelOpen})),toggleRightPanel:()=>e(i=>({rightPanelOpen:!i.rightPanelOpen})),setLastUpdated:i=>e({lastUpdated:i}),setIsLoading:i=>e({isLoading:i}),setNetworkInfo:i=>e({networkInfo:i}),setHosts:i=>e({hosts:i}),getSelectedNode:()=>{const{nodes:i,selectedNodeId:o}=r();return i.find(a=>a.id===o)||null},getChildNodes:()=>{const{nodes:i,selectedNodeId:o}=r();return o?i.find(u=>u.id===o)?i.filter(u=>u.data.parentId===o):[]:[]},getFilteredNodes:()=>{const{nodes:i,viewMode:o,searchQuery:a,typeFilters:u,statusFilter:l}=r();let c=i;if(a){const h=a.toLowerCase();c=c.filter(p=>{var g;return p.name.toLowerCase().includes(h)||((g=p.data.ip)==null?void 0:g.toLowerCase().includes(h))})}l!=="all"&&(c=c.filter(h=>h.data.status===l)),u.length>0&&u.lengthu.includes(h.type)));let d=[];if(o==="network"?d=["gateway","vlan","wifi","host_physical","host_vm","host_container"]:o==="host"?d=["gateway","vlan","wifi","host_physical","host_vm","host_container"]:o==="service"?d=["host_physical","host_vm","host_container","service","volume"]:o==="filesystem"&&(d=["volume","mount","path"]),d.length>0){const h=new Map(i.map(g=>[g.id,g])),p=new Set;i.forEach(g=>{var m;if(d.includes(g.type)){p.add(g.id);let w=g;for(;(m=w==null?void 0:w.data)!=null&&m.parentId;){const S=w.data.parentId;if(p.add(S),w=h.get(S),!w)break}}}),c=c.filter(g=>p.has(g.id))}return c}}),{name:"homelab-topology-settings",version:1,storage:Vb(()=>localStorage),partialize:e=>({viewMode:e.viewMode,orientation:e.orientation,searchQuery:e.searchQuery,typeFilters:e.typeFilters,statusFilter:e.statusFilter,leftPanelOpen:e.leftPanelOpen,rightPanelOpen:e.rightPanelOpen})})),q1={jellyfin:"media",immich:"media",sonarr:"media",radarr:"media",sabnzbd:"media",qbittorrent:"media",lidarr:"media",readarr:"media",bazarr:"media",tdarr:"media",traefik:"infra",authentik:"infra",vaultwarden:"infra",gitea:"infra",postgres:"infra",portainer:"infra",prometheus:"monitoring",grafana:"monitoring",loki:"monitoring",uptimekuma:"monitoring",cadvisor:"monitoring",nodeexporter:"monitoring",litellm:"ai",ollama:"ai","code-server":"ai",qdrant:"storage"};function Q3(e){const r=Object.keys(q1).find(i=>e.toLowerCase().includes(i.toLowerCase()));return q1[r||""]||"other"}const Tc={gateway:{model:"UniFi Dream Machine Pro",ip:"192.168.1.1"},vlans:[{id:1,name:"Default",subnet:"192.168.1.0/24",purpose:"Core infrastructure"},{id:3,name:"Trusted",subnet:"192.168.3.0/24",purpose:"Trusted devices"},{id:10,name:"Family",subnet:"192.168.10.0/24",purpose:"Family devices"},{id:20,name:"Guest",subnet:"192.168.20.0/24",purpose:"Guest network"},{id:30,name:"IoT",subnet:"192.168.30.0/24",purpose:"IoT devices, Home Assistant"},{id:50,name:"Production",subnet:"192.168.50.0/24",purpose:"Production services"}],wifi:[{ssid:"Will of D.",vlan:"default"},{ssid:"Will of D. IoT",vlan:30},{ssid:"Family of D.",vlan:10}]},Z3=[{name:"ubuntu",ip:"192.168.50.61",type:"vm",role:"Primary Docker Host",containers:[]},{name:"grizzley",ip:"192.168.50.84",type:"rpi5",role:"Edge Services",containers:[]},{name:"ice",ip:"192.168.50.197",type:"rpi5",role:"Spare/Development",containers:[]},{name:"panda",ip:"192.168.30.196",type:"rpi5",role:"Home Assistant",containers:[]},{name:"truenas",ip:"192.168.50.12",type:"physical",role:"Storage (NAS)",containers:[]},{name:"proxmox",ip:"192.168.50.11",type:"physical",role:"Hypervisor",containers:[]}],J3={traefik:{description:"Reverse proxy and load balancer",importance:5},jellyfin:{description:"Media server",importance:5},immich:{description:"Photo and video management",importance:4},authentik:{description:"Identity provider and SSO",importance:5},gitea:{description:"Self-hosted Git service",importance:4},prometheus:{description:"Monitoring and metrics",importance:4},grafana:{description:"Metrics visualization",importance:4},sonarr:{description:"TV show management",importance:4},radarr:{description:"Movie management",importance:4},tdarr:{description:"Video transcoding",importance:3},frigate:{description:"NVR with local AI",importance:4},vaultwarden:{description:"Password manager",importance:5},portainer:{description:"Container management UI",importance:3},ollama:{description:"Local LLM runtime",importance:4},litellm:{description:"LLM API gateway",importance:4}};function eA(e){const r=e.toLowerCase();return r.includes("up")||r.includes("running")?"running":r.includes("exited")||r.includes("stopped")||r.includes("dead")?"stopped":"unknown"}function tA(e,r){const i=[],o=[];i.push({id:"gateway",type:"gateway",name:"UniFi Gateway",data:{status:"running",metadata:{model:r.gateway.model,ip:r.gateway.ip},importance:5,description:"Main network gateway and firewall"}}),r.vlans.forEach(u=>{i.push({id:`vlan-${u.id}`,type:"vlan",name:`VLAN ${u.id}: ${u.name}`,data:{status:"running",metadata:{subnet:u.subnet,purpose:u.purpose},importance:4,description:u.purpose||"",parentId:"gateway"}}),o.push({id:`e-gateway-vlan${u.id}`,source:"gateway",target:`vlan-${u.id}`})}),r.wifi.forEach(u=>{const l=`wifi-${u.ssid.replace(/\s+/g,"-")}`;i.push({id:l,type:"wifi",name:u.ssid,data:{status:"running",metadata:{vlan:u.vlan},importance:3,parentId:"gateway"}}),o.push({id:`e-gateway-${l}`,source:"gateway",target:l})}),e.forEach(u=>{const l=u.ip.startsWith("192.168.50")?"vlan-50":u.ip.startsWith("192.168.30")?"vlan-30":u.ip.startsWith("192.168.10")?"vlan-10":"vlan-1",c=u.name==="proxmox"||u.name==="truenas"?"host_physical":u.name==="ubuntu"?"host_vm":"host_container",d={id:u.name,type:c,name:`${u.name} (${u.ip})`,data:{ip:u.ip,status:u.online?"running":"stopped",metadata:{role:u.name==="ubuntu"?"Primary Docker Host":u.name==="grizzley"?"Edge Services":u.name==="truenas"?"Storage (NAS)":u.name==="proxmox"?"Hypervisor":"Host",type:c,containerCount:u.containers.length,cpuUsage:u.cpuUsage,memoryUsage:u.memoryUsage,uptime:u.uptime},importance:u.name==="ubuntu"?5:4,description:u.name==="ubuntu"?"Primary Docker Host with GPU":u.name==="grizzley"?"Edge Traefik & Camera Services":u.name==="truenas"?"TrueNAS Storage":"Host",parentId:l}};i.push(d),o.push({id:`e-${l}-${u.name}`,source:l,target:u.name}),u.containers.forEach(h=>{const p=J3[h.name.replace(/-/g,"")]||{description:h.name,importance:3},g=h.ports.length>0?h.ports.join(", "):void 0;i.push({id:`${u.name}-${h.name}`,type:"service",name:h.name,data:{status:eA(h.status),metadata:{host:u.name,image:h.image,ports:g,created:h.created},category:Q3(h.name),importance:p.importance,description:p.description,parentId:u.name}}),o.push({id:`e-${u.name}-${h.name}`,source:u.name,target:`${u.name}-${h.name}`})})});const a={id:"truenas-nfs",type:"mount",name:"/mnt/truenas/media",data:{status:"running",metadata:{type:"nfs",server:"192.168.50.12"},importance:5,description:"TrueNAS NFS mount for media storage",parentId:"truenas"}};return i.push(a),o.push({id:"e-truenas-nfs",source:"truenas",target:"truenas-nfs"}),["/movies","/tv","/music","/photos"].forEach(u=>{const l=`path-${u.replace(/\//g,"-")}`;i.push({id:l,type:"path",name:u,data:{status:"running",metadata:{type:"filesystem"},importance:4,parentId:"truenas-nfs"}}),o.push({id:`e-nfs-${l}`,source:"truenas-nfs",target:l})}),{nodes:i,edges:o}}async function nA(e,r){const i=[],o=[],a=(l,c)=>Math.random()*(c-l)+l,u={ubuntu:()=>({name:"ubuntu",ip:"192.168.50.61",online:!0,cpuUsage:Math.round(a(5,35)*10)/10,memoryUsage:Math.round(a(35,65)*10)/10,uptime:"45 days",containers:[{name:"traefik",image:"traefik:v3.6.7",status:"running",ports:["80","443"],created:"2024-01-15"},{name:"jellyfin",image:"jellyfin/jellyfin:10.11.5",status:"running",ports:["8096","9090"],created:"2024-01-15"},{name:"immich",image:"ghcr.io/immich-app/immich-server:release",status:"running",ports:[],created:"2024-06-20"},{name:"authentik",image:"ghcr.io/goauthentik/server:2025.2",status:"running",ports:[],created:"2024-02-10"},{name:"gitea",image:"gitea/gitea:latest",status:"running",ports:["3000","2222"],created:"2024-01-20"},{name:"prometheus",image:"prom/prometheus:latest",status:"running",ports:["9090"],created:"2024-01-15"},{name:"grafana",image:"grafana/grafana:11.4.0",status:"running",ports:["3000"],created:"2024-01-15"},{name:"sonarr",image:"lscr.io/linuxserver/sonarr:latest",status:"running",ports:[],created:"2024-01-15"},{name:"radarr",image:"lscr.io/linuxserver/radarr:latest",status:"running",ports:[],created:"2024-01-15"},{name:"tdarr",image:"ghcr.io/haveagitgat/tdarr:latest",status:"running",ports:["8265","8266","8267"],created:"2024-01-15"}]}),grizzley:()=>({name:"grizzley",ip:"192.168.50.84",online:!0,cpuUsage:Math.round(a(3,25)*10)/10,memoryUsage:Math.round(a(45,80)*10)/10,uptime:"30 days",containers:[{name:"traefik",image:"traefik:v3.6.7",status:"running",ports:["80","443"],created:"2024-01-10"},{name:"frigate",image:"ghcr.io/blakeblackscreen/frigate:0.14",status:"running",ports:["5000","8554"],created:"2024-03-01"},{name:"scrypted",image:"koush/scrypted",status:"running",ports:["10443"],created:"2024-04-15"}]}),truenas:()=>({name:"truenas",ip:"192.168.50.12",online:!0,cpuUsage:Math.round(a(1,15)*10)/10,memoryUsage:Math.round(a(20,50)*10)/10,uptime:"90 days",containers:[{name:"qdrant",image:"qdrant/qdrant:v1.12.0",status:"running",ports:["6333","6334"],created:"2024-02-01"}]})};for(const l of e){const c=u[l];c?i.push(c()):(i.push({name:l,ip:"",online:!1,containers:[]}),o.push(`Host ${l}: No data available (use SSH to discover)`))}return{hosts:i,timestamp:new Date,errors:o}}/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ub=(...e)=>e.filter((r,i,o)=>!!r&&r.trim()!==""&&o.indexOf(r)===i).join(" ").trim();/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var iA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oA=ie.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:u,iconNode:l,...c},d)=>ie.createElement("svg",{ref:d,...iA,width:r,height:r,stroke:e,strokeWidth:o?Number(i)*24/Number(r):i,className:Ub("lucide",a),...c},[...l.map(([h,p])=>ie.createElement(h,p)),...Array.isArray(u)?u:[u]]));/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ve=(e,r)=>{const i=ie.forwardRef(({className:o,...a},u)=>ie.createElement(oA,{ref:u,iconNode:r,className:Ub(`lucide-${rA(e)}`,o),...a}));return i.displayName=`${e}`,i};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aA=Ve("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sA=Ve("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qo=Ve("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=Ve("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uA=Ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lA=Ve("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mr=Ve("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=Ve("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=Ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cA=Ve("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rv=Ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=Ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fA=Ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dA=Ve("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hA=Ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pA=Ve("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tr=Ve("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gA=Ve("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vA=Ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yi=Ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=Ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mv=Ve("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mA=Ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Ni(e,r){return{gateway:"#6366F1",vlan:"#8B5CF6",wifi:"#EC4899",host_physical:"#10B981",host_vm:"#14B8A6",host_container:"#F59E0B",service:yA(r),volume:"#A855F7",mount:"#84CC16",path:"#EAB308"}[e]||"#6B7280"}function yA(e){return{media:"#EF4444",infra:"#3B82F6",monitoring:"#22C55E",ai:"#F97316",storage:"#06B6D4",other:"#6B7280"}[e||"other"]}function Qb(e){return{running:"#22C55E",stopped:"#EF4444",unknown:"#6B7280"}[e]}function wA(e){return{1:"Minimal",2:"Low",3:"Medium",4:"High",5:"Critical"}[e]||"Unknown"}function xA(e){return{1:"#6B7280",2:"#9CA3AF",3:"#F59E0B",4:"#F97316",5:"#EF4444"}[e]||"#6B7280"}const _A=[{mode:"full",label:"Full",icon:I.jsx(dA,{className:"w-4 h-4"})},{mode:"network",label:"Network",icon:I.jsx(Tr,{className:"w-4 h-4"})},{mode:"host",label:"Hosts",icon:I.jsx(Kb,{className:"w-4 h-4"})},{mode:"service",label:"Services",icon:I.jsx(Qo,{className:"w-4 h-4"})},{mode:"filesystem",label:"Files",icon:I.jsx(Mr,{className:"w-4 h-4"})}],SA=[{value:"LR",label:"Left to Right",icon:I.jsx(aA,{className:"w-4 h-4"})},{value:"TB",label:"Top to Bottom",icon:I.jsx(sA,{className:"w-4 h-4"})}],EA=[{type:"gateway",icon:I.jsx(gA,{className:"w-4 h-4"})},{type:"vlan",icon:I.jsx(Tr,{className:"w-4 h-4"})},{type:"wifi",icon:I.jsx(Mv,{className:"w-4 h-4"})},{type:"host_physical",icon:I.jsx(Kb,{className:"w-4 h-4"})},{type:"host_vm",icon:I.jsx(pA,{className:"w-4 h-4"})},{type:"host_container",icon:I.jsx(lA,{className:"w-4 h-4"})},{type:"service",icon:I.jsx(Qo,{className:"w-4 h-4"})},{type:"volume",icon:I.jsx(Mr,{className:"w-4 h-4"})},{type:"mount",icon:I.jsx(cA,{className:"w-4 h-4"})},{type:"path",icon:I.jsx(Rv,{className:"w-4 h-4"})}];function bA({onRefresh:e,isLoading:r}){const{viewMode:i,setViewMode:o,orientation:a,setOrientation:u,searchQuery:l,setSearchQuery:c,typeFilters:d,toggleTypeFilter:h,statusFilter:p,setStatusFilter:g,toggleLeftPanel:m,toggleRightPanel:w,leftPanelOpen:S,rightPanelOpen:b,isLoading:x}=Ii(),E=r??x,C=async()=>{e&&await e()};return I.jsxs("div",{className:"h-14 bg-slate-800 border-b border-slate-700 px-4 flex items-center justify-between",children:[I.jsxs("div",{className:"flex items-center gap-4",children:[I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx("div",{className:"w-8 h-8 bg-indigo-500 rounded-lg flex items-center justify-center",children:I.jsx(Tr,{className:"w-5 h-5 text-white"})}),I.jsx("h1",{className:"text-lg font-semibold text-white",children:"Homelab Topology"})]}),I.jsx("div",{className:"h-6 w-px bg-slate-600"}),I.jsx("div",{className:"flex items-center gap-1",children:_A.map(({mode:_,label:k,icon:R})=>I.jsxs("button",{onClick:()=>o(_),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm transition-colors ${i===_?"bg-indigo-500/20 text-indigo-400 border border-indigo-500/50":"text-slate-400 hover:text-white hover:bg-slate-700"}`,children:[R,k]},_))}),I.jsx("div",{className:"h-6 w-px bg-slate-600"}),I.jsx("div",{className:"flex items-center gap-2",children:I.jsx("select",{value:a,onChange:_=>u(_.target.value),className:"h-9 px-3 bg-slate-700 border border-slate-600 rounded-lg text-sm text-slate-300 focus:outline-none focus:border-indigo-500 cursor-pointer",children:SA.map(({value:_,label:k})=>I.jsx("option",{value:_,children:k},_))})}),I.jsx("div",{className:"h-6 w-px bg-slate-600"}),I.jsx("div",{className:"flex items-center gap-1",children:EA.map(({type:_,icon:k})=>{const R=d.includes(_),M=Ni(_);return I.jsx("button",{onClick:()=>h(_),className:`p-2 rounded-md transition-colors ${R?"border":"text-slate-500 hover:text-slate-300 hover:bg-slate-700"}`,style:R?{backgroundColor:`${M}20`,borderColor:`${M}50`,color:M}:void 0,title:_,children:k},_)})}),I.jsx("div",{className:"h-6 w-px bg-slate-600"}),I.jsx("div",{className:"flex items-center gap-2",children:I.jsxs("select",{value:p,onChange:_=>g(_.target.value),className:"h-9 px-3 bg-slate-700 border border-slate-600 rounded-lg text-sm text-slate-300 focus:outline-none focus:border-indigo-500 cursor-pointer",children:[I.jsx("option",{value:"all",children:"All Status"}),I.jsx("option",{value:"running",children:"Running"}),I.jsx("option",{value:"stopped",children:"Stopped"})]})})]}),I.jsxs("div",{className:"flex items-center gap-3",children:[I.jsxs("div",{className:"relative",children:[I.jsx(vA,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),I.jsx("input",{type:"text",placeholder:"Search nodes...",value:l,onChange:_=>c(_.target.value),className:"w-64 h-9 pl-9 pr-4 bg-slate-700 border border-slate-600 rounded-lg text-sm text-white placeholder-slate-400 focus:outline-none focus:border-indigo-500"})]}),I.jsxs("button",{onClick:C,disabled:E,className:"h-9 px-3 flex items-center gap-2 bg-slate-700 hover:bg-slate-600 border border-slate-600 rounded-lg text-sm text-slate-300 transition-colors disabled:opacity-50",children:[I.jsx(hA,{className:`w-4 h-4 ${E?"animate-spin":""}`}),E?"Loading...":"Refresh"]}),I.jsx("div",{className:"h-6 w-px bg-slate-600"}),I.jsx("button",{onClick:m,className:`p-2 rounded-lg transition-colors ${S?"bg-indigo-500/20 text-indigo-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:"Toggle left panel",children:I.jsx(Qo,{className:"w-5 h-5"})}),I.jsx("button",{onClick:w,className:`p-2 rounded-lg transition-colors ${b?"bg-indigo-500/20 text-indigo-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:"Toggle right panel",children:I.jsx(Mr,{className:"w-5 h-5"})})]})]})}const kA={gateway:I.jsx(Tr,{className:"w-4 h-4"}),vlan:I.jsx(Tr,{className:"w-4 h-4"}),wifi:I.jsx(Mv,{className:"w-4 h-4"}),host_physical:I.jsx(yi,{className:"w-4 h-4"}),host_vm:I.jsx(yi,{className:"w-4 h-4"}),host_container:I.jsx(yi,{className:"w-4 h-4"}),service:I.jsx(Qo,{className:"w-4 h-4"}),volume:I.jsx(Mr,{className:"w-4 h-4"}),mount:I.jsx(Mr,{className:"w-4 h-4"}),path:I.jsx(Rv,{className:"w-4 h-4"})},CA={gateway:"Gateway",vlan:"VLAN",wifi:"WiFi",host_physical:"Physical",host_vm:"VM",host_container:"Container",service:"Service",volume:"Volume",mount:"Mount",path:"Path"};function NA(){const{nodes:e,selectedNodeId:r,setSelectedNode:i}=Ii(),o=e.find(l=>l.id===r),a=e.filter(l=>l.data.parentId===r),u=a.reduce((l,c)=>(l[c.type]||(l[c.type]=[]),l[c.type].push(c),l),{});return I.jsxs("div",{className:"w-72 bg-slate-800 border-r border-slate-700 flex flex-col",children:[I.jsxs("div",{className:"h-12 px-4 flex items-center border-b border-slate-700",children:[I.jsx("h2",{className:"text-sm font-semibold text-white uppercase tracking-wide",children:o?"Child Nodes":"Select a Node"}),a.length>0&&I.jsx("span",{className:"ml-2 px-2 py-0.5 bg-slate-700 text-slate-300 text-xs rounded-full",children:a.length})]}),I.jsx("div",{className:"flex-1 overflow-y-auto",children:o?a.length===0?I.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"No child nodes"}):I.jsx("div",{className:"p-2",children:Object.entries(u).map(([l,c])=>I.jsxs("div",{className:"mb-3",children:[I.jsxs("div",{className:"px-2 py-1 text-xs font-medium text-slate-500 uppercase tracking-wide",children:[CA[l],"s (",c.length,")"]}),c.map(d=>I.jsxs("button",{onClick:()=>i(d.id),className:`w-full px-3 py-2 flex items-center gap-3 rounded-lg transition-colors text-left ${r===d.id?"bg-indigo-500/20 text-indigo-300":"text-slate-300 hover:bg-slate-700"}`,children:[I.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{backgroundColor:`${Ni(d.type,d.data.category)}20`},children:I.jsx("div",{style:{color:Ni(d.type,d.data.category)},children:kA[d.type]})}),I.jsxs("div",{className:"flex-1 min-w-0",children:[I.jsx("div",{className:"text-sm font-medium truncate",children:d.name}),d.data.ip&&I.jsx("div",{className:"text-xs text-slate-500",children:d.data.ip})]}),I.jsx(uA,{className:"w-4 h-4 text-slate-500"})]},d.id))]},l))}):I.jsx("div",{className:"p-4 text-center text-slate-500 text-sm",children:"Click on a node to view its child nodes"})})]})}const IA=[{id:"details",label:"Details",icon:I.jsx(fA,{className:"w-4 h-4"})},{id:"config",label:"Config",icon:I.jsx(Wb,{className:"w-4 h-4"})},{id:"files",label:"Files",icon:I.jsx(Yb,{className:"w-4 h-4"})},{id:"usage",label:"Usage",icon:I.jsx(Gb,{className:"w-4 h-4"})},{id:"importance",label:"Importance",icon:I.jsx(Xb,{className:"w-4 h-4"})}];function RA(){const{nodes:e,selectedNodeId:r,setSelectedNode:i}=Ii(),[o,a]=ie.useState("details"),u=e.find(d=>d.id===r);if(!u)return I.jsx("div",{className:"w-80 bg-slate-800 border-l border-slate-700 flex flex-col items-center justify-center p-4",children:I.jsx("div",{className:"text-slate-500 text-sm text-center",children:"Select a node to view its details"})});const l=Ni(u.type,u.data.category),c=Qb(u.data.status);return I.jsxs("div",{className:"w-80 bg-slate-800 border-l border-slate-700 flex flex-col",children:[I.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b border-slate-700",children:[I.jsx("h2",{className:"text-sm font-semibold text-white truncate",children:u.name}),I.jsx("button",{onClick:()=>i(null),className:"p-1 hover:bg-slate-700 rounded transition-colors",children:I.jsx(mA,{className:"w-4 h-4 text-slate-400"})})]}),I.jsx("div",{className:"flex border-b border-slate-700",children:IA.map(d=>I.jsx("button",{onClick:()=>a(d.id),className:`flex-1 flex items-center justify-center gap-1 py-3 text-xs transition-colors ${o===d.id?"text-indigo-400 border-b-2 border-indigo-400 bg-indigo-500/10":"text-slate-400 hover:text-white"}`,children:d.icon},d.id))}),I.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[o==="details"&&I.jsx(MA,{node:u,nodeColor:l,statusColor:c}),o==="config"&&I.jsx(TA,{node:u}),o==="files"&&I.jsx(PA,{node:u}),o==="usage"&&I.jsx(AA,{node:u}),o==="importance"&&I.jsx(qA,{node:u})]})]})}function MA({node:e,nodeColor:r,statusColor:i}){return I.jsxs("div",{className:"space-y-4",children:[I.jsxs("div",{className:"flex items-center gap-3",children:[I.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{backgroundColor:`${r}20`},children:I.jsx("div",{style:{color:r},className:"text-lg font-bold",children:e.name.charAt(0).toUpperCase()})}),I.jsxs("div",{children:[I.jsx("div",{className:"text-white font-medium",children:e.type.replace(/_/g," ")}),I.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[I.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i}}),I.jsx("span",{className:"text-slate-400 capitalize",children:e.data.status})]})]})]}),I.jsxs("div",{className:"space-y-3",children:[I.jsxs("div",{children:[I.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide mb-1",children:"IP Address"}),I.jsx("div",{className:"font-mono text-sm text-white",children:e.data.ip||"N/A"})]}),e.data.description&&I.jsxs("div",{children:[I.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide mb-1",children:"Description"}),I.jsx("div",{className:"text-sm text-slate-300",children:e.data.description})]}),I.jsxs("div",{children:[I.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide mb-1",children:"Metadata"}),I.jsx("div",{className:"bg-slate-900 rounded-lg p-3 font-mono text-xs text-slate-300 overflow-x-auto",children:JSON.stringify(e.data.metadata,null,2)})]})]})]})}function TA({node:e}){return e.data.config?I.jsx("div",{children:I.jsx("pre",{className:"bg-slate-900 rounded-lg p-3 font-mono text-xs text-slate-300 overflow-x-auto",children:e.data.config})}):I.jsxs("div",{className:"text-center text-slate-500 py-8",children:[I.jsx(Wb,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),I.jsx("div",{className:"text-sm",children:"No configuration available"})]})}function PA({node:e}){const r=e.data.files||["/etc/docker-compose.yml","/etc/traefik/dynamic.yml","/var/log/container.log"];return I.jsx("div",{className:"space-y-1",children:r.map((i,o)=>I.jsxs("button",{className:"w-full px-3 py-2 flex items-center gap-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left transition-colors",children:[I.jsx(Yb,{className:"w-4 h-4 text-slate-400"}),I.jsx("span",{className:"font-mono text-xs text-slate-300 truncate",children:i})]},o))})}function AA({node:e}){return e.type==="service"?I.jsxs("div",{className:"space-y-4",children:[I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[I.jsx("span",{className:"text-slate-400",children:"CPU"}),I.jsx("span",{className:"text-white",children:"12.4%"})]}),I.jsx("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:I.jsx("div",{className:"h-full w-[12.4%] bg-indigo-500 rounded-full"})})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[I.jsx("span",{className:"text-slate-400",children:"Memory"}),I.jsx("span",{className:"text-white",children:"256 MB / 1 GB"})]}),I.jsx("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:I.jsx("div",{className:"h-full w-[25.6%] bg-purple-500 rounded-full"})})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[I.jsx("span",{className:"text-slate-400",children:"Network I/O"}),I.jsx("span",{className:"text-white",children:"1.2 MB/s ↓ 0.8 MB/s ↑"})]}),I.jsx("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:I.jsx("div",{className:"h-full w-[40%] bg-cyan-500 rounded-full"})})]})]}):I.jsxs("div",{className:"text-center text-slate-500 py-8",children:[I.jsx(Gb,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),I.jsx("div",{className:"text-sm",children:"Usage data available for services only"})]})}function qA({node:e}){var u;const r=e.data.importance||3,i=wA(r),o=xA(r),a={5:["Critical infrastructure","Single point of failure","Required for other services"],4:["Important service","Used frequently","Difficult to replace"],3:["Standard service","Can be rebuilt","Not critical"],2:["Optional service","Rarely used","Easy to recreate"],1:["Development only","Non-critical","Can be disabled"]};return I.jsxs("div",{className:"space-y-4",children:[I.jsx("div",{className:"flex items-center justify-center gap-2",children:[1,2,3,4,5].map(l=>I.jsx(Xb,{className:`w-8 h-8 ${l<=r?"fill-yellow-500 text-yellow-500":"text-slate-600"}`},l))}),I.jsxs("div",{className:"text-center",children:[I.jsx("div",{className:"text-lg font-semibold",style:{color:o},children:i}),I.jsxs("div",{className:"text-sm text-slate-400",children:["Importance Level ",r,"/5"]})]}),I.jsxs("div",{className:"bg-slate-700/50 rounded-lg p-3",children:[I.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide mb-2",children:"Why this level?"}),I.jsx("ul",{className:"space-y-1",children:(u=a[r])==null?void 0:u.map((l,c)=>I.jsxs("li",{className:"text-sm text-slate-300 flex items-center gap-2",children:[I.jsx("div",{className:"w-1 h-1 bg-slate-500 rounded-full"}),l]},c))})]})]})}function Tv(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pc,L1;function LA(){if(L1)return Pc;L1=1;function e(){this.__data__=[],this.size=0}return Pc=e,Pc}var Ac,j1;function Ri(){if(j1)return Ac;j1=1;function e(r,i){return r===i||r!==r&&i!==i}return Ac=e,Ac}var qc,O1;function ou(){if(O1)return qc;O1=1;var e=Ri();function r(i,o){for(var a=i.length;a--;)if(e(i[a][0],o))return a;return-1}return qc=r,qc}var Lc,z1;function jA(){if(z1)return Lc;z1=1;var e=ou(),r=Array.prototype,i=r.splice;function o(a){var u=this.__data__,l=e(u,a);if(l<0)return!1;var c=u.length-1;return l==c?u.pop():i.call(u,l,1),--this.size,!0}return Lc=o,Lc}var jc,D1;function OA(){if(D1)return jc;D1=1;var e=ou();function r(i){var o=this.__data__,a=e(o,i);return a<0?void 0:o[a][1]}return jc=r,jc}var Oc,F1;function zA(){if(F1)return Oc;F1=1;var e=ou();function r(i){return e(this.__data__,i)>-1}return Oc=r,Oc}var zc,$1;function DA(){if($1)return zc;$1=1;var e=ou();function r(i,o){var a=this.__data__,u=e(a,i);return u<0?(++this.size,a.push([i,o])):a[u][1]=o,this}return zc=r,zc}var Dc,B1;function au(){if(B1)return Dc;B1=1;var e=LA(),r=jA(),i=OA(),o=zA(),a=DA();function u(l){var c=-1,d=l==null?0:l.length;for(this.clear();++c-1&&o%1==0&&o-1&&i%1==0&&i<=e}return Lf=r,Lf}var jf,Dw;function dq(){if(Dw)return jf;Dw=1;var e=Pr(),r=Lv(),i=vn(),o="[object Arguments]",a="[object Array]",u="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",h="[object Map]",p="[object Number]",g="[object Object]",m="[object RegExp]",w="[object Set]",S="[object String]",b="[object WeakMap]",x="[object ArrayBuffer]",E="[object DataView]",C="[object Float32Array]",_="[object Float64Array]",k="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",T="[object Uint8Array]",O="[object Uint8ClampedArray]",z="[object Uint16Array]",W="[object Uint32Array]",L={};L[C]=L[_]=L[k]=L[R]=L[M]=L[T]=L[O]=L[z]=L[W]=!0,L[o]=L[a]=L[x]=L[u]=L[E]=L[l]=L[c]=L[d]=L[h]=L[p]=L[g]=L[m]=L[w]=L[S]=L[b]=!1;function $(Q){return i(Q)&&r(Q.length)&&!!L[e(Q)]}return jf=$,jf}var Of,Fw;function hu(){if(Fw)return Of;Fw=1;function e(r){return function(i){return r(i)}}return Of=e,Of}var To={exports:{}};To.exports;var $w;function jv(){return $w||($w=1,(function(e,r){var i=Zb(),o=r&&!r.nodeType&&r,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,l=u&&i.process,c=(function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}})();e.exports=c})(To,To.exports)),To.exports}var zf,Bw;function ta(){if(Bw)return zf;Bw=1;var e=dq(),r=hu(),i=jv(),o=i&&i.isTypedArray,a=o?r(o):e;return zf=a,zf}var Df,Hw;function tk(){if(Hw)return Df;Hw=1;var e=lq(),r=ea(),i=Xe(),o=Ti(),a=du(),u=ta(),l=Object.prototype,c=l.hasOwnProperty;function d(h,p){var g=i(h),m=!g&&r(h),w=!g&&!m&&o(h),S=!g&&!m&&!w&&u(h),b=g||m||w||S,x=b?e(h.length,String):[],E=x.length;for(var C in h)(p||c.call(h,C))&&!(b&&(C=="length"||w&&(C=="offset"||C=="parent")||S&&(C=="buffer"||C=="byteLength"||C=="byteOffset")||a(C,E)))&&x.push(C);return x}return Df=d,Df}var Ff,Vw;function pu(){if(Vw)return Ff;Vw=1;var e=Object.prototype;function r(i){var o=i&&i.constructor,a=typeof o=="function"&&o.prototype||e;return i===a}return Ff=r,Ff}var $f,Uw;function nk(){if(Uw)return $f;Uw=1;function e(r,i){return function(o){return r(i(o))}}return $f=e,$f}var Bf,Gw;function hq(){if(Gw)return Bf;Gw=1;var e=nk(),r=e(Object.keys,Object);return Bf=r,Bf}var Hf,Ww;function Ov(){if(Ww)return Hf;Ww=1;var e=pu(),r=hq(),i=Object.prototype,o=i.hasOwnProperty;function a(u){if(!e(u))return r(u);var l=[];for(var c in Object(u))o.call(u,c)&&c!="constructor"&&l.push(c);return l}return Hf=a,Hf}var Vf,Yw;function Mn(){if(Yw)return Vf;Yw=1;var e=Zo(),r=Lv();function i(o){return o!=null&&r(o.length)&&!e(o)}return Vf=i,Vf}var Uf,Kw;function rr(){if(Kw)return Uf;Kw=1;var e=tk(),r=Ov(),i=Mn();function o(a){return i(a)?e(a):r(a)}return Uf=o,Uf}var Gf,Xw;function pq(){if(Xw)return Gf;Xw=1;var e=Jo(),r=rr();function i(o,a){return o&&e(a,r(a),o)}return Gf=i,Gf}var Wf,Qw;function gq(){if(Qw)return Wf;Qw=1;function e(r){var i=[];if(r!=null)for(var o in Object(r))i.push(o);return i}return Wf=e,Wf}var Yf,Zw;function vq(){if(Zw)return Yf;Zw=1;var e=Bt(),r=pu(),i=gq(),o=Object.prototype,a=o.hasOwnProperty;function u(l){if(!e(l))return i(l);var c=r(l),d=[];for(var h in l)h=="constructor"&&(c||!a.call(l,h))||d.push(h);return d}return Yf=u,Yf}var Kf,Jw;function qr(){if(Jw)return Kf;Jw=1;var e=tk(),r=vq(),i=Mn();function o(a){return i(a)?e(a,!0):r(a)}return Kf=o,Kf}var Xf,ex;function mq(){if(ex)return Xf;ex=1;var e=Jo(),r=qr();function i(o,a){return o&&e(a,r(a),o)}return Xf=i,Xf}var Po={exports:{}};Po.exports;var tx;function rk(){return tx||(tx=1,(function(e,r){var i=on(),o=r&&!r.nodeType&&r,a=o&&!0&&e&&!e.nodeType&&e,u=a&&a.exports===o,l=u?i.Buffer:void 0,c=l?l.allocUnsafe:void 0;function d(h,p){if(p)return h.slice();var g=h.length,m=c?c(g):new h.constructor(g);return h.copy(m),m}e.exports=d})(Po,Po.exports)),Po.exports}var Qf,nx;function ik(){if(nx)return Qf;nx=1;function e(r,i){var o=-1,a=r.length;for(i||(i=Array(a));++ow))return!1;var b=g.get(l),x=g.get(c);if(b&&x)return b==c&&x==l;var E=-1,C=!0,_=d&a?new e:void 0;for(g.set(l,c),g.set(c,l);++E0&&u(p)?a>1?i(p,a-1,u,l,c):e(c,p):l||(c[c.length]=p)}return c}return Bh=i,Bh}var Hh,Y_;function pL(){if(Y_)return Hh;Y_=1;function e(r,i,o){switch(o.length){case 0:return r.call(i);case 1:return r.call(i,o[0]);case 2:return r.call(i,o[0],o[1]);case 3:return r.call(i,o[0],o[1],o[2])}return r.apply(i,o)}return Hh=e,Hh}var Vh,K_;function Lk(){if(K_)return Vh;K_=1;var e=pL(),r=Math.max;function i(o,a,u){return a=r(a===void 0?o.length-1:a,0),function(){for(var l=arguments,c=-1,d=r(l.length-a,0),h=Array(d);++c0){if(++u>=e)return arguments[0]}else u=0;return a.apply(void 0,arguments)}}return Gh=o,Gh}var Wh,Z_;function jk(){if(Z_)return Wh;Z_=1;var e=gL(),r=vL(),i=r(e);return Wh=i,Wh}var Yh,J_;function xu(){if(J_)return Yh;J_=1;var e=Lr(),r=Lk(),i=jk();function o(a,u){return i(r(a,u,e),a+"")}return Yh=o,Yh}var Kh,eS;function Ok(){if(eS)return Kh;eS=1;function e(r,i,o,a){for(var u=r.length,l=o+(a?1:-1);a?l--:++l-1}return Jh=r,Jh}var ep,oS;function _L(){if(oS)return ep;oS=1;function e(r,i,o){for(var a=-1,u=r==null?0:r.length;++a=l){var E=h?null:a(d);if(E)return u(E);S=!1,m=o,x=new e}else x=h?[]:b;e:for(;++g1?w.setNode(S,g):w.setNode(S)}),this},a.prototype.setNode=function(p,g){return e.has(this._nodes,p)?(arguments.length>1&&(this._nodes[p]=g),this):(this._nodes[p]=arguments.length>1?g:this._defaultNodeLabelFn(p),this._isCompound&&(this._parent[p]=i,this._children[p]={},this._children[i][p]=!0),this._in[p]={},this._preds[p]={},this._out[p]={},this._sucs[p]={},++this._nodeCount,this)},a.prototype.node=function(p){return this._nodes[p]},a.prototype.hasNode=function(p){return e.has(this._nodes,p)},a.prototype.removeNode=function(p){var g=this;if(e.has(this._nodes,p)){var m=function(w){g.removeEdge(g._edgeObjs[w])};delete this._nodes[p],this._isCompound&&(this._removeFromParentsChildList(p),delete this._parent[p],e.each(this.children(p),function(w){g.setParent(w)}),delete this._children[p]),e.each(e.keys(this._in[p]),m),delete this._in[p],delete this._preds[p],e.each(e.keys(this._out[p]),m),delete this._out[p],delete this._sucs[p],--this._nodeCount}return this},a.prototype.setParent=function(p,g){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(g))g=i;else{g+="";for(var m=g;!e.isUndefined(m);m=this.parent(m))if(m===p)throw new Error("Setting "+g+" as parent of "+p+" would create a cycle");this.setNode(g)}return this.setNode(p),this._removeFromParentsChildList(p),this._parent[p]=g,this._children[g][p]=!0,this},a.prototype._removeFromParentsChildList=function(p){delete this._children[this._parent[p]][p]},a.prototype.parent=function(p){if(this._isCompound){var g=this._parent[p];if(g!==i)return g}},a.prototype.children=function(p){if(e.isUndefined(p)&&(p=i),this._isCompound){var g=this._children[p];if(g)return e.keys(g)}else{if(p===i)return this.nodes();if(this.hasNode(p))return[]}},a.prototype.predecessors=function(p){var g=this._preds[p];if(g)return e.keys(g)},a.prototype.successors=function(p){var g=this._sucs[p];if(g)return e.keys(g)},a.prototype.neighbors=function(p){var g=this.predecessors(p);if(g)return e.union(g,this.successors(p))},a.prototype.isLeaf=function(p){var g;return this.isDirected()?g=this.successors(p):g=this.neighbors(p),g.length===0},a.prototype.filterNodes=function(p){var g=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});g.setGraph(this.graph());var m=this;e.each(this._nodes,function(b,x){p(x)&&g.setNode(x,b)}),e.each(this._edgeObjs,function(b){g.hasNode(b.v)&&g.hasNode(b.w)&&g.setEdge(b,m.edge(b))});var w={};function S(b){var x=m.parent(b);return x===void 0||g.hasNode(x)?(w[b]=x,x):x in w?w[x]:S(x)}return this._isCompound&&e.each(g.nodes(),function(b){g.setParent(b,S(b))}),g},a.prototype.setDefaultEdgeLabel=function(p){return e.isFunction(p)||(p=e.constant(p)),this._defaultEdgeLabelFn=p,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(p,g){var m=this,w=arguments;return e.reduce(p,function(S,b){return w.length>1?m.setEdge(S,b,g):m.setEdge(S,b),b}),this},a.prototype.setEdge=function(){var p,g,m,w,S=!1,b=arguments[0];typeof b=="object"&&b!==null&&"v"in b?(p=b.v,g=b.w,m=b.name,arguments.length===2&&(w=arguments[1],S=!0)):(p=b,g=arguments[1],m=arguments[3],arguments.length>2&&(w=arguments[2],S=!0)),p=""+p,g=""+g,e.isUndefined(m)||(m=""+m);var x=c(this._isDirected,p,g,m);if(e.has(this._edgeLabels,x))return S&&(this._edgeLabels[x]=w),this;if(!e.isUndefined(m)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(p),this.setNode(g),this._edgeLabels[x]=S?w:this._defaultEdgeLabelFn(p,g,m);var E=d(this._isDirected,p,g,m);return p=E.v,g=E.w,Object.freeze(E),this._edgeObjs[x]=E,u(this._preds[g],p),u(this._sucs[p],g),this._in[g][x]=E,this._out[p][x]=E,this._edgeCount++,this},a.prototype.edge=function(p,g,m){var w=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,g,m);return this._edgeLabels[w]},a.prototype.hasEdge=function(p,g,m){var w=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,g,m);return e.has(this._edgeLabels,w)},a.prototype.removeEdge=function(p,g,m){var w=arguments.length===1?h(this._isDirected,arguments[0]):c(this._isDirected,p,g,m),S=this._edgeObjs[w];return S&&(p=S.v,g=S.w,delete this._edgeLabels[w],delete this._edgeObjs[w],l(this._preds[g],p),l(this._sucs[p],g),delete this._in[g][w],delete this._out[p][w],this._edgeCount--),this},a.prototype.inEdges=function(p,g){var m=this._in[p];if(m){var w=e.values(m);return g?e.filter(w,function(S){return S.v===g}):w}},a.prototype.outEdges=function(p,g){var m=this._out[p];if(m){var w=e.values(m);return g?e.filter(w,function(S){return S.w===g}):w}},a.prototype.nodeEdges=function(p,g){var m=this.inEdges(p,g);if(m)return m.concat(this.outEdges(p,g))};function u(p,g){p[g]?p[g]++:p[g]=1}function l(p,g){--p[g]||delete p[g]}function c(p,g,m,w){var S=""+g,b=""+m;if(!p&&S>b){var x=S;S=b,b=x}return S+o+b+o+(e.isUndefined(w)?r:w)}function d(p,g,m,w){var S=""+g,b=""+m;if(!p&&S>b){var x=S;S=b,b=x}var E={v:S,w:b};return w&&(E.name=w),E}function h(p,g){return c(p,g.v,g.w,g.name)}return lp}var cp,gS;function NL(){return gS||(gS=1,cp="2.1.8"),cp}var fp,vS;function IL(){return vS||(vS=1,fp={Graph:Wv(),version:NL()}),fp}var dp,mS;function RL(){if(mS)return dp;mS=1;var e=Ht(),r=Wv();dp={write:i,read:u};function i(l){var c={options:{directed:l.isDirected(),multigraph:l.isMultigraph(),compound:l.isCompound()},nodes:o(l),edges:a(l)};return e.isUndefined(l.graph())||(c.value=e.clone(l.graph())),c}function o(l){return e.map(l.nodes(),function(c){var d=l.node(c),h=l.parent(c),p={v:c};return e.isUndefined(d)||(p.value=d),e.isUndefined(h)||(p.parent=h),p})}function a(l){return e.map(l.edges(),function(c){var d=l.edge(c),h={v:c.v,w:c.w};return e.isUndefined(c.name)||(h.name=c.name),e.isUndefined(d)||(h.value=d),h})}function u(l){var c=new r(l.options).setGraph(l.value);return e.each(l.nodes,function(d){c.setNode(d.v,d.value),d.parent&&c.setParent(d.v,d.parent)}),e.each(l.edges,function(d){c.setEdge({v:d.v,w:d.w,name:d.name},d.value)}),c}return dp}var hp,yS;function ML(){if(yS)return hp;yS=1;var e=Ht();hp=r;function r(i){var o={},a=[],u;function l(c){e.has(o,c)||(o[c]=!0,u.push(c),e.each(i.successors(c),l),e.each(i.predecessors(c),l))}return e.each(i.nodes(),function(c){u=[],l(c),u.length&&a.push(u)}),a}return hp}var pp,wS;function Fk(){if(wS)return pp;wS=1;var e=Ht();pp=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(i){return i.key})},r.prototype.has=function(i){return e.has(this._keyIndices,i)},r.prototype.priority=function(i){var o=this._keyIndices[i];if(o!==void 0)return this._arr[o].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(i,o){var a=this._keyIndices;if(i=String(i),!e.has(a,i)){var u=this._arr,l=u.length;return a[i]=l,u.push({key:i,priority:o}),this._decrease(l),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var i=this._arr.pop();return delete this._keyIndices[i.key],this._heapify(0),i.key},r.prototype.decrease=function(i,o){var a=this._keyIndices[i];if(o>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+i+" Old: "+this._arr[a].priority+" New: "+o);this._arr[a].priority=o,this._decrease(a)},r.prototype._heapify=function(i){var o=this._arr,a=2*i,u=a+1,l=i;a>1,!(o[u].priority0&&(g=p.removeMin(),m=h[g],m.distance!==Number.POSITIVE_INFINITY);)d(g).forEach(w);return h}return gp}var vp,_S;function TL(){if(_S)return vp;_S=1;var e=$k(),r=Ht();vp=i;function i(o,a,u){return r.transform(o.nodes(),function(l,c){l[c]=e(o,c,a,u)},{})}return vp}var mp,SS;function Bk(){if(SS)return mp;SS=1;var e=Ht();mp=r;function r(i){var o=0,a=[],u={},l=[];function c(d){var h=u[d]={onStack:!0,lowlink:o,index:o++};if(a.push(d),i.successors(d).forEach(function(m){e.has(u,m)?u[m].onStack&&(h.lowlink=Math.min(h.lowlink,u[m].index)):(c(m),h.lowlink=Math.min(h.lowlink,u[m].lowlink))}),h.lowlink===h.index){var p=[],g;do g=a.pop(),u[g].onStack=!1,p.push(g);while(d!==g);l.push(p)}}return i.nodes().forEach(function(d){e.has(u,d)||c(d)}),l}return mp}var yp,ES;function PL(){if(ES)return yp;ES=1;var e=Ht(),r=Bk();yp=i;function i(o){return e.filter(r(o),function(a){return a.length>1||a.length===1&&o.hasEdge(a[0],a[0])})}return yp}var wp,bS;function AL(){if(bS)return wp;bS=1;var e=Ht();wp=i;var r=e.constant(1);function i(a,u,l){return o(a,u||r,l||function(c){return a.outEdges(c)})}function o(a,u,l){var c={},d=a.nodes();return d.forEach(function(h){c[h]={},c[h][h]={distance:0},d.forEach(function(p){h!==p&&(c[h][p]={distance:Number.POSITIVE_INFINITY})}),l(h).forEach(function(p){var g=p.v===h?p.w:p.v,m=u(p);c[h][g]={distance:m,predecessor:h}})}),d.forEach(function(h){var p=c[h];d.forEach(function(g){var m=c[g];d.forEach(function(w){var S=m[h],b=p[w],x=m[w],E=S.distance+b.distance;E0;){if(h=d.removeMin(),e.has(c,h))l.setEdge(h,c[h]);else{if(g)throw new Error("Input graph is not connected: "+a);g=!0}a.nodeEdges(h).forEach(p)}return l}return kp}var Cp,TS;function zL(){return TS||(TS=1,Cp={components:ML(),dijkstra:$k(),dijkstraAll:TL(),findCycles:PL(),floydWarshall:AL(),isAcyclic:qL(),postorder:LL(),preorder:jL(),prim:OL(),tarjan:Bk(),topsort:Hk()}),Cp}var Np,PS;function DL(){if(PS)return Np;PS=1;var e=IL();return Np={Graph:e.Graph,json:RL(),alg:zL(),version:e.version},Np}var Ip,AS;function nn(){if(AS)return Ip;AS=1;var e;if(typeof Tv=="function")try{e=DL()}catch{}return e||(e=window.graphlib),Ip=e,Ip}var Rp,qS;function FL(){if(qS)return Rp;qS=1;var e=gk(),r=1,i=4;function o(a){return e(a,r|i)}return Rp=o,Rp}var Mp,LS;function _u(){if(LS)return Mp;LS=1;var e=Ri(),r=Mn(),i=du(),o=Bt();function a(u,l,c){if(!o(c))return!1;var d=typeof l;return(d=="number"?r(c)&&i(l,c.length):d=="string"&&l in c)?e(c[l],u):!1}return Mp=a,Mp}var Tp,jS;function $L(){if(jS)return Tp;jS=1;var e=xu(),r=Ri(),i=_u(),o=qr(),a=Object.prototype,u=a.hasOwnProperty,l=e(function(c,d){c=Object(c);var h=-1,p=d.length,g=p>2?d[2]:void 0;for(g&&i(d[0],d[1],g)&&(p=1);++h-1?d[h?u[p]:p]:void 0}}return Pp=o,Pp}var Ap,zS;function HL(){if(zS)return Ap;zS=1;var e=/\s/;function r(i){for(var o=i.length;o--&&e.test(i.charAt(o)););return o}return Ap=r,Ap}var qp,DS;function VL(){if(DS)return qp;DS=1;var e=HL(),r=/^\s+/;function i(o){return o&&o.slice(0,e(o)+1).replace(r,"")}return qp=i,qp}var Lp,FS;function UL(){if(FS)return Lp;FS=1;var e=VL(),r=Bt(),i=Ai(),o=NaN,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;function d(h){if(typeof h=="number")return h;if(i(h))return o;if(r(h)){var p=typeof h.valueOf=="function"?h.valueOf():h;h=r(p)?p+"":p}if(typeof h!="string")return h===0?h:+h;h=e(h);var g=u.test(h);return g||l.test(h)?c(h.slice(2),g?2:8):a.test(h)?o:+h}return Lp=d,Lp}var jp,$S;function Uk(){if($S)return jp;$S=1;var e=UL(),r=1/0,i=17976931348623157e292;function o(a){if(!a)return a===0?a:0;if(a=e(a),a===r||a===-r){var u=a<0?-1:1;return u*i}return a===a?a:0}return jp=o,jp}var Op,BS;function GL(){if(BS)return Op;BS=1;var e=Uk();function r(i){var o=e(i),a=o%1;return o===o?a?o-a:o:0}return Op=r,Op}var zp,HS;function WL(){if(HS)return zp;HS=1;var e=Ok(),r=Tn(),i=GL(),o=Math.max;function a(u,l,c){var d=u==null?0:u.length;if(!d)return-1;var h=c==null?0:i(c);return h<0&&(h=o(d+h,0)),e(u,r(l,3),h)}return zp=a,zp}var Dp,VS;function YL(){if(VS)return Dp;VS=1;var e=BL(),r=WL(),i=e(r);return Dp=i,Dp}var Fp,US;function Gk(){if(US)return Fp;US=1;var e=Gv();function r(i){var o=i==null?0:i.length;return o?e(i,1):[]}return Fp=r,Fp}var $p,GS;function KL(){if(GS)return $p;GS=1;var e=Bv(),r=vk(),i=qr();function o(a,u){return a==null?a:e(a,r(u),i)}return $p=o,$p}var Bp,WS;function XL(){if(WS)return Bp;WS=1;function e(r){var i=r==null?0:r.length;return i?r[i-1]:void 0}return Bp=e,Bp}var Hp,YS;function QL(){if(YS)return Hp;YS=1;var e=cu(),r=Hv(),i=Tn();function o(a,u){var l={};return u=i(u,3),r(a,function(c,d,h){e(l,d,u(c,d,h))}),l}return Hp=o,Hp}var Vp,KS;function Yv(){if(KS)return Vp;KS=1;var e=Ai();function r(i,o,a){for(var u=-1,l=i.length;++ui}return Up=e,Up}var Gp,QS;function JL(){if(QS)return Gp;QS=1;var e=Yv(),r=ZL(),i=Lr();function o(a){return a&&a.length?e(a,i,r):void 0}return Gp=o,Gp}var Wp,ZS;function Wk(){if(ZS)return Wp;ZS=1;var e=cu(),r=Ri();function i(o,a,u){(u!==void 0&&!r(o[a],u)||u===void 0&&!(a in o))&&e(o,a,u)}return Wp=i,Wp}var Yp,JS;function ej(){if(JS)return Yp;JS=1;var e=Pr(),r=gu(),i=vn(),o="[object Object]",a=Function.prototype,u=Object.prototype,l=a.toString,c=u.hasOwnProperty,d=l.call(Object);function h(p){if(!i(p)||e(p)!=o)return!1;var g=r(p);if(g===null)return!0;var m=c.call(g,"constructor")&&g.constructor;return typeof m=="function"&&m instanceof m&&l.call(m)==d}return Yp=h,Yp}var Kp,e2;function Yk(){if(e2)return Kp;e2=1;function e(r,i){if(!(i==="constructor"&&typeof r[i]=="function")&&i!="__proto__")return r[i]}return Kp=e,Kp}var Xp,t2;function tj(){if(t2)return Xp;t2=1;var e=Jo(),r=qr();function i(o){return e(o,r(o))}return Xp=i,Xp}var Qp,n2;function nj(){if(n2)return Qp;n2=1;var e=Wk(),r=rk(),i=dk(),o=ik(),a=pk(),u=ea(),l=Xe(),c=zk(),d=Ti(),h=Zo(),p=Bt(),g=ej(),m=ta(),w=Yk(),S=tj();function b(x,E,C,_,k,R,M){var T=w(x,C),O=w(E,C),z=M.get(O);if(z){e(x,C,z);return}var W=R?R(T,O,C+"",x,E,M):void 0,L=W===void 0;if(L){var $=l(O),Q=!$&&d(O),A=!$&&!Q&&m(O);W=O,$||Q||A?l(T)?W=T:c(T)?W=o(T):Q?(L=!1,W=r(O,!0)):A?(L=!1,W=i(O,!0)):W=[]:g(O)||u(O)?(W=T,u(T)?W=S(T):(!p(T)||h(T))&&(W=a(O))):L=!1}L&&(M.set(O,W),k(W,O,_,R,M),M.delete(O)),e(x,C,W)}return Qp=b,Qp}var Zp,r2;function rj(){if(r2)return Zp;r2=1;var e=lu(),r=Wk(),i=Bv(),o=nj(),a=Bt(),u=qr(),l=Yk();function c(d,h,p,g,m){d!==h&&i(h,function(w,S){if(m||(m=new e),a(w))o(d,h,S,p,c,g,m);else{var b=g?g(l(d,S),w,S+"",d,h,m):void 0;b===void 0&&(b=w),r(d,S,b)}},u)}return Zp=c,Zp}var Jp,i2;function ij(){if(i2)return Jp;i2=1;var e=xu(),r=_u();function i(o){return e(function(a,u){var l=-1,c=u.length,d=c>1?u[c-1]:void 0,h=c>2?u[2]:void 0;for(d=o.length>3&&typeof d=="function"?(c--,d):void 0,h&&r(u[0],u[1],h)&&(d=c<3?void 0:d,c=1),a=Object(a);++lo||c&&d&&p&&!h&&!g||u&&d&&p||!a&&p||!l)return 1;if(!u&&!c&&!g&&i=h)return p;var g=a[u];return p*(g=="desc"?-1:1)}}return i.index-o.index}return gg=r,gg}var vg,_2;function xj(){if(_2)return vg;_2=1;var e=mu(),r=wu(),i=Tn(),o=Pk(),a=mj(),u=hu(),l=wj(),c=Lr(),d=Xe();function h(p,g,m){g.length?g=e(g,function(b){return d(b)?function(x){return r(x,b.length===1?b[0]:b)}:b}):g=[c];var w=-1;g=e(g,u(i));var S=o(p,function(b,x,E){var C=e(g,function(_){return _(b)});return{criteria:C,index:++w,value:b}});return a(S,function(b,x){return l(b,x,m)})}return vg=h,vg}var mg,S2;function _j(){if(S2)return mg;S2=1;var e=Gv(),r=xj(),i=xu(),o=_u(),a=i(function(u,l){if(u==null)return[];var c=l.length;return c>1&&o(u,l[0],l[1])?l=[]:c>2&&o(l[0],l[1],l[2])&&(l=[l[0]]),r(u,e(l,1),[])});return mg=a,mg}var yg,E2;function Sj(){if(E2)return yg;E2=1;var e=kk(),r=0;function i(o){var a=++r;return e(o)+a}return yg=i,yg}var wg,b2;function Ej(){if(b2)return wg;b2=1;function e(r,i,o){for(var a=-1,u=r.length,l=i.length,c={};++a0;--x)if(b=p[x].dequeue(),b){m=m.concat(l(h,p,g,b,!0));break}}}return m}function l(h,p,g,m,w){var S=w?[]:void 0;return e.forEach(h.inEdges(m.v),function(b){var x=h.edge(b),E=h.node(b.v);w&&S.push({v:b.v,w:b.w}),E.out-=x,d(p,g,E)}),e.forEach(h.outEdges(m.v),function(b){var x=h.edge(b),E=b.w,C=h.node(E);C.in-=x,d(p,g,C)}),h.removeNode(m.v),S}function c(h,p){var g=new r,m=0,w=0;e.forEach(h.nodes(),function(x){g.setNode(x,{v:x,in:0,out:0})}),e.forEach(h.edges(),function(x){var E=g.edge(x.v,x.w)||0,C=p(x),_=E+C;g.setEdge(x.v,x.w,_),w=Math.max(w,g.node(x.v).out+=C),m=Math.max(m,g.node(x.w).in+=C)});var S=e.range(w+m+3).map(function(){return new i}),b=m+1;return e.forEach(g.nodes(),function(x){d(S,b,g.node(x))}),{graph:g,buckets:S,zeroIdx:b}}function d(h,p,g){g.out?g.in?h[g.out-g.in+p].enqueue(g):h[h.length-1].enqueue(g):h[0].enqueue(g)}return Eg}var bg,R2;function Nj(){if(R2)return bg;R2=1;var e=De(),r=Cj();bg={run:i,undo:a};function i(u){var l=u.graph().acyclicer==="greedy"?r(u,c(u)):o(u);e.forEach(l,function(d){var h=u.edge(d);u.removeEdge(d),h.forwardName=d.name,h.reversed=!0,u.setEdge(d.w,d.v,h,e.uniqueId("rev"))});function c(d){return function(h){return d.edge(h).weight}}}function o(u){var l=[],c={},d={};function h(p){e.has(d,p)||(d[p]=!0,c[p]=!0,e.forEach(u.outEdges(p),function(g){e.has(c,g.w)?l.push(g):h(g.w)}),delete c[p])}return e.forEach(u.nodes(),h),l}function a(u){e.forEach(u.edges(),function(l){var c=u.edge(l);if(c.reversed){u.removeEdge(l);var d=c.forwardName;delete c.reversed,delete c.forwardName,u.setEdge(l.w,l.v,c,d)}})}return bg}var kg,M2;function St(){if(M2)return kg;M2=1;var e=De(),r=nn().Graph;kg={addDummyNode:i,simplify:o,asNonCompoundGraph:a,successorWeights:u,predecessorWeights:l,intersectRect:c,buildLayerMatrix:d,normalizeRanks:h,removeEmptyRanks:p,addBorderNode:g,maxRank:m,partition:w,time:S,notime:b};function i(x,E,C,_){var k;do k=e.uniqueId(_);while(x.hasNode(k));return C.dummy=E,x.setNode(k,C),k}function o(x){var E=new r().setGraph(x.graph());return e.forEach(x.nodes(),function(C){E.setNode(C,x.node(C))}),e.forEach(x.edges(),function(C){var _=E.edge(C.v,C.w)||{weight:0,minlen:1},k=x.edge(C);E.setEdge(C.v,C.w,{weight:_.weight+k.weight,minlen:Math.max(_.minlen,k.minlen)})}),E}function a(x){var E=new r({multigraph:x.isMultigraph()}).setGraph(x.graph());return e.forEach(x.nodes(),function(C){x.children(C).length||E.setNode(C,x.node(C))}),e.forEach(x.edges(),function(C){E.setEdge(C,x.edge(C))}),E}function u(x){var E=e.map(x.nodes(),function(C){var _={};return e.forEach(x.outEdges(C),function(k){_[k.w]=(_[k.w]||0)+x.edge(k).weight}),_});return e.zipObject(x.nodes(),E)}function l(x){var E=e.map(x.nodes(),function(C){var _={};return e.forEach(x.inEdges(C),function(k){_[k.v]=(_[k.v]||0)+x.edge(k).weight}),_});return e.zipObject(x.nodes(),E)}function c(x,E){var C=x.x,_=x.y,k=E.x-C,R=E.y-_,M=x.width/2,T=x.height/2;if(!k&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var O,z;return Math.abs(R)*M>Math.abs(k)*T?(R<0&&(T=-T),O=T*k/R,z=T):(k<0&&(M=-M),O=M,z=M*R/k),{x:C+O,y:_+z}}function d(x){var E=e.map(e.range(m(x)+1),function(){return[]});return e.forEach(x.nodes(),function(C){var _=x.node(C),k=_.rank;e.isUndefined(k)||(E[k][_.order]=C)}),E}function h(x){var E=e.min(e.map(x.nodes(),function(C){return x.node(C).rank}));e.forEach(x.nodes(),function(C){var _=x.node(C);e.has(_,"rank")&&(_.rank-=E)})}function p(x){var E=e.min(e.map(x.nodes(),function(R){return x.node(R).rank})),C=[];e.forEach(x.nodes(),function(R){var M=x.node(R).rank-E;C[M]||(C[M]=[]),C[M].push(R)});var _=0,k=x.graph().nodeRankFactor;e.forEach(C,function(R,M){e.isUndefined(R)&&M%k!==0?--_:_&&e.forEach(R,function(T){x.node(T).rank+=_})})}function g(x,E,C,_){var k={width:0,height:0};return arguments.length>=4&&(k.rank=C,k.order=_),i(x,"border",k,E)}function m(x){return e.max(e.map(x.nodes(),function(E){var C=x.node(E).rank;if(!e.isUndefined(C))return C}))}function w(x,E){var C={lhs:[],rhs:[]};return e.forEach(x,function(_){E(_)?C.lhs.push(_):C.rhs.push(_)}),C}function S(x,E){var C=e.now();try{return E()}finally{console.log(x+" time: "+(e.now()-C)+"ms")}}function b(x,E){return E()}return kg}var Cg,T2;function Ij(){if(T2)return Cg;T2=1;var e=De(),r=St();Cg={run:i,undo:a};function i(u){u.graph().dummyChains=[],e.forEach(u.edges(),function(l){o(u,l)})}function o(u,l){var c=l.v,d=u.node(c).rank,h=l.w,p=u.node(h).rank,g=l.name,m=u.edge(l),w=m.labelRank;if(p!==d+1){u.removeEdge(l);var S,b,x;for(x=0,++d;dz.lim&&(W=z,L=!0);var $=e.filter(k.edges(),function(Q){return L===C(_,_.node(Q.v),W)&&L!==C(_,_.node(Q.w),W)});return e.minBy($,function(Q){return i(k,Q)})}function b(_,k,R,M){var T=R.v,O=R.w;_.removeEdge(T,O),_.setEdge(M.v,M.w,{}),g(_),d(_,k),x(_,k)}function x(_,k){var R=e.find(_.nodes(),function(T){return!k.node(T).parent}),M=a(_,R);M=M.slice(1),e.forEach(M,function(T){var O=_.node(T).parent,z=k.edge(T,O),W=!1;z||(z=k.edge(O,T),W=!0),k.node(T).rank=k.node(O).rank+(W?z.minlen:-z.minlen)})}function E(_,k,R){return _.hasEdge(k,R)}function C(_,k,R){return R.low<=k.lim&&k.lim<=R.lim}return Rg}var Mg,L2;function Mj(){if(L2)return Mg;L2=1;var e=Us(),r=e.longestPath,i=Xk(),o=Rj();Mg=a;function a(d){switch(d.graph().ranker){case"network-simplex":c(d);break;case"tight-tree":l(d);break;case"longest-path":u(d);break;default:c(d)}}var u=r;function l(d){r(d),i(d)}function c(d){o(d)}return Mg}var Tg,j2;function Tj(){if(j2)return Tg;j2=1;var e=De();Tg=r;function r(a){var u=o(a);e.forEach(a.graph().dummyChains,function(l){for(var c=a.node(l),d=c.edgeObj,h=i(a,u,d.v,d.w),p=h.path,g=h.lca,m=0,w=p[m],S=!0;l!==d.w;){if(c=a.node(l),S){for(;(w=p[m])!==g&&a.node(w).maxRankp||g>u[m].lim));for(w=m,m=c;(m=a.parent(m))!==w;)h.push(m);return{path:d.concat(h.reverse()),lca:w}}function o(a){var u={},l=0;function c(d){var h=l;e.forEach(a.children(d),c),u[d]={low:h,lim:l++}}return e.forEach(a.children(),c),u}return Tg}var Pg,O2;function Pj(){if(O2)return Pg;O2=1;var e=De(),r=St();Pg={run:i,cleanup:l};function i(c){var d=r.addDummyNode(c,"root",{},"_root"),h=a(c),p=e.max(e.values(h))-1,g=2*p+1;c.graph().nestingRoot=d,e.forEach(c.edges(),function(w){c.edge(w).minlen*=g});var m=u(c)+1;e.forEach(c.children(),function(w){o(c,d,g,m,p,h,w)}),c.graph().nodeRankFactor=g}function o(c,d,h,p,g,m,w){var S=c.children(w);if(!S.length){w!==d&&c.setEdge(d,w,{weight:0,minlen:h});return}var b=r.addBorderNode(c,"_bt"),x=r.addBorderNode(c,"_bb"),E=c.node(w);c.setParent(b,w),E.borderTop=b,c.setParent(x,w),E.borderBottom=x,e.forEach(S,function(C){o(c,d,h,p,g,m,C);var _=c.node(C),k=_.borderTop?_.borderTop:C,R=_.borderBottom?_.borderBottom:C,M=_.borderTop?p:2*p,T=k!==R?1:g-m[w]+1;c.setEdge(b,k,{weight:M,minlen:T,nestingEdge:!0}),c.setEdge(R,x,{weight:M,minlen:T,nestingEdge:!0})}),c.parent(w)||c.setEdge(d,b,{weight:0,minlen:g+m[w]})}function a(c){var d={};function h(p,g){var m=c.children(p);m&&m.length&&e.forEach(m,function(w){h(w,g+1)}),d[p]=g}return e.forEach(c.children(),function(p){h(p,1)}),d}function u(c){return e.reduce(c.edges(),function(d,h){return d+c.edge(h).weight},0)}function l(c){var d=c.graph();c.removeNode(d.nestingRoot),delete d.nestingRoot,e.forEach(c.edges(),function(h){var p=c.edge(h);p.nestingEdge&&c.removeEdge(h)})}return Pg}var Ag,z2;function Aj(){if(z2)return Ag;z2=1;var e=De(),r=St();Ag=i;function i(a){function u(l){var c=a.children(l),d=a.node(l);if(c.length&&e.forEach(c,u),e.has(d,"minRank")){d.borderLeft=[],d.borderRight=[];for(var h=d.minRank,p=d.maxRank+1;h0;)w%2&&(S+=p[w+1]),w=w-1>>1,p[w]+=m.weight;g+=m.weight*S})),g}return jg}var Og,B2;function Oj(){if(B2)return Og;B2=1;var e=De();Og=r;function r(i,o){return e.map(o,function(a){var u=i.inEdges(a);if(u.length){var l=e.reduce(u,function(c,d){var h=i.edge(d),p=i.node(d.v);return{sum:c.sum+h.weight*p.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:a,barycenter:l.sum/l.weight,weight:l.weight}}else return{v:a}})}return Og}var zg,H2;function zj(){if(H2)return zg;H2=1;var e=De();zg=r;function r(a,u){var l={};e.forEach(a,function(d,h){var p=l[d.v]={indegree:0,in:[],out:[],vs:[d.v],i:h};e.isUndefined(d.barycenter)||(p.barycenter=d.barycenter,p.weight=d.weight)}),e.forEach(u.edges(),function(d){var h=l[d.v],p=l[d.w];!e.isUndefined(h)&&!e.isUndefined(p)&&(p.indegree++,h.out.push(l[d.w]))});var c=e.filter(l,function(d){return!d.indegree});return i(c)}function i(a){var u=[];function l(h){return function(p){p.merged||(e.isUndefined(p.barycenter)||e.isUndefined(h.barycenter)||p.barycenter>=h.barycenter)&&o(h,p)}}function c(h){return function(p){p.in.push(h),--p.indegree===0&&a.push(p)}}for(;a.length;){var d=a.pop();u.push(d),e.forEach(d.in.reverse(),l(d)),e.forEach(d.out,c(d))}return e.map(e.filter(u,function(h){return!h.merged}),function(h){return e.pick(h,["vs","i","barycenter","weight"])})}function o(a,u){var l=0,c=0;a.weight&&(l+=a.barycenter*a.weight,c+=a.weight),u.weight&&(l+=u.barycenter*u.weight,c+=u.weight),a.vs=u.vs.concat(a.vs),a.barycenter=l/c,a.weight=c,a.i=Math.min(u.i,a.i),u.merged=!0}return zg}var Dg,V2;function Dj(){if(V2)return Dg;V2=1;var e=De(),r=St();Dg=i;function i(u,l){var c=r.partition(u,function(b){return e.has(b,"barycenter")}),d=c.lhs,h=e.sortBy(c.rhs,function(b){return-b.i}),p=[],g=0,m=0,w=0;d.sort(a(!!l)),w=o(p,h,w),e.forEach(d,function(b){w+=b.vs.length,p.push(b.vs),g+=b.barycenter*b.weight,m+=b.weight,w=o(p,h,w)});var S={vs:e.flatten(p,!0)};return m&&(S.barycenter=g/m,S.weight=m),S}function o(u,l,c){for(var d;l.length&&(d=e.last(l)).i<=c;)l.pop(),u.push(d.vs),c++;return c}function a(u){return function(l,c){return l.barycenterc.barycenter?1:u?c.i-l.i:l.i-c.i}}return Dg}var Fg,U2;function Fj(){if(U2)return Fg;U2=1;var e=De(),r=Oj(),i=zj(),o=Dj();Fg=a;function a(c,d,h,p){var g=c.children(d),m=c.node(d),w=m?m.borderLeft:void 0,S=m?m.borderRight:void 0,b={};w&&(g=e.filter(g,function(R){return R!==w&&R!==S}));var x=r(c,g);e.forEach(x,function(R){if(c.children(R.v).length){var M=a(c,R.v,h,p);b[R.v]=M,e.has(M,"barycenter")&&l(R,M)}});var E=i(x,h);u(E,b);var C=o(E,p);if(w&&(C.vs=e.flatten([w,C.vs,S],!0),c.predecessors(w).length)){var _=c.node(c.predecessors(w)[0]),k=c.node(c.predecessors(S)[0]);e.has(C,"barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+_.order+k.order)/(C.weight+2),C.weight+=2}return C}function u(c,d){e.forEach(c,function(h){h.vs=e.flatten(h.vs.map(function(p){return d[p]?d[p].vs:p}),!0)})}function l(c,d){e.isUndefined(c.barycenter)?(c.barycenter=d.barycenter,c.weight=d.weight):(c.barycenter=(c.barycenter*c.weight+d.barycenter*d.weight)/(c.weight+d.weight),c.weight+=d.weight)}return Fg}var $g,G2;function $j(){if(G2)return $g;G2=1;var e=De(),r=nn().Graph;$g=i;function i(a,u,l){var c=o(a),d=new r({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(function(h){return a.node(h)});return e.forEach(a.nodes(),function(h){var p=a.node(h),g=a.parent(h);(p.rank===u||p.minRank<=u&&u<=p.maxRank)&&(d.setNode(h),d.setParent(h,g||c),e.forEach(a[l](h),function(m){var w=m.v===h?m.w:m.v,S=d.edge(w,h),b=e.isUndefined(S)?0:S.weight;d.setEdge(w,h,{weight:a.edge(m).weight+b})}),e.has(p,"minRank")&&d.setNode(h,{borderLeft:p.borderLeft[u],borderRight:p.borderRight[u]}))}),d}function o(a){for(var u;a.hasNode(u=e.uniqueId("_root")););return u}return $g}var Bg,W2;function Bj(){if(W2)return Bg;W2=1;var e=De();Bg=r;function r(i,o,a){var u={},l;e.forEach(a,function(c){for(var d=i.parent(c),h,p;d;){if(h=i.parent(d),h?(p=u[h],u[h]=d):(p=l,l=d),p&&p!==d){o.setEdge(p,d);return}d=h}})}return Bg}var Hg,Y2;function Hj(){if(Y2)return Hg;Y2=1;var e=De(),r=Lj(),i=jj(),o=Fj(),a=$j(),u=Bj(),l=nn().Graph,c=St();Hg=d;function d(m){var w=c.maxRank(m),S=h(m,e.range(1,w+1),"inEdges"),b=h(m,e.range(w-1,-1,-1),"outEdges"),x=r(m);g(m,x);for(var E=Number.POSITIVE_INFINITY,C,_=0,k=0;k<4;++_,++k){p(_%2?S:b,_%4>=2),x=c.buildLayerMatrix(m);var R=i(m,x);RW)&&l(_,Q,L)})})}function R(M,T){var O=-1,z,W=0;return e.forEach(T,function(L,$){if(E.node(L).dummy==="border"){var Q=E.predecessors(L);Q.length&&(z=E.node(Q[0]).order,k(T,W,$,O,z),W=$,O=z)}k(T,W,T.length,z,M.length)}),T}return e.reduce(C,R),_}function u(E,C){if(E.node(C).dummy)return e.find(E.predecessors(C),function(_){return E.node(_).dummy})}function l(E,C,_){if(C>_){var k=C;C=_,_=k}var R=E[C];R||(E[C]=R={}),R[_]=!0}function c(E,C,_){if(C>_){var k=C;C=_,_=k}return e.has(E[C],_)}function d(E,C,_,k){var R={},M={},T={};return e.forEach(C,function(O){e.forEach(O,function(z,W){R[z]=z,M[z]=z,T[z]=W})}),e.forEach(C,function(O){var z=-1;e.forEach(O,function(W){var L=k(W);if(L.length){L=e.sortBy(L,function(V){return T[V]});for(var $=(L.length-1)/2,Q=Math.floor($),A=Math.ceil($);Q<=A;++Q){var G=L[Q];M[W]===W&&z({})),o.setGraph({rankdir:i,nodesep:50,ranksep:100}),e.forEach(u=>{o.setNode(u.id,{width:nE,height:rE})}),r.forEach(u=>{o.setEdge(u.source,u.target)}),tE.layout(o),{nodes:e.map(u=>{const l=o.node(u.id);return l?{...u,position:{x:l.x-nE/2,y:l.y-rE/2}}:u}),edges:r}}function t5(){const{edges:e,selectedNodeId:r,setSelectedNode:i,getFilteredNodes:o,orientation:a,viewMode:u}=Ii(),[l,c]=ie.useState([]),[d,h]=ie.useState([]);ie.useEffect(()=>{const m=o();if(m.length===0){c([]),h([]);return}const w=new Set(m.map(C=>C.id)),S=m.map(C=>({id:C.id,type:"custom",position:{x:0,y:0},data:{label:C.name,type:C.type,status:C.data.status,category:C.data.category,ip:C.data.ip},selected:C.id===r})),b=e.filter(C=>w.has(C.source)&&w.has(C.target)).map(C=>({id:C.id,source:C.source,target:C.target,type:"smoothstep",animated:C.source===r||C.target===r,style:{stroke:C.source===r||C.target===r?"#38BDF8":"#475569",strokeWidth:C.source===r||C.target===r?2:1},markerEnd:{type:"arrowclosed",color:C.source===r||C.target===r?"#38BDF8":"#475569"}})),{nodes:x,edges:E}=e5(S,b,a);c(x),h(E)},[o,e,r,a,u]);const p=ie.useCallback((m,w)=>{i(w.id)},[i]),g=ie.useCallback(()=>{i(null)},[i]);return I.jsx("div",{className:"w-full h-full",children:I.jsxs(g3,{nodes:l,edges:d,onNodeClick:p,onPaneClick:g,nodeTypes:Jj,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},proOptions:{hideAttribution:!0},children:[I.jsx(x3,{color:"#334155",gap:20,size:1}),I.jsx(N3,{className:"!bg-slate-700 !border-slate-600 !rounded-lg !shadow-lg"}),I.jsx(F3,{className:"!bg-slate-800 !border-slate-700",nodeColor:m=>{var w,S;return Ni(((w=m.data)==null?void 0:w.type)||"service",((S=m.data)==null?void 0:S.category)||void 0)},maskColor:"rgba(15, 23, 42, 0.8)"})]})})}const n5=3e4;function r5(){const{setNodes:e,setEdges:r,setNetworkInfo:i,setHosts:o,setLastUpdated:a,setIsLoading:u,leftPanelOpen:l,rightPanelOpen:c,isLoading:d}=Ii(),h=ie.useRef(d);h.current=d;const p=ie.useCallback(async()=>{if(!h.current){u(!0);try{const m=await nA(["ubuntu","grizzley","truenas","ice","panda","proxmox"]),{nodes:w,edges:S}=tA(m.hosts,Tc),b=m.hosts.map(x=>({name:x.name,ip:x.ip,type:x.name==="ubuntu"?"vm":x.name==="proxmox"||x.name==="truenas"?"physical":"rpi5",role:x.name==="ubuntu"?"Primary Docker Host":x.name==="grizzley"?"Edge Services":x.name==="truenas"?"Storage (NAS)":x.name==="proxmox"?"Hypervisor":"Host",containers:x.containers.map(E=>E.name)}));e(w),r(S),i(Tc),o(b),a(new Date)}catch(g){console.error("Discovery failed:",g),e([]),r([]),i(Tc),o(Z3),a(new Date)}finally{u(!1)}}},[e,r,i,o,a,u]);return ie.useEffect(()=>{p();const g=setInterval(p,n5);return()=>clearInterval(g)},[p]),I.jsx(Fb,{children:I.jsxs("div",{className:"h-screen w-screen flex flex-col bg-slate-900",children:[I.jsx(bA,{onRefresh:p,isLoading:d}),I.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[l&&I.jsx(NA,{}),I.jsx("div",{className:"flex-1",children:I.jsx(t5,{})}),c&&I.jsx(RA,{})]}),I.jsx(i5,{})]})})}function i5(){const{lastUpdated:e,nodes:r}=Ii(),[i,o]=ie.useState(30),a=u=>u?u.toLocaleTimeString():"Never";return ie.useEffect(()=>{o(30);const u=setInterval(()=>{o(l=>l<=1?30:l-1)},1e3);return()=>clearInterval(u)},[e]),I.jsxs("div",{className:"h-8 bg-slate-800 border-t border-slate-700 px-4 flex items-center justify-between text-xs text-slate-400",children:[I.jsxs("span",{children:["Nodes: ",r.length]}),I.jsxs("div",{className:"flex items-center gap-4",children:[I.jsxs("span",{children:["Next refresh: ",i,"s"]}),I.jsxs("span",{children:["Last updated: ",a(e)]})]})]})}ON.createRoot(document.getElementById("root")).render(I.jsx(hi.StrictMode,{children:I.jsx(r5,{})}));