import{r as A,g as Of,R as I}from"./acebuilds-fbc0ccc6.js";function W0(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Ff={exports:{}},be={},Hf={exports:{}},Bf={};/** * @license React * scheduler.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. */(function(e){function t(k,S){var T=k.length;k.push(S);e:for(;0>>1,F=k[D];if(0>>1;Do(K,T))Qo(Z,K)?(k[D]=Z,k[Q]=T,D=Q):(k[D]=K,k[U]=T,D=U);else if(Qo(Z,T))k[D]=Z,k[Q]=T,D=Q;else break e}}return S}function o(k,S){var T=k.sortIndex-S.sortIndex;return T!==0?T:k.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,s=l.now();e.unstable_now=function(){return l.now()-s}}var u=[],a=[],c=1,f=null,p=3,g=!1,x=!1,v=!1,_=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(k){for(var S=n(a);S!==null;){if(S.callback===null)r(a);else if(S.startTime<=k)r(a),S.sortIndex=S.expirationTime,t(u,S);else break;S=n(a)}}function y(k){if(v=!1,m(k),!x)if(n(u)!==null)x=!0,P(E);else{var S=n(a);S!==null&&$(y,S.startTime-k)}}function E(k,S){x=!1,v&&(v=!1,d(C),C=-1),g=!0;var T=p;try{for(m(S),f=n(u);f!==null&&(!(f.expirationTime>S)||k&&!H());){var D=f.callback;if(typeof D=="function"){f.callback=null,p=f.priorityLevel;var F=D(f.expirationTime<=S);S=e.unstable_now(),typeof F=="function"?f.callback=F:f===n(u)&&r(u),m(S)}else r(u);f=n(u)}if(f!==null)var W=!0;else{var U=n(a);U!==null&&$(y,U.startTime-S),W=!1}return W}finally{f=null,p=T,g=!1}}var M=!1,N=null,C=-1,R=5,L=-1;function H(){return!(e.unstable_now()-Lk||125D?(k.sortIndex=T,t(a,k),n(u)===null&&k===n(a)&&(v?(d(C),C=-1):v=!0,$(y,T-D))):(k.sortIndex=F,t(u,k),x||g||(x=!0,P(E))),k},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(k){var S=p;return function(){var T=p;p=S;try{return k.apply(this,arguments)}finally{p=T}}}})(Bf);Hf.exports=Bf;var Y0=Hf.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 X0=A,qe=Y0;function B(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ss=Object.prototype.hasOwnProperty,j0=/^[: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]*$/,Wa={},Ya={};function K0(e){return Ss.call(Ya,e)?!0:Ss.call(Wa,e)?!1:j0.test(e)?Ya[e]=!0:(Wa[e]=!0,!1)}function Q0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Z0(e,t,n,r){if(t===null||typeof t>"u"||Q0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $e(e,t,n,r,o,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var Ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ce[e]=new $e(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ce[t]=new $e(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ce[e]=new $e(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ce[e]=new $e(e,2,!1,e,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(e){Ce[e]=new $e(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ce[e]=new $e(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ce[e]=new $e(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ce[e]=new $e(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ce[e]=new $e(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tu=/[\-:]([a-z])/g;function zu(e){return e[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(e){var t=e.replace(Tu,zu);Ce[t]=new $e(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Tu,zu);Ce[t]=new $e(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Tu,zu);Ce[t]=new $e(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ce[e]=new $e(e,1,!1,e.toLowerCase(),null,!1,!1)});Ce.xlinkHref=new $e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ce[e]=new $e(e,1,!1,e.toLowerCase(),null,!0,!0)});function Au(e,t,n,r){var o=Ce.hasOwnProperty(t)?Ce[t]:null;(o!==null?o.type!==0:r||!(2s||o[l]!==i[s]){var u=` `+o[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=s);break}}}finally{Vl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?br(e):""}function G0(e){switch(e.tag){case 5:return br(e.type);case 16:return br("Lazy");case 13:return br("Suspense");case 19:return br("SuspenseList");case 0:case 2:case 15:return e=Ul(e.type,!1),e;case 11:return e=Ul(e.type.render,!1),e;case 1:return e=Ul(e.type,!0),e;default:return""}}function Ns(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case rr:return"Fragment";case nr:return"Portal";case Es:return"Profiler";case Du:return"StrictMode";case _s:return"Suspense";case ks:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Wf:return(e.displayName||"Context")+".Consumer";case Uf:return(e._context.displayName||"Context")+".Provider";case Iu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ru:return t=e.displayName||null,t!==null?t:Ns(e.type)||"Memo";case tn:t=e._payload,e=e._init;try{return Ns(e(t))}catch{}}return null}function q0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ns(t);case 8:return t===Du?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function J0(e){var t=Xf(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qo(e){e._valueTracker||(e._valueTracker=J0(e))}function jf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Xf(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Di(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Cs(e,t){var n=t.checked;return de({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ja(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=xn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Kf(e,t){t=t.checked,t!=null&&Au(e,"checked",t,!1)}function Ms(e,t){Kf(e,t);var n=xn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ps(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ps(e,t.type,xn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ka(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ps(e,t,n){(t!=="number"||Di(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var eo=Array.isArray;function gr(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Zo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function vo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var lo={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},b0=["Webkit","ms","Moz","O"];Object.keys(lo).forEach(function(e){b0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),lo[t]=lo[e]})});function qf(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||lo.hasOwnProperty(e)&&lo[e]?(""+t).trim():t+"px"}function Jf(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=qf(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var eg=de({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 As(e,t){if(t){if(eg[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(B(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(B(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(B(61))}if(t.style!=null&&typeof t.style!="object")throw Error(B(62))}}function Ds(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Is=null;function Lu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rs=null,mr=null,yr=null;function Ga(e){if(e=Uo(e)){if(typeof Rs!="function")throw Error(B(280));var t=e.stateNode;t&&(t=yl(t),Rs(e.stateNode,e.type,t))}}function bf(e){mr?yr?yr.push(e):yr=[e]:mr=e}function ed(){if(mr){var e=mr,t=yr;if(yr=mr=null,Ga(e),t)for(e=0;e>>=0,e===0?32:31-(fg(e)/dg|0)|0}var Go=64,qo=4194304;function to(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $i(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var s=l&~o;s!==0?r=to(s):(i&=l,i!==0&&(r=to(i)))}else l=n&~o,l!==0?r=to(l):i!==0&&(r=to(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Bo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yt(t),e[t]=n}function mg(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=uo),ic=String.fromCharCode(32),lc=!1;function xd(e,t){switch(e){case"keyup":return Yg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var or=!1;function jg(e,t){switch(e){case"compositionend":return Sd(t);case"keypress":return t.which!==32?null:(lc=!0,ic);case"textInput":return e=t.data,e===ic&&lc?null:e;default:return null}}function Kg(e,t){if(or)return e==="compositionend"||!Wu&&xd(e,t)?(e=vd(),wi=Bu=un=null,or=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cc(n)}}function Nd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cd(){for(var e=window,t=Di();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Di(e.document)}return t}function Yu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function nm(e){var t=Cd(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Nd(n.ownerDocument.documentElement,n)){if(r!==null&&Yu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=fc(n,i);var l=fc(n,r);o&&l&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ir=null,Bs=null,co=null,Vs=!1;function dc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vs||ir==null||ir!==Di(r)||(r=ir,"selectionStart"in r&&Yu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),co&&ko(co,r)||(co=r,r=Hi(Bs,"onSelect"),0ur||(e.current=Ks[ur],Ks[ur]=null,ur--)}function oe(e,t){ur++,Ks[ur]=e.current,e.current=t}var Sn={},De=kn(Sn),Ue=kn(!1),Vn=Sn;function Cr(e,t){var n=e.type.contextTypes;if(!n)return Sn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function We(e){return e=e.childContextTypes,e!=null}function Vi(){le(Ue),le(De)}function wc(e,t,n){if(De.current!==Sn)throw Error(B(168));oe(De,t),oe(Ue,n)}function Ld(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(B(108,q0(e)||"Unknown",o));return de({},n,r)}function Ui(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Sn,Vn=De.current,oe(De,e),oe(Ue,Ue.current),!0}function xc(e,t,n){var r=e.stateNode;if(!r)throw Error(B(169));n?(e=Ld(e,t,Vn),r.__reactInternalMemoizedMergedChildContext=e,le(Ue),le(De),oe(De,e)):le(Ue),oe(Ue,n)}var Ht=null,vl=!1,ns=!1;function $d(e){Ht===null?Ht=[e]:Ht.push(e)}function hm(e){vl=!0,$d(e)}function Nn(){if(!ns&&Ht!==null){ns=!0;var e=0,t=b;try{var n=Ht;for(b=1;e>=l,o-=l,Bt=1<<32-yt(t)+o|n<C?(R=N,N=null):R=N.sibling;var L=p(d,N,m[C],y);if(L===null){N===null&&(N=R);break}e&&N&&L.alternate===null&&t(d,N),h=i(L,h,C),M===null?E=L:M.sibling=L,M=L,N=R}if(C===m.length)return n(d,N),ae&&zn(d,C),E;if(N===null){for(;CC?(R=N,N=null):R=N.sibling;var H=p(d,N,L.value,y);if(H===null){N===null&&(N=R);break}e&&N&&H.alternate===null&&t(d,N),h=i(H,h,C),M===null?E=H:M.sibling=H,M=H,N=R}if(L.done)return n(d,N),ae&&zn(d,C),E;if(N===null){for(;!L.done;C++,L=m.next())L=f(d,L.value,y),L!==null&&(h=i(L,h,C),M===null?E=L:M.sibling=L,M=L);return ae&&zn(d,C),E}for(N=r(d,N);!L.done;C++,L=m.next())L=g(N,d,C,L.value,y),L!==null&&(e&&L.alternate!==null&&N.delete(L.key===null?C:L.key),h=i(L,h,C),M===null?E=L:M.sibling=L,M=L);return e&&N.forEach(function(V){return t(d,V)}),ae&&zn(d,C),E}function _(d,h,m,y){if(typeof m=="object"&&m!==null&&m.type===rr&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Ko:e:{for(var E=m.key,M=h;M!==null;){if(M.key===E){if(E=m.type,E===rr){if(M.tag===7){n(d,M.sibling),h=o(M,m.props.children),h.return=d,d=h;break e}}else if(M.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===tn&&_c(E)===M.type){n(d,M.sibling),h=o(M,m.props),h.ref=Xr(d,M,m),h.return=d,d=h;break e}n(d,M);break}else t(d,M);M=M.sibling}m.type===rr?(h=Hn(m.props.children,d.mode,y,m.key),h.return=d,d=h):(y=Mi(m.type,m.key,m.props,null,d.mode,y),y.ref=Xr(d,h,m),y.return=d,d=y)}return l(d);case nr:e:{for(M=m.key;h!==null;){if(h.key===M)if(h.tag===4&&h.stateNode.containerInfo===m.containerInfo&&h.stateNode.implementation===m.implementation){n(d,h.sibling),h=o(h,m.children||[]),h.return=d,d=h;break e}else{n(d,h);break}else t(d,h);h=h.sibling}h=cs(m,d.mode,y),h.return=d,d=h}return l(d);case tn:return M=m._init,_(d,h,M(m._payload),y)}if(eo(m))return x(d,h,m,y);if(Br(m))return v(d,h,m,y);oi(d,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,h!==null&&h.tag===6?(n(d,h.sibling),h=o(h,m),h.return=d,d=h):(n(d,h),h=as(m,d.mode,y),h.return=d,d=h),l(d)):n(d,h)}return _}var Pr=Bd(!0),Vd=Bd(!1),Xi=kn(null),ji=null,fr=null,Qu=null;function Zu(){Qu=fr=ji=null}function Gu(e){var t=Xi.current;le(Xi),e._currentValue=t}function Gs(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function wr(e,t){ji=e,Qu=fr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Be=!0),e.firstContext=null)}function ut(e){var t=e._currentValue;if(Qu!==e)if(e={context:e,memoizedValue:t,next:null},fr===null){if(ji===null)throw Error(B(308));fr=e,ji.dependencies={lanes:0,firstContext:e}}else fr=fr.next=e;return t}var Rn=null;function qu(e){Rn===null?Rn=[e]:Rn.push(e)}function Ud(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,qu(t)):(n.next=o.next,o.next=n),t.interleaved=n,jt(e,r)}function jt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var nn=!1;function Ju(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,jt(e,n)}return o=r.interleaved,o===null?(t.next=t,qu(r)):(t.next=o.next,o.next=t),r.interleaved=t,jt(e,n)}function Si(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ou(e,n)}}function kc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ki(e,t,n,r){var o=e.updateQueue;nn=!1;var i=o.firstBaseUpdate,l=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,a=u.next;u.next=null,l===null?i=a:l.next=a,l=u;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==l&&(s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=u))}if(i!==null){var f=o.baseState;l=0,c=a=u=null,s=i;do{var p=s.lane,g=s.eventTime;if((r&p)===p){c!==null&&(c=c.next={eventTime:g,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var x=e,v=s;switch(p=t,g=n,v.tag){case 1:if(x=v.payload,typeof x=="function"){f=x.call(g,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=v.payload,p=typeof x=="function"?x.call(g,f,p):x,p==null)break e;f=de({},f,p);break e;case 2:nn=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[s]:p.push(s))}else g={eventTime:g,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(a=c=g,u=f):c=c.next=g,l|=p;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;p=s,s=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(1);if(c===null&&(u=f),o.baseState=u,o.firstBaseUpdate=a,o.lastBaseUpdate=c,t=o.shared.interleaved,t!==null){o=t;do l|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Yn|=l,e.lanes=l,e.memoizedState=f}}function Nc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=os.transition;os.transition={};try{e(!1),t()}finally{b=n,os.transition=r}}function lp(){return at().memoizedState}function vm(e,t,n){var r=mn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sp(e))up(t,n);else if(n=Ud(e,t,n,r),n!==null){var o=Le();vt(n,e,r,o),ap(n,t,r)}}function wm(e,t,n){var r=mn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sp(e))up(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,s=i(l,n);if(o.hasEagerState=!0,o.eagerState=s,xt(s,l)){var u=t.interleaved;u===null?(o.next=o,qu(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Ud(e,t,o,r),n!==null&&(o=Le(),vt(n,e,r,o),ap(n,t,r))}}function sp(e){var t=e.alternate;return e===fe||t!==null&&t===fe}function up(e,t){fo=Zi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ap(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ou(e,n)}}var Gi={readContext:ut,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},xm={readContext:ut,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:ut,useEffect:Mc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_i(4194308,4,tp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _i(4194308,4,e,t)},useInsertionEffect:function(e,t){return _i(4,2,e,t)},useMemo:function(e,t){var n=Mt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=vm.bind(null,fe,e),[r.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:Cc,useDebugValue:la,useDeferredValue:function(e){return Mt().memoizedState=e},useTransition:function(){var e=Cc(!1),t=e[0];return e=ym.bind(null,e[1]),Mt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=fe,o=Mt();if(ae){if(n===void 0)throw Error(B(407));n=n()}else{if(n=t(),Ee===null)throw Error(B(349));Wn&30||Kd(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Mc(Zd.bind(null,r,i,e),[e]),r.flags|=2048,Do(9,Qd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Mt(),t=Ee.identifierPrefix;if(ae){var n=Vt,r=Bt;n=(r&~(1<<32-yt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=zo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[zt]=t,e[Mo]=r,wp(e,t,!1,!1),t.stateNode=e;e:{switch(l=Ds(n,r),n){case"dialog":ie("cancel",e),ie("close",e),o=r;break;case"iframe":case"object":case"embed":ie("load",e),o=r;break;case"video":case"audio":for(o=0;oAr&&(t.flags|=128,r=!0,jr(i,!1),t.lanes=4194304)}else{if(!r)if(e=Qi(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!ae)return ze(t),null}else 2*me()-i.renderingStartTime>Ar&&n!==1073741824&&(t.flags|=128,r=!0,jr(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=me(),t.sibling=null,n=ce.current,oe(ce,r?n&1|2:n&1),t):(ze(t),null);case 22:case 23:return da(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qe&1073741824&&(ze(t),t.subtreeFlags&6&&(t.flags|=8192)):ze(t),null;case 24:return null;case 25:return null}throw Error(B(156,t.tag))}function Pm(e,t){switch(ju(t),t.tag){case 1:return We(t.type)&&Vi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Tr(),le(Ue),le(De),ta(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ea(t),null;case 13:if(le(ce),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(B(340));Mr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(ce),null;case 4:return Tr(),null;case 10:return Gu(t.type._context),null;case 22:case 23:return da(),null;case 24:return null;default:return null}}var li=!1,Ae=!1,Tm=typeof WeakSet=="function"?WeakSet:Set,X=null;function dr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ge(e,t,r)}else n.current=null}function iu(e,t,n){try{n()}catch(r){ge(e,t,r)}}var Fc=!1;function zm(e,t){if(Us=Oi,e=Cd(),Yu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,s=-1,u=-1,a=0,c=0,f=e,p=null;t:for(;;){for(var g;f!==n||o!==0&&f.nodeType!==3||(s=l+o),f!==i||r!==0&&f.nodeType!==3||(u=l+r),f.nodeType===3&&(l+=f.nodeValue.length),(g=f.firstChild)!==null;)p=f,f=g;for(;;){if(f===e)break t;if(p===n&&++a===o&&(s=l),p===i&&++c===r&&(u=l),(g=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=g}n=s===-1||u===-1?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ws={focusedElem:e,selectionRange:n},Oi=!1,X=t;X!==null;)if(t=X,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var v=x.memoizedProps,_=x.memoizedState,d=t.stateNode,h=d.getSnapshotBeforeUpdate(t.elementType===t.type?v:pt(t.type,v),_);d.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(B(163))}}catch(y){ge(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return x=Fc,Fc=!1,x}function po(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&iu(t,n,i)}o=o.next}while(o!==r)}}function Sl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function lu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ep(e){var t=e.alternate;t!==null&&(e.alternate=null,Ep(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zt],delete t[Mo],delete t[js],delete t[dm],delete t[pm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _p(e){return e.tag===5||e.tag===3||e.tag===4}function Hc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_p(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function su(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Bi));else if(r!==4&&(e=e.child,e!==null))for(su(e,t,n),e=e.sibling;e!==null;)su(e,t,n),e=e.sibling}function uu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(uu(e,t,n),e=e.sibling;e!==null;)uu(e,t,n),e=e.sibling}var ke=null,ht=!1;function bt(e,t,n){for(n=n.child;n!==null;)kp(e,t,n),n=n.sibling}function kp(e,t,n){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(pl,n)}catch{}switch(n.tag){case 5:Ae||dr(n,t);case 6:var r=ke,o=ht;ke=null,bt(e,t,n),ke=r,ht=o,ke!==null&&(ht?(e=ke,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ke.removeChild(n.stateNode));break;case 18:ke!==null&&(ht?(e=ke,n=n.stateNode,e.nodeType===8?ts(e.parentNode,n):e.nodeType===1&&ts(e,n),Eo(e)):ts(ke,n.stateNode));break;case 4:r=ke,o=ht,ke=n.stateNode.containerInfo,ht=!0,bt(e,t,n),ke=r,ht=o;break;case 0:case 11:case 14:case 15:if(!Ae&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&iu(n,t,l),o=o.next}while(o!==r)}bt(e,t,n);break;case 1:if(!Ae&&(dr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){ge(n,t,s)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(Ae=(r=Ae)||n.memoizedState!==null,bt(e,t,n),Ae=r):bt(e,t,n);break;default:bt(e,t,n)}}function Bc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Tm),t.forEach(function(r){var o=Hm.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function dt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=l),r&=~i}if(r=o,r=me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Dm(r/1960))-r,10e?16:e,an===null)var r=!1;else{if(e=an,an=null,bi=0,q&6)throw Error(B(331));var o=q;for(q|=4,X=e.current;X!==null;){var i=X,l=i.child;if(X.flags&16){var s=i.deletions;if(s!==null){for(var u=0;ume()-ca?Fn(e,0):aa|=n),Ye(e,t)}function Dp(e,t){t===0&&(e.mode&1?(t=qo,qo<<=1,!(qo&130023424)&&(qo=4194304)):t=1);var n=Le();e=jt(e,t),e!==null&&(Bo(e,t,n),Ye(e,n))}function Fm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Dp(e,n)}function Hm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(B(314))}r!==null&&r.delete(t),Dp(e,n)}var Ip;Ip=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)Be=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Be=!1,Cm(e,t,n);Be=!!(e.flags&131072)}else Be=!1,ae&&t.flags&1048576&&Od(t,Yi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ki(e,t),e=t.pendingProps;var o=Cr(t,De.current);wr(t,n),o=ra(null,t,r,e,o,n);var i=oa();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(r)?(i=!0,Ui(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ju(t),o.updater=xl,t.stateNode=o,o._reactInternals=t,Js(t,r,e,n),t=tu(null,t,r,!0,i,n)):(t.tag=0,ae&&i&&Xu(t),Re(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ki(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Vm(r),e=pt(r,e),o){case 0:t=eu(null,t,r,e,n);break e;case 1:t=Lc(null,t,r,e,n);break e;case 11:t=Ic(null,t,r,e,n);break e;case 14:t=Rc(null,t,r,pt(r.type,e),n);break e}throw Error(B(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:pt(r,o),eu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:pt(r,o),Lc(e,t,r,o,n);case 3:e:{if(mp(t),e===null)throw Error(B(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Wd(e,t),Ki(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=zr(Error(B(423)),t),t=$c(e,t,r,n,o);break e}else if(r!==o){o=zr(Error(B(424)),t),t=$c(e,t,r,n,o);break e}else for(Ze=pn(t.stateNode.containerInfo.firstChild),Ge=t,ae=!0,gt=null,n=Vd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mr(),r===o){t=Kt(e,t,n);break e}Re(e,t,r,n)}t=t.child}return t;case 5:return Yd(t),e===null&&Zs(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,l=o.children,Ys(r,o)?l=null:i!==null&&Ys(r,i)&&(t.flags|=32),gp(e,t),Re(e,t,l,n),t.child;case 6:return e===null&&Zs(t),null;case 13:return yp(e,t,n);case 4:return bu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pr(t,null,r,n):Re(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:pt(r,o),Ic(e,t,r,o,n);case 7:return Re(e,t,t.pendingProps,n),t.child;case 8:return Re(e,t,t.pendingProps.children,n),t.child;case 12:return Re(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,l=o.value,oe(Xi,r._currentValue),r._currentValue=l,i!==null)if(xt(i.value,l)){if(i.children===o.children&&!Ue.current){t=Kt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){l=i.child;for(var u=s.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=Wt(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?u.next=u:(u.next=c.next,c.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Gs(i.return,n,t),s.lanes|=n;break}u=u.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(B(341));l.lanes|=n,s=l.alternate,s!==null&&(s.lanes|=n),Gs(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}Re(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,wr(t,n),o=ut(o),r=r(o),t.flags|=1,Re(e,t,r,n),t.child;case 14:return r=t.type,o=pt(r,t.pendingProps),o=pt(r.type,o),Rc(e,t,r,o,n);case 15:return pp(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:pt(r,o),ki(e,t),t.tag=1,We(r)?(e=!0,Ui(t)):e=!1,wr(t,n),cp(t,r,o),Js(t,r,o,n),tu(null,t,r,!0,e,n);case 19:return vp(e,t,n);case 22:return hp(e,t,n)}throw Error(B(156,t.tag))};function Rp(e,t){return sd(e,t)}function Bm(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function it(e,t,n,r){return new Bm(e,t,n,r)}function ha(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vm(e){if(typeof e=="function")return ha(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Iu)return 11;if(e===Ru)return 14}return 2}function yn(e,t){var n=e.alternate;return n===null?(n=it(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Mi(e,t,n,r,o,i){var l=2;if(r=e,typeof e=="function")ha(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case rr:return Hn(n.children,o,i,t);case Du:l=8,o|=8;break;case Es:return e=it(12,n,t,o|2),e.elementType=Es,e.lanes=i,e;case _s:return e=it(13,n,t,o),e.elementType=_s,e.lanes=i,e;case ks:return e=it(19,n,t,o),e.elementType=ks,e.lanes=i,e;case Yf:return _l(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Uf:l=10;break e;case Wf:l=9;break e;case Iu:l=11;break e;case Ru:l=14;break e;case tn:l=16,r=null;break e}throw Error(B(130,e==null?e:typeof e,""))}return t=it(l,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Hn(e,t,n,r){return e=it(7,e,r,t),e.lanes=n,e}function _l(e,t,n,r){return e=it(22,e,r,t),e.elementType=Yf,e.lanes=n,e.stateNode={isHidden:!1},e}function as(e,t,n){return e=it(6,e,null,t),e.lanes=n,e}function cs(e,t,n){return t=it(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Um(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yl(0),this.expirationTimes=Yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yl(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ga(e,t,n,r,o,i,l,s,u){return e=new Um(e,t,n,s,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=it(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ju(i),e}function Wm(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fp)}catch(e){console.error(e)}}Fp(),Ff.exports=be;var Pl=Ff.exports;const Qm=Of(Pl),cE=W0({__proto__:null,default:Qm},[Pl]);function Me(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ny:ty;Up.useSyncExternalStore=Dr.useSyncExternalStore!==void 0?Dr.useSyncExternalStore:ry;Vp.exports=Up;var oy=Vp.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Tl=A,iy=oy;function ly(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sy=typeof Object.is=="function"?Object.is:ly,uy=iy.useSyncExternalStore,ay=Tl.useRef,cy=Tl.useEffect,fy=Tl.useMemo,dy=Tl.useDebugValue;Bp.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=ay(null);if(i.current===null){var l={hasValue:!1,value:null};i.current=l}else l=i.current;i=fy(function(){function u(g){if(!a){if(a=!0,c=g,g=r(g),o!==void 0&&l.hasValue){var x=l.value;if(o(x,g))return f=x}return f=g}if(x=f,sy(c,g))return x;var v=r(g);return o!==void 0&&o(x,v)?x:(c=g,f=v)}var a=!1,c,f,p=n===void 0?null:n;return[function(){return u(t())},p===null?void 0:function(){return u(p())}]},[t,n,r,o]);var s=uy(e,i[0],i[1]);return cy(function(){l.hasValue=!0,l.value=s},[s]),dy(s),s};Hp.exports=Bp;var py=Hp.exports;const hy=Of(py),Qc=e=>{let t;const n=new Set,r=(c,f)=>{const p=typeof c=="function"?c(t):c;if(!Object.is(p,t)){const g=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,g))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>a,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{n.clear()}},a=t=e(r,o,u);return u},gy=e=>e?Qc(e):Qc,{useDebugValue:my}=I,{useSyncExternalStoreWithSelector:yy}=hy,vy=e=>e;function Wp(e,t=vy,n){const r=yy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return my(r),r}const Zc=(e,t)=>{const n=gy(e),r=(o,i=t)=>Wp(n,o,i);return Object.assign(r,n),r},wy=(e,t)=>e?Zc(e,t):Zc;function _e(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var xy={value:()=>{}};function zl(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Pi.prototype=zl.prototype={constructor:Pi,on:function(e,t){var n=this._,r=Sy(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(o),r=0,o,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),qc.hasOwnProperty(t)?{space:qc[t],local:e}:e}function _y(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===pu&&t.documentElement.namespaceURI===pu?t.createElement(e):t.createElementNS(n,e)}}function ky(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yp(e){var t=Al(e);return(t.local?ky:_y)(t)}function Ny(){}function wa(e){return e==null?Ny:function(){return this.querySelector(e)}}function Cy(e){typeof e!="function"&&(e=wa(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=m&&(m=h+1);!(E=_[m])&&++m=0;)(l=r[o])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function qy(e){e||(e=Jy);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function by(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ev(){return Array.from(this)}function tv(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?dv:typeof t=="function"?hv:pv)(e,t,n??"")):Ir(this.node(),e)}function Ir(e,t){return e.style.getPropertyValue(t)||Zp(e).getComputedStyle(e,null).getPropertyValue(t)}function mv(e){return function(){delete this[e]}}function yv(e,t){return function(){this[e]=t}}function vv(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wv(e,t){return arguments.length>1?this.each((t==null?mv:typeof t=="function"?vv:yv)(e,t)):this.node()[e]}function Gp(e){return e.trim().split(/^|\s+/)}function xa(e){return e.classList||new qp(e)}function qp(e){this._node=e,this._names=Gp(e.getAttribute("class")||"")}qp.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Jp(e,t){for(var n=xa(e),r=-1,o=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Kv(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n()=>e;function hu(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:l,y:s,dx:u,dy:a,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:a,enumerable:!0,configurable:!0},_:{value:c}})}hu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function r1(e){return!e.ctrlKey&&!e.button}function o1(){return this.parentNode}function i1(e,t){return t??{x:e.x,y:e.y}}function l1(){return navigator.maxTouchPoints||"ontouchstart"in this}function oh(){var e=r1,t=o1,n=i1,r=l1,o={},i=zl("start","drag","end"),l=0,s,u,a,c,f=0;function p(y){y.on("mousedown.drag",g).filter(r).on("touchstart.drag",_).on("touchmove.drag",d,n1).on("touchend.drag touchcancel.drag",h).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,E){if(!(c||!e.call(this,y,E))){var M=m(this,t.call(this,y,E),y,E,"mouse");M&&(ot(y.view).on("mousemove.drag",x,Ro).on("mouseup.drag",v,Ro),nh(y.view),ds(y),a=!1,s=y.clientX,u=y.clientY,M("start",y))}}function x(y){if(Sr(y),!a){var E=y.clientX-s,M=y.clientY-u;a=E*E+M*M>f}o.mouse("drag",y)}function v(y){ot(y.view).on("mousemove.drag mouseup.drag",null),rh(y.view,a),Sr(y),o.mouse("end",y)}function _(y,E){if(e.call(this,y,E)){var M=y.changedTouches,N=t.call(this,y,E),C=M.length,R,L;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ci(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ci(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=u1.exec(e))?new Ve(t[1],t[2],t[3],1):(t=a1.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=c1.exec(e))?ci(t[1],t[2],t[3],t[4]):(t=f1.exec(e))?ci(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=d1.exec(e))?of(t[1],t[2]/100,t[3]/100,1):(t=p1.exec(e))?of(t[1],t[2]/100,t[3]/100,t[4]):Jc.hasOwnProperty(e)?tf(Jc[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function tf(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function ci(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ve(e,t,n,r)}function m1(e){return e instanceof Xo||(e=jn(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function gu(e,t,n,r){return arguments.length===1?m1(e):new Ve(e,t,n,r??1)}function Ve(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Sa(Ve,gu,ih(Xo,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lo:Math.pow(Lo,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(Bn(this.r),Bn(this.g),Bn(this.b),ol(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:nf,formatHex:nf,formatHex8:y1,formatRgb:rf,toString:rf}));function nf(){return`#${$n(this.r)}${$n(this.g)}${$n(this.b)}`}function y1(){return`#${$n(this.r)}${$n(this.g)}${$n(this.b)}${$n((isNaN(this.opacity)?1:this.opacity)*255)}`}function rf(){const e=ol(this.opacity);return`${e===1?"rgb(":"rgba("}${Bn(this.r)}, ${Bn(this.g)}, ${Bn(this.b)}${e===1?")":`, ${e})`}`}function ol(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Bn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $n(e){return e=Bn(e),(e<16?"0":"")+e.toString(16)}function of(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new mt(e,t,n,r)}function lh(e){if(e instanceof mt)return new mt(e.h,e.s,e.l,e.opacity);if(e instanceof Xo||(e=jn(e)),!e)return new mt;if(e instanceof mt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,s=i-o,u=(i+o)/2;return s?(t===i?l=(n-r)/s+(n0&&u<1?0:l,new mt(l,s,u,e.opacity)}function v1(e,t,n,r){return arguments.length===1?lh(e):new mt(e,t,n,r??1)}function mt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Sa(mt,v1,ih(Xo,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new mt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lo:Math.pow(Lo,e),new mt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Ve(ps(e>=240?e-240:e+120,o,r),ps(e,o,r),ps(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new mt(lf(this.h),fi(this.s),fi(this.l),ol(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=ol(this.opacity);return`${e===1?"hsl(":"hsla("}${lf(this.h)}, ${fi(this.s)*100}%, ${fi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function lf(e){return e=(e||0)%360,e<0?e+360:e}function fi(e){return Math.max(0,Math.min(1,e||0))}function ps(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ea=e=>()=>e;function w1(e,t){return function(n){return e+n*t}}function x1(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function S1(e){return(e=+e)==1?sh:function(t,n){return n-t?x1(t,n,e):Ea(isNaN(t)?n:t)}}function sh(e,t){var n=t-e;return n?w1(e,n):Ea(isNaN(e)?t:e)}const il=function e(t){var n=S1(t);function r(o,i){var l=n((o=gu(o)).r,(i=gu(i)).r),s=n(o.g,i.g),u=n(o.b,i.b),a=sh(o.opacity,i.opacity);return function(c){return o.r=l(c),o.g=s(c),o.b=u(c),o.opacity=a(c),o+""}}return r.gamma=e,r}(1);function E1(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;on&&(i=t.slice(n,i),s[l]?s[l]+=i:s[++l]=i),(r=r[0])===(o=o[0])?s[l]?s[l]+=o:s[++l]=o:(s[++l]=null,u.push({i:l,x:Tt(r,o)})),n=hs.lastIndex;return n180?c+=360:c-a>180&&(a+=360),p.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Tt(a,c)})):c&&f.push(o(f)+"rotate("+c+r)}function s(a,c,f,p){a!==c?p.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Tt(a,c)}):c&&f.push(o(f)+"skewX("+c+r)}function u(a,c,f,p,g,x){if(a!==f||c!==p){var v=g.push(o(g)+"scale(",null,",",null,")");x.push({i:v-4,x:Tt(a,f)},{i:v-2,x:Tt(c,p)})}else(f!==1||p!==1)&&g.push(o(g)+"scale("+f+","+p+")")}return function(a,c){var f=[],p=[];return a=e(a),c=e(c),i(a.translateX,a.translateY,c.translateX,c.translateY,f,p),l(a.rotate,c.rotate,f,p),s(a.skewX,c.skewX,f,p),u(a.scaleX,a.scaleY,c.scaleX,c.scaleY,f,p),a=c=null,function(g){for(var x=-1,v=p.length,_;++x=0&&e._call.call(void 0,t),e=e._next;--Rr}function af(){Kn=(sl=Oo.now())+Dl,Rr=ro=0;try{F1()}finally{Rr=0,B1(),Kn=0}}function H1(){var e=Oo.now(),t=e-sl;t>fh&&(Dl-=t,sl=e)}function B1(){for(var e,t=ll,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ll=n);oo=e,vu(r)}function vu(e){if(!Rr){ro&&(ro=clearTimeout(ro));var t=e-Kn;t>24?(e<1/0&&(ro=setTimeout(af,e-Oo.now()-Dl)),Qr&&(Qr=clearInterval(Qr))):(Qr||(sl=Oo.now(),Qr=setInterval(H1,fh)),Rr=1,dh(af))}}function cf(e,t,n){var r=new ul;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var V1=zl("start","end","cancel","interrupt"),U1=[],hh=0,ff=1,wu=2,Ti=3,df=4,xu=5,zi=6;function Il(e,t,n,r,o,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;W1(e,n,{name:t,index:r,group:o,on:V1,tween:U1,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:hh})}function Na(e,t){var n=St(e,t);if(n.state>hh)throw new Error("too late; already scheduled");return n}function Rt(e,t){var n=St(e,t);if(n.state>Ti)throw new Error("too late; already running");return n}function St(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function W1(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=ph(i,0,n.time);function i(a){n.state=ff,n.timer.restart(l,n.delay,n.time),n.delay<=a&&l(a-n.delay)}function l(a){var c,f,p,g;if(n.state!==ff)return u();for(c in r)if(g=r[c],g.name===n.name){if(g.state===Ti)return cf(l);g.state===df?(g.state=zi,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[c]):+cwu&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function ww(e,t,n){var r,o,i=vw(t)?Na:Rt;return function(){var l=i(this,e),s=l.on;s!==r&&(o=(r=s).copy()).on(t,n),l.on=o}}function xw(e,t){var n=this._id;return arguments.length<2?St(this.node(),n).on.on(e):this.each(ww(n,e,t))}function Sw(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ew(){return this.on("end.remove",Sw(this._id))}function _w(e){var t=this._name,n=this._id;typeof e!="function"&&(e=wa(e));for(var r=this._groups,o=r.length,i=new Array(o),l=0;l()=>e;function Qw(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ut(e,t,n){this.k=e,this.x=t,this.y=n}Ut.prototype={constructor:Ut,scale:function(e){return e===1?this:new Ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ut(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vn=new Ut(1,0,0);Ut.prototype;function gs(e){e.stopImmediatePropagation()}function Zr(e){e.preventDefault(),e.stopImmediatePropagation()}function Zw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gw(){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 pf(){return this.__zoom||vn}function qw(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jw(){return navigator.maxTouchPoints||"ontouchstart"in this}function bw(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function ex(){var e=Zw,t=Gw,n=bw,r=qw,o=Jw,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=$1,a=zl("start","zoom","end"),c,f,p,g=500,x=150,v=0,_=10;function d(w){w.property("__zoom",pf).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",L).filter(o).on("touchstart.zoom",H).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}d.transform=function(w,z,P,$){var k=w.selection?w.selection():w;k.property("__zoom",pf),w!==k?E(w,z,P,$):k.interrupt().each(function(){M(this,arguments).event($).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},d.scaleBy=function(w,z,P,$){d.scaleTo(w,function(){var k=this.__zoom.k,S=typeof z=="function"?z.apply(this,arguments):z;return k*S},P,$)},d.scaleTo=function(w,z,P,$){d.transform(w,function(){var k=t.apply(this,arguments),S=this.__zoom,T=P==null?y(k):typeof P=="function"?P.apply(this,arguments):P,D=S.invert(T),F=typeof z=="function"?z.apply(this,arguments):z;return n(m(h(S,F),T,D),k,l)},P,$)},d.translateBy=function(w,z,P,$){d.transform(w,function(){return n(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof P=="function"?P.apply(this,arguments):P),t.apply(this,arguments),l)},null,$)},d.translateTo=function(w,z,P,$,k){d.transform(w,function(){var S=t.apply(this,arguments),T=this.__zoom,D=$==null?y(S):typeof $=="function"?$.apply(this,arguments):$;return n(vn.translate(D[0],D[1]).scale(T.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof P=="function"?-P.apply(this,arguments):-P),S,l)},$,k)};function h(w,z){return z=Math.max(i[0],Math.min(i[1],z)),z===w.k?w:new Ut(z,w.x,w.y)}function m(w,z,P){var $=z[0]-P[0]*w.k,k=z[1]-P[1]*w.k;return $===w.x&&k===w.y?w:new Ut(w.k,$,k)}function y(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,z,P,$){w.on("start.zoom",function(){M(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event($).end()}).tween("zoom",function(){var k=this,S=arguments,T=M(k,S).event($),D=t.apply(k,S),F=P==null?y(D):typeof P=="function"?P.apply(k,S):P,W=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),U=k.__zoom,K=typeof z=="function"?z.apply(k,S):z,Q=u(U.invert(F).concat(W/U.k),K.invert(F).concat(W/K.k));return function(Z){if(Z===1)Z=K;else{var J=Q(Z),ue=W/J[2];Z=new Ut(ue,F[0]-J[0]*ue,F[1]-J[1]*ue)}T.zoom(null,Z)}})}function M(w,z,P){return!P&&w.__zooming||new N(w,z)}function N(w,z){this.that=w,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,z),this.taps=0}N.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,z){return this.mouse&&w!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var z=ot(this.that).datum();a.call(w,this.that,new Qw(w,{sourceEvent:this.sourceEvent,target:d,type:w,transform:this.that.__zoom,dispatch:a}),z)}};function C(w,...z){if(!e.apply(this,arguments))return;var P=M(this,z).event(w),$=this.__zoom,k=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,r.apply(this,arguments)))),S=Pt(w);if(P.wheel)(P.mouse[0][0]!==S[0]||P.mouse[0][1]!==S[1])&&(P.mouse[1]=$.invert(P.mouse[0]=S)),clearTimeout(P.wheel);else{if($.k===k)return;P.mouse=[S,$.invert(S)],Ai(this),P.start()}Zr(w),P.wheel=setTimeout(T,x),P.zoom("mouse",n(m(h($,k),P.mouse[0],P.mouse[1]),P.extent,l));function T(){P.wheel=null,P.end()}}function R(w,...z){if(p||!e.apply(this,arguments))return;var P=w.currentTarget,$=M(this,z,!0).event(w),k=ot(w.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",W,!0),S=Pt(w,P),T=w.clientX,D=w.clientY;nh(w.view),gs(w),$.mouse=[S,this.__zoom.invert(S)],Ai(this),$.start();function F(U){if(Zr(U),!$.moved){var K=U.clientX-T,Q=U.clientY-D;$.moved=K*K+Q*Q>v}$.event(U).zoom("mouse",n(m($.that.__zoom,$.mouse[0]=Pt(U,P),$.mouse[1]),$.extent,l))}function W(U){k.on("mousemove.zoom mouseup.zoom",null),rh(U.view,$.moved),Zr(U),$.event(U).end()}}function L(w,...z){if(e.apply(this,arguments)){var P=this.__zoom,$=Pt(w.changedTouches?w.changedTouches[0]:w,this),k=P.invert($),S=P.k*(w.shiftKey?.5:2),T=n(m(h(P,S),$,k),t.apply(this,z),l);Zr(w),s>0?ot(this).transition().duration(s).call(E,T,$,w):ot(this).call(d.transform,T,$,w)}}function H(w,...z){if(e.apply(this,arguments)){var P=w.touches,$=P.length,k=M(this,z,w.changedTouches.length===$).event(w),S,T,D,F;for(gs(w),T=0;T<$;++T)D=P[T],F=Pt(D,this),F=[F,this.__zoom.invert(F),D.identifier],k.touch0?!k.touch1&&k.touch0[2]!==F[2]&&(k.touch1=F,k.taps=0):(k.touch0=F,S=!0,k.taps=1+!!c);c&&(c=clearTimeout(c)),S&&(k.taps<2&&(f=F[0],c=setTimeout(function(){c=null},g)),Ai(this),k.start())}}function V(w,...z){if(this.__zooming){var P=M(this,z).event(w),$=w.changedTouches,k=$.length,S,T,D,F;for(Zr(w),S=0;S"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},vh=Zt.error001();function re(e,t){const n=A.useContext(Rl);if(n===null)throw new Error(vh);return Wp(n,e,t)}const ve=()=>{const e=A.useContext(Rl);if(e===null)throw new Error(vh);return A.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},nx=e=>e.userSelectionActive?"none":"all";function wh({position:e,children:t,className:n,style:r,...o}){const i=re(nx),l=`${e}`.split("-");return I.createElement("div",{className:Me(["react-flow__panel",n,...l]),style:{...r,pointerEvents:i},...o},t)}function rx({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:I.createElement(wh,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},I.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const ox=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:o=!0,labelBgStyle:i={},labelBgPadding:l=[2,4],labelBgBorderRadius:s=2,children:u,className:a,...c})=>{const f=A.useRef(null),[p,g]=A.useState({x:0,y:0,width:0,height:0}),x=Me(["react-flow__edge-textwrapper",a]);return A.useEffect(()=>{if(f.current){const v=f.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),typeof n>"u"||!n?null:I.createElement("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:x,visibility:p.width?"visible":"hidden",...c},o&&I.createElement("rect",{width:p.width+2*l[0],x:-l[0],y:-l[1],height:p.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:s,ry:s}),I.createElement("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:f,style:r},n),u)};var ix=A.memo(ox);const Ma=e=>({width:e.offsetWidth,height:e.offsetHeight}),En=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pa=(e={x:0,y:0},t)=>({x:En(e.x,t[0][0],t[1][0]),y:En(e.y,t[0][1],t[1][1])}),hf=(e,t,n)=>en?-En(Math.abs(e-n),1,50)/50:0,xh=(e,t)=>{const n=hf(e.x,35,t.width-35)*20,r=hf(e.y,35,t.height-35)*20;return[n,r]},Sh=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},lx=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ta=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),sx=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),gf=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Su=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ux=e=>lt(e.width)&<(e.height)&<(e.x)&<(e.y),lt=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Eh=["Enter"," ","Escape"],ax=(e,t)=>{},cx=e=>"nativeEvent"in e;function Eu(e){var o,i;const t=cx(e)?e.nativeEvent:e,n=((i=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const _h=e=>"clientX"in e,wn=(e,t)=>{var i,l;const n=_h(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},al=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},jo=({id:e,path:t,labelX:n,labelY:r,label:o,labelStyle:i,labelShowBg:l,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:a,style:c,markerEnd:f,markerStart:p,interactionWidth:g=20})=>I.createElement(I.Fragment,null,I.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:p}),g&&I.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}),o&<(n)&<(r)?I.createElement(ix,{x:n,y:r,label:o,labelStyle:i,labelShowBg:l,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:a}):null);jo.displayName="BaseEdge";function Gr(e,t,n){return n===void 0?n:r=>{const o=t().edges.find(i=>i.id===e);o&&n(r,{...o})}}function kh({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n{const[_,d,h]=Ch({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i});return I.createElement(jo,{path:_,labelX:d,labelY:h,label:l,labelStyle:s,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,interactionWidth:v})});za.displayName="SimpleBezierEdge";const yf={[j.Left]:{x:-1,y:0},[j.Right]:{x:1,y:0},[j.Top]:{x:0,y:-1},[j.Bottom]:{x:0,y:1}},fx=({source:e,sourcePosition:t=j.Bottom,target:n})=>t===j.Left||t===j.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dx({source:e,sourcePosition:t=j.Bottom,target:n,targetPosition:r=j.Top,center:o,offset:i}){const l=yf[t],s=yf[r],u={x:e.x+l.x*i,y:e.y+l.y*i},a={x:n.x+s.x*i,y:n.y+s.y*i},c=fx({source:u,sourcePosition:t,target:a}),f=c.x!==0?"x":"y",p=c[f];let g=[],x,v;const _={x:0,y:0},d={x:0,y:0},[h,m,y,E]=kh({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){x=o.x??h,v=o.y??m;const N=[{x,y:u.y},{x,y:a.y}],C=[{x:u.x,y:v},{x:a.x,y:v}];l[f]===p?g=f==="x"?N:C:g=f==="x"?C:N}else{const N=[{x:u.x,y:a.y}],C=[{x:a.x,y:u.y}];if(f==="x"?g=l.x===p?C:N:g=l.y===p?N:C,t===r){const O=Math.abs(e[f]-n[f]);if(O<=i){const w=Math.min(i-1,i-O);l[f]===p?_[f]=(u[f]>e[f]?-1:1)*w:d[f]=(a[f]>n[f]?-1:1)*w}}if(t!==r){const O=f==="x"?"y":"x",w=l[f]===s[O],z=u[O]>a[O],P=u[O]=V?(x=(R.x+L.x)/2,v=g[0].y):(x=g[0].x,v=(R.y+L.y)/2)}return[[e,{x:u.x+_.x,y:u.y+_.y},...g,{x:a.x+d.x,y:a.y+d.y},n],x,v,y,E]}function px(e,t,n,r){const o=Math.min(vf(e,t)/2,vf(t,n)/2,r),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const a=e.x{let m="";return h>0&&h{const[d,h,m]=_u({sourceX:e,sourceY:t,sourcePosition:f,targetX:n,targetY:r,targetPosition:p,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset});return I.createElement(jo,{path:d,labelX:h,labelY:m,label:o,labelStyle:i,labelShowBg:l,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:a,style:c,markerEnd:g,markerStart:x,interactionWidth:_})});Ll.displayName="SmoothStepEdge";const Aa=A.memo(e=>{var t;return I.createElement(Ll,{...e,pathOptions:A.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Aa.displayName="StepEdge";function hx({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,l,s]=kh({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,l,s]}const Da=A.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:o,labelStyle:i,labelShowBg:l,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:a,style:c,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[x,v,_]=hx({sourceX:e,sourceY:t,targetX:n,targetY:r});return I.createElement(jo,{path:x,labelX:v,labelY:_,label:o,labelStyle:i,labelShowBg:l,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:a,style:c,markerEnd:f,markerStart:p,interactionWidth:g})});Da.displayName="StraightEdge";function hi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wf({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case j.Left:return[t-hi(t-r,i),n];case j.Right:return[t+hi(r-t,i),n];case j.Top:return[t,n-hi(n-o,i)];case j.Bottom:return[t,n+hi(o-n,i)]}}function Mh({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:r,targetY:o,targetPosition:i=j.Top,curvature:l=.25}){const[s,u]=wf({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[a,c]=wf({pos:i,x1:r,y1:o,x2:e,y2:t,c:l}),[f,p,g,x]=Nh({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:u,targetControlX:a,targetControlY:c});return[`M${e},${t} C${s},${u} ${a},${c} ${r},${o}`,f,p,g,x]}const fl=A.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o=j.Bottom,targetPosition:i=j.Top,label:l,labelStyle:s,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,pathOptions:v,interactionWidth:_})=>{const[d,h,m]=Mh({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:i,curvature:v==null?void 0:v.curvature});return I.createElement(jo,{path:d,labelX:h,labelY:m,label:l,labelStyle:s,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:x,interactionWidth:_})});fl.displayName="BezierEdge";const Ia=A.createContext(null),gx=Ia.Provider;Ia.Consumer;const Ra=()=>A.useContext(Ia),mx=e=>"id"in e&&"source"in e&&"target"in e,Ph=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ku=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,yx=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),vx=(e,t)=>{if(!e.source||!e.target)return t;let n;return mx(e)?n={...e}:n={...e,id:Ph(e)},yx(n,t)?t:t.concat(n)},pE=(e,t,n,r={shouldReplaceId:!0})=>{const{id:o,...i}=e;if(!t.source||!t.target||!n.find(u=>u.id===o))return n;const s={...i,id:r.shouldReplaceId?Ph(t):o,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(u=>u.id!==o).concat(s)},Nu=({x:e,y:t},[n,r,o],i,[l,s])=>{const u={x:(e-n)/o,y:(t-r)/o};return i?{x:l*Math.round(u.x/l),y:s*Math.round(u.y/s)}:u},Th=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r}),_r=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],o={x:e.position.x-n,y:e.position.y-r};return{...o,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:o}},$l=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const{x:i,y:l}=_r(o,t).positionAbsolute;return lx(r,Ta({x:i,y:l,width:o.width||0,height:o.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return sx(n)},zh=(e,t,[n,r,o]=[0,0,1],i=!1,l=!1,s=[0,0])=>{const u={x:(t.x-n)/o,y:(t.y-r)/o,width:t.width/o,height:t.height/o},a=[];return e.forEach(c=>{const{width:f,height:p,selectable:g=!0,hidden:x=!1}=c;if(l&&!g||x)return!1;const{positionAbsolute:v}=_r(c,s),_={x:v.x,y:v.y,width:f||0,height:p||0},d=Su(u,_),h=typeof f>"u"||typeof p>"u"||f===null||p===null,m=i&&d>0,y=(f||0)*(p||0);(h||m||d>=y||c.dragging)&&a.push(c)}),a},Ah=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},Dh=(e,t,n,r,o,i=.1)=>{const l=t/(e.width*(1+i)),s=n/(e.height*(1+i)),u=Math.min(l,s),a=En(u,r,o),c=e.x+e.width/2,f=e.y+e.height/2,p=t/2-c*a,g=n/2-f*a;return{x:p,y:g,zoom:a}},Dn=(e,t=0)=>e.transition().duration(t);function xf(e,t,n,r){return(t[n]||[]).reduce((o,i)=>{var l,s;return`${e.id}-${i.id}-${n}`!==r&&o.push({id:i.id||null,type:n,nodeId:e.id,x:(((l=e.positionAbsolute)==null?void 0:l.x)??0)+i.x+i.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+i.y+i.height/2}),o},[])}function wx(e,t,n,r,o,i){const{x:l,y:s}=wn(e),a=t.elementsFromPoint(l,s).find(x=>x.classList.contains("react-flow__handle"));if(a){const x=a.getAttribute("data-nodeid");if(x){const v=La(void 0,a),_=a.getAttribute("data-handleid"),d=i({nodeId:x,id:_,type:v});if(d){const h=o.find(m=>m.nodeId===x&&m.type===v&&m.id===_);return{handle:{id:_,type:v,nodeId:x,x:(h==null?void 0:h.x)||n.x,y:(h==null?void 0:h.y)||n.y},validHandleResult:d}}}}let c=[],f=1/0;if(o.forEach(x=>{const v=Math.sqrt((x.x-n.x)**2+(x.y-n.y)**2);if(v<=r){const _=i(x);v<=f&&(vx.isValid),g=c.some(({handle:x})=>x.type==="target");return c.find(({handle:x,validHandleResult:v})=>g?x.type==="target":p?v.isValid:!0)||c[0]}const xx={source:null,target:null,sourceHandle:null,targetHandle:null},Ih=()=>({handleDomNode:null,isValid:!1,connection:xx,endHandle:null});function Rh(e,t,n,r,o,i,l){const s=o==="target",u=l.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),a={...Ih(),handleDomNode:u};if(u){const c=La(void 0,u),f=u.getAttribute("data-nodeid"),p=u.getAttribute("data-handleid"),g=u.classList.contains("connectable"),x=u.classList.contains("connectableend"),v={source:s?f:n,sourceHandle:s?p:r,target:s?n:f,targetHandle:s?r:p};a.connection=v,g&&x&&(t===Qn.Strict?s&&c==="source"||!s&&c==="target":f!==n||p!==r)&&(a.endHandle={nodeId:f,handleId:p,type:c},a.isValid=i(v))}return a}function Sx({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((o,i)=>{if(i[se]){const{handleBounds:l}=i[se];let s=[],u=[];l&&(s=xf(i,l,"source",`${t}-${n}-${r}`),u=xf(i,l,"target",`${t}-${n}-${r}`)),o.push(...s,...u)}return o},[])}function La(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ms(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Ex(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Lh({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:o,getState:i,setState:l,isValidConnection:s,edgeUpdaterType:u,onEdgeUpdateEnd:a}){const c=Sh(e.target),{connectionMode:f,domNode:p,autoPanOnConnect:g,connectionRadius:x,onConnectStart:v,panBy:_,getNodes:d,cancelConnection:h}=i();let m=0,y;const{x:E,y:M}=wn(e),N=c==null?void 0:c.elementFromPoint(E,M),C=La(u,N),R=p==null?void 0:p.getBoundingClientRect();if(!R||!C)return;let L,H=wn(e,R),V=!1,O=null,w=!1,z=null;const P=Sx({nodes:d(),nodeId:n,handleId:t,handleType:C}),$=()=>{if(!g)return;const[T,D]=xh(H,R);_({x:T,y:D}),m=requestAnimationFrame($)};l({connectionPosition:H,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),v==null||v(e,{nodeId:n,handleId:t,handleType:C});function k(T){const{transform:D}=i();H=wn(T,R);const{handle:F,validHandleResult:W}=wx(T,c,Nu(H,D,!1,[1,1]),x,P,U=>Rh(U,f,n,t,o?"target":"source",s,c));if(y=F,V||($(),V=!0),z=W.handleDomNode,O=W.connection,w=W.isValid,l({connectionPosition:y&&w?Th({x:y.x,y:y.y},D):H,connectionStatus:Ex(!!y,w),connectionEndHandle:W.endHandle}),!y&&!w&&!z)return ms(L);O.source!==O.target&&z&&(ms(L),L=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",w),z.classList.toggle("react-flow__handle-valid",w))}function S(T){var D,F;(y||z)&&O&&w&&(r==null||r(O)),(F=(D=i()).onConnectEnd)==null||F.call(D,T),u&&(a==null||a(T)),ms(L),h(),cancelAnimationFrame(m),V=!1,w=!1,O=null,z=null,c.removeEventListener("mousemove",k),c.removeEventListener("mouseup",S),c.removeEventListener("touchmove",k),c.removeEventListener("touchend",S)}c.addEventListener("mousemove",k),c.addEventListener("mouseup",S),c.addEventListener("touchmove",k),c.addEventListener("touchend",S)}const Sf=()=>!0,_x=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),kx=(e,t,n)=>r=>{const{connectionStartHandle:o,connectionEndHandle:i,connectionClickStartHandle:l}=r;return{connecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n}},$h=A.forwardRef(({type:e="source",position:t=j.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:l,onConnect:s,children:u,className:a,onMouseDown:c,onTouchStart:f,...p},g)=>{var R,L;const x=l||null,v=e==="target",_=ve(),d=Ra(),{connectOnClick:h,noPanClassName:m}=re(_x,_e),{connecting:y,clickConnecting:E}=re(kx(d,x,e),_e);d||(L=(R=_.getState()).onError)==null||L.call(R,"010",Zt.error010());const M=H=>{const{defaultEdgeOptions:V,onConnect:O,hasDefaultEdges:w}=_.getState(),z={...V,...H};if(w){const{edges:P,setEdges:$}=_.getState();$(vx(z,P))}O==null||O(z),s==null||s(z)},N=H=>{if(!d)return;const V=_h(H);o&&(V&&H.button===0||!V)&&Lh({event:H,handleId:x,nodeId:d,onConnect:M,isTarget:v,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Sf}),V?c==null||c(H):f==null||f(H)},C=H=>{const{onClickConnectStart:V,onClickConnectEnd:O,connectionClickStartHandle:w,connectionMode:z,isValidConnection:P}=_.getState();if(!d||!w&&!o)return;if(!w){V==null||V(H,{nodeId:d,handleId:x,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:d,type:e,handleId:x}});return}const $=Sh(H.target),k=n||P||Sf,{connection:S,isValid:T}=Rh({nodeId:d,id:x,type:e},z,w.nodeId,w.handleId||null,w.type,k,$);T&&M(S),O==null||O(H),_.setState({connectionClickStartHandle:null})};return I.createElement("div",{"data-handleid":x,"data-nodeid":d,"data-handlepos":t,"data-id":`${d}-${x}-${e}`,className:Me(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,a,{source:!v,target:v,connectable:r,connectablestart:o,connectableend:i,connecting:E,connectionindicator:r&&(o&&!y||i&&y)}]),onMouseDown:N,onTouchStart:N,onClick:h?C:void 0,ref:g,...p},u)});$h.displayName="Handle";var dl=A.memo($h);const Oh=({data:e,isConnectable:t,targetPosition:n=j.Top,sourcePosition:r=j.Bottom})=>I.createElement(I.Fragment,null,I.createElement(dl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,I.createElement(dl,{type:"source",position:r,isConnectable:t}));Oh.displayName="DefaultNode";var Cu=A.memo(Oh);const Fh=({data:e,isConnectable:t,sourcePosition:n=j.Bottom})=>I.createElement(I.Fragment,null,e==null?void 0:e.label,I.createElement(dl,{type:"source",position:n,isConnectable:t}));Fh.displayName="InputNode";var Hh=A.memo(Fh);const Bh=({data:e,isConnectable:t,targetPosition:n=j.Top})=>I.createElement(I.Fragment,null,I.createElement(dl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Bh.displayName="OutputNode";var Vh=A.memo(Bh);const $a=()=>null;$a.displayName="GroupNode";const Nx=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),gi=e=>e.id;function Cx(e,t){return _e(e.selectedNodes.map(gi),t.selectedNodes.map(gi))&&_e(e.selectedEdges.map(gi),t.selectedEdges.map(gi))}const Uh=A.memo(({onSelectionChange:e})=>{const t=ve(),{selectedNodes:n,selectedEdges:r}=re(Nx,Cx);return A.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChange.forEach(i=>i(o))},[n,r,e]),null});Uh.displayName="SelectionListener";const Mx=e=>!!e.onSelectionChange;function Px({onSelectionChange:e}){const t=re(Mx);return e||t?I.createElement(Uh,{onSelectionChange:e}):null}const Tx=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Jn(e,t){A.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function G(e,t,n){A.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const zx=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:o,onConnectStart:i,onConnectEnd:l,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:a,nodesConnectable:c,nodesFocusable:f,edgesFocusable:p,edgesUpdatable:g,elevateNodesOnSelect:x,minZoom:v,maxZoom:_,nodeExtent:d,onNodesChange:h,onEdgesChange:m,elementsSelectable:y,connectionMode:E,snapGrid:M,snapToGrid:N,translateExtent:C,connectOnClick:R,defaultEdgeOptions:L,fitView:H,fitViewOptions:V,onNodesDelete:O,onEdgesDelete:w,onNodeDrag:z,onNodeDragStart:P,onNodeDragStop:$,onSelectionDrag:k,onSelectionDragStart:S,onSelectionDragStop:T,noPanClassName:D,nodeOrigin:F,rfId:W,autoPanOnConnect:U,autoPanOnNodeDrag:K,onError:Q,connectionRadius:Z,isValidConnection:J,nodeDragThreshold:ue})=>{const{setNodes:ee,setEdges:pe,setDefaultNodesAndEdges:Ie,setMinZoom:Oe,setMaxZoom:Xe,setTranslateExtent:he,setNodeExtent:je,reset:te}=re(Tx,_e),Y=ve();return A.useEffect(()=>{const ne=r==null?void 0:r.map(Et=>({...Et,...L}));return Ie(n,ne),()=>{te()}},[]),G("defaultEdgeOptions",L,Y.setState),G("connectionMode",E,Y.setState),G("onConnect",o,Y.setState),G("onConnectStart",i,Y.setState),G("onConnectEnd",l,Y.setState),G("onClickConnectStart",s,Y.setState),G("onClickConnectEnd",u,Y.setState),G("nodesDraggable",a,Y.setState),G("nodesConnectable",c,Y.setState),G("nodesFocusable",f,Y.setState),G("edgesFocusable",p,Y.setState),G("edgesUpdatable",g,Y.setState),G("elementsSelectable",y,Y.setState),G("elevateNodesOnSelect",x,Y.setState),G("snapToGrid",N,Y.setState),G("snapGrid",M,Y.setState),G("onNodesChange",h,Y.setState),G("onEdgesChange",m,Y.setState),G("connectOnClick",R,Y.setState),G("fitViewOnInit",H,Y.setState),G("fitViewOnInitOptions",V,Y.setState),G("onNodesDelete",O,Y.setState),G("onEdgesDelete",w,Y.setState),G("onNodeDrag",z,Y.setState),G("onNodeDragStart",P,Y.setState),G("onNodeDragStop",$,Y.setState),G("onSelectionDrag",k,Y.setState),G("onSelectionDragStart",S,Y.setState),G("onSelectionDragStop",T,Y.setState),G("noPanClassName",D,Y.setState),G("nodeOrigin",F,Y.setState),G("rfId",W,Y.setState),G("autoPanOnConnect",U,Y.setState),G("autoPanOnNodeDrag",K,Y.setState),G("onError",Q,Y.setState),G("connectionRadius",Z,Y.setState),G("isValidConnection",J,Y.setState),G("nodeDragThreshold",ue,Y.setState),Jn(e,ee),Jn(t,pe),Jn(v,Oe),Jn(_,Xe),Jn(C,he),Jn(d,je),null},Ef={display:"none"},Ax={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Wh="react-flow__node-desc",Yh="react-flow__edge-desc",Dx="react-flow__aria-live",Ix=e=>e.ariaLiveMessage;function Rx({rfId:e}){const t=re(Ix);return I.createElement("div",{id:`${Dx}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ax},t)}function Lx({rfId:e,disableKeyboardA11y:t}){return I.createElement(I.Fragment,null,I.createElement("div",{id:`${Wh}-${e}`,style:Ef},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),I.createElement("div",{id:`${Yh}-${e}`,style:Ef},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&I.createElement(Rx,{rfId:e}))}var Ho=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=A.useState(!1),o=A.useRef(!1),i=A.useRef(new Set([])),[l,s]=A.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=a.reduce((f,p)=>f.concat(...p),[]);return[a,c]}return[[],[]]},[e]);return A.useEffect(()=>{const u=typeof document<"u"?document:null,a=(t==null?void 0:t.target)||u;if(e!==null){const c=g=>{if(o.current=g.ctrlKey||g.metaKey||g.shiftKey,(!o.current||o.current&&!t.actInsideInputWithModifier)&&Eu(g))return!1;const v=kf(g.code,s);i.current.add(g[v]),_f(l,i.current,!1)&&(g.preventDefault(),r(!0))},f=g=>{if((!o.current||o.current&&!t.actInsideInputWithModifier)&&Eu(g))return!1;const v=kf(g.code,s);_f(l,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(g[v]),g.key==="Meta"&&i.current.clear(),o.current=!1},p=()=>{i.current.clear(),r(!1)};return a==null||a.addEventListener("keydown",c),a==null||a.addEventListener("keyup",f),window.addEventListener("blur",p),()=>{a==null||a.removeEventListener("keydown",c),a==null||a.removeEventListener("keyup",f),window.removeEventListener("blur",p)}}},[e,r]),n};function _f(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function kf(e,t){return t.includes(e)?"code":"key"}function Xh(e,t,n,r){var s,u;const o=e.parentNode||e.parentId;if(!o)return n;const i=t.get(o),l=_r(i,r);return Xh(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((s=i[se])==null?void 0:s.z)??0)>(n.z??0)?((u=i[se])==null?void 0:u.z)??0:n.z??0},r)}function jh(e,t,n){e.forEach(r=>{var i;const o=r.parentNode||r.parentId;if(o&&!e.has(o))throw new Error(`Parent node ${o} not found`);if(o||n!=null&&n[r.id]){const{x:l,y:s,z:u}=Xh(r,e,{...r.position,z:((i=r[se])==null?void 0:i.z)??0},t);r.positionAbsolute={x:l,y:s},r[se].z=u,n!=null&&n[r.id]&&(r[se].isParent=!0)}})}function ys(e,t,n,r){const o=new Map,i={},l=r?1e3:0;return e.forEach(s=>{var g;const u=(lt(s.zIndex)?s.zIndex:0)+(s.selected?l:0),a=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(i[f]=!0);const p=(a==null?void 0:a.type)&&(a==null?void 0:a.type)!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:p||(g=a==null?void 0:a[se])==null?void 0:g.handleBounds,z:u}}),o.set(s.id,c)}),jh(o,n,i),o}function Kh(e,t={}){const{getNodes:n,width:r,height:o,minZoom:i,maxZoom:l,d3Zoom:s,d3Selection:u,fitViewOnInitDone:a,fitViewOnInit:c,nodeOrigin:f}=e(),p=t.initial&&!a&&c;if(s&&u&&(p||!t.initial)){const x=n().filter(_=>{var h;const d=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(h=t.nodes)!=null&&h.length?d&&t.nodes.some(m=>m.id===_.id):d}),v=x.every(_=>_.width&&_.height);if(x.length>0&&v){const _=$l(x,f),{x:d,y:h,zoom:m}=Dh(_,r,o,t.minZoom??i,t.maxZoom??l,t.padding??.1),y=vn.translate(d,h).scale(m);return typeof t.duration=="number"&&t.duration>0?s.transform(Dn(u,t.duration),y):s.transform(u,y),!0}}return!1}function $x(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[se]:r[se],selected:n.selected})}),new Map(t)}function Ox(e,t){return t.map(n=>{const r=e.find(o=>o.id===n.id);return r&&(n.selected=r.selected),n})}function mi({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:o,edges:i,onNodesChange:l,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:a}=n();e!=null&&e.length&&(u&&r({nodeInternals:$x(e,o)}),l==null||l(e)),t!=null&&t.length&&(a&&r({edges:Ox(t,i)}),s==null||s(t))}const bn=()=>{},Fx={zoomIn:bn,zoomOut:bn,zoomTo:bn,getZoom:()=>1,setViewport:bn,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:bn,fitBounds:bn,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},Hx=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Bx=()=>{const e=ve(),{d3Zoom:t,d3Selection:n}=re(Hx,_e);return A.useMemo(()=>n&&t?{zoomIn:o=>t.scaleBy(Dn(n,o==null?void 0:o.duration),1.2),zoomOut:o=>t.scaleBy(Dn(n,o==null?void 0:o.duration),1/1.2),zoomTo:(o,i)=>t.scaleTo(Dn(n,i==null?void 0:i.duration),o),getZoom:()=>e.getState().transform[2],setViewport:(o,i)=>{const[l,s,u]=e.getState().transform,a=vn.translate(o.x??l,o.y??s).scale(o.zoom??u);t.transform(Dn(n,i==null?void 0:i.duration),a)},getViewport:()=>{const[o,i,l]=e.getState().transform;return{x:o,y:i,zoom:l}},fitView:o=>Kh(e.getState,o),setCenter:(o,i,l)=>{const{width:s,height:u,maxZoom:a}=e.getState(),c=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:a,f=s/2-o*c,p=u/2-i*c,g=vn.translate(f,p).scale(c);t.transform(Dn(n,l==null?void 0:l.duration),g)},fitBounds:(o,i)=>{const{width:l,height:s,minZoom:u,maxZoom:a}=e.getState(),{x:c,y:f,zoom:p}=Dh(o,l,s,u,a,(i==null?void 0:i.padding)??.1),g=vn.translate(c,f).scale(p);t.transform(Dn(n,i==null?void 0:i.duration),g)},project:o=>{const{transform:i,snapToGrid:l,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Nu(o,i,l,s)},screenToFlowPosition:o=>{const{transform:i,snapToGrid:l,snapGrid:s,domNode:u}=e.getState();if(!u)return o;const{x:a,y:c}=u.getBoundingClientRect(),f={x:o.x-a,y:o.y-c};return Nu(f,i,l,s)},flowToScreenPosition:o=>{const{transform:i,domNode:l}=e.getState();if(!l)return o;const{x:s,y:u}=l.getBoundingClientRect(),a=Th(o,i);return{x:a.x+s,y:a.y+u}},viewportInitialized:!0}:Fx,[t,n])};function Oa(){const e=Bx(),t=ve(),n=A.useCallback(()=>t.getState().getNodes().map(v=>({...v})),[]),r=A.useCallback(v=>t.getState().nodeInternals.get(v),[]),o=A.useCallback(()=>{const{edges:v=[]}=t.getState();return v.map(_=>({..._}))},[]),i=A.useCallback(v=>{const{edges:_=[]}=t.getState();return _.find(d=>d.id===v)},[]),l=A.useCallback(v=>{const{getNodes:_,setNodes:d,hasDefaultNodes:h,onNodesChange:m}=t.getState(),y=_(),E=typeof v=="function"?v(y):v;if(h)d(E);else if(m){const M=E.length===0?y.map(N=>({type:"remove",id:N.id})):E.map(N=>({item:N,type:"reset"}));m(M)}},[]),s=A.useCallback(v=>{const{edges:_=[],setEdges:d,hasDefaultEdges:h,onEdgesChange:m}=t.getState(),y=typeof v=="function"?v(_):v;if(h)d(y);else if(m){const E=y.length===0?_.map(M=>({type:"remove",id:M.id})):y.map(M=>({item:M,type:"reset"}));m(E)}},[]),u=A.useCallback(v=>{const _=Array.isArray(v)?v:[v],{getNodes:d,setNodes:h,hasDefaultNodes:m,onNodesChange:y}=t.getState();if(m){const M=[...d(),..._];h(M)}else if(y){const E=_.map(M=>({item:M,type:"add"}));y(E)}},[]),a=A.useCallback(v=>{const _=Array.isArray(v)?v:[v],{edges:d=[],setEdges:h,hasDefaultEdges:m,onEdgesChange:y}=t.getState();if(m)h([...d,..._]);else if(y){const E=_.map(M=>({item:M,type:"add"}));y(E)}},[]),c=A.useCallback(()=>{const{getNodes:v,edges:_=[],transform:d}=t.getState(),[h,m,y]=d;return{nodes:v().map(E=>({...E})),edges:_.map(E=>({...E})),viewport:{x:h,y:m,zoom:y}}},[]),f=A.useCallback(({nodes:v,edges:_})=>{const{nodeInternals:d,getNodes:h,edges:m,hasDefaultNodes:y,hasDefaultEdges:E,onNodesDelete:M,onEdgesDelete:N,onNodesChange:C,onEdgesChange:R}=t.getState(),L=(v||[]).map(z=>z.id),H=(_||[]).map(z=>z.id),V=h().reduce((z,P)=>{const $=P.parentNode||P.parentId,k=!L.includes(P.id)&&$&&z.find(T=>T.id===$);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(L.includes(P.id)||k)&&z.push(P),z},[]),O=m.filter(z=>typeof z.deletable=="boolean"?z.deletable:!0),w=O.filter(z=>H.includes(z.id));if(V||w){const z=Ah(V,O),P=[...w,...z],$=P.reduce((k,S)=>(k.includes(S.id)||k.push(S.id),k),[]);if((E||y)&&(E&&t.setState({edges:m.filter(k=>!$.includes(k.id))}),y&&(V.forEach(k=>{d.delete(k.id)}),t.setState({nodeInternals:new Map(d)}))),$.length>0&&(N==null||N(P),R&&R($.map(k=>({id:k,type:"remove"})))),V.length>0&&(M==null||M(V),C)){const k=V.map(S=>({id:S.id,type:"remove"}));C(k)}}},[]),p=A.useCallback(v=>{const _=ux(v),d=_?null:t.getState().nodeInternals.get(v.id);return!_&&!d?[null,null,_]:[_?v:gf(d),d,_]},[]),g=A.useCallback((v,_=!0,d)=>{const[h,m,y]=p(v);return h?(d||t.getState().getNodes()).filter(E=>{if(!y&&(E.id===m.id||!E.positionAbsolute))return!1;const M=gf(E),N=Su(M,h);return _&&N>0||N>=h.width*h.height}):[]},[]),x=A.useCallback((v,_,d=!0)=>{const[h]=p(v);if(!h)return!1;const m=Su(h,_);return d&&m>0||m>=h.width*h.height},[]);return A.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:o,getEdge:i,setNodes:l,setEdges:s,addNodes:u,addEdges:a,toObject:c,deleteElements:f,getIntersectingNodes:g,isNodeIntersecting:x}),[e,n,r,o,i,l,s,u,a,c,f,g,x])}const Vx={actInsideInputWithModifier:!1};var Ux=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=ve(),{deleteElements:r}=Oa(),o=Ho(e,Vx),i=Ho(t);A.useEffect(()=>{if(o){const{edges:l,getNodes:s}=n.getState(),u=s().filter(c=>c.selected),a=l.filter(c=>c.selected);r({nodes:u,edges:a}),n.setState({nodesSelectionActive:!1})}},[o]),A.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function Wx(e){const t=ve();A.useEffect(()=>{let n;const r=()=>{var i,l;if(!e.current)return;const o=Ma(e.current);(o.height===0||o.width===0)&&((l=(i=t.getState()).onError)==null||l.call(i,"004",Zt.error004())),t.setState({width:o.width||500,height:o.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const Fa={position:"absolute",width:"100%",height:"100%",top:0,left:0},Yx=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,yi=e=>({x:e.x,y:e.y,zoom:e.k}),er=(e,t)=>e.target.closest(`.${t}`),Nf=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Cf=e=>{const t=e.ctrlKey&&al()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Xx=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),jx=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:o=!0,zoomOnPinch:i=!0,panOnScroll:l=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=On.Free,zoomOnDoubleClick:a=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:p,translateExtent:g,minZoom:x,maxZoom:v,zoomActivationKeyCode:_,preventScrolling:d=!0,children:h,noWheelClassName:m,noPanClassName:y})=>{const E=A.useRef(),M=ve(),N=A.useRef(!1),C=A.useRef(!1),R=A.useRef(null),L=A.useRef({x:0,y:0,zoom:0}),{d3Zoom:H,d3Selection:V,d3ZoomHandler:O,userSelectionActive:w}=re(Xx,_e),z=Ho(_),P=A.useRef(0),$=A.useRef(!1),k=A.useRef();return Wx(R),A.useEffect(()=>{if(R.current){const S=R.current.getBoundingClientRect(),T=ex().scaleExtent([x,v]).translateExtent(g),D=ot(R.current).call(T),F=vn.translate(p.x,p.y).scale(En(p.zoom,x,v)),W=[[0,0],[S.width,S.height]],U=T.constrain()(F,W,g);T.transform(D,U),T.wheelDelta(Cf),M.setState({d3Zoom:T,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:R.current.closest(".react-flow")})}},[]),A.useEffect(()=>{V&&H&&(l&&!z&&!w?V.on("wheel.zoom",S=>{if(er(S,m))return!1;S.preventDefault(),S.stopImmediatePropagation();const T=V.property("__zoom").k||1,D=al();if(S.ctrlKey&&i&&D){const ue=Pt(S),ee=Cf(S),pe=T*Math.pow(2,ee);H.scaleTo(V,pe,ue,S);return}const F=S.deltaMode===1?20:1;let W=u===On.Vertical?0:S.deltaX*F,U=u===On.Horizontal?0:S.deltaY*F;!D&&S.shiftKey&&u!==On.Vertical&&(W=S.deltaY*F,U=0),H.translateBy(V,-(W/T)*s,-(U/T)*s,{internal:!0});const K=yi(V.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:Z,onViewportChangeEnd:J}=M.getState();clearTimeout(k.current),$.current||($.current=!0,t==null||t(S,K),Q==null||Q(K)),$.current&&(e==null||e(S,K),Z==null||Z(K),k.current=setTimeout(()=>{n==null||n(S,K),J==null||J(K),$.current=!1},150))},{passive:!1}):typeof O<"u"&&V.on("wheel.zoom",function(S,T){if(!d&&S.type==="wheel"&&!S.ctrlKey||er(S,m))return null;S.preventDefault(),O.call(this,S,T)},{passive:!1}))},[w,l,u,V,H,O,z,i,d,m,t,e,n]),A.useEffect(()=>{H&&H.on("start",S=>{var F,W;if(!S.sourceEvent||S.sourceEvent.internal)return null;P.current=(F=S.sourceEvent)==null?void 0:F.button;const{onViewportChangeStart:T}=M.getState(),D=yi(S.transform);N.current=!0,L.current=D,((W=S.sourceEvent)==null?void 0:W.type)==="mousedown"&&M.setState({paneDragging:!0}),T==null||T(D),t==null||t(S.sourceEvent,D)})},[H,t]),A.useEffect(()=>{H&&(w&&!N.current?H.on("zoom",null):w||H.on("zoom",S=>{var D;const{onViewportChange:T}=M.getState();if(M.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),C.current=!!(r&&Nf(f,P.current??0)),(e||T)&&!((D=S.sourceEvent)!=null&&D.internal)){const F=yi(S.transform);T==null||T(F),e==null||e(S.sourceEvent,F)}}))},[w,H,e,f,r]),A.useEffect(()=>{H&&H.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:T}=M.getState();if(N.current=!1,M.setState({paneDragging:!1}),r&&Nf(f,P.current??0)&&!C.current&&r(S.sourceEvent),C.current=!1,(n||T)&&Yx(L.current,S.transform)){const D=yi(S.transform);L.current=D,clearTimeout(E.current),E.current=setTimeout(()=>{T==null||T(D),n==null||n(S.sourceEvent,D)},l?150:0)}})},[H,l,f,n,r]),A.useEffect(()=>{H&&H.filter(S=>{const T=z||o,D=i&&S.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&S.button===1&&S.type==="mousedown"&&(er(S,"react-flow__node")||er(S,"react-flow__edge")))return!0;if(!f&&!T&&!l&&!a&&!i||w||!a&&S.type==="dblclick"||er(S,m)&&S.type==="wheel"||er(S,y)&&(S.type!=="wheel"||l&&S.type==="wheel"&&!z)||!i&&S.ctrlKey&&S.type==="wheel"||!T&&!l&&!D&&S.type==="wheel"||!f&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(f)&&!f.includes(S.button)&&(S.type==="mousedown"||S.type==="touchstart"))return!1;const F=Array.isArray(f)&&f.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&F})},[w,H,o,i,l,a,f,c,z]),I.createElement("div",{className:"react-flow__renderer",ref:R,style:Fa},h)},Kx=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qx(){const{userSelectionActive:e,userSelectionRect:t}=re(Kx,_e);return e&&t?I.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Mf(e,t){const n=t.parentNode||t.parentId,r=e.find(o=>o.id===n);if(r){const o=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(o>0||i>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,o>0&&(r.style.width+=o),i>0&&(r.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);r.position.x=r.position.x-l,r.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);r.position.y=r.position.y-l,r.style.height+=l,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function Qh(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,o)=>{const i=e.filter(s=>s.id===o.id);if(i.length===0)return r.push(o),r;const l={...o};for(const s of i)if(s)switch(s.type){case"select":{l.selected=s.selected;break}case"position":{typeof s.position<"u"&&(l.position=s.position),typeof s.positionAbsolute<"u"&&(l.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&Mf(r,l);break}case"dimensions":{typeof s.dimensions<"u"&&(l.width=s.dimensions.width,l.height=s.dimensions.height),typeof s.updateStyle<"u"&&(l.style={...l.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(l.resizing=s.resizing),l.expandParent&&Mf(r,l);break}case"remove":return r}return r.push(l),r},n)}function Zh(e,t){return Qh(e,t)}function Zx(e,t){return Qh(e,t)}const rn=(e,t)=>({id:e,type:"select",selected:t});function hr(e,t){return e.reduce((n,r)=>{const o=t.includes(r.id);return!r.selected&&o?(r.selected=!0,n.push(rn(r.id,!0))):r.selected&&!o&&(r.selected=!1,n.push(rn(r.id,!1))),n},[])}const vs=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Gx=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Gh=A.memo(({isSelecting:e,selectionMode:t=Fo.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:o,onPaneClick:i,onPaneContextMenu:l,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:a,onPaneMouseLeave:c,children:f})=>{const p=A.useRef(null),g=ve(),x=A.useRef(0),v=A.useRef(0),_=A.useRef(),{userSelectionActive:d,elementsSelectable:h,dragging:m}=re(Gx,_e),y=()=>{g.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,v.current=0},E=O=>{i==null||i(O),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},M=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}l==null||l(O)},N=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:w,domNode:z}=g.getState();if(_.current=z==null?void 0:z.getBoundingClientRect(),!h||!e||O.button!==0||O.target!==p.current||!_.current)return;const{x:P,y:$}=wn(O,_.current);w(),g.setState({userSelectionRect:{width:0,height:0,startX:P,startY:$,x:P,y:$}}),r==null||r(O)},R=O=>{const{userSelectionRect:w,nodeInternals:z,edges:P,transform:$,onNodesChange:k,onEdgesChange:S,nodeOrigin:T,getNodes:D}=g.getState();if(!e||!_.current||!w)return;g.setState({userSelectionActive:!0,nodesSelectionActive:!1});const F=wn(O,_.current),W=w.startX??0,U=w.startY??0,K={...w,x:F.xee.id),ue=Z.map(ee=>ee.id);if(x.current!==ue.length){x.current=ue.length;const ee=hr(Q,ue);ee.length&&(k==null||k(ee))}if(v.current!==J.length){v.current=J.length;const ee=hr(P,J);ee.length&&(S==null||S(ee))}g.setState({userSelectionRect:K})},L=O=>{if(O.button!==0)return;const{userSelectionRect:w}=g.getState();!d&&w&&O.target===p.current&&(E==null||E(O)),g.setState({nodesSelectionActive:x.current>0}),y(),o==null||o(O)},H=O=>{d&&(g.setState({nodesSelectionActive:x.current>0}),o==null||o(O)),y()},V=h&&(e||d);return I.createElement("div",{className:Me(["react-flow__pane",{dragging:m,selection:e}]),onClick:V?void 0:vs(E,p),onContextMenu:vs(M,p),onWheel:vs(N,p),onMouseEnter:V?void 0:u,onMouseDown:V?C:void 0,onMouseMove:V?R:a,onMouseUp:V?L:void 0,onMouseLeave:V?H:c,ref:p,style:Fa},f,I.createElement(Qx,null))});Gh.displayName="Pane";function qh(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:qh(r,t):!1}function Pf(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function qx(e,t,n,r){return Array.from(e.values()).filter(o=>(o.selected||o.id===r)&&(!o.parentNode||o.parentId||!qh(o,e))&&(o.draggable||t&&typeof o.draggable>"u")).map(o=>{var i,l;return{id:o.id,position:o.position||{x:0,y:0},positionAbsolute:o.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=o.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((l=o.positionAbsolute)==null?void 0:l.y)??0)},delta:{x:0,y:0},extent:o.extent,parentNode:o.parentNode||o.parentId,parentId:o.parentNode||o.parentId,width:o.width,height:o.height,expandParent:o.expandParent}})}function Jx(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Jh(e,t,n,r,o=[0,0],i){const l=Jx(e,e.extent||r);let s=l;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=n.get(u),{x:p,y:g}=_r(f,o).positionAbsolute;s=f&<(p)&<(g)&<(f.width)&<(f.height)?[[p+e.width*o[0],g+e.height*o[1]],[p+f.width-e.width+e.width*o[0],g+f.height-e.height+e.height*o[1]]]:s}else i==null||i("005",Zt.error005()),s=l;else if(e.extent&&u&&e.extent!=="parent"){const f=n.get(u),{x:p,y:g}=_r(f,o).positionAbsolute;s=[[e.extent[0][0]+p,e.extent[0][1]+g],[e.extent[1][0]+p,e.extent[1][1]+g]]}let a={x:0,y:0};if(u){const f=n.get(u);a=_r(f,o).positionAbsolute}const c=s&&s!=="parent"?Pa(t,s):t;return{position:{x:c.x-a.x,y:c.y-a.y},positionAbsolute:c}}function ws({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(o=>({...n.get(o.id),position:o.position,positionAbsolute:o.positionAbsolute}));return[e?r.find(o=>o.id===e):r[0],r]}const Tf=(e,t,n,r)=>{const o=t.querySelectorAll(e);if(!o||!o.length)return null;const i=Array.from(o),l=t.getBoundingClientRect(),s={x:l.width*r[0],y:l.height*r[1]};return i.map(u=>{const a=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(a.left-l.left-s.x)/n,y:(a.top-l.top-s.y)/n,...Ma(u)}})};function qr(e,t,n){return n===void 0?n:r=>{const o=t().nodeInternals.get(e);o&&n(r,{...o})}}function Mu({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:l,nodeInternals:s,onError:u}=t.getState(),a=s.get(e);if(!a){u==null||u("012",Zt.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&l)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):o([e])}function bh(){const e=ve();return A.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:o,snapToGrid:i}=e.getState(),l=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,u={x:(l-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:i?o[0]*Math.round(u.x/o[0]):u.x,ySnapped:i?o[1]*Math.round(u.y/o[1]):u.y,...u}},[])}function xs(e){return(t,n,r)=>e==null?void 0:e(t,r)}function e0({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,selectNodesOnDrag:l}){const s=ve(),[u,a]=A.useState(!1),c=A.useRef([]),f=A.useRef({x:null,y:null}),p=A.useRef(0),g=A.useRef(null),x=A.useRef({x:0,y:0}),v=A.useRef(null),_=A.useRef(!1),d=A.useRef(!1),h=bh();return A.useEffect(()=>{if(e!=null&&e.current){const m=ot(e.current),y=({x:N,y:C})=>{const{nodeInternals:R,onNodeDrag:L,onSelectionDrag:H,updateNodePositions:V,nodeExtent:O,snapGrid:w,snapToGrid:z,nodeOrigin:P,onError:$}=s.getState();f.current={x:N,y:C};let k=!1,S={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&O){const D=$l(c.current,P);S=Ta(D)}if(c.current=c.current.map(D=>{const F={x:N-D.distance.x,y:C-D.distance.y};z&&(F.x=w[0]*Math.round(F.x/w[0]),F.y=w[1]*Math.round(F.y/w[1]));const W=[[O[0][0],O[0][1]],[O[1][0],O[1][1]]];c.current.length>1&&O&&!D.extent&&(W[0][0]=D.positionAbsolute.x-S.x+O[0][0],W[1][0]=D.positionAbsolute.x+(D.width??0)-S.x2+O[1][0],W[0][1]=D.positionAbsolute.y-S.y+O[0][1],W[1][1]=D.positionAbsolute.y+(D.height??0)-S.y2+O[1][1]);const U=Jh(D,F,R,W,P,$);return k=k||D.position.x!==U.position.x||D.position.y!==U.position.y,D.position=U.position,D.positionAbsolute=U.positionAbsolute,D}),!k)return;V(c.current,!0,!0),a(!0);const T=o?L:xs(H);if(T&&v.current){const[D,F]=ws({nodeId:o,dragItems:c.current,nodeInternals:R});T(v.current,D,F)}},E=()=>{if(!g.current)return;const[N,C]=xh(x.current,g.current);if(N!==0||C!==0){const{transform:R,panBy:L}=s.getState();f.current.x=(f.current.x??0)-N/R[2],f.current.y=(f.current.y??0)-C/R[2],L({x:N,y:C})&&y(f.current)}p.current=requestAnimationFrame(E)},M=N=>{var P;const{nodeInternals:C,multiSelectionActive:R,nodesDraggable:L,unselectNodesAndEdges:H,onNodeDragStart:V,onSelectionDragStart:O}=s.getState();d.current=!0;const w=o?V:xs(O);(!l||!i)&&!R&&o&&((P=C.get(o))!=null&&P.selected||H()),o&&i&&l&&Mu({id:o,store:s,nodeRef:e});const z=h(N);if(f.current=z,c.current=qx(C,L,z,o),w&&c.current){const[$,k]=ws({nodeId:o,dragItems:c.current,nodeInternals:C});w(N.sourceEvent,$,k)}};if(t)m.on(".drag",null);else{const N=oh().on("start",C=>{const{domNode:R,nodeDragThreshold:L}=s.getState();L===0&&M(C);const H=h(C);f.current=H,g.current=(R==null?void 0:R.getBoundingClientRect())||null,x.current=wn(C.sourceEvent,g.current)}).on("drag",C=>{var V,O;const R=h(C),{autoPanOnNodeDrag:L,nodeDragThreshold:H}=s.getState();if(!_.current&&d.current&&L&&(_.current=!0,E()),!d.current){const w=R.xSnapped-(((V=f==null?void 0:f.current)==null?void 0:V.x)??0),z=R.ySnapped-(((O=f==null?void 0:f.current)==null?void 0:O.y)??0);Math.sqrt(w*w+z*z)>H&&M(C)}(f.current.x!==R.xSnapped||f.current.y!==R.ySnapped)&&c.current&&d.current&&(v.current=C.sourceEvent,x.current=wn(C.sourceEvent,g.current),y(R))}).on("end",C=>{if(d.current&&(a(!1),_.current=!1,d.current=!1,cancelAnimationFrame(p.current),c.current)){const{updateNodePositions:R,nodeInternals:L,onNodeDragStop:H,onSelectionDragStop:V}=s.getState(),O=o?H:xs(V);if(R(c.current,!1,!1),O){const[w,z]=ws({nodeId:o,dragItems:c.current,nodeInternals:L});O(C.sourceEvent,w,z)}}}).filter(C=>{const R=C.target;return!C.button&&(!n||!Pf(R,`.${n}`,e))&&(!r||Pf(R,r,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,n,r,i,s,o,l,h]),u}function t0(){const e=ve();return A.useCallback(n=>{const{nodeInternals:r,nodeExtent:o,updateNodePositions:i,getNodes:l,snapToGrid:s,snapGrid:u,onError:a,nodesDraggable:c}=e.getState(),f=l().filter(h=>h.selected&&(h.draggable||c&&typeof h.draggable>"u")),p=s?u[0]:5,g=s?u[1]:5,x=n.isShiftPressed?4:1,v=n.x*p*x,_=n.y*g*x,d=f.map(h=>{if(h.positionAbsolute){const m={x:h.positionAbsolute.x+v,y:h.positionAbsolute.y+_};s&&(m.x=u[0]*Math.round(m.x/u[0]),m.y=u[1]*Math.round(m.y/u[1]));const{positionAbsolute:y,position:E}=Jh(h,m,r,o,void 0,a);h.position=E,h.positionAbsolute=y}return h});i(d,!0,!1)},[])}const kr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Jr=e=>{const t=({id:n,type:r,data:o,xPos:i,yPos:l,xPosOrigin:s,yPosOrigin:u,selected:a,onClick:c,onMouseEnter:f,onMouseMove:p,onMouseLeave:g,onContextMenu:x,onDoubleClick:v,style:_,className:d,isDraggable:h,isSelectable:m,isConnectable:y,isFocusable:E,selectNodesOnDrag:M,sourcePosition:N,targetPosition:C,hidden:R,resizeObserver:L,dragHandle:H,zIndex:V,isParent:O,noDragClassName:w,noPanClassName:z,initialized:P,disableKeyboardA11y:$,ariaLabel:k,rfId:S,hasHandleBounds:T})=>{const D=ve(),F=A.useRef(null),W=A.useRef(null),U=A.useRef(N),K=A.useRef(C),Q=A.useRef(r),Z=m||h||c||f||p||g,J=t0(),ue=qr(n,D.getState,f),ee=qr(n,D.getState,p),pe=qr(n,D.getState,g),Ie=qr(n,D.getState,x),Oe=qr(n,D.getState,v),Xe=te=>{const{nodeDragThreshold:Y}=D.getState();if(m&&(!M||!h||Y>0)&&Mu({id:n,store:D,nodeRef:F}),c){const ne=D.getState().nodeInternals.get(n);ne&&c(te,{...ne})}},he=te=>{if(!Eu(te)&&!$)if(Eh.includes(te.key)&&m){const Y=te.key==="Escape";Mu({id:n,store:D,unselect:Y,nodeRef:F})}else h&&a&&Object.prototype.hasOwnProperty.call(kr,te.key)&&(D.setState({ariaLiveMessage:`Moved selected node ${te.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~l}`}),J({x:kr[te.key].x,y:kr[te.key].y,isShiftPressed:te.shiftKey}))};A.useEffect(()=>()=>{W.current&&(L==null||L.unobserve(W.current),W.current=null)},[]),A.useEffect(()=>{if(F.current&&!R){const te=F.current;(!P||!T||W.current!==te)&&(W.current&&(L==null||L.unobserve(W.current)),L==null||L.observe(te),W.current=te)}},[R,P,T]),A.useEffect(()=>{const te=Q.current!==r,Y=U.current!==N,ne=K.current!==C;F.current&&(te||Y||ne)&&(te&&(Q.current=r),Y&&(U.current=N),ne&&(K.current=C),D.getState().updateNodeDimensions([{id:n,nodeElement:F.current,forceUpdate:!0}]))},[n,r,N,C]);const je=e0({nodeRef:F,disabled:R||!h,noDragClassName:w,handleSelector:H,nodeId:n,isSelectable:m,selectNodesOnDrag:M});return R?null:I.createElement("div",{className:Me(["react-flow__node",`react-flow__node-${r}`,{[z]:h},d,{selected:a,selectable:m,parent:O,dragging:je}]),ref:F,style:{zIndex:V,transform:`translate(${s}px,${u}px)`,pointerEvents:Z?"all":"none",visibility:P?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:ue,onMouseMove:ee,onMouseLeave:pe,onContextMenu:Ie,onClick:Xe,onDoubleClick:Oe,onKeyDown:E?he:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":$?void 0:`${Wh}-${S}`,"aria-label":k},I.createElement(gx,{value:n},I.createElement(e,{id:n,data:o,type:r,xPos:i,yPos:l,selected:a,isConnectable:y,sourcePosition:N,targetPosition:C,dragging:je,dragHandle:H,zIndex:V})))};return t.displayName="NodeWrapper",A.memo(t)};const bx=e=>{const t=e.getNodes().filter(n=>n.selected);return{...$l(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function eS({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ve(),{width:o,height:i,x:l,y:s,transformString:u,userSelectionActive:a}=re(bx,_e),c=t0(),f=A.useRef(null);if(A.useEffect(()=>{var x;n||(x=f.current)==null||x.focus({preventScroll:!0})},[n]),e0({nodeRef:f}),a||!o||!i)return null;const p=e?x=>{const v=r.getState().getNodes().filter(_=>_.selected);e(x,v)}:void 0,g=x=>{Object.prototype.hasOwnProperty.call(kr,x.key)&&c({x:kr[x.key].x,y:kr[x.key].y,isShiftPressed:x.shiftKey})};return I.createElement("div",{className:Me(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},I.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:i,top:s,left:l}}))}var tS=A.memo(eS);const nS=e=>e.nodesSelectionActive,n0=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,deleteKeyCode:s,onMove:u,onMoveStart:a,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:p,selectionMode:g,onSelectionStart:x,onSelectionEnd:v,multiSelectionKeyCode:_,panActivationKeyCode:d,zoomActivationKeyCode:h,elementsSelectable:m,zoomOnScroll:y,zoomOnPinch:E,panOnScroll:M,panOnScrollSpeed:N,panOnScrollMode:C,zoomOnDoubleClick:R,panOnDrag:L,defaultViewport:H,translateExtent:V,minZoom:O,maxZoom:w,preventScrolling:z,onSelectionContextMenu:P,noWheelClassName:$,noPanClassName:k,disableKeyboardA11y:S})=>{const T=re(nS),D=Ho(f),F=Ho(d),W=F||L,U=F||M,K=D||p&&W!==!0;return Ux({deleteKeyCode:s,multiSelectionKeyCode:_}),I.createElement(jx,{onMove:u,onMoveStart:a,onMoveEnd:c,onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:y,zoomOnPinch:E,panOnScroll:U,panOnScrollSpeed:N,panOnScrollMode:C,zoomOnDoubleClick:R,panOnDrag:!D&&W,defaultViewport:H,translateExtent:V,minZoom:O,maxZoom:w,zoomActivationKeyCode:h,preventScrolling:z,noWheelClassName:$,noPanClassName:k},I.createElement(Gh,{onSelectionStart:x,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:W,isSelecting:!!K,selectionMode:g},e,T&&I.createElement(tS,{onSelectionContextMenu:P,noPanClassName:k,disableKeyboardA11y:S})))};n0.displayName="FlowRenderer";var rS=A.memo(n0);function oS(e){return re(A.useCallback(n=>e?zh(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function iS(e){const t={input:Jr(e.input||Hh),default:Jr(e.default||Cu),output:Jr(e.output||Vh),group:Jr(e.group||$a)},n={},r=Object.keys(e).filter(o=>!["input","default","output","group"].includes(o)).reduce((o,i)=>(o[i]=Jr(e[i]||Cu),o),n);return{...t,...r}}const lS=({x:e,y:t,width:n,height:r,origin:o})=>!n||!r?{x:e,y:t}:o[0]<0||o[1]<0||o[0]>1||o[1]>1?{x:e,y:t}:{x:e-n*o[0],y:t-r*o[1]},sS=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),r0=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,updateNodeDimensions:i,onError:l}=re(sS,_e),s=oS(e.onlyRenderVisibleElements),u=A.useRef(),a=A.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const p=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));i(p)});return u.current=c,c},[]);return A.useEffect(()=>()=>{var c;(c=u==null?void 0:u.current)==null||c.disconnect()},[]),I.createElement("div",{className:"react-flow__nodes",style:Fa},s.map(c=>{var E,M,N;let f=c.type||"default";e.nodeTypes[f]||(l==null||l("003",Zt.error003(f)),f="default");const p=e.nodeTypes[f]||e.nodeTypes.default,g=!!(c.draggable||t&&typeof c.draggable>"u"),x=!!(c.selectable||o&&typeof c.selectable>"u"),v=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),d=e.nodeExtent?Pa(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,h=(d==null?void 0:d.x)??0,m=(d==null?void 0:d.y)??0,y=lS({x:h,y:m,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return I.createElement(p,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||j.Bottom,targetPosition:c.targetPosition||j.Top,hidden:c.hidden,xPos:h,yPos:m,xPosOrigin:y.x,yPosOrigin:y.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:g,isSelectable:x,isConnectable:v,isFocusable:_,resizeObserver:a,dragHandle:c.dragHandle,zIndex:((E=c[se])==null?void 0:E.z)??0,isParent:!!((M=c[se])!=null&&M.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!((N=c[se])!=null&&N.handleBounds)})}))};r0.displayName="NodeRenderer";var uS=A.memo(r0);const aS=(e,t,n)=>n===j.Left?e-t:n===j.Right?e+t:e,cS=(e,t,n)=>n===j.Top?e-t:n===j.Bottom?e+t:e,zf="react-flow__edgeupdater",Af=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:l,type:s})=>I.createElement("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:l,className:Me([zf,`${zf}-${s}`]),cx:aS(t,r,e),cy:cS(n,r,e),r,stroke:"transparent",fill:"transparent"}),fS=()=>!0;var tr=e=>{const t=({id:n,className:r,type:o,data:i,onClick:l,onEdgeDoubleClick:s,selected:u,animated:a,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,style:_,source:d,target:h,sourceX:m,sourceY:y,targetX:E,targetY:M,sourcePosition:N,targetPosition:C,elementsSelectable:R,hidden:L,sourceHandleId:H,targetHandleId:V,onContextMenu:O,onMouseEnter:w,onMouseMove:z,onMouseLeave:P,edgeUpdaterRadius:$,onEdgeUpdate:k,onEdgeUpdateStart:S,onEdgeUpdateEnd:T,markerEnd:D,markerStart:F,rfId:W,ariaLabel:U,isFocusable:K,isUpdatable:Q,pathOptions:Z,interactionWidth:J,disableKeyboardA11y:ue})=>{const ee=A.useRef(null),[pe,Ie]=A.useState(!1),[Oe,Xe]=A.useState(!1),he=ve(),je=A.useMemo(()=>`url('#${ku(F,W)}')`,[F,W]),te=A.useMemo(()=>`url('#${ku(D,W)}')`,[D,W]);if(L)return null;const Y=Pe=>{var Nt;const{edges:ft,addSelectedEdges:Cn,unselectNodesAndEdges:Mn,multiSelectionActive:Pn}=he.getState(),$t=ft.find(Fr=>Fr.id===n);$t&&(R&&(he.setState({nodesSelectionActive:!1}),$t.selected&&Pn?(Mn({nodes:[],edges:[$t]}),(Nt=ee.current)==null||Nt.blur()):Cn([n])),l&&l(Pe,$t))},ne=Gr(n,he.getState,s),Et=Gr(n,he.getState,O),qt=Gr(n,he.getState,w),Jt=Gr(n,he.getState,z),Lt=Gr(n,he.getState,P),_t=(Pe,ft)=>{if(Pe.button!==0)return;const{edges:Cn,isValidConnection:Mn}=he.getState(),Pn=ft?h:d,$t=(ft?V:H)||null,Nt=ft?"target":"source",Fr=Mn||fS,Ol=ft,Hr=Cn.find(Tn=>Tn.id===n);Xe(!0),S==null||S(Pe,Hr,Nt);const Fl=Tn=>{Xe(!1),T==null||T(Tn,Hr,Nt)};Lh({event:Pe,handleId:$t,nodeId:Pn,onConnect:Tn=>k==null?void 0:k(Hr,Tn),isTarget:Ol,getState:he.getState,setState:he.setState,isValidConnection:Fr,edgeUpdaterType:Nt,onEdgeUpdateEnd:Fl})},Fe=Pe=>_t(Pe,!0),Ke=Pe=>_t(Pe,!1),tt=()=>Ie(!0),ct=()=>Ie(!1),kt=!R&&!l,Or=Pe=>{var ft;if(!ue&&Eh.includes(Pe.key)&&R){const{unselectNodesAndEdges:Cn,addSelectedEdges:Mn,edges:Pn}=he.getState();Pe.key==="Escape"?((ft=ee.current)==null||ft.blur(),Cn({edges:[Pn.find(Nt=>Nt.id===n)]})):Mn([n])}};return I.createElement("g",{className:Me(["react-flow__edge",`react-flow__edge-${o}`,r,{selected:u,animated:a,inactive:kt,updating:pe}]),onClick:Y,onDoubleClick:ne,onContextMenu:Et,onMouseEnter:qt,onMouseMove:Jt,onMouseLeave:Lt,onKeyDown:K?Or:void 0,tabIndex:K?0:void 0,role:K?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${d} to ${h}`,"aria-describedby":K?`${Yh}-${W}`:void 0,ref:ee},!Oe&&I.createElement(e,{id:n,source:d,target:h,selected:u,animated:a,label:c,labelStyle:f,labelShowBg:p,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:v,data:i,style:_,sourceX:m,sourceY:y,targetX:E,targetY:M,sourcePosition:N,targetPosition:C,sourceHandleId:H,targetHandleId:V,markerStart:je,markerEnd:te,pathOptions:Z,interactionWidth:J}),Q&&I.createElement(I.Fragment,null,(Q==="source"||Q===!0)&&I.createElement(Af,{position:N,centerX:m,centerY:y,radius:$,onMouseDown:Fe,onMouseEnter:tt,onMouseOut:ct,type:"source"}),(Q==="target"||Q===!0)&&I.createElement(Af,{position:C,centerX:E,centerY:M,radius:$,onMouseDown:Ke,onMouseEnter:tt,onMouseOut:ct,type:"target"})))};return t.displayName="EdgeWrapper",A.memo(t)};function dS(e){const t={default:tr(e.default||fl),straight:tr(e.bezier||Da),step:tr(e.step||Aa),smoothstep:tr(e.step||Ll),simplebezier:tr(e.simplebezier||za)},n={},r=Object.keys(e).filter(o=>!["default","bezier"].includes(o)).reduce((o,i)=>(o[i]=tr(e[i]||fl),o),n);return{...t,...r}}function Df(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,o=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,l=(n==null?void 0:n.height)||t.height;switch(e){case j.Top:return{x:r+i/2,y:o};case j.Right:return{x:r+i,y:o+l/2};case j.Bottom:return{x:r+i/2,y:o+l};case j.Left:return{x:r,y:o+l/2}}}function If(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const pS=(e,t,n,r,o,i)=>{const l=Df(n,e,t),s=Df(i,r,o);return{sourceX:l.x,sourceY:l.y,targetX:s.x,targetY:s.y}};function hS({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:o,targetHeight:i,width:l,height:s,transform:u}){const a={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+o),y2:Math.max(e.y+r,t.y+i)};a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const c=Ta({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:l/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,a.x2)-Math.max(c.x,a.x)),p=Math.max(0,Math.min(c.y2,a.y2)-Math.max(c.y,a.y));return Math.ceil(f*p)>0}function Rf(e){var r,o,i,l,s;const t=((r=e==null?void 0:e[se])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const gS=[{level:0,isMaxLevel:!0,edges:[]}];function mS(e,t,n=!1){let r=-1;const o=e.reduce((l,s)=>{var c,f;const u=lt(s.zIndex);let a=u?s.zIndex:0;if(n){const p=t.get(s.target),g=t.get(s.source),x=s.selected||(p==null?void 0:p.selected)||(g==null?void 0:g.selected),v=Math.max(((c=g==null?void 0:g[se])==null?void 0:c.z)||0,((f=p==null?void 0:p[se])==null?void 0:f.z)||0,1e3);a=(u?s.zIndex:0)+(x?v:0)}return l[a]?l[a].push(s):l[a]=[s],r=a>r?a:r,l},{}),i=Object.entries(o).map(([l,s])=>{const u=+l;return{edges:s,level:u,isMaxLevel:u===r}});return i.length===0?gS:i}function yS(e,t,n){const r=re(A.useCallback(o=>e?o.edges.filter(i=>{const l=t.get(i.source),s=t.get(i.target);return(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&hS({sourcePos:l.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:l.width,sourceHeight:l.height,targetWidth:s.width,targetHeight:s.height,width:o.width,height:o.height,transform:o.transform})}):o.edges,[e,t]));return mS(r,t,n)}const vS=({color:e="none",strokeWidth:t=1})=>I.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),wS=({color:e="none",strokeWidth:t=1})=>I.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Lf={[cl.Arrow]:vS,[cl.ArrowClosed]:wS};function xS(e){const t=ve();return A.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(Lf,e)?Lf[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Zt.error009(e)),null)},[e])}const SS=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:s="auto-start-reverse"})=>{const u=xS(t);return u?I.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:s,refX:"0",refY:"0"},I.createElement(u,{color:n,strokeWidth:l})):null},ES=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((o,i)=>([i.markerStart,i.markerEnd].forEach(l=>{if(l&&typeof l=="object"){const s=ku(l,t);r.includes(s)||(o.push({id:s,color:l.color||e,...l}),r.push(s))}}),o),[]).sort((o,i)=>o.id.localeCompare(i.id))},o0=({defaultColor:e,rfId:t})=>{const n=re(A.useCallback(ES({defaultColor:e,rfId:t}),[e,t]),(r,o)=>!(r.length!==o.length||r.some((i,l)=>i.id!==o[l].id)));return I.createElement("defs",null,n.map(r=>I.createElement(SS,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};o0.displayName="MarkerDefinitions";var _S=A.memo(o0);const kS=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),i0=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:o,noPanClassName:i,onEdgeUpdate:l,onEdgeContextMenu:s,onEdgeMouseEnter:u,onEdgeMouseMove:a,onEdgeMouseLeave:c,onEdgeClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:g,onEdgeUpdateStart:x,onEdgeUpdateEnd:v,children:_,disableKeyboardA11y:d})=>{const{edgesFocusable:h,edgesUpdatable:m,elementsSelectable:y,width:E,height:M,connectionMode:N,nodeInternals:C,onError:R}=re(kS,_e),L=yS(t,C,n);return E?I.createElement(I.Fragment,null,L.map(({level:H,edges:V,isMaxLevel:O})=>I.createElement("svg",{key:H,style:{zIndex:H},width:E,height:M,className:"react-flow__edges react-flow__container"},O&&I.createElement(_S,{defaultColor:e,rfId:r}),I.createElement("g",null,V.map(w=>{const[z,P,$]=Rf(C.get(w.source)),[k,S,T]=Rf(C.get(w.target));if(!$||!T)return null;let D=w.type||"default";o[D]||(R==null||R("011",Zt.error011(D)),D="default");const F=o[D]||o.default,W=N===Qn.Strict?S.target:(S.target??[]).concat(S.source??[]),U=If(P.source,w.sourceHandle),K=If(W,w.targetHandle),Q=(U==null?void 0:U.position)||j.Bottom,Z=(K==null?void 0:K.position)||j.Top,J=!!(w.focusable||h&&typeof w.focusable>"u"),ue=typeof l<"u"&&(w.updatable||m&&typeof w.updatable>"u");if(!U||!K)return R==null||R("008",Zt.error008(U,w)),null;const{sourceX:ee,sourceY:pe,targetX:Ie,targetY:Oe}=pS(z,U,Q,k,K,Z);return I.createElement(F,{key:w.id,id:w.id,className:Me([w.className,i]),type:D,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:ee,sourceY:pe,targetX:Ie,targetY:Oe,sourcePosition:Q,targetPosition:Z,elementsSelectable:y,onEdgeUpdate:l,onContextMenu:s,onMouseEnter:u,onMouseMove:a,onMouseLeave:c,onClick:f,edgeUpdaterRadius:p,onEdgeDoubleClick:g,onEdgeUpdateStart:x,onEdgeUpdateEnd:v,rfId:r,ariaLabel:w.ariaLabel,isFocusable:J,isUpdatable:ue,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:d})})))),_):null};i0.displayName="EdgeRenderer";var NS=A.memo(i0);const CS=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function MS({children:e}){const t=re(CS);return I.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function PS(e){const t=Oa(),n=A.useRef(!1);A.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const TS={[j.Left]:j.Right,[j.Right]:j.Left,[j.Top]:j.Bottom,[j.Bottom]:j.Top},l0=({nodeId:e,handleType:t,style:n,type:r=sn.Bezier,CustomComponent:o,connectionStatus:i})=>{var M,N,C;const{fromNode:l,handleId:s,toX:u,toY:a,connectionMode:c}=re(A.useCallback(R=>({fromNode:R.nodeInternals.get(e),handleId:R.connectionHandleId,toX:(R.connectionPosition.x-R.transform[0])/R.transform[2],toY:(R.connectionPosition.y-R.transform[1])/R.transform[2],connectionMode:R.connectionMode}),[e]),_e),f=(M=l==null?void 0:l[se])==null?void 0:M.handleBounds;let p=f==null?void 0:f[t];if(c===Qn.Loose&&(p=p||(f==null?void 0:f[t==="source"?"target":"source"])),!l||!p)return null;const g=s?p.find(R=>R.id===s):p[0],x=g?g.x+g.width/2:(l.width??0)/2,v=g?g.y+g.height/2:l.height??0,_=(((N=l.positionAbsolute)==null?void 0:N.x)??0)+x,d=(((C=l.positionAbsolute)==null?void 0:C.y)??0)+v,h=g==null?void 0:g.position,m=h?TS[h]:null;if(!h||!m)return null;if(o)return I.createElement(o,{connectionLineType:r,connectionLineStyle:n,fromNode:l,fromHandle:g,fromX:_,fromY:d,toX:u,toY:a,fromPosition:h,toPosition:m,connectionStatus:i});let y="";const E={sourceX:_,sourceY:d,sourcePosition:h,targetX:u,targetY:a,targetPosition:m};return r===sn.Bezier?[y]=Mh(E):r===sn.Step?[y]=_u({...E,borderRadius:0}):r===sn.SmoothStep?[y]=_u(E):r===sn.SimpleBezier?[y]=Ch(E):y=`M${_},${d} ${u},${a}`,I.createElement("path",{d:y,fill:"none",className:"react-flow__connection-path",style:n})};l0.displayName="ConnectionLine";const zS=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function AS({containerStyle:e,style:t,type:n,component:r}){const{nodeId:o,handleType:i,nodesConnectable:l,width:s,height:u,connectionStatus:a}=re(zS,_e);return!(o&&i&&s&&l)?null:I.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},I.createElement("g",{className:Me(["react-flow__connection",a])},I.createElement(l0,{nodeId:o,handleType:i,style:t,type:n,CustomComponent:r,connectionStatus:a})))}function $f(e,t){return A.useRef(null),ve(),A.useMemo(()=>t(e),[e])}const s0=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:o,onInit:i,onNodeClick:l,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,onSelectionContextMenu:x,onSelectionStart:v,onSelectionEnd:_,connectionLineType:d,connectionLineStyle:h,connectionLineComponent:m,connectionLineContainerStyle:y,selectionKeyCode:E,selectionOnDrag:M,selectionMode:N,multiSelectionKeyCode:C,panActivationKeyCode:R,zoomActivationKeyCode:L,deleteKeyCode:H,onlyRenderVisibleElements:V,elementsSelectable:O,selectNodesOnDrag:w,defaultViewport:z,translateExtent:P,minZoom:$,maxZoom:k,preventScrolling:S,defaultMarkerColor:T,zoomOnScroll:D,zoomOnPinch:F,panOnScroll:W,panOnScrollSpeed:U,panOnScrollMode:K,zoomOnDoubleClick:Q,panOnDrag:Z,onPaneClick:J,onPaneMouseEnter:ue,onPaneMouseMove:ee,onPaneMouseLeave:pe,onPaneScroll:Ie,onPaneContextMenu:Oe,onEdgeUpdate:Xe,onEdgeContextMenu:he,onEdgeMouseEnter:je,onEdgeMouseMove:te,onEdgeMouseLeave:Y,edgeUpdaterRadius:ne,onEdgeUpdateStart:Et,onEdgeUpdateEnd:qt,noDragClassName:Jt,noWheelClassName:Lt,noPanClassName:_t,elevateEdgesOnSelect:Fe,disableKeyboardA11y:Ke,nodeOrigin:tt,nodeExtent:ct,rfId:kt})=>{const Or=$f(e,iS),Pe=$f(t,dS);return PS(i),I.createElement(rS,{onPaneClick:J,onPaneMouseEnter:ue,onPaneMouseMove:ee,onPaneMouseLeave:pe,onPaneContextMenu:Oe,onPaneScroll:Ie,deleteKeyCode:H,selectionKeyCode:E,selectionOnDrag:M,selectionMode:N,onSelectionStart:v,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:R,zoomActivationKeyCode:L,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:o,zoomOnScroll:D,zoomOnPinch:F,zoomOnDoubleClick:Q,panOnScroll:W,panOnScrollSpeed:U,panOnScrollMode:K,panOnDrag:Z,defaultViewport:z,translateExtent:P,minZoom:$,maxZoom:k,onSelectionContextMenu:x,preventScrolling:S,noDragClassName:Jt,noWheelClassName:Lt,noPanClassName:_t,disableKeyboardA11y:Ke},I.createElement(MS,null,I.createElement(NS,{edgeTypes:Pe,onEdgeClick:s,onEdgeDoubleClick:a,onEdgeUpdate:Xe,onlyRenderVisibleElements:V,onEdgeContextMenu:he,onEdgeMouseEnter:je,onEdgeMouseMove:te,onEdgeMouseLeave:Y,onEdgeUpdateStart:Et,onEdgeUpdateEnd:qt,edgeUpdaterRadius:ne,defaultMarkerColor:T,noPanClassName:_t,elevateEdgesOnSelect:!!Fe,disableKeyboardA11y:Ke,rfId:kt},I.createElement(AS,{style:h,type:d,component:m,containerStyle:y})),I.createElement("div",{className:"react-flow__edgelabel-renderer"}),I.createElement(uS,{nodeTypes:Or,onNodeClick:l,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:p,onNodeContextMenu:g,selectNodesOnDrag:w,onlyRenderVisibleElements:V,noPanClassName:_t,noDragClassName:Jt,disableKeyboardA11y:Ke,nodeOrigin:tt,nodeExtent:ct,rfId:kt})))};s0.displayName="GraphView";var DS=A.memo(s0);const Pu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],en={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Pu,nodeExtent:Pu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Qn.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:ax,isValidConnection:void 0},IS=()=>wy((e,t)=>({...en,setNodes:n=>{const{nodeInternals:r,nodeOrigin:o,elevateNodesOnSelect:i}=t();e({nodeInternals:ys(n,r,o,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(o=>({...r,...o}))})},setDefaultNodesAndEdges:(n,r)=>{const o=typeof n<"u",i=typeof r<"u",l=o?ys(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:l,edges:i?r:[],hasDefaultNodes:o,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:o,fitViewOnInit:i,fitViewOnInitDone:l,fitViewOnInitOptions:s,domNode:u,nodeOrigin:a}=t(),c=u==null?void 0:u.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:p}=new window.DOMMatrixReadOnly(f.transform),g=n.reduce((v,_)=>{const d=o.get(_.id);if(d!=null&&d.hidden)o.set(d.id,{...d,[se]:{...d[se],handleBounds:void 0}});else if(d){const h=Ma(_.nodeElement);!!(h.width&&h.height&&(d.width!==h.width||d.height!==h.height||_.forceUpdate))&&(o.set(d.id,{...d,[se]:{...d[se],handleBounds:{source:Tf(".source",_.nodeElement,p,a),target:Tf(".target",_.nodeElement,p,a)}},...h}),v.push({id:d.id,type:"dimensions",dimensions:h}))}return v},[]);jh(o,a);const x=l||i&&!l&&Kh(t,{initial:!0,...s});e({nodeInternals:new Map(o),fitViewOnInitDone:x}),(g==null?void 0:g.length)>0&&(r==null||r(g))},updateNodePositions:(n,r=!0,o=!1)=>{const{triggerNodeChanges:i}=t(),l=n.map(s=>{const u={id:s.id,type:"position",dragging:o};return r&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});i(l)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:o,hasDefaultNodes:i,nodeOrigin:l,getNodes:s,elevateNodesOnSelect:u}=t();if(n!=null&&n.length){if(i){const a=Zh(n,s()),c=ys(a,o,l,u);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let l,s=null;r?l=n.map(u=>rn(u,!0)):(l=hr(i(),n),s=hr(o,[])),mi({changedNodes:l,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:o,getNodes:i}=t();let l,s=null;r?l=n.map(u=>rn(u,!0)):(l=hr(o,n),s=hr(i(),[])),mi({changedNodes:s,changedEdges:l,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:o,getNodes:i}=t(),l=n||i(),s=r||o,u=l.map(c=>(c.selected=!1,rn(c.id,!1))),a=s.map(c=>rn(c.id,!1));mi({changedNodes:u,changedEdges:a,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:o}=t();r==null||r.scaleExtent([n,o]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:o}=t();r==null||r.scaleExtent([o,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),i=r().filter(s=>s.selected).map(s=>rn(s.id,!1)),l=n.filter(s=>s.selected).map(s=>rn(s.id,!1));mi({changedNodes:i,changedEdges:l,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(o=>{o.positionAbsolute=Pa(o.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:o,height:i,d3Zoom:l,d3Selection:s,translateExtent:u}=t();if(!l||!s||!n.x&&!n.y)return!1;const a=vn.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[o,i]],f=l==null?void 0:l.constrain()(a,c,u);return l.transform(s,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>e({connectionNodeId:en.connectionNodeId,connectionHandleId:en.connectionHandleId,connectionHandleType:en.connectionHandleType,connectionStatus:en.connectionStatus,connectionStartHandle:en.connectionStartHandle,connectionEndHandle:en.connectionEndHandle}),reset:()=>e({...en})}),Object.is),u0=({children:e})=>{const t=A.useRef(null);return t.current||(t.current=IS()),I.createElement(tx,{value:t.current},e)};u0.displayName="ReactFlowProvider";const a0=({children:e})=>A.useContext(Rl)?I.createElement(I.Fragment,null,e):I.createElement(u0,null,e);a0.displayName="ReactFlowWrapper";const RS={input:Hh,default:Cu,output:Vh,group:$a},LS={default:fl,straight:Da,step:Aa,smoothstep:Ll,simplebezier:za},$S=[0,0],OS=[15,15],FS={x:0,y:0,zoom:1},HS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},BS=A.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i=RS,edgeTypes:l=LS,onNodeClick:s,onEdgeClick:u,onInit:a,onMove:c,onMoveStart:f,onMoveEnd:p,onConnect:g,onConnectStart:x,onConnectEnd:v,onClickConnectStart:_,onClickConnectEnd:d,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:E,onNodeDoubleClick:M,onNodeDragStart:N,onNodeDrag:C,onNodeDragStop:R,onNodesDelete:L,onEdgesDelete:H,onSelectionChange:V,onSelectionDragStart:O,onSelectionDrag:w,onSelectionDragStop:z,onSelectionContextMenu:P,onSelectionStart:$,onSelectionEnd:k,connectionMode:S=Qn.Strict,connectionLineType:T=sn.Bezier,connectionLineStyle:D,connectionLineComponent:F,connectionLineContainerStyle:W,deleteKeyCode:U="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:Q=!1,selectionMode:Z=Fo.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:ue=al()?"Meta":"Control",zoomActivationKeyCode:ee=al()?"Meta":"Control",snapToGrid:pe=!1,snapGrid:Ie=OS,onlyRenderVisibleElements:Oe=!1,selectNodesOnDrag:Xe=!0,nodesDraggable:he,nodesConnectable:je,nodesFocusable:te,nodeOrigin:Y=$S,edgesFocusable:ne,edgesUpdatable:Et,elementsSelectable:qt,defaultViewport:Jt=FS,minZoom:Lt=.5,maxZoom:_t=2,translateExtent:Fe=Pu,preventScrolling:Ke=!0,nodeExtent:tt,defaultMarkerColor:ct="#b1b1b7",zoomOnScroll:kt=!0,zoomOnPinch:Or=!0,panOnScroll:Pe=!1,panOnScrollSpeed:ft=.5,panOnScrollMode:Cn=On.Free,zoomOnDoubleClick:Mn=!0,panOnDrag:Pn=!0,onPaneClick:$t,onPaneMouseEnter:Nt,onPaneMouseMove:Fr,onPaneMouseLeave:Ol,onPaneScroll:Hr,onPaneContextMenu:Fl,children:Ha,onEdgeUpdate:Tn,onEdgeContextMenu:h0,onEdgeDoubleClick:g0,onEdgeMouseEnter:m0,onEdgeMouseMove:y0,onEdgeMouseLeave:v0,onEdgeUpdateStart:w0,onEdgeUpdateEnd:x0,edgeUpdaterRadius:S0=10,onNodesChange:E0,onEdgesChange:_0,noDragClassName:k0="nodrag",noWheelClassName:N0="nowheel",noPanClassName:Ba="nopan",fitView:C0=!1,fitViewOptions:M0,connectOnClick:P0=!0,attributionPosition:T0,proOptions:z0,defaultEdgeOptions:A0,elevateNodesOnSelect:D0=!0,elevateEdgesOnSelect:I0=!1,disableKeyboardA11y:Va=!1,autoPanOnConnect:R0=!0,autoPanOnNodeDrag:L0=!0,connectionRadius:$0=20,isValidConnection:O0,onError:F0,style:H0,id:Ua,nodeDragThreshold:B0,...V0},U0)=>{const Hl=Ua||"1";return I.createElement("div",{...V0,style:{...H0,...HS},ref:U0,className:Me(["react-flow",o]),"data-testid":"rf__wrapper",id:Ua},I.createElement(a0,null,I.createElement(DS,{onInit:a,onMove:c,onMoveStart:f,onMoveEnd:p,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:h,onNodeMouseMove:m,onNodeMouseLeave:y,onNodeContextMenu:E,onNodeDoubleClick:M,nodeTypes:i,edgeTypes:l,connectionLineType:T,connectionLineStyle:D,connectionLineComponent:F,connectionLineContainerStyle:W,selectionKeyCode:K,selectionOnDrag:Q,selectionMode:Z,deleteKeyCode:U,multiSelectionKeyCode:ue,panActivationKeyCode:J,zoomActivationKeyCode:ee,onlyRenderVisibleElements:Oe,selectNodesOnDrag:Xe,defaultViewport:Jt,translateExtent:Fe,minZoom:Lt,maxZoom:_t,preventScrolling:Ke,zoomOnScroll:kt,zoomOnPinch:Or,zoomOnDoubleClick:Mn,panOnScroll:Pe,panOnScrollSpeed:ft,panOnScrollMode:Cn,panOnDrag:Pn,onPaneClick:$t,onPaneMouseEnter:Nt,onPaneMouseMove:Fr,onPaneMouseLeave:Ol,onPaneScroll:Hr,onPaneContextMenu:Fl,onSelectionContextMenu:P,onSelectionStart:$,onSelectionEnd:k,onEdgeUpdate:Tn,onEdgeContextMenu:h0,onEdgeDoubleClick:g0,onEdgeMouseEnter:m0,onEdgeMouseMove:y0,onEdgeMouseLeave:v0,onEdgeUpdateStart:w0,onEdgeUpdateEnd:x0,edgeUpdaterRadius:S0,defaultMarkerColor:ct,noDragClassName:k0,noWheelClassName:N0,noPanClassName:Ba,elevateEdgesOnSelect:I0,rfId:Hl,disableKeyboardA11y:Va,nodeOrigin:Y,nodeExtent:tt}),I.createElement(zx,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:x,onConnectEnd:v,onClickConnectStart:_,onClickConnectEnd:d,nodesDraggable:he,nodesConnectable:je,nodesFocusable:te,edgesFocusable:ne,edgesUpdatable:Et,elementsSelectable:qt,elevateNodesOnSelect:D0,minZoom:Lt,maxZoom:_t,nodeExtent:tt,onNodesChange:E0,onEdgesChange:_0,snapToGrid:pe,snapGrid:Ie,connectionMode:S,translateExtent:Fe,connectOnClick:P0,defaultEdgeOptions:A0,fitView:C0,fitViewOptions:M0,onNodesDelete:L,onEdgesDelete:H,onNodeDragStart:N,onNodeDrag:C,onNodeDragStop:R,onSelectionDrag:w,onSelectionDragStart:O,onSelectionDragStop:z,noPanClassName:Ba,nodeOrigin:Y,rfId:Hl,autoPanOnConnect:R0,autoPanOnNodeDrag:L0,onError:F0,connectionRadius:$0,isValidConnection:O0,nodeDragThreshold:B0}),I.createElement(Px,{onSelectionChange:V}),Ha,I.createElement(rx,{proOptions:z0,position:T0}),I.createElement(Lx,{rfId:Hl,disableKeyboardA11y:Va})))});BS.displayName="ReactFlow";const VS=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function hE({children:e}){const t=re(VS);return t?Pl.createPortal(e,t):null}function gE(){const e=ve();return A.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),i=(Array.isArray(t)?t:[t]).reduce((l,s)=>{const u=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return u&&l.push({id:s,nodeElement:u,forceUpdate:!0}),l},[]);requestAnimationFrame(()=>r(i))},[])}const US=e=>e.getNodes();function mE(){return re(US,_e)}function c0(e){return t=>{const[n,r]=A.useState(t),o=A.useCallback(i=>r(l=>e(i,l)),[]);return[n,r,o]}}const yE=c0(Zh),vE=c0(Zx);function WS(){return I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},I.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function YS(){return I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},I.createElement("path",{d:"M0 0h32v4.2H0z"}))}function XS(){return I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},I.createElement("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 jS(){return I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},I.createElement("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 KS(){return I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},I.createElement("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"}))}const io=({children:e,className:t,...n})=>I.createElement("button",{type:"button",className:Me(["react-flow__controls-button",t]),...n},e);io.displayName="ControlButton";const QS=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),f0=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:l,onFitView:s,onInteractiveChange:u,className:a,children:c,position:f="bottom-left"})=>{const p=ve(),[g,x]=A.useState(!1),{isInteractive:v,minZoomReached:_,maxZoomReached:d}=re(QS,_e),{zoomIn:h,zoomOut:m,fitView:y}=Oa();if(A.useEffect(()=>{x(!0)},[]),!g)return null;const E=()=>{h(),i==null||i()},M=()=>{m(),l==null||l()},N=()=>{y(o),s==null||s()},C=()=>{p.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)};return I.createElement(wh,{className:Me(["react-flow__controls",a]),position:f,style:e,"data-testid":"rf__controls"},t&&I.createElement(I.Fragment,null,I.createElement(io,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:d},I.createElement(WS,null)),I.createElement(io,{onClick:M,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},I.createElement(YS,null))),n&&I.createElement(io,{className:"react-flow__controls-fitview",onClick:N,title:"fit view","aria-label":"fit view"},I.createElement(XS,null)),r&&I.createElement(io,{className:"react-flow__controls-interactive",onClick:C,title:"toggle interactivity","aria-label":"toggle interactivity"},v?I.createElement(KS,null):I.createElement(jS,null)),c)};f0.displayName="Controls";var wE=A.memo(f0),wt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(wt||(wt={}));function ZS({color:e,dimensions:t,lineWidth:n}){return I.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function GS({color:e,radius:t}){return I.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const qS={[wt.Dots]:"#91919a",[wt.Lines]:"#eee",[wt.Cross]:"#e2e2e2"},JS={[wt.Dots]:1,[wt.Lines]:1,[wt.Cross]:6},bS=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function d0({id:e,variant:t=wt.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=2,color:l,style:s,className:u}){const a=A.useRef(null),{transform:c,patternId:f}=re(bS,_e),p=l||qS[t],g=r||JS[t],x=t===wt.Dots,v=t===wt.Cross,_=Array.isArray(n)?n:[n,n],d=[_[0]*c[2]||1,_[1]*c[2]||1],h=g*c[2],m=v?[h,h]:d,y=x?[h/i,h/i]:[m[0]/i,m[1]/i];return I.createElement("svg",{className:Me(["react-flow__background",u]),style:{...s,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:a,"data-testid":"rf__background"},I.createElement("pattern",{id:f+e,x:c[0]%d[0],y:c[1]%d[1],width:d[0],height:d[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${y[0]},-${y[1]})`},x?I.createElement(GS,{color:p,radius:h/i}):I.createElement(ZS,{dimensions:m,color:p,lineWidth:o})),I.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}d0.displayName="Background";var xE=A.memo(d0);const eE=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__renderer")};function tE({children:e}){const t=re(eE);return t?Pl.createPortal(e,t):null}const nE=(e,t)=>{var n,r,o,i,l,s;return((n=e==null?void 0:e.positionAbsolute)==null?void 0:n.x)===((r=t==null?void 0:t.positionAbsolute)==null?void 0:r.x)&&((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)===((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.y)&&(e==null?void 0:e.width)===(t==null?void 0:t.width)&&(e==null?void 0:e.height)===(t==null?void 0:t.height)&&(e==null?void 0:e.selected)===(t==null?void 0:t.selected)&&((l=e==null?void 0:e[se])==null?void 0:l.z)===((s=t==null?void 0:t[se])==null?void 0:s.z)},rE=(e,t)=>e.length===t.length&&e.every((n,r)=>nE(n,t[r])),oE=e=>({transform:e.transform,nodeOrigin:e.nodeOrigin,selectedNodesCount:e.getNodes().filter(t=>t.selected).length});function iE(e,t,n,r,o){let i=.5;o==="start"?i=0:o==="end"&&(i=1);let l=[(e.x+e.width*i)*t[2]+t[0],e.y*t[2]+t[1]-r],s=[-100*i,-100];switch(n){case j.Right:l=[(e.x+e.width)*t[2]+t[0]+r,(e.y+e.height*i)*t[2]+t[1]],s=[0,-100*i];break;case j.Bottom:l[1]=(e.y+e.height)*t[2]+t[1]+r,s[1]=0;break;case j.Left:l=[e.x*t[2]+t[0]-r,(e.y+e.height*i)*t[2]+t[1]],s=[-100,-100*i];break}return`translate(${l[0]}px, ${l[1]}px) translate(${s[0]}%, ${s[1]}%)`}function SE({nodeId:e,children:t,className:n,style:r,isVisible:o,position:i=j.Top,offset:l=10,align:s="center",...u}){const a=Ra(),c=A.useCallback(m=>(Array.isArray(e)?e:[e||a||""]).reduce((E,M)=>{const N=m.nodeInternals.get(M);return N&&E.push(N),E},[]),[e,a]),f=re(c,rE),{transform:p,nodeOrigin:g,selectedNodesCount:x}=re(oE,_e);if(!(typeof o=="boolean"?o:f.length===1&&f[0].selected&&x===1)||!f.length)return null;const _=$l(f,g),d=Math.max(...f.map(m=>{var y;return(((y=m[se])==null?void 0:y.z)||1)+1})),h={position:"absolute",transform:iE(_,p,i,l,s),zIndex:d,...r};return I.createElement(tE,null,I.createElement("div",{style:h,className:Me(["react-flow__node-toolbar",n]),...u},t))}var mo;(function(e){e.Line="line",e.Handle="handle"})(mo||(mo={}));function lE({width:e,prevWidth:t,height:n,prevHeight:r,invertX:o,invertY:i}){const l=e-t,s=n-r,u=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&o&&(u[0]=u[0]*-1),s&&i&&(u[1]=u[1]*-1),u}const p0={width:0,height:0,x:0,y:0},sE={...p0,pointerX:0,pointerY:0,aspectRatio:1};function uE({nodeId:e,position:t,variant:n=mo.Handle,className:r,style:o={},children:i,color:l,minWidth:s=10,minHeight:u=10,maxWidth:a=Number.MAX_VALUE,maxHeight:c=Number.MAX_VALUE,keepAspectRatio:f=!1,shouldResize:p,onResizeStart:g,onResize:x,onResizeEnd:v}){const _=Ra(),d=typeof e=="string"?e:_,h=ve(),m=A.useRef(null),y=A.useRef(sE),E=A.useRef(p0),M=bh(),N=n===mo.Line?"right":"bottom-right",C=t??N;A.useEffect(()=>{if(!m.current||!d)return;const V=ot(m.current),O=C.includes("right")||C.includes("left"),w=C.includes("bottom")||C.includes("top"),z=C.includes("left"),P=C.includes("top"),$=oh().on("start",k=>{const S=h.getState().nodeInternals.get(d),{xSnapped:T,ySnapped:D}=M(k);E.current={width:(S==null?void 0:S.width)??0,height:(S==null?void 0:S.height)??0,x:(S==null?void 0:S.position.x)??0,y:(S==null?void 0:S.position.y)??0},y.current={...E.current,pointerX:T,pointerY:D,aspectRatio:E.current.width/E.current.height},g==null||g(k,{...E.current})}).on("drag",k=>{const{nodeInternals:S,triggerNodeChanges:T}=h.getState(),{xSnapped:D,ySnapped:F}=M(k),W=S.get(d);if(W){const U=[],{pointerX:K,pointerY:Q,width:Z,height:J,x:ue,y:ee,aspectRatio:pe}=y.current,{x:Ie,y:Oe,width:Xe,height:he}=E.current,je=Math.floor(O?D-K:0),te=Math.floor(w?F-Q:0);let Y=En(Z+(z?-je:je),s,a),ne=En(J+(P?-te:te),u,c);if(f){const Fe=Y/ne,Ke=O&&w,tt=O&&!w,ct=w&&!O;Y=Fe<=pe&&Ke||ct?ne*pe:Y,ne=Fe>pe&&Ke||tt?Y/pe:ne,Y>=a?(Y=a,ne=a/pe):Y<=s&&(Y=s,ne=s/pe),ne>=c?(ne=c,Y=c*pe):ne<=u&&(ne=u,Y=u*pe)}const Et=Y!==Xe,qt=ne!==he;if(z||P){const Fe=z?ue-(Y-Z):ue,Ke=P?ee-(ne-J):ee,tt=Fe!==Ie&&Et,ct=Ke!==Oe&&qt;if(tt||ct){const kt={id:W.id,type:"position",position:{x:tt?Fe:Ie,y:ct?Ke:Oe}};U.push(kt),E.current.x=kt.position.x,E.current.y=kt.position.y}}if(Et||qt){const Fe={id:d,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:Y,height:ne}};U.push(Fe),E.current.width=Y,E.current.height=ne}if(U.length===0)return;const Jt=lE({width:E.current.width,prevWidth:Xe,height:E.current.height,prevHeight:he,invertX:z,invertY:P}),Lt={...E.current,direction:Jt};if((p==null?void 0:p(k,Lt))===!1)return;x==null||x(k,Lt),T(U)}}).on("end",k=>{const S={id:d,type:"dimensions",resizing:!1};v==null||v(k,{...E.current}),h.getState().triggerNodeChanges([S])});return V.call($),()=>{V.on(".drag",null)}},[d,C,s,u,a,c,f,M,g,x,v]);const R=C.split("-"),L=n===mo.Line?"borderColor":"backgroundColor",H=l?{...o,[L]:l}:o;return I.createElement("div",{className:Me(["react-flow__resize-control","nodrag",...R,n,r]),ref:m,style:H},i)}var EE=A.memo(uE);export{jo as B,wE as C,hE as E,dl as H,SE as N,j as P,Qm as R,vx as a,gE as b,EE as c,mE as d,yE as e,vE as f,Mh as g,pE as h,BS as i,xE as j,wt as k,Tt as l,_a as m,fE as n,cE as o,dE as p,u0 as q,Pl as r,Oa as u};