diff --git "a/assets/index-CkhzpNg6.js" "b/assets/index-CkhzpNg6.js" deleted file mode 100644--- "a/assets/index-CkhzpNg6.js" +++ /dev/null @@ -1,110 +0,0 @@ -var ZC=Object.defineProperty;var rv=t=>{throw TypeError(t)};var e1=(t,n,r)=>n in t?ZC(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;var Cn=(t,n,r)=>e1(t,typeof n!="symbol"?n+"":n,r),ov=(t,n,r)=>n.has(t)||rv("Cannot "+r);var kl=(t,n,r)=>(ov(t,n,"read from private field"),r?r.call(t):n.get(t)),iv=(t,n,r)=>n.has(t)?rv("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,r),sv=(t,n,r,o)=>(ov(t,n,"write to private field"),o?o.call(t,r):n.set(t,r),r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function o(s){if(s.ep)return;s.ep=!0;const l=r(s);fetch(s.href,l)}})();var Ur=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Mf={exports:{}},Nl={},Lf={exports:{}},ut={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var av;function t1(){if(av)return ut;av=1;var t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.iterator;function y(q){return q===null||typeof q!="object"?null:(q=v&&q[v]||q["@@iterator"],typeof q=="function"?q:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function A(q,se,Ee){this.props=q,this.context=se,this.refs=b,this.updater=Ee||x}A.prototype.isReactComponent={},A.prototype.setState=function(q,se){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,se,"setState")},A.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function _(){}_.prototype=A.prototype;function N(q,se,Ee){this.props=q,this.context=se,this.refs=b,this.updater=Ee||x}var R=N.prototype=new _;R.constructor=N,C(R,A.prototype),R.isPureReactComponent=!0;var D=Array.isArray,Z=Object.prototype.hasOwnProperty,ue={current:null},K={key:!0,ref:!0,__self:!0,__source:!0};function ne(q,se,Ee){var be,Ae={},Ne=null,$e=null;if(se!=null)for(be in se.ref!==void 0&&($e=se.ref),se.key!==void 0&&(Ne=""+se.key),se)Z.call(se,be)&&!K.hasOwnProperty(be)&&(Ae[be]=se[be]);var Te=arguments.length-2;if(Te===1)Ae.children=Ee;else if(1>>1,se=z[q];if(0>>1;qs(Ae,J))Nes($e,Ae)?(z[q]=$e,z[Ne]=J,q=Ne):(z[q]=Ae,z[be]=J,q=be);else if(Nes($e,J))z[q]=$e,z[Ne]=J,q=Ne;else break e}}return G}function s(z,G){var J=z.sortIndex-G.sortIndex;return J!==0?J:z.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();t.unstable_now=function(){return u.now()-h}}var d=[],p=[],m=1,v=null,y=3,x=!1,C=!1,b=!1,A=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function R(z){for(var G=r(p);G!==null;){if(G.callback===null)o(p);else if(G.startTime<=z)o(p),G.sortIndex=G.expirationTime,n(d,G);else break;G=r(p)}}function D(z){if(b=!1,R(z),!C)if(r(d)!==null)C=!0,j(Z);else{var G=r(p);G!==null&&Y(D,G.startTime-z)}}function Z(z,G){C=!1,b&&(b=!1,_(ne),ne=-1),x=!0;var J=y;try{for(R(G),v=r(d);v!==null&&(!(v.expirationTime>G)||z&&!H());){var q=v.callback;if(typeof q=="function"){v.callback=null,y=v.priorityLevel;var se=q(v.expirationTime<=G);G=t.unstable_now(),typeof se=="function"?v.callback=se:v===r(d)&&o(d),R(G)}else o(d);v=r(d)}if(v!==null)var Ee=!0;else{var be=r(p);be!==null&&Y(D,be.startTime-G),Ee=!1}return Ee}finally{v=null,y=J,x=!1}}var ue=!1,K=null,ne=-1,I=5,M=-1;function H(){return!(t.unstable_now()-Mz||125q?(z.sortIndex=J,n(p,z),r(d)===null&&z===r(p)&&(b?(_(ne),ne=-1):b=!0,Y(D,J-q))):(z.sortIndex=se,n(d,z),C||x||(C=!0,j(Z))),z},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(z){var G=y;return function(){var J=y;y=G;try{return z.apply(this,arguments)}finally{y=J}}}}(Bf)),Bf}var dv;function i1(){return dv||(dv=1,jf.exports=o1()),jf.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 fv;function s1(){if(fv)return Mn;fv=1;var t=vc(),n=i1();function r(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,c=1;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,p=/^[: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]*$/,m={},v={};function y(i){return d.call(v,i)?!0:d.call(m,i)?!1:p.test(i)?v[i]=!0:(m[i]=!0,!1)}function x(i,a,c,g){if(c!==null&&c.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return g?!1:c!==null?!c.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function C(i,a,c,g){if(a===null||typeof a>"u"||x(i,a,c,g))return!0;if(g)return!1;if(c!==null)switch(c.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function b(i,a,c,g,S,P,L){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=g,this.attributeNamespace=S,this.mustUseProperty=c,this.propertyName=i,this.type=a,this.sanitizeURL=P,this.removeEmptyString=L}var A={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){A[i]=new b(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var a=i[0];A[a]=new b(a,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){A[i]=new b(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){A[i]=new b(i,2,!1,i,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(i){A[i]=new b(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){A[i]=new b(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){A[i]=new b(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){A[i]=new b(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){A[i]=new b(i,5,!1,i.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function N(i){return i[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(i){var a=i.replace(_,N);A[a]=new b(a,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var a=i.replace(_,N);A[a]=new b(a,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var a=i.replace(_,N);A[a]=new b(a,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){A[i]=new b(i,1,!1,i.toLowerCase(),null,!1,!1)}),A.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){A[i]=new b(i,1,!1,i.toLowerCase(),null,!0,!0)});function R(i,a,c,g){var S=A.hasOwnProperty(a)?A[a]:null;(S!==null?S.type!==0:g||!(2Q||S[L]!==P[Q]){var re=` -`+S[L].replace(" at new "," at ");return i.displayName&&re.includes("")&&(re=re.replace("",i.displayName)),re}while(1<=L&&0<=Q);break}}}finally{Ee=!1,Error.prepareStackTrace=c}return(i=i?i.displayName||i.name:"")?se(i):""}function Ae(i){switch(i.tag){case 5:return se(i.type);case 16:return se("Lazy");case 13:return se("Suspense");case 19:return se("SuspenseList");case 0:case 2:case 15:return i=be(i.type,!1),i;case 11:return i=be(i.type.render,!1),i;case 1:return i=be(i.type,!0),i;default:return""}}function Ne(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case K:return"Fragment";case ue:return"Portal";case I:return"Profiler";case ne:return"StrictMode";case X:return"Suspense";case V:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case H:return(i.displayName||"Context")+".Consumer";case M:return(i._context.displayName||"Context")+".Provider";case W:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case F:return a=i.displayName||null,a!==null?a:Ne(i.type)||"Memo";case j:a=i._payload,i=i._init;try{return Ne(i(a))}catch{}}return null}function $e(i){var a=i.type;switch(i.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=a.render,i=i.displayName||i.name||"",a.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ne(a);case 8:return a===ne?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Te(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ce(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Je(i){var a=Ce(i)?"checked":"value",c=Object.getOwnPropertyDescriptor(i.constructor.prototype,a),g=""+i[a];if(!i.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var S=c.get,P=c.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return S.call(this)},set:function(L){g=""+L,P.call(this,L)}}),Object.defineProperty(i,a,{enumerable:c.enumerable}),{getValue:function(){return g},setValue:function(L){g=""+L},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function nt(i){i._valueTracker||(i._valueTracker=Je(i))}function Fe(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),g="";return i&&(g=Ce(i)?i.checked?"true":"false":i.value),i=g,i!==c?(a.setValue(i),!0):!1}function st(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function mt(i,a){var c=a.checked;return J({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??i._wrapperState.initialChecked})}function xt(i,a){var c=a.defaultValue==null?"":a.defaultValue,g=a.checked!=null?a.checked:a.defaultChecked;c=Te(a.value!=null?a.value:c),i._wrapperState={initialChecked:g,initialValue:c,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function tn(i,a){a=a.checked,a!=null&&R(i,"checked",a,!1)}function bo(i,a){tn(i,a);var c=Te(a.value),g=a.type;if(c!=null)g==="number"?(c===0&&i.value===""||i.value!=c)&&(i.value=""+c):i.value!==""+c&&(i.value=""+c);else if(g==="submit"||g==="reset"){i.removeAttribute("value");return}a.hasOwnProperty("value")?Co(i,a.type,c):a.hasOwnProperty("defaultValue")&&Co(i,a.type,Te(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(i.defaultChecked=!!a.defaultChecked)}function ri(i,a,c){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var g=a.type;if(!(g!=="submit"&&g!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+i._wrapperState.initialValue,c||a===i.value||(i.value=a),i.defaultValue=a}c=i.name,c!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,c!==""&&(i.name=c)}function Co(i,a,c){(a!=="number"||st(i.ownerDocument)!==i)&&(c==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+c&&(i.defaultValue=""+c))}var mn=Array.isArray;function jt(i,a,c,g){if(i=i.options,a){a={};for(var S=0;S"+a.valueOf().toString()+"",a=nr.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;a.firstChild;)i.appendChild(a.firstChild)}});function rr(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var yn={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},oi=["Webkit","ms","Moz","O"];Object.keys(yn).forEach(function(i){oi.forEach(function(a){a=a+i.charAt(0).toUpperCase()+i.substring(1),yn[a]=yn[i]})});function ii(i,a,c){return a==null||typeof a=="boolean"||a===""?"":c||typeof a!="number"||a===0||yn.hasOwnProperty(i)&&yn[i]?(""+a).trim():a+"px"}function Fn(i,a){i=i.style;for(var c in a)if(a.hasOwnProperty(c)){var g=c.indexOf("--")===0,S=ii(c,a[c],g);c==="float"&&(c="cssFloat"),g?i.setProperty(c,S):i[c]=S}}var We=J({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 br(i,a){if(a){if(We[i]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(r(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(r(61))}if(a.style!=null&&typeof a.style!="object")throw Error(r(62))}}function jn(i,a){if(i.indexOf("-")===-1)return typeof a.is=="string";switch(i){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 eo=null;function Be(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Po=null,Cr=null,or=null;function Qi(i){if(i=ml(i)){if(typeof Po!="function")throw Error(r(280));var a=i.stateNode;a&&(a=Zc(a),Po(i.stateNode,i.type,a))}}function _o(i){Cr?or?or.push(i):or=[i]:Cr=i}function Ks(){if(Cr){var i=Cr,a=or;if(or=Cr=null,Qi(i),a)for(i=0;i>>=0,i===0?32:31-(Js(i)/Zs|0)|0}var hr=64,dr=4194304;function on(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function io(i,a){var c=i.pendingLanes;if(c===0)return 0;var g=0,S=i.suspendedLanes,P=i.pingedLanes,L=c&268435455;if(L!==0){var Q=L&~S;Q!==0?g=on(Q):(P&=L,P!==0&&(g=on(P)))}else L=c&~S,L!==0?g=on(L):P!==0&&(g=on(P));if(g===0)return 0;if(a!==0&&a!==g&&(a&S)===0&&(S=g&-g,P=a&-a,S>=P||S===16&&(P&4194240)!==0))return a;if((g&4)!==0&&(g|=c&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=g;0c;c++)a.push(i);return a}function xn(i,a,c){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-rn(a),i[a]=c}function ts(i,a){var c=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var g=i.eventTimes;for(i=i.expirationTimes;0=mi),qc=" ",Gc=!1;function fs(i,a){switch(i){case"keyup":return Hc.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pr(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var St=!1;function ga(i,a){switch(i){case"compositionend":return pr(a);case"keypress":return a.which!==32?null:(Gc=!0,qc);case"textInput":return i=a.data,i===qc&&Gc?null:i;default:return null}}function Rn(i,a){if(St)return i==="compositionend"||!ds&&fs(i,a)?(i=aa(),pi=ol=ao=null,St=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:c,offset:a-i};i=g}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ie(c)}}function pe(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?pe(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function ce(){for(var i=window,a=st();a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=st(i.document)}return a}function me(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}function we(i){var a=ce(),c=i.focusedElem,g=i.selectionRange;if(a!==c&&c&&c.ownerDocument&&pe(c.ownerDocument.documentElement,c)){if(g!==null&&me(c)){if(a=g.start,i=g.end,i===void 0&&(i=a),"selectionStart"in c)c.selectionStart=a,c.selectionEnd=Math.min(i,c.value.length);else if(i=(a=c.ownerDocument||document)&&a.defaultView||window,i.getSelection){i=i.getSelection();var S=c.textContent.length,P=Math.min(g.start,S);g=g.end===void 0?P:Math.min(g.end,S),!i.extend&&P>g&&(S=g,g=P,P=S),S=he(c,P);var L=he(c,g);S&&L&&(i.rangeCount!==1||i.anchorNode!==S.node||i.anchorOffset!==S.offset||i.focusNode!==L.node||i.focusOffset!==L.offset)&&(a=a.createRange(),a.setStart(S.node,S.offset),i.removeAllRanges(),P>g?(i.addRange(a),i.extend(L.node,L.offset)):(a.setEnd(L.node,L.offset),i.addRange(a)))}}for(a=[],i=c;i=i.parentNode;)i.nodeType===1&&a.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c=document.documentMode,Se=null,Oe=null,Le=null,ke=!1;function De(i,a,c){var g=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;ke||Se==null||Se!==st(g)||(g=Se,"selectionStart"in g&&me(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Le&&fe(Le,g)||(Le=g,g=Xc(Oe,"onSelect"),0xa||(i.current=kd[xa],kd[xa]=null,xa--)}function _t(i,a){xa++,kd[xa]=i.current,i.current=a}var xi={},cn=wi(xi),On=wi(!1),ys=xi;function Sa(i,a){var c=i.type.contextTypes;if(!c)return xi;var g=i.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===a)return g.__reactInternalMemoizedMaskedChildContext;var S={},P;for(P in c)S[P]=a[P];return g&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=S),S}function kn(i){return i=i.childContextTypes,i!=null}function eu(){Rt(On),Rt(cn)}function Pm(i,a,c){if(cn.current!==xi)throw Error(r(168));_t(cn,a),_t(On,c)}function _m(i,a,c){var g=i.stateNode;if(a=a.childContextTypes,typeof g.getChildContext!="function")return c;g=g.getChildContext();for(var S in g)if(!(S in a))throw Error(r(108,$e(i)||"Unknown",S));return J({},c,g)}function tu(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||xi,ys=cn.current,_t(cn,i),_t(On,On.current),!0}function Am(i,a,c){var g=i.stateNode;if(!g)throw Error(r(169));c?(i=_m(i,a,ys),g.__reactInternalMemoizedMergedChildContext=i,Rt(On),Rt(cn),_t(cn,i)):Rt(On),_t(On,c)}var Lo=null,nu=!1,Nd=!1;function Tm(i){Lo===null?Lo=[i]:Lo.push(i)}function vC(i){nu=!0,Tm(i)}function Si(){if(!Nd&&Lo!==null){Nd=!0;var i=0,a=yt;try{var c=Lo;for(yt=1;i>=L,S-=L,Fo=1<<32-rn(a)+S|c<tt?(Xt=Qe,Qe=null):Xt=Qe.sibling;var gt=Pe(ge,Qe,ye[tt],Me);if(gt===null){Qe===null&&(Qe=Xt);break}i&&Qe&>.alternate===null&&a(ge,Qe),le=P(gt,le,tt),Xe===null?Ge=gt:Xe.sibling=gt,Xe=gt,Qe=Xt}if(tt===ye.length)return c(ge,Qe),kt&&ws(ge,tt),Ge;if(Qe===null){for(;tttt?(Xt=Qe,Qe=null):Xt=Qe.sibling;var Oi=Pe(ge,Qe,gt.value,Me);if(Oi===null){Qe===null&&(Qe=Xt);break}i&&Qe&&Oi.alternate===null&&a(ge,Qe),le=P(Oi,le,tt),Xe===null?Ge=Oi:Xe.sibling=Oi,Xe=Oi,Qe=Xt}if(gt.done)return c(ge,Qe),kt&&ws(ge,tt),Ge;if(Qe===null){for(;!gt.done;tt++,gt=ye.next())gt=Re(ge,gt.value,Me),gt!==null&&(le=P(gt,le,tt),Xe===null?Ge=gt:Xe.sibling=gt,Xe=gt);return kt&&ws(ge,tt),Ge}for(Qe=g(ge,Qe);!gt.done;tt++,gt=ye.next())gt=ze(Qe,ge,tt,gt.value,Me),gt!==null&&(i&>.alternate!==null&&Qe.delete(gt.key===null?tt:gt.key),le=P(gt,le,tt),Xe===null?Ge=gt:Xe.sibling=gt,Xe=gt);return i&&Qe.forEach(function(JC){return a(ge,JC)}),kt&&ws(ge,tt),Ge}function $t(ge,le,ye,Me){if(typeof ye=="object"&&ye!==null&&ye.type===K&&ye.key===null&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case Z:e:{for(var Ge=ye.key,Xe=le;Xe!==null;){if(Xe.key===Ge){if(Ge=ye.type,Ge===K){if(Xe.tag===7){c(ge,Xe.sibling),le=S(Xe,ye.props.children),le.return=ge,ge=le;break e}}else if(Xe.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===j&&Im(Ge)===Xe.type){c(ge,Xe.sibling),le=S(Xe,ye.props),le.ref=yl(ge,Xe,ye),le.return=ge,ge=le;break e}c(ge,Xe);break}else a(ge,Xe);Xe=Xe.sibling}ye.type===K?(le=As(ye.props.children,ge.mode,Me,ye.key),le.return=ge,ge=le):(Me=Ou(ye.type,ye.key,ye.props,null,ge.mode,Me),Me.ref=yl(ge,le,ye),Me.return=ge,ge=Me)}return L(ge);case ue:e:{for(Xe=ye.key;le!==null;){if(le.key===Xe)if(le.tag===4&&le.stateNode.containerInfo===ye.containerInfo&&le.stateNode.implementation===ye.implementation){c(ge,le.sibling),le=S(le,ye.children||[]),le.return=ge,ge=le;break e}else{c(ge,le);break}else a(ge,le);le=le.sibling}le=Of(ye,ge.mode,Me),le.return=ge,ge=le}return L(ge);case j:return Xe=ye._init,$t(ge,le,Xe(ye._payload),Me)}if(mn(ye))return Ue(ge,le,ye,Me);if(G(ye))return qe(ge,le,ye,Me);su(ge,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"?(ye=""+ye,le!==null&&le.tag===6?(c(ge,le.sibling),le=S(le,ye),le.return=ge,ge=le):(c(ge,le),le=Rf(ye,ge.mode,Me),le.return=ge,ge=le),L(ge)):c(ge,le)}return $t}var Pa=Mm(!0),Lm=Mm(!1),au=wi(null),lu=null,_a=null,jd=null;function Bd(){jd=_a=lu=null}function $d(i){var a=au.current;Rt(au),i._currentValue=a}function Vd(i,a,c){for(;i!==null;){var g=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),i===c)break;i=i.return}}function Aa(i,a){lu=i,jd=_a=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&a)!==0&&(Nn=!0),i.firstContext=null)}function yr(i){var a=i._currentValue;if(jd!==i)if(i={context:i,memoizedValue:a,next:null},_a===null){if(lu===null)throw Error(r(308));_a=i,lu.dependencies={lanes:0,firstContext:i}}else _a=_a.next=i;return a}var xs=null;function zd(i){xs===null?xs=[i]:xs.push(i)}function Fm(i,a,c,g){var S=a.interleaved;return S===null?(c.next=c,zd(a)):(c.next=S.next,S.next=c),a.interleaved=c,Bo(i,g)}function Bo(i,a){i.lanes|=a;var c=i.alternate;for(c!==null&&(c.lanes|=a),c=i,i=i.return;i!==null;)i.childLanes|=a,c=i.alternate,c!==null&&(c.childLanes|=a),c=i,i=i.return;return c.tag===3?c.stateNode:null}var bi=!1;function Hd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jm(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function $o(i,a){return{eventTime:i,lane:a,tag:0,payload:null,callback:null,next:null}}function Ci(i,a,c){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(pt&2)!==0){var S=g.pending;return S===null?a.next=a:(a.next=S.next,S.next=a),g.pending=a,Bo(i,c)}return S=g.interleaved,S===null?(a.next=a,zd(g)):(a.next=S.next,S.next=a),g.interleaved=a,Bo(i,c)}function cu(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194240)!==0)){var g=a.lanes;g&=i.pendingLanes,c|=g,a.lanes=c,ra(i,c)}}function Bm(i,a){var c=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,c===g)){var S=null,P=null;if(c=c.firstBaseUpdate,c!==null){do{var L={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};P===null?S=P=L:P=P.next=L,c=c.next}while(c!==null);P===null?S=P=a:P=P.next=a}else S=P=a;c={baseState:g.baseState,firstBaseUpdate:S,lastBaseUpdate:P,shared:g.shared,effects:g.effects},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}function uu(i,a,c,g){var S=i.updateQueue;bi=!1;var P=S.firstBaseUpdate,L=S.lastBaseUpdate,Q=S.shared.pending;if(Q!==null){S.shared.pending=null;var re=Q,ve=re.next;re.next=null,L===null?P=ve:L.next=ve,L=re;var _e=i.alternate;_e!==null&&(_e=_e.updateQueue,Q=_e.lastBaseUpdate,Q!==L&&(Q===null?_e.firstBaseUpdate=ve:Q.next=ve,_e.lastBaseUpdate=re))}if(P!==null){var Re=S.baseState;L=0,_e=ve=re=null,Q=P;do{var Pe=Q.lane,ze=Q.eventTime;if((g&Pe)===Pe){_e!==null&&(_e=_e.next={eventTime:ze,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Ue=i,qe=Q;switch(Pe=a,ze=c,qe.tag){case 1:if(Ue=qe.payload,typeof Ue=="function"){Re=Ue.call(ze,Re,Pe);break e}Re=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=qe.payload,Pe=typeof Ue=="function"?Ue.call(ze,Re,Pe):Ue,Pe==null)break e;Re=J({},Re,Pe);break e;case 2:bi=!0}}Q.callback!==null&&Q.lane!==0&&(i.flags|=64,Pe=S.effects,Pe===null?S.effects=[Q]:Pe.push(Q))}else ze={eventTime:ze,lane:Pe,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},_e===null?(ve=_e=ze,re=Re):_e=_e.next=ze,L|=Pe;if(Q=Q.next,Q===null){if(Q=S.shared.pending,Q===null)break;Pe=Q,Q=Pe.next,Pe.next=null,S.lastBaseUpdate=Pe,S.shared.pending=null}}while(!0);if(_e===null&&(re=Re),S.baseState=re,S.firstBaseUpdate=ve,S.lastBaseUpdate=_e,a=S.shared.interleaved,a!==null){S=a;do L|=S.lane,S=S.next;while(S!==a)}else P===null&&(S.shared.lanes=0);Cs|=L,i.lanes=L,i.memoizedState=Re}}function $m(i,a,c){if(i=a.effects,a.effects=null,i!==null)for(a=0;ac?c:4,i(!0);var g=Kd.transition;Kd.transition={};try{i(!1),a()}finally{yt=c,Kd.transition=g}}function iy(){return vr().memoizedState}function bC(i,a,c){var g=Ai(i);if(c={lane:g,action:c,hasEagerState:!1,eagerState:null,next:null},sy(i))ay(a,c);else if(c=Fm(i,a,c,g),c!==null){var S=bn();jr(c,i,g,S),ly(c,a,g)}}function CC(i,a,c){var g=Ai(i),S={lane:g,action:c,hasEagerState:!1,eagerState:null,next:null};if(sy(i))ay(a,S);else{var P=i.alternate;if(i.lanes===0&&(P===null||P.lanes===0)&&(P=a.lastRenderedReducer,P!==null))try{var L=a.lastRenderedState,Q=P(L,c);if(S.hasEagerState=!0,S.eagerState=Q,te(Q,L)){var re=a.interleaved;re===null?(S.next=S,zd(a)):(S.next=re.next,re.next=S),a.interleaved=S;return}}catch{}finally{}c=Fm(i,a,S,g),c!==null&&(S=bn(),jr(c,i,g,S),ly(c,a,g))}}function sy(i){var a=i.alternate;return i===Dt||a!==null&&a===Dt}function ay(i,a){Sl=fu=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function ly(i,a,c){if((c&4194240)!==0){var g=a.lanes;g&=i.pendingLanes,c|=g,a.lanes=c,ra(i,c)}}var mu={readContext:yr,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},EC={readContext:yr,useCallback:function(i,a){return ho().memoizedState=[i,a===void 0?null:a],i},useContext:yr,useEffect:Qm,useImperativeHandle:function(i,a,c){return c=c!=null?c.concat([i]):null,pu(4194308,4,ey.bind(null,a,i),c)},useLayoutEffect:function(i,a){return pu(4194308,4,i,a)},useInsertionEffect:function(i,a){return pu(4,2,i,a)},useMemo:function(i,a){var c=ho();return a=a===void 0?null:a,i=i(),c.memoizedState=[i,a],i},useReducer:function(i,a,c){var g=ho();return a=c!==void 0?c(a):a,g.memoizedState=g.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},g.queue=i,i=i.dispatch=bC.bind(null,Dt,i),[g.memoizedState,i]},useRef:function(i){var a=ho();return i={current:i},a.memoizedState=i},useState:Ym,useDebugValue:tf,useDeferredValue:function(i){return ho().memoizedState=i},useTransition:function(){var i=Ym(!1),a=i[0];return i=SC.bind(null,i[1]),ho().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,c){var g=Dt,S=ho();if(kt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),Yt===null)throw Error(r(349));(bs&30)!==0||Um(g,a,c)}S.memoizedState=c;var P={value:c,getSnapshot:a};return S.queue=P,Qm(qm.bind(null,g,P,i),[i]),g.flags|=2048,El(9,Wm.bind(null,g,P,c,a),void 0,null),c},useId:function(){var i=ho(),a=Yt.identifierPrefix;if(kt){var c=jo,g=Fo;c=(g&~(1<<32-rn(g)-1)).toString(32)+c,a=":"+a+"R"+c,c=bl++,0<\/script>",i=i.removeChild(i.firstChild)):typeof g.is=="string"?i=L.createElement(c,{is:g.is}):(i=L.createElement(c),c==="select"&&(L=i,g.multiple?L.multiple=!0:g.size&&(L.size=g.size))):i=L.createElementNS(i,c),i[co]=a,i[gl]=g,Ty(i,a,!1,!1),a.stateNode=i;e:{switch(L=jn(c,g),c){case"dialog":Tt("cancel",i),Tt("close",i),S=g;break;case"iframe":case"object":case"embed":Tt("load",i),S=g;break;case"video":case"audio":for(S=0;SNa&&(a.flags|=128,g=!0,Pl(P,!1),a.lanes=4194304)}else{if(!g)if(i=hu(L),i!==null){if(a.flags|=128,g=!0,c=i.updateQueue,c!==null&&(a.updateQueue=c,a.flags|=4),Pl(P,!0),P.tail===null&&P.tailMode==="hidden"&&!L.alternate&&!kt)return hn(a),null}else 2*Pt()-P.renderingStartTime>Na&&c!==1073741824&&(a.flags|=128,g=!0,Pl(P,!1),a.lanes=4194304);P.isBackwards?(L.sibling=a.child,a.child=L):(c=P.last,c!==null?c.sibling=L:a.child=L,P.last=L)}return P.tail!==null?(a=P.tail,P.rendering=a,P.tail=a.sibling,P.renderingStartTime=Pt(),a.sibling=null,c=Nt.current,_t(Nt,g?c&1|2:c&1),a):(hn(a),null);case 22:case 23:return _f(),g=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==g&&(a.flags|=8192),g&&(a.mode&1)!==0?(Gn&1073741824)!==0&&(hn(a),a.subtreeFlags&6&&(a.flags|=8192)):hn(a),null;case 24:return null;case 25:return null}throw Error(r(156,a.tag))}function NC(i,a){switch(Id(a),a.tag){case 1:return kn(a.type)&&eu(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ta(),Rt(On),Rt(cn),Gd(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return Wd(a),null;case 13:if(Rt(Nt),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Ea()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Rt(Nt),null;case 4:return Ta(),null;case 10:return $d(a.type._context),null;case 22:case 23:return _f(),null;case 24:return null;default:return null}}var xu=!1,dn=!1,DC=typeof WeakSet=="function"?WeakSet:Set,He=null;function Oa(i,a){var c=i.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(g){Lt(i,a,g)}else c.current=null}function pf(i,a,c){try{c()}catch(g){Lt(i,a,g)}}var ky=!1;function IC(i,a){if(Pd=so,i=ce(),me(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var g=c.getSelection&&c.getSelection();if(g&&g.rangeCount!==0){c=g.anchorNode;var S=g.anchorOffset,P=g.focusNode;g=g.focusOffset;try{c.nodeType,P.nodeType}catch{c=null;break e}var L=0,Q=-1,re=-1,ve=0,_e=0,Re=i,Pe=null;t:for(;;){for(var ze;Re!==c||S!==0&&Re.nodeType!==3||(Q=L+S),Re!==P||g!==0&&Re.nodeType!==3||(re=L+g),Re.nodeType===3&&(L+=Re.nodeValue.length),(ze=Re.firstChild)!==null;)Pe=Re,Re=ze;for(;;){if(Re===i)break t;if(Pe===c&&++ve===S&&(Q=L),Pe===P&&++_e===g&&(re=L),(ze=Re.nextSibling)!==null)break;Re=Pe,Pe=Re.parentNode}Re=ze}c=Q===-1||re===-1?null:{start:Q,end:re}}else c=null}c=c||{start:0,end:0}}else c=null;for(_d={focusedElem:i,selectionRange:c},so=!1,He=a;He!==null;)if(a=He,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,He=i;else for(;He!==null;){a=He;try{var Ue=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Ue!==null){var qe=Ue.memoizedProps,$t=Ue.memoizedState,ge=a.stateNode,le=ge.getSnapshotBeforeUpdate(a.elementType===a.type?qe:Mr(a.type,qe),$t);ge.__reactInternalSnapshotBeforeUpdate=le}break;case 3:var ye=a.stateNode.containerInfo;ye.nodeType===1?ye.textContent="":ye.nodeType===9&&ye.documentElement&&ye.removeChild(ye.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Me){Lt(a,a.return,Me)}if(i=a.sibling,i!==null){i.return=a.return,He=i;break}He=a.return}return Ue=ky,ky=!1,Ue}function _l(i,a,c){var g=a.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var S=g=g.next;do{if((S.tag&i)===i){var P=S.destroy;S.destroy=void 0,P!==void 0&&pf(a,c,P)}S=S.next}while(S!==g)}}function Su(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var c=a=a.next;do{if((c.tag&i)===i){var g=c.create;c.destroy=g()}c=c.next}while(c!==a)}}function gf(i){var a=i.ref;if(a!==null){var c=i.stateNode;switch(i.tag){case 5:i=c;break;default:i=c}typeof a=="function"?a(i):a.current=i}}function Ny(i){var a=i.alternate;a!==null&&(i.alternate=null,Ny(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&(delete a[co],delete a[gl],delete a[Od],delete a[mC],delete a[yC])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Dy(i){return i.tag===5||i.tag===3||i.tag===4}function Iy(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Dy(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function mf(i,a,c){var g=i.tag;if(g===5||g===6)i=i.stateNode,a?c.nodeType===8?c.parentNode.insertBefore(i,a):c.insertBefore(i,a):(c.nodeType===8?(a=c.parentNode,a.insertBefore(i,c)):(a=c,a.appendChild(i)),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Jc));else if(g!==4&&(i=i.child,i!==null))for(mf(i,a,c),i=i.sibling;i!==null;)mf(i,a,c),i=i.sibling}function yf(i,a,c){var g=i.tag;if(g===5||g===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(g!==4&&(i=i.child,i!==null))for(yf(i,a,c),i=i.sibling;i!==null;)yf(i,a,c),i=i.sibling}var Jt=null,Lr=!1;function Ei(i,a,c){for(c=c.child;c!==null;)My(i,a,c),c=c.sibling}function My(i,a,c){if(wn&&typeof wn.onCommitFiberUnmount=="function")try{wn.onCommitFiberUnmount(Tr,c)}catch{}switch(c.tag){case 5:dn||Oa(c,a);case 6:var g=Jt,S=Lr;Jt=null,Ei(i,a,c),Jt=g,Lr=S,Jt!==null&&(Lr?(i=Jt,c=c.stateNode,i.nodeType===8?i.parentNode.removeChild(c):i.removeChild(c)):Jt.removeChild(c.stateNode));break;case 18:Jt!==null&&(Lr?(i=Jt,c=c.stateNode,i.nodeType===8?Rd(i.parentNode,c):i.nodeType===1&&Rd(i,c),hi(i)):Rd(Jt,c.stateNode));break;case 4:g=Jt,S=Lr,Jt=c.stateNode.containerInfo,Lr=!0,Ei(i,a,c),Jt=g,Lr=S;break;case 0:case 11:case 14:case 15:if(!dn&&(g=c.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){S=g=g.next;do{var P=S,L=P.destroy;P=P.tag,L!==void 0&&((P&2)!==0||(P&4)!==0)&&pf(c,a,L),S=S.next}while(S!==g)}Ei(i,a,c);break;case 1:if(!dn&&(Oa(c,a),g=c.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=c.memoizedProps,g.state=c.memoizedState,g.componentWillUnmount()}catch(Q){Lt(c,a,Q)}Ei(i,a,c);break;case 21:Ei(i,a,c);break;case 22:c.mode&1?(dn=(g=dn)||c.memoizedState!==null,Ei(i,a,c),dn=g):Ei(i,a,c);break;default:Ei(i,a,c)}}function Ly(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var c=i.stateNode;c===null&&(c=i.stateNode=new DC),a.forEach(function(g){var S=HC.bind(null,i,g);c.has(g)||(c.add(g),g.then(S,S))})}}function Fr(i,a){var c=a.deletions;if(c!==null)for(var g=0;gS&&(S=L),g&=~P}if(g=S,g=Pt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*LC(g/1960))-g,10i?16:i,_i===null)var g=!1;else{if(i=_i,_i=null,_u=0,(pt&6)!==0)throw Error(r(331));var S=pt;for(pt|=4,He=i.current;He!==null;){var P=He,L=P.child;if((He.flags&16)!==0){var Q=P.deletions;if(Q!==null){for(var re=0;rePt()-xf?Ps(i,0):wf|=c),In(i,a)}function Yy(i,a){a===0&&((i.mode&1)===0?a=1:(a=dr,dr<<=1,(dr&130023424)===0&&(dr=4194304)));var c=bn();i=Bo(i,a),i!==null&&(xn(i,a,c),In(i,c))}function zC(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),Yy(i,c)}function HC(i,a){var c=0;switch(i.tag){case 13:var g=i.stateNode,S=i.memoizedState;S!==null&&(c=S.retryLane);break;case 19:g=i.stateNode;break;default:throw Error(r(314))}g!==null&&g.delete(a),Yy(i,c)}var Xy;Xy=function(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps||On.current)Nn=!0;else{if((i.lanes&c)===0&&(a.flags&128)===0)return Nn=!1,OC(i,a,c);Nn=(i.flags&131072)!==0}else Nn=!1,kt&&(a.flags&1048576)!==0&&Rm(a,ou,a.index);switch(a.lanes=0,a.tag){case 2:var g=a.type;wu(i,a),i=a.pendingProps;var S=Sa(a,cn.current);Aa(a,c),S=Xd(null,a,g,i,S,c);var P=Qd();return a.flags|=1,typeof S=="object"&&S!==null&&typeof S.render=="function"&&S.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,kn(g)?(P=!0,tu(a)):P=!1,a.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,Hd(a),S.updater=yu,a.stateNode=S,S._reactInternals=a,rf(a,g,i,c),a=lf(null,a,g,!0,P,c)):(a.tag=0,kt&&P&&Dd(a),Sn(null,a,S,c),a=a.child),a;case 16:g=a.elementType;e:{switch(wu(i,a),i=a.pendingProps,S=g._init,g=S(g._payload),a.type=g,S=a.tag=WC(g),i=Mr(g,i),S){case 0:a=af(null,a,g,i,c);break e;case 1:a=by(null,a,g,i,c);break e;case 11:a=yy(null,a,g,i,c);break e;case 14:a=vy(null,a,g,Mr(g.type,i),c);break e}throw Error(r(306,g,""))}return a;case 0:return g=a.type,S=a.pendingProps,S=a.elementType===g?S:Mr(g,S),af(i,a,g,S,c);case 1:return g=a.type,S=a.pendingProps,S=a.elementType===g?S:Mr(g,S),by(i,a,g,S,c);case 3:e:{if(Cy(a),i===null)throw Error(r(387));g=a.pendingProps,P=a.memoizedState,S=P.element,jm(i,a),uu(a,g,null,c);var L=a.memoizedState;if(g=L.element,P.isDehydrated)if(P={element:g,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},a.updateQueue.baseState=P,a.memoizedState=P,a.flags&256){S=Ra(Error(r(423)),a),a=Ey(i,a,g,c,S);break e}else if(g!==S){S=Ra(Error(r(424)),a),a=Ey(i,a,g,c,S);break e}else for(qn=vi(a.stateNode.containerInfo.firstChild),Wn=a,kt=!0,Ir=null,c=Lm(a,null,g,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Ea(),g===S){a=Vo(i,a,c);break e}Sn(i,a,g,c)}a=a.child}return a;case 5:return Vm(a),i===null&&Ld(a),g=a.type,S=a.pendingProps,P=i!==null?i.memoizedProps:null,L=S.children,Ad(g,S)?L=null:P!==null&&Ad(g,P)&&(a.flags|=32),Sy(i,a),Sn(i,a,L,c),a.child;case 6:return i===null&&Ld(a),null;case 13:return Py(i,a,c);case 4:return Ud(a,a.stateNode.containerInfo),g=a.pendingProps,i===null?a.child=Pa(a,null,g,c):Sn(i,a,g,c),a.child;case 11:return g=a.type,S=a.pendingProps,S=a.elementType===g?S:Mr(g,S),yy(i,a,g,S,c);case 7:return Sn(i,a,a.pendingProps,c),a.child;case 8:return Sn(i,a,a.pendingProps.children,c),a.child;case 12:return Sn(i,a,a.pendingProps.children,c),a.child;case 10:e:{if(g=a.type._context,S=a.pendingProps,P=a.memoizedProps,L=S.value,_t(au,g._currentValue),g._currentValue=L,P!==null)if(te(P.value,L)){if(P.children===S.children&&!On.current){a=Vo(i,a,c);break e}}else for(P=a.child,P!==null&&(P.return=a);P!==null;){var Q=P.dependencies;if(Q!==null){L=P.child;for(var re=Q.firstContext;re!==null;){if(re.context===g){if(P.tag===1){re=$o(-1,c&-c),re.tag=2;var ve=P.updateQueue;if(ve!==null){ve=ve.shared;var _e=ve.pending;_e===null?re.next=re:(re.next=_e.next,_e.next=re),ve.pending=re}}P.lanes|=c,re=P.alternate,re!==null&&(re.lanes|=c),Vd(P.return,c,a),Q.lanes|=c;break}re=re.next}}else if(P.tag===10)L=P.type===a.type?null:P.child;else if(P.tag===18){if(L=P.return,L===null)throw Error(r(341));L.lanes|=c,Q=L.alternate,Q!==null&&(Q.lanes|=c),Vd(L,c,a),L=P.sibling}else L=P.child;if(L!==null)L.return=P;else for(L=P;L!==null;){if(L===a){L=null;break}if(P=L.sibling,P!==null){P.return=L.return,L=P;break}L=L.return}P=L}Sn(i,a,S.children,c),a=a.child}return a;case 9:return S=a.type,g=a.pendingProps.children,Aa(a,c),S=yr(S),g=g(S),a.flags|=1,Sn(i,a,g,c),a.child;case 14:return g=a.type,S=Mr(g,a.pendingProps),S=Mr(g.type,S),vy(i,a,g,S,c);case 15:return wy(i,a,a.type,a.pendingProps,c);case 17:return g=a.type,S=a.pendingProps,S=a.elementType===g?S:Mr(g,S),wu(i,a),a.tag=1,kn(g)?(i=!0,tu(a)):i=!1,Aa(a,c),uy(a,g,S),rf(a,g,S,c),lf(null,a,g,!0,i,c);case 19:return Ay(i,a,c);case 22:return xy(i,a,c)}throw Error(r(156,a.tag))};function Qy(i,a){return ai(i,a)}function UC(i,a,c,g){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xr(i,a,c,g){return new UC(i,a,c,g)}function Tf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function WC(i){if(typeof i=="function")return Tf(i)?1:0;if(i!=null){if(i=i.$$typeof,i===W)return 11;if(i===F)return 14}return 2}function Ri(i,a){var c=i.alternate;return c===null?(c=xr(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&14680064,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c}function Ou(i,a,c,g,S,P){var L=2;if(g=i,typeof i=="function")Tf(i)&&(L=1);else if(typeof i=="string")L=5;else e:switch(i){case K:return As(c.children,S,P,a);case ne:L=8,S|=8;break;case I:return i=xr(12,c,a,S|2),i.elementType=I,i.lanes=P,i;case X:return i=xr(13,c,a,S),i.elementType=X,i.lanes=P,i;case V:return i=xr(19,c,a,S),i.elementType=V,i.lanes=P,i;case Y:return ku(c,S,P,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case M:L=10;break e;case H:L=9;break e;case W:L=11;break e;case F:L=14;break e;case j:L=16,g=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return a=xr(L,c,a,S),a.elementType=i,a.type=g,a.lanes=P,a}function As(i,a,c,g){return i=xr(7,i,g,a),i.lanes=c,i}function ku(i,a,c,g){return i=xr(22,i,g,a),i.elementType=Y,i.lanes=c,i.stateNode={isHidden:!1},i}function Rf(i,a,c){return i=xr(6,i,null,a),i.lanes=c,i}function Of(i,a,c){return a=xr(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function qC(i,a,c,g,S){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=na(0),this.expirationTimes=na(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=na(0),this.identifierPrefix=g,this.onRecoverableError=S,this.mutableSourceEagerHydrationData=null}function kf(i,a,c,g,S,P,L,Q,re){return i=new qC(i,a,c,Q,re),a===1?(a=1,P===!0&&(a|=8)):a=0,P=xr(3,null,null,a),i.current=P,P.stateNode=i,P.memoizedState={element:g,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hd(P),i}function GC(i,a,c){var g=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),Ff.exports=s1(),Ff.exports}var gv;function a1(){if(gv)return ju;gv=1;var t=Iw();return ju.createRoot=t.createRoot,ju.hydrateRoot=t.hydrateRoot,ju}var l1=a1();const mv=t=>{let n;const r=new Set,o=(p,m)=>{const v=typeof p=="function"?p(n):p;if(!Object.is(v,n)){const y=n;n=m??(typeof v!="object"||v===null)?v:Object.assign({},n,v),r.forEach(x=>x(n,y))}},s=()=>n,h={setState:o,getState:s,getInitialState:()=>d,subscribe:p=>(r.add(p),()=>r.delete(p))},d=n=t(o,s,h);return h},c1=t=>t?mv(t):mv,u1=t=>t;function h1(t,n=u1){const r=en.useSyncExternalStore(t.subscribe,()=>n(t.getState()),()=>n(t.getInitialState()));return en.useDebugValue(r),r}const d1=t=>{const n=c1(t),r=o=>h1(n,o);return Object.assign(r,n),r},f1=t=>d1;function zt(t){if(typeof t=="string"||typeof t=="number")return""+t;let n="";if(Array.isArray(t))for(let r=0,o;r{}};function jh(){for(var t=0,n=arguments.length,r={},o;t=0&&(o=r.slice(s+1),r=r.slice(0,s)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}ah.prototype=jh.prototype={constructor:ah,on:function(t,n){var r=this._,o=g1(t+"",r),s,l=-1,u=o.length;if(arguments.length<2){for(;++l0)for(var r=new Array(s),o=0,s,l;o=0&&(n=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),vv.hasOwnProperty(n)?{space:vv[n],local:t}:t}function y1(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===Ap&&n.documentElement.namespaceURI===Ap?n.createElement(t):n.createElementNS(r,t)}}function v1(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Mw(t){var n=Bh(t);return(n.local?v1:y1)(n)}function w1(){}function gg(t){return t==null?w1:function(){return this.querySelector(t)}}function x1(t){typeof t!="function"&&(t=gg(t));for(var n=this._groups,r=n.length,o=new Array(r),s=0;s=R&&(R=N+1);!(Z=A[R])&&++R=0;)(u=o[s])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function W1(t){t||(t=q1);function n(v,y){return v&&y?t(v.__data__,y.__data__):!v-!y}for(var r=this._groups,o=r.length,s=new Array(o),l=0;ln?1:t>=n?0:NaN}function G1(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function K1(){return Array.from(this)}function Y1(){for(var t=this._groups,n=0,r=t.length;n1?this.each((n==null?sE:typeof n=="function"?lE:aE)(t,n,r??"")):za(this.node(),t)}function za(t,n){return t.style.getPropertyValue(n)||$w(t).getComputedStyle(t,null).getPropertyValue(n)}function uE(t){return function(){delete this[t]}}function hE(t,n){return function(){this[t]=n}}function dE(t,n){return function(){var r=n.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function fE(t,n){return arguments.length>1?this.each((n==null?uE:typeof n=="function"?dE:hE)(t,n)):this.node()[t]}function Vw(t){return t.trim().split(/^|\s+/)}function mg(t){return t.classList||new zw(t)}function zw(t){this._node=t,this._names=Vw(t.getAttribute("class")||"")}zw.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Hw(t,n){for(var r=mg(t),o=-1,s=n.length;++o=0&&(r=n.slice(o+1),n=n.slice(0,o)),{type:n,name:r}})}function VE(t){return function(){var n=this.__on;if(n){for(var r=0,o=-1,s=n.length,l;r()=>t;function Tp(t,{sourceEvent:n,subject:r,target:o,identifier:s,active:l,x:u,y:h,dx:d,dy:p,dispatch:m}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:m}})}Tp.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function QE(t){return!t.ctrlKey&&!t.button}function JE(){return this.parentNode}function ZE(t,n){return n??{x:t.x,y:t.y}}function eP(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yw(){var t=QE,n=JE,r=ZE,o=eP,s={},l=jh("start","drag","end"),u=0,h,d,p,m,v=0;function y(D){D.on("mousedown.drag",x).filter(o).on("touchstart.drag",A).on("touchmove.drag",_,XE).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(D,Z){if(!(m||!t.call(this,D,Z))){var ue=R(this,n.call(this,D,Z),D,Z,"mouse");ue&&(Yn(D.view).on("mousemove.drag",C,Zl).on("mouseup.drag",b,Zl),Gw(D.view),$f(D),p=!1,h=D.clientX,d=D.clientY,ue("start",D))}}function C(D){if(Ba(D),!p){var Z=D.clientX-h,ue=D.clientY-d;p=Z*Z+ue*ue>v}s.mouse("drag",D)}function b(D){Yn(D.view).on("mousemove.drag mouseup.drag",null),Kw(D.view,p),Ba(D),s.mouse("end",D)}function A(D,Z){if(t.call(this,D,Z)){var ue=D.changedTouches,K=n.call(this,D,Z),ne=ue.length,I,M;for(I=0;I>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?$u(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?$u(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=nP.exec(t))?new Ln(n[1],n[2],n[3],1):(n=rP.exec(t))?new Ln(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=oP.exec(t))?$u(n[1],n[2],n[3],n[4]):(n=iP.exec(t))?$u(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=sP.exec(t))?Pv(n[1],n[2]/100,n[3]/100,1):(n=aP.exec(t))?Pv(n[1],n[2]/100,n[3]/100,n[4]):wv.hasOwnProperty(t)?bv(wv[t]):t==="transparent"?new Ln(NaN,NaN,NaN,0):null}function bv(t){return new Ln(t>>16&255,t>>8&255,t&255,1)}function $u(t,n,r,o){return o<=0&&(t=n=r=NaN),new Ln(t,n,r,o)}function uP(t){return t instanceof xc||(t=nc(t)),t?(t=t.rgb(),new Ln(t.r,t.g,t.b,t.opacity)):new Ln}function Rp(t,n,r,o){return arguments.length===1?uP(t):new Ln(t,n,r,o??1)}function Ln(t,n,r,o){this.r=+t,this.g=+n,this.b=+r,this.opacity=+o}yg(Ln,Rp,Xw(xc,{brighter(t){return t=t==null?xh:Math.pow(xh,t),new Ln(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ec:Math.pow(ec,t),new Ln(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ln(Fs(this.r),Fs(this.g),Fs(this.b),Sh(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:Cv,formatHex:Cv,formatHex8:hP,formatRgb:Ev,toString:Ev}));function Cv(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}`}function hP(){return`#${Ms(this.r)}${Ms(this.g)}${Ms(this.b)}${Ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ev(){const t=Sh(this.opacity);return`${t===1?"rgb(":"rgba("}${Fs(this.r)}, ${Fs(this.g)}, ${Fs(this.b)}${t===1?")":`, ${t})`}`}function Sh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fs(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ms(t){return t=Fs(t),(t<16?"0":"")+t.toString(16)}function Pv(t,n,r,o){return o<=0?t=n=r=NaN:r<=0||r>=1?t=n=NaN:n<=0&&(t=NaN),new zr(t,n,r,o)}function Qw(t){if(t instanceof zr)return new zr(t.h,t.s,t.l,t.opacity);if(t instanceof xc||(t=nc(t)),!t)return new zr;if(t instanceof zr)return t;t=t.rgb();var n=t.r/255,r=t.g/255,o=t.b/255,s=Math.min(n,r,o),l=Math.max(n,r,o),u=NaN,h=l-s,d=(l+s)/2;return h?(n===l?u=(r-o)/h+(r0&&d<1?0:u,new zr(u,h,d,t.opacity)}function dP(t,n,r,o){return arguments.length===1?Qw(t):new zr(t,n,r,o??1)}function zr(t,n,r,o){this.h=+t,this.s=+n,this.l=+r,this.opacity=+o}yg(zr,dP,Xw(xc,{brighter(t){return t=t==null?xh:Math.pow(xh,t),new zr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ec:Math.pow(ec,t),new zr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,n=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,o=r+(r<.5?r:1-r)*n,s=2*r-o;return new Ln(Vf(t>=240?t-240:t+120,s,o),Vf(t,s,o),Vf(t<120?t+240:t-120,s,o),this.opacity)},clamp(){return new zr(_v(this.h),Vu(this.s),Vu(this.l),Sh(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 t=Sh(this.opacity);return`${t===1?"hsl(":"hsla("}${_v(this.h)}, ${Vu(this.s)*100}%, ${Vu(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _v(t){return t=(t||0)%360,t<0?t+360:t}function Vu(t){return Math.max(0,Math.min(1,t||0))}function Vf(t,n,r){return(t<60?n+(r-n)*t/60:t<180?r:t<240?n+(r-n)*(240-t)/60:n)*255}const Jw=t=>()=>t;function fP(t,n){return function(r){return t+r*n}}function pP(t,n,r){return t=Math.pow(t,r),n=Math.pow(n,r)-t,r=1/r,function(o){return Math.pow(t+o*n,r)}}function gP(t){return(t=+t)==1?Zw:function(n,r){return r-n?pP(n,r,t):Jw(isNaN(n)?r:n)}}function Zw(t,n){var r=n-t;return r?fP(t,r):Jw(isNaN(t)?n:t)}const Av=function t(n){var r=gP(n);function o(s,l){var u=r((s=Rp(s)).r,(l=Rp(l)).r),h=r(s.g,l.g),d=r(s.b,l.b),p=Zw(s.opacity,l.opacity);return function(m){return s.r=u(m),s.g=h(m),s.b=d(m),s.opacity=p(m),s+""}}return o.gamma=t,o}(1);function Ii(t,n){return t=+t,n=+n,function(r){return t*(1-r)+n*r}}var Op=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zf=new RegExp(Op.source,"g");function mP(t){return function(){return t}}function yP(t){return function(n){return t(n)+""}}function vP(t,n){var r=Op.lastIndex=zf.lastIndex=0,o,s,l,u=-1,h=[],d=[];for(t=t+"",n=n+"";(o=Op.exec(t))&&(s=zf.exec(n));)(l=s.index)>r&&(l=n.slice(r,l),h[u]?h[u]+=l:h[++u]=l),(o=o[0])===(s=s[0])?h[u]?h[u]+=s:h[++u]=s:(h[++u]=null,d.push({i:u,x:Ii(o,s)})),r=zf.lastIndex;return r180?m+=360:m-p>180&&(p+=360),y.push({i:v.push(s(v)+"rotate(",null,o)-2,x:Ii(p,m)})):m&&v.push(s(v)+"rotate("+m+o)}function h(p,m,v,y){p!==m?y.push({i:v.push(s(v)+"skewX(",null,o)-2,x:Ii(p,m)}):m&&v.push(s(v)+"skewX("+m+o)}function d(p,m,v,y,x,C){if(p!==v||m!==y){var b=x.push(s(x)+"scale(",null,",",null,")");C.push({i:b-4,x:Ii(p,v)},{i:b-2,x:Ii(m,y)})}else(v!==1||y!==1)&&x.push(s(x)+"scale("+v+","+y+")")}return function(p,m){var v=[],y=[];return p=t(p),m=t(m),l(p.translateX,p.translateY,m.translateX,m.translateY,v,y),u(p.rotate,m.rotate,v,y),h(p.skewX,m.skewX,v,y),d(p.scaleX,p.scaleY,m.scaleX,m.scaleY,v,y),p=m=null,function(x){for(var C=-1,b=y.length,A;++C=0&&t._call.call(void 0,n),t=t._next;--Ha}function Ov(){Vs=(Ch=rc.now())+$h,Ha=ql=0;try{TP()}finally{Ha=0,OP(),Vs=0}}function RP(){var t=rc.now(),n=t-Ch;n>nx&&($h-=n,Ch=t)}function OP(){for(var t,n=bh,r,o=1/0;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(r=n._next,n._next=null,n=t?t._next=r:bh=r);Gl=t,Np(o)}function Np(t){if(!Ha){ql&&(ql=clearTimeout(ql));var n=t-Vs;n>24?(t<1/0&&(ql=setTimeout(Ov,t-rc.now()-$h)),Dl&&(Dl=clearInterval(Dl))):(Dl||(Ch=rc.now(),Dl=setInterval(RP,nx)),Ha=1,rx(Ov))}}function kv(t,n,r){var o=new Eh;return n=n==null?0:+n,o.restart(s=>{o.stop(),t(s+n)},n,r),o}var kP=jh("start","end","cancel","interrupt"),NP=[],ix=0,Nv=1,Dp=2,lh=3,Dv=4,Ip=5,ch=6;function Vh(t,n,r,o,s,l){var u=t.__transition;if(!u)t.__transition={};else if(r in u)return;DP(t,r,{name:n,index:o,group:s,on:kP,tween:NP,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:ix})}function wg(t,n){var r=Xr(t,n);if(r.state>ix)throw new Error("too late; already scheduled");return r}function vo(t,n){var r=Xr(t,n);if(r.state>lh)throw new Error("too late; already running");return r}function Xr(t,n){var r=t.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function DP(t,n,r){var o=t.__transition,s;o[n]=r,r.timer=ox(l,0,r.time);function l(p){r.state=Nv,r.timer.restart(u,r.delay,r.time),r.delay<=p&&u(p-r.delay)}function u(p){var m,v,y,x;if(r.state!==Nv)return d();for(m in o)if(x=o[m],x.name===r.name){if(x.state===lh)return kv(u);x.state===Dv?(x.state=ch,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete o[m]):+mDp&&o.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function c_(t,n,r){var o,s,l=l_(n)?wg:vo;return function(){var u=l(this,t),h=u.on;h!==o&&(s=(o=h).copy()).on(n,r),u.on=s}}function u_(t,n){var r=this._id;return arguments.length<2?Xr(this.node(),r).on.on(t):this.each(c_(r,t,n))}function h_(t){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==t)return;n&&n.removeChild(this)}}function d_(){return this.on("end.remove",h_(this._id))}function f_(t){var n=this._name,r=this._id;typeof t!="function"&&(t=gg(t));for(var o=this._groups,s=o.length,l=new Array(s),u=0;u()=>t;function j_(t,{sourceEvent:n,target:r,transform:o,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:s}})}function Ko(t,n,r){this.k=t,this.x=n,this.y=r}Ko.prototype={constructor:Ko,scale:function(t){return t===1?this:new Ko(this.k*t,this.x,this.y)},translate:function(t,n){return t===0&n===0?this:new Ko(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var zh=new Ko(1,0,0);cx.prototype=Ko.prototype;function cx(t){for(;!t.__zoom;)if(!(t=t.parentNode))return zh;return t.__zoom}function Hf(t){t.stopImmediatePropagation()}function Il(t){t.preventDefault(),t.stopImmediatePropagation()}function B_(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function $_(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Iv(){return this.__zoom||zh}function V_(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function z_(){return navigator.maxTouchPoints||"ontouchstart"in this}function H_(t,n,r){var o=t.invertX(n[0][0])-r[0][0],s=t.invertX(n[1][0])-r[1][0],l=t.invertY(n[0][1])-r[0][1],u=t.invertY(n[1][1])-r[1][1];return t.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function ux(){var t=B_,n=$_,r=H_,o=V_,s=z_,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],h=250,d=_P,p=jh("start","zoom","end"),m,v,y,x=500,C=150,b=0,A=10;function _(V){V.property("__zoom",Iv).on("wheel.zoom",ne,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",M).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",W).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(V,F,j,Y){var z=V.selection?V.selection():V;z.property("__zoom",Iv),V!==z?Z(V,F,j,Y):z.interrupt().each(function(){ue(this,arguments).event(Y).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},_.scaleBy=function(V,F,j,Y){_.scaleTo(V,function(){var z=this.__zoom.k,G=typeof F=="function"?F.apply(this,arguments):F;return z*G},j,Y)},_.scaleTo=function(V,F,j,Y){_.transform(V,function(){var z=n.apply(this,arguments),G=this.__zoom,J=j==null?D(z):typeof j=="function"?j.apply(this,arguments):j,q=G.invert(J),se=typeof F=="function"?F.apply(this,arguments):F;return r(R(N(G,se),J,q),z,u)},j,Y)},_.translateBy=function(V,F,j,Y){_.transform(V,function(){return r(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof j=="function"?j.apply(this,arguments):j),n.apply(this,arguments),u)},null,Y)},_.translateTo=function(V,F,j,Y,z){_.transform(V,function(){var G=n.apply(this,arguments),J=this.__zoom,q=Y==null?D(G):typeof Y=="function"?Y.apply(this,arguments):Y;return r(zh.translate(q[0],q[1]).scale(J.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof j=="function"?-j.apply(this,arguments):-j),G,u)},Y,z)};function N(V,F){return F=Math.max(l[0],Math.min(l[1],F)),F===V.k?V:new Ko(F,V.x,V.y)}function R(V,F,j){var Y=F[0]-j[0]*V.k,z=F[1]-j[1]*V.k;return Y===V.x&&z===V.y?V:new Ko(V.k,Y,z)}function D(V){return[(+V[0][0]+ +V[1][0])/2,(+V[0][1]+ +V[1][1])/2]}function Z(V,F,j,Y){V.on("start.zoom",function(){ue(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){ue(this,arguments).event(Y).end()}).tween("zoom",function(){var z=this,G=arguments,J=ue(z,G).event(Y),q=n.apply(z,G),se=j==null?D(q):typeof j=="function"?j.apply(z,G):j,Ee=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),be=z.__zoom,Ae=typeof F=="function"?F.apply(z,G):F,Ne=d(be.invert(se).concat(Ee/be.k),Ae.invert(se).concat(Ee/Ae.k));return function($e){if($e===1)$e=Ae;else{var Te=Ne($e),Ce=Ee/Te[2];$e=new Ko(Ce,se[0]-Te[0]*Ce,se[1]-Te[1]*Ce)}J.zoom(null,$e)}})}function ue(V,F,j){return!j&&V.__zooming||new K(V,F)}function K(V,F){this.that=V,this.args=F,this.active=0,this.sourceEvent=null,this.extent=n.apply(V,F),this.taps=0}K.prototype={event:function(V){return V&&(this.sourceEvent=V),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(V,F){return this.mouse&&V!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&V!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&V!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(V){var F=Yn(this.that).datum();p.call(V,this.that,new j_(V,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:p}),F)}};function ne(V,...F){if(!t.apply(this,arguments))return;var j=ue(this,F).event(V),Y=this.__zoom,z=Math.max(l[0],Math.min(l[1],Y.k*Math.pow(2,o.apply(this,arguments)))),G=$r(V);if(j.wheel)(j.mouse[0][0]!==G[0]||j.mouse[0][1]!==G[1])&&(j.mouse[1]=Y.invert(j.mouse[0]=G)),clearTimeout(j.wheel);else{if(Y.k===z)return;j.mouse=[G,Y.invert(G)],uh(this),j.start()}Il(V),j.wheel=setTimeout(J,C),j.zoom("mouse",r(R(N(Y,z),j.mouse[0],j.mouse[1]),j.extent,u));function J(){j.wheel=null,j.end()}}function I(V,...F){if(y||!t.apply(this,arguments))return;var j=V.currentTarget,Y=ue(this,F,!0).event(V),z=Yn(V.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",Ee,!0),G=$r(V,j),J=V.clientX,q=V.clientY;Gw(V.view),Hf(V),Y.mouse=[G,this.__zoom.invert(G)],uh(this),Y.start();function se(be){if(Il(be),!Y.moved){var Ae=be.clientX-J,Ne=be.clientY-q;Y.moved=Ae*Ae+Ne*Ne>b}Y.event(be).zoom("mouse",r(R(Y.that.__zoom,Y.mouse[0]=$r(be,j),Y.mouse[1]),Y.extent,u))}function Ee(be){z.on("mousemove.zoom mouseup.zoom",null),Kw(be.view,Y.moved),Il(be),Y.event(be).end()}}function M(V,...F){if(t.apply(this,arguments)){var j=this.__zoom,Y=$r(V.changedTouches?V.changedTouches[0]:V,this),z=j.invert(Y),G=j.k*(V.shiftKey?.5:2),J=r(R(N(j,G),Y,z),n.apply(this,F),u);Il(V),h>0?Yn(this).transition().duration(h).call(Z,J,Y,V):Yn(this).call(_.transform,J,Y,V)}}function H(V,...F){if(t.apply(this,arguments)){var j=V.touches,Y=j.length,z=ue(this,F,V.changedTouches.length===Y).event(V),G,J,q,se;for(Hf(V),J=0;J"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:n,sourceHandle:r,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?r:o}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID."},oc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],hx=["Enter"," ","Escape"];var Ua;(function(t){t.Strict="strict",t.Loose="loose"})(Ua||(Ua={}));var js;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(js||(js={}));var ic;(function(t){t.Partial="partial",t.Full="full"})(ic||(ic={}));const dx={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Mi;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Mi||(Mi={}));var Ph;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ph||(Ph={}));var Ye;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Ye||(Ye={}));const Mv={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top};function U_(t,n){if(!t&&!n)return!0;if(!t||!n||t.size!==n.size)return!1;if(!t.size&&!n.size)return!0;for(const r of t.keys())if(!n.has(r))return!1;return!0}function Lv(t,n,r){if(!r)return;const o=[];t.forEach((s,l)=>{n!=null&&n.has(l)||o.push(s)}),o.length&&r(o)}function fx(t){return t===null?null:t?"valid":"invalid"}const px=t=>"id"in t&&"source"in t&&"target"in t,W_=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Sg=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),q_=(t,n,r)=>{if(!t.id)return[];const o=new Set;return r.forEach(s=>{s.target===t.id&&o.add(s.source)}),n.filter(s=>o.has(s.id))},Sc=(t,n=[0,0])=>{const{width:r,height:o}=ti(t),s=t.origin??n,l=r*s[0],u=o*s[1];return{x:t.position.x-l,y:t.position.y-u}},G_=(t,n={nodeOrigin:[0,0],nodeLookup:void 0})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const r=t.reduce((o,s)=>{const l=typeof s=="string";let u=!n.nodeLookup&&!l?s:void 0;n.nodeLookup&&(u=l?n.nodeLookup.get(s):Sg(s)?s:n.nodeLookup.get(s.id));const h=u?_h(u,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Hh(o,h)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Uh(r)},bc=(t,n={})=>{if(t.size===0)return{x:0,y:0,width:0,height:0};let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return t.forEach(o=>{if(n.filter===void 0||n.filter(o)){const s=_h(o);r=Hh(r,s)}}),Uh(r)},gx=(t,n,[r,o,s]=[0,0,1],l=!1,u=!1)=>{const h={...Cc(n,[r,o,s]),width:n.width/s,height:n.height/s},d=[];for(const p of t.values()){const{measured:m,selectable:v=!0,hidden:y=!1}=p;if(u&&!v||y)continue;const x=m.width??p.width??p.initialWidth??null,C=m.height??p.height??p.initialHeight??null,b=sc(h,qa(p)),A=(x??0)*(C??0),_=l&&b>0;(!p.internals.handleBounds||_||b>=A||p.dragging)&&d.push(p)}return d},K_=(t,n)=>{const r=new Set;return t.forEach(o=>{r.add(o.id)}),n.filter(o=>r.has(o.source)||r.has(o.target))};function Mp(t,n){const r=new Map,o=n!=null&&n.nodes?new Set(n.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!s.hidden)&&(!o||o.has(s.id))&&r.set(s.id,s)}),r}async function Lp({nodes:t,width:n,height:r,panZoom:o,minZoom:s,maxZoom:l},u){if(t.size===0)return Promise.resolve(!1);const h=bc(t),d=bg(h,n,r,(u==null?void 0:u.minZoom)??s,(u==null?void 0:u.maxZoom)??l,(u==null?void 0:u.padding)??.1);return await o.setViewport(d,{duration:u==null?void 0:u.duration}),Promise.resolve(!0)}function mx({nodeId:t,nextPosition:n,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:s,onError:l}){const u=r.get(t),h=u.parentId?r.get(u.parentId):void 0,{x:d,y:p}=h?h.internals.positionAbsolute:{x:0,y:0},m=u.origin??o;let v=s;if(u.extent==="parent"&&!u.expandParent)if(!h)l==null||l("005",wo.error005());else{const x=h.measured.width,C=h.measured.height;x&&C&&(v=[[d,p],[d+x,p+C]])}else h&&Ga(u.extent)&&(v=[[u.extent[0][0]+d,u.extent[0][1]+p],[u.extent[1][0]+d,u.extent[1][1]+p]]);const y=Ga(v)?zs(n,v,u.measured):n;return{position:{x:y.x-d+u.measured.width*m[0],y:y.y-p+u.measured.height*m[1]},positionAbsolute:y}}async function Y_({nodesToRemove:t=[],edgesToRemove:n=[],nodes:r,edges:o,onBeforeDelete:s}){const l=new Set(t.map(y=>y.id)),u=[];for(const y of r){if(y.deletable===!1)continue;const x=l.has(y.id),C=!x&&y.parentId&&u.find(b=>b.id===y.parentId);(x||C)&&u.push(y)}const h=new Set(n.map(y=>y.id)),d=o.filter(y=>y.deletable!==!1),m=K_(u,d);for(const y of d)h.has(y.id)&&!m.find(C=>C.id===y.id)&&m.push(y);if(!s)return{edges:m,nodes:u};const v=await s({nodes:u,edges:m});return typeof v=="boolean"?v?{edges:m,nodes:u}:{edges:[],nodes:[]}:v}const Wa=(t,n=0,r=1)=>Math.min(Math.max(t,n),r),zs=(t={x:0,y:0},n,r)=>({x:Wa(t.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:Wa(t.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function yx(t,n,r){const{width:o,height:s}=ti(r),{x:l,y:u}=r.internals.positionAbsolute;return zs(t,[[l,u],[l+o,u+s]],n)}const Fv=(t,n,r)=>tr?-Wa(Math.abs(t-r),1,n)/n:0,vx=(t,n,r=15,o=40)=>{const s=Fv(t.x,o,n.width-o)*r,l=Fv(t.y,o,n.height-o)*r;return[s,l]},Hh=(t,n)=>({x:Math.min(t.x,n.x),y:Math.min(t.y,n.y),x2:Math.max(t.x2,n.x2),y2:Math.max(t.y2,n.y2)}),Fp=({x:t,y:n,width:r,height:o})=>({x:t,y:n,x2:t+r,y2:n+o}),Uh=({x:t,y:n,x2:r,y2:o})=>({x:t,y:n,width:r-t,height:o-n}),qa=(t,n=[0,0])=>{var s,l;const{x:r,y:o}=Sg(t)?t.internals.positionAbsolute:Sc(t,n);return{x:r,y:o,width:((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0,height:((l=t.measured)==null?void 0:l.height)??t.height??t.initialHeight??0}},_h=(t,n=[0,0])=>{var s,l;const{x:r,y:o}=Sg(t)?t.internals.positionAbsolute:Sc(t,n);return{x:r,y:o,x2:r+(((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0),y2:o+(((l=t.measured)==null?void 0:l.height)??t.height??t.initialHeight??0)}},wx=(t,n)=>Uh(Hh(Fp(t),Fp(n))),sc=(t,n)=>{const r=Math.max(0,Math.min(t.x+t.width,n.x+n.width)-Math.max(t.x,n.x)),o=Math.max(0,Math.min(t.y+t.height,n.y+n.height)-Math.max(t.y,n.y));return Math.ceil(r*o)},jv=t=>Wr(t.width)&&Wr(t.height)&&Wr(t.x)&&Wr(t.y),Wr=t=>!isNaN(t)&&isFinite(t),X_=(t,n)=>{},Wh=(t,n=[1,1])=>({x:n[0]*Math.round(t.x/n[0]),y:n[1]*Math.round(t.y/n[1])}),Cc=({x:t,y:n},[r,o,s],l=!1,u=[1,1])=>{const h={x:(t-r)/s,y:(n-o)/s};return l?Wh(h,u):h},xx=({x:t,y:n},[r,o,s])=>({x:t*s+r,y:n*s+o}),bg=(t,n,r,o,s,l)=>{const u=n/(t.width*(1+l)),h=r/(t.height*(1+l)),d=Math.min(u,h),p=Wa(d,o,s),m=t.x+t.width/2,v=t.y+t.height/2,y=n/2-m*p,x=r/2-v*p;return{x:y,y:x,zoom:p}},Ah=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ga(t){return t!==void 0&&t!=="parent"}function ti(t){var n,r;return{width:((n=t.measured)==null?void 0:n.width)??t.width??t.initialWidth??0,height:((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight??0}}function Sx(t){var n,r;return(((n=t.measured)==null?void 0:n.width)??t.width??t.initialWidth)!==void 0&&(((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight)!==void 0}function bx(t,n={width:0,height:0},r,o,s){const l={...t},u=o.get(r);if(u){const h=u.origin||s;l.x+=u.internals.positionAbsolute.x-(n.width??0)*h[0],l.y+=u.internals.positionAbsolute.y-(n.height??0)*h[1]}return l}function Bv(t,n){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}function Yl(t,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:o,containerBounds:s}){const{x:l,y:u}=Xo(t),h=Cc({x:l-((s==null?void 0:s.left)??0),y:u-((s==null?void 0:s.top)??0)},o),{x:d,y:p}=r?Wh(h,n):h;return{xSnapped:d,ySnapped:p,...h}}const qh=t=>({width:t.offsetWidth,height:t.offsetHeight}),Cx=t=>{var n;return((n=t==null?void 0:t.getRootNode)==null?void 0:n.call(t))||(window==null?void 0:window.document)},Q_=["INPUT","SELECT","TEXTAREA"];function jp(t){var o,s;const n=((s=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:s[0])||t.target;return(n==null?void 0:n.nodeType)!==1?!1:Q_.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Ex=t=>"clientX"in t,Xo=(t,n)=>{var l,u;const r=Ex(t),o=r?t.clientX:(l=t.touches)==null?void 0:l[0].clientX,s=r?t.clientY:(u=t.touches)==null?void 0:u[0].clientY;return{x:o-((n==null?void 0:n.left)??0),y:s-((n==null?void 0:n.top)??0)}},$v=(t,n,r,o,s)=>{const l=n.querySelectorAll(`.${t}`);return!l||!l.length?null:Array.from(l).map(u=>{const h=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:t,nodeId:s,position:u.getAttribute("data-handlepos"),x:(h.left-r.left)/o,y:(h.top-r.top)/o,...qh(u)}})};function Px({sourceX:t,sourceY:n,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:h}){const d=t*.125+s*.375+u*.375+r*.125,p=n*.125+l*.375+h*.375+o*.125,m=Math.abs(d-t),v=Math.abs(p-n);return[d,p,m,v]}function Uu(t,n){return t>=0?.5*t:n*25*Math.sqrt(-t)}function Vv({pos:t,x1:n,y1:r,x2:o,y2:s,c:l}){switch(t){case Ye.Left:return[n-Uu(n-o,l),r];case Ye.Right:return[n+Uu(o-n,l),r];case Ye.Top:return[n,r-Uu(r-s,l)];case Ye.Bottom:return[n,r+Uu(s-r,l)]}}function _x({sourceX:t,sourceY:n,sourcePosition:r=Ye.Bottom,targetX:o,targetY:s,targetPosition:l=Ye.Top,curvature:u=.25}){const[h,d]=Vv({pos:r,x1:t,y1:n,x2:o,y2:s,c:u}),[p,m]=Vv({pos:l,x1:o,y1:s,x2:t,y2:n,c:u}),[v,y,x,C]=Px({sourceX:t,sourceY:n,targetX:o,targetY:s,sourceControlX:h,sourceControlY:d,targetControlX:p,targetControlY:m});return[`M${t},${n} C${h},${d} ${p},${m} ${o},${s}`,v,y,x,C]}function Ax({sourceX:t,sourceY:n,targetX:r,targetY:o}){const s=Math.abs(r-t)/2,l=r0}const eA=({source:t,sourceHandle:n,target:r,targetHandle:o})=>`xy-edge__${t}${n||""}-${r}${o||""}`,tA=(t,n)=>n.some(r=>r.source===t.source&&r.target===t.target&&(r.sourceHandle===t.sourceHandle||!r.sourceHandle&&!t.sourceHandle)&&(r.targetHandle===t.targetHandle||!r.targetHandle&&!t.targetHandle)),Bp=(t,n)=>{if(!t.source||!t.target)return n;let r;return px(t)?r={...t}:r={...t,id:eA(t)},tA(r,n)?n:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,n.concat(r))};function Tx({sourceX:t,sourceY:n,targetX:r,targetY:o}){const[s,l,u,h]=Ax({sourceX:t,sourceY:n,targetX:r,targetY:o});return[`M ${t},${n}L ${r},${o}`,s,l,u,h]}const zv={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},nA=({source:t,sourcePosition:n=Ye.Bottom,target:r})=>n===Ye.Left||n===Ye.Right?t.xMath.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2));function rA({source:t,sourcePosition:n=Ye.Bottom,target:r,targetPosition:o=Ye.Top,center:s,offset:l}){const u=zv[n],h=zv[o],d={x:t.x+u.x*l,y:t.y+u.y*l},p={x:r.x+h.x*l,y:r.y+h.y*l},m=nA({source:d,sourcePosition:n,target:p}),v=m.x!==0?"x":"y",y=m[v];let x=[],C,b;const A={x:0,y:0},_={x:0,y:0},[N,R,D,Z]=Ax({sourceX:t.x,sourceY:t.y,targetX:r.x,targetY:r.y});if(u[v]*h[v]===-1){C=s.x??N,b=s.y??R;const K=[{x:C,y:d.y},{x:C,y:p.y}],ne=[{x:d.x,y:b},{x:p.x,y:b}];u[v]===y?x=v==="x"?K:ne:x=v==="x"?ne:K}else{const K=[{x:d.x,y:p.y}],ne=[{x:p.x,y:d.y}];if(v==="x"?x=u.x===y?ne:K:x=u.y===y?K:ne,n===o){const X=Math.abs(t[v]-r[v]);if(X<=l){const V=Math.min(l-1,l-X);u[v]===y?A[v]=(d[v]>t[v]?-1:1)*V:_[v]=(p[v]>r[v]?-1:1)*V}}if(n!==o){const X=v==="x"?"y":"x",V=u[v]===h[X],F=d[X]>p[X],j=d[X]=W?(C=(I.x+M.x)/2,b=x[0].y):(C=x[0].x,b=(I.y+M.y)/2)}return[[t,{x:d.x+A.x,y:d.y+A.y},...x,{x:p.x+_.x,y:p.y+_.y},r],C,b,D,Z]}function oA(t,n,r,o){const s=Math.min(Hv(t,n)/2,Hv(n,r)/2,o),{x:l,y:u}=n;if(t.x===l&&l===r.x||t.y===u&&u===r.y)return`L${l} ${u}`;if(t.y===u){const p=t.x{let R="";return N>0&&Nr.id===n):t[0])||null}function Vp(t,n){return t?typeof t=="string"?t:`${n?`${n}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function sA(t,{id:n,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:s}){const l=new Set;return t.reduce((u,h)=>([h.markerStart||o,h.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const p=Vp(d,n);l.has(p)||(u.push({id:p,color:d.color||r,...d}),l.add(p))}}),u),[]).sort((u,h)=>u.id.localeCompare(h.id))}const Cg={nodeOrigin:[0,0],nodeExtent:oc,elevateNodesOnSelect:!0,defaults:{}},aA={...Cg,checkEquality:!0};function Eg(t,n){const r={...t};for(const o in n)n[o]!==void 0&&(r[o]=n[o]);return r}function lA(t,n,r){const o=Eg(Cg,r);for(const s of t.values())if(s.parentId)Pg(s,t,n,o);else{const l=Sc(s,o.nodeOrigin),u=Ga(s.extent)?s.extent:o.nodeExtent,h=zs(l,u,ti(s));s.internals.positionAbsolute=h}}function zp(t,n,r,o){var h,d;const s=Eg(aA,o),l=new Map(n),u=s!=null&&s.elevateNodesOnSelect?1e3:0;n.clear(),r.clear();for(const p of t){let m=l.get(p.id);if(s.checkEquality&&p===(m==null?void 0:m.internals.userNode))n.set(p.id,m);else{const v=Sc(p,s.nodeOrigin),y=Ga(p.extent)?p.extent:s.nodeExtent,x=zs(v,y,ti(p));m={...s.defaults,...p,measured:{width:(h=p.measured)==null?void 0:h.width,height:(d=p.measured)==null?void 0:d.height},internals:{positionAbsolute:x,handleBounds:p.measured?m==null?void 0:m.internals.handleBounds:void 0,z:Rx(p,u),userNode:p}},n.set(p.id,m)}p.parentId&&Pg(m,n,r,o)}}function cA(t,n){if(!t.parentId)return;const r=n.get(t.parentId);r?r.set(t.id,t):n.set(t.parentId,new Map([[t.id,t]]))}function Pg(t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:l,nodeExtent:u}=Eg(Cg,o),h=t.parentId,d=n.get(h);if(!d){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}cA(t,r);const p=s?1e3:0,{x:m,y:v,z:y}=uA(t,d,l,u,p),{positionAbsolute:x}=t.internals,C=m!==x.x||v!==x.y;(C||y!==t.internals.z)&&n.set(t.id,{...t,internals:{...t.internals,positionAbsolute:C?{x:m,y:v}:x,z:y}})}function Rx(t,n){return(Wr(t.zIndex)?t.zIndex:0)+(t.selected?n:0)}function uA(t,n,r,o,s){const{x:l,y:u}=n.internals.positionAbsolute,h=ti(t),d=Sc(t,r),p=Ga(t.extent)?zs(d,t.extent,h):d;let m=zs({x:l+p.x,y:u+p.y},o,h);t.extent==="parent"&&(m=yx(m,h,n));const v=Rx(t,s),y=n.internals.z??0;return{x:m.x,y:m.y,z:y>v?y:v}}function _g(t,n,r,o=[0,0]){var u;const s=[],l=new Map;for(const h of t){const d=n.get(h.parentId);if(!d)continue;const p=((u=l.get(h.parentId))==null?void 0:u.expandedRect)??qa(d),m=wx(p,h.rect);l.set(h.parentId,{expandedRect:m,parent:d})}return l.size>0&&l.forEach(({expandedRect:h,parent:d},p)=>{var R;const m=d.internals.positionAbsolute,v=ti(d),y=d.origin??o,x=h.x0||C>0||_||N)&&(s.push({id:p,type:"position",position:{x:d.position.x-x+_,y:d.position.y-C+N}}),(R=r.get(p))==null||R.forEach(D=>{t.some(Z=>Z.id===D.id)||s.push({id:D.id,type:"position",position:{x:D.position.x+x,y:D.position.y+C}})})),(v.width0){const y=_g(v,n,r,s);d.push(...y)}return{changes:d,updatedInternals:h}}async function dA({delta:t,panZoom:n,transform:r,translateExtent:o,width:s,height:l}){if(!n||!t.x&&!t.y)return Promise.resolve(!1);const u=await n.setViewportConstrained({x:r[0]+t.x,y:r[1]+t.y,zoom:r[2]},[[0,0],[s,l]],o),h=!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2]);return Promise.resolve(h)}function Gv(t,n,r,o,s,l){let u=s;const h=o.get(u)||new Map;o.set(u,h.set(r,n)),u=`${s}-${t}`;const d=o.get(u)||new Map;if(o.set(u,d.set(r,n)),l){u=`${s}-${t}-${l}`;const p=o.get(u)||new Map;o.set(u,p.set(r,n))}}function Ox(t,n,r){t.clear(),n.clear();for(const o of r){const{source:s,target:l,sourceHandle:u=null,targetHandle:h=null}=o,d={edgeId:o.id,source:s,target:l,sourceHandle:u,targetHandle:h},p=`${s}-${u}--${l}-${h}`,m=`${l}-${h}--${s}-${u}`;Gv("source",d,m,t,s,u),Gv("target",d,p,t,l,h),n.set(o.id,o)}}function kx(t,n){if(!t.parentId)return!1;const r=n.get(t.parentId);return r?r.selected?!0:kx(r,n):!1}function Kv(t,n,r){var s;let o=t;do{if((s=o==null?void 0:o.matches)!=null&&s.call(o,n))return!0;if(o===r)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function fA(t,n,r,o){const s=new Map;for(const[l,u]of t)if((u.selected||u.id===o)&&(!u.parentId||!kx(u,t))&&(u.draggable||n&&typeof u.draggable>"u")){const h=t.get(l);h&&s.set(l,{id:l,position:h.position||{x:0,y:0},distance:{x:r.x-h.internals.positionAbsolute.x,y:r.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return s}function Uf({nodeId:t,dragItems:n,nodeLookup:r,dragging:o=!0}){var u,h,d;const s=[];for(const[p,m]of n){const v=(u=r.get(p))==null?void 0:u.internals.userNode;v&&s.push({...v,position:m.position,dragging:o})}if(!t)return[s[0],s];const l=(h=r.get(t))==null?void 0:h.internals.userNode;return[l?{...l,position:((d=n.get(t))==null?void 0:d.position)||l.position,dragging:o}:s[0],s]}function pA({onNodeMouseDown:t,getStoreItems:n,onDragStart:r,onDrag:o,onDragStop:s}){let l={x:null,y:null},u=0,h=new Map,d=!1,p={x:0,y:0},m=null,v=!1,y=null,x=!1;function C({noDragClassName:A,handleSelector:_,domNode:N,isSelectable:R,nodeId:D,nodeClickDistance:Z=0}){y=Yn(N);function ue({x:M,y:H},W){const{nodeLookup:X,nodeExtent:V,snapGrid:F,snapToGrid:j,nodeOrigin:Y,onNodeDrag:z,onSelectionDrag:G,onError:J,updateNodePositions:q}=n();l={x:M,y:H};let se=!1,Ee={x:0,y:0,x2:0,y2:0};if(h.size>1&&V){const be=bc(h);Ee=Fp(be)}for(const[be,Ae]of h){if(!X.has(be))continue;let Ne={x:M-Ae.distance.x,y:H-Ae.distance.y};j&&(Ne=Wh(Ne,F));let $e=[[V[0][0],V[0][1]],[V[1][0],V[1][1]]];if(h.size>1&&V&&!Ae.extent){const{positionAbsolute:Je}=Ae.internals,nt=Je.x-Ee.x+V[0][0],Fe=Je.x+Ae.measured.width-Ee.x2+V[1][0],st=Je.y-Ee.y+V[0][1],mt=Je.y+Ae.measured.height-Ee.y2+V[1][1];$e=[[nt,st],[Fe,mt]]}const{position:Te,positionAbsolute:Ce}=mx({nodeId:be,nextPosition:Ne,nodeLookup:X,nodeExtent:$e,nodeOrigin:Y,onError:J});se=se||Ae.position.x!==Te.x||Ae.position.y!==Te.y,Ae.position=Te,Ae.internals.positionAbsolute=Ce}if(se&&(q(h,!0),W&&(o||z||!D&&G))){const[be,Ae]=Uf({nodeId:D,dragItems:h,nodeLookup:X});o==null||o(W,h,be,Ae),z==null||z(W,be,Ae),D||G==null||G(W,Ae)}}async function K(){if(!m)return;const{transform:M,panBy:H,autoPanSpeed:W}=n(),[X,V]=vx(p,m,W);(X!==0||V!==0)&&(l.x=(l.x??0)-X/M[2],l.y=(l.y??0)-V/M[2],await H({x:X,y:V})&&ue(l,null)),u=requestAnimationFrame(K)}function ne(M){var se;const{nodeLookup:H,multiSelectionActive:W,nodesDraggable:X,transform:V,snapGrid:F,snapToGrid:j,selectNodesOnDrag:Y,onNodeDragStart:z,onSelectionDragStart:G,unselectNodesAndEdges:J}=n();v=!0,(!Y||!R)&&!W&&D&&((se=H.get(D))!=null&&se.selected||J()),R&&Y&&D&&(t==null||t(D));const q=Yl(M.sourceEvent,{transform:V,snapGrid:F,snapToGrid:j,containerBounds:m});if(l=q,h=fA(H,X,q,D),h.size>0&&(r||z||!D&&G)){const[Ee,be]=Uf({nodeId:D,dragItems:h,nodeLookup:H});r==null||r(M.sourceEvent,h,Ee,be),z==null||z(M.sourceEvent,Ee,be),D||G==null||G(M.sourceEvent,be)}}const I=Yw().clickDistance(Z).on("start",M=>{const{domNode:H,nodeDragThreshold:W,transform:X,snapGrid:V,snapToGrid:F}=n();m=(H==null?void 0:H.getBoundingClientRect())||null,x=!1,W===0&&ne(M),l=Yl(M.sourceEvent,{transform:X,snapGrid:V,snapToGrid:F,containerBounds:m}),p=Xo(M.sourceEvent,m)}).on("drag",M=>{const{autoPanOnNodeDrag:H,transform:W,snapGrid:X,snapToGrid:V,nodeDragThreshold:F,nodeLookup:j}=n(),Y=Yl(M.sourceEvent,{transform:W,snapGrid:X,snapToGrid:V,containerBounds:m});if((M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||D&&!j.has(D))&&(x=!0),!x){if(!d&&H&&v&&(d=!0,K()),!v){const z=Y.xSnapped-(l.x??0),G=Y.ySnapped-(l.y??0);Math.sqrt(z*z+G*G)>F&&ne(M)}(l.x!==Y.xSnapped||l.y!==Y.ySnapped)&&h&&v&&(p=Xo(M.sourceEvent,m),ue(Y,M.sourceEvent))}}).on("end",M=>{if(!(!v||x)&&(d=!1,v=!1,cancelAnimationFrame(u),h.size>0)){const{nodeLookup:H,updateNodePositions:W,onNodeDragStop:X,onSelectionDragStop:V}=n();if(W(h,!1),s||X||!D&&V){const[F,j]=Uf({nodeId:D,dragItems:h,nodeLookup:H,dragging:!1});s==null||s(M.sourceEvent,h,F,j),X==null||X(M.sourceEvent,F,j),D||V==null||V(M.sourceEvent,j)}}}).filter(M=>{const H=M.target;return!M.button&&(!A||!Kv(H,`.${A}`,N))&&(!_||Kv(H,_,N))});y.call(I)}function b(){y==null||y.on(".drag",null)}return{update:C,destroy:b}}function gA(t,n,r){const o=[],s={x:t.x-r,y:t.y-r,width:r*2,height:r*2};for(const l of n.values())sc(s,qa(l))>0&&o.push(l);return o}const mA=250;function yA(t,n,r,o){var h,d;let s=[],l=1/0;const u=gA(t,r,n+mA);for(const p of u){const m=[...((h=p.internals.handleBounds)==null?void 0:h.source)??[],...((d=p.internals.handleBounds)==null?void 0:d.target)??[]];for(const v of m){if(o.nodeId===v.nodeId&&o.type===v.type&&o.id===v.id)continue;const{x:y,y:x}=ac(p,v,v.position,!0),C=Math.sqrt(Math.pow(y-t.x,2)+Math.pow(x-t.y,2));C>n||(C1){const p=o.type==="source"?"target":"source";return s.find(m=>m.type===p)??s[0]}return s[0]}function Nx(t,n,r,o,s,l=!1){var p,m,v;const u=o.get(t);if(!u)return null;const h=s==="strict"?(p=u.internals.handleBounds)==null?void 0:p[n]:[...((m=u.internals.handleBounds)==null?void 0:m.source)??[],...((v=u.internals.handleBounds)==null?void 0:v.target)??[]],d=(r?h==null?void 0:h.find(y=>y.id===r):h==null?void 0:h[0])??null;return d&&l?{...d,...ac(u,d,d.position,!0)}:d}function Dx(t,n){return t||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function vA(t,n){let r=null;return n?r=!0:t&&!n&&(r=!1),r}const Ix=()=>!0;function wA(t,{connectionMode:n,connectionRadius:r,handleId:o,nodeId:s,edgeUpdaterType:l,isTarget:u,domNode:h,nodeLookup:d,lib:p,autoPanOnConnect:m,flowId:v,panBy:y,cancelConnection:x,onConnectStart:C,onConnect:b,onConnectEnd:A,isValidConnection:_=Ix,onReconnectEnd:N,updateConnection:R,getTransform:D,getFromHandle:Z,autoPanSpeed:ue}){const K=Cx(t.target);let ne=0,I;const{x:M,y:H}=Xo(t),W=K==null?void 0:K.elementFromPoint(M,H),X=Dx(l,W),V=h==null?void 0:h.getBoundingClientRect();if(!V||!X)return;const F=Nx(s,X,o,d,n);if(!F)return;let j=Xo(t,V),Y=!1,z=null,G=!1,J=null;function q(){if(!m||!V)return;const[Ce,Je]=vx(j,V,ue);y({x:Ce,y:Je}),ne=requestAnimationFrame(q)}const se={...F,nodeId:s,type:X,position:F.position},Ee=d.get(s),Ae={inProgress:!0,isValid:null,from:ac(Ee,se,Ye.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:Ee,to:j,toHandle:null,toPosition:Mv[se.position],toNode:null};R(Ae);let Ne=Ae;C==null||C(t,{nodeId:s,handleId:o,handleType:X});function $e(Ce){if(!Z()||!se){Te(Ce);return}const Je=D();j=Xo(Ce,V),I=yA(Cc(j,Je,!1,[1,1]),r,d,se),Y||(q(),Y=!0);const nt=Mx(Ce,{handle:I,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:u?"target":"source",isValidConnection:_,doc:K,lib:p,flowId:v,nodeLookup:d});J=nt.handleDomNode,z=nt.connection,G=vA(!!I,nt.isValid);const Fe={...Ne,isValid:G,to:I&&G?xx({x:I.x,y:I.y},Je):j,toHandle:nt.toHandle,toPosition:G&&nt.toHandle?nt.toHandle.position:Mv[se.position],toNode:nt.toHandle?d.get(nt.toHandle.nodeId):null};G&&I&&Ne.toHandle&&Fe.toHandle&&Ne.toHandle.type===Fe.toHandle.type&&Ne.toHandle.nodeId===Fe.toHandle.nodeId&&Ne.toHandle.id===Fe.toHandle.id&&Ne.to.x===Fe.to.x&&Ne.to.y===Fe.to.y||(R(Fe),Ne=Fe)}function Te(Ce){(I||J)&&z&&G&&(b==null||b(z));const{inProgress:Je,...nt}=Ne,Fe={...nt,toPosition:Ne.toHandle?Ne.toPosition:null};A==null||A(Ce,Fe),l&&(N==null||N(Ce,Fe)),x(),cancelAnimationFrame(ne),Y=!1,G=!1,z=null,J=null,K.removeEventListener("mousemove",$e),K.removeEventListener("mouseup",Te),K.removeEventListener("touchmove",$e),K.removeEventListener("touchend",Te)}K.addEventListener("mousemove",$e),K.addEventListener("mouseup",Te),K.addEventListener("touchmove",$e),K.addEventListener("touchend",Te)}function Mx(t,{handle:n,connectionMode:r,fromNodeId:o,fromHandleId:s,fromType:l,doc:u,lib:h,flowId:d,isValidConnection:p=Ix,nodeLookup:m}){const v=l==="target",y=n?u.querySelector(`.${h}-flow__handle[data-id="${d}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x,y:C}=Xo(t),b=u.elementFromPoint(x,C),A=b!=null&&b.classList.contains(`${h}-flow__handle`)?b:y,_={handleDomNode:A,isValid:!1,connection:null,toHandle:null};if(A){const N=Dx(void 0,A),R=A.getAttribute("data-nodeid"),D=A.getAttribute("data-handleid"),Z=A.classList.contains("connectable"),ue=A.classList.contains("connectableend");if(!R||!N)return _;const K={source:v?R:o,sourceHandle:v?D:s,target:v?o:R,targetHandle:v?s:D};_.connection=K;const I=Z&&ue&&(r===Ua.Strict?v&&N==="source"||!v&&N==="target":R!==o||D!==s);_.isValid=I&&p(K),_.toHandle=Nx(R,N,D,m,r,!1)}return _}const Hp={onPointerDown:wA,isValid:Mx};function xA({domNode:t,panZoom:n,getTransform:r,getViewScale:o}){const s=Yn(t);function l({translateExtent:h,width:d,height:p,zoomStep:m=10,pannable:v=!0,zoomable:y=!0,inversePan:x=!1}){const C=R=>{const D=r();if(R.sourceEvent.type!=="wheel"||!n)return;const Z=-R.sourceEvent.deltaY*(R.sourceEvent.deltaMode===1?.05:R.sourceEvent.deltaMode?1:.002)*m,ue=D[2]*Math.pow(2,Z);n.scaleTo(ue)};let b=[0,0];const A=R=>{(R.sourceEvent.type==="mousedown"||R.sourceEvent.type==="touchstart")&&(b=[R.sourceEvent.clientX??R.sourceEvent.touches[0].clientX,R.sourceEvent.clientY??R.sourceEvent.touches[0].clientY])},_=R=>{const D=r();if(R.sourceEvent.type!=="mousemove"&&R.sourceEvent.type!=="touchmove"||!n)return;const Z=[R.sourceEvent.clientX??R.sourceEvent.touches[0].clientX,R.sourceEvent.clientY??R.sourceEvent.touches[0].clientY],ue=[Z[0]-b[0],Z[1]-b[1]];b=Z;const K=o()*Math.max(D[2],Math.log(D[2]))*(x?-1:1),ne={x:D[0]-ue[0]*K,y:D[1]-ue[1]*K},I=[[0,0],[d,p]];n.setViewportConstrained({x:ne.x,y:ne.y,zoom:D[2]},I,h)},N=ux().on("start",A).on("zoom",v?_:null).on("zoom.wheel",y?C:null);s.call(N,{})}function u(){s.on("zoom",null)}return{update:l,destroy:u,pointer:$r}}const SA=(t,n)=>t.x!==n.x||t.y!==n.y||t.zoom!==n.k,Gh=t=>({x:t.x,y:t.y,zoom:t.k}),Wf=({x:t,y:n,zoom:r})=>zh.translate(t,n).scale(r),Fa=(t,n)=>t.target.closest(`.${n}`),Lx=(t,n)=>n===2&&Array.isArray(t)&&t.includes(2),qf=(t,n=0,r=()=>{})=>{const o=typeof n=="number"&&n>0;return o||r(),o?t.transition().duration(n).on("end",r):t},Fx=t=>{const n=t.ctrlKey&&Ah()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*n};function bA({zoomPanValues:t,noWheelClassName:n,d3Selection:r,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:h,onPanZoom:d,onPanZoomEnd:p}){return m=>{if(Fa(m,n))return!1;m.preventDefault(),m.stopImmediatePropagation();const v=r.property("__zoom").k||1;if(m.ctrlKey&&u){const A=$r(m),_=Fx(m),N=v*Math.pow(2,_);o.scaleTo(r,N,A,m);return}const y=m.deltaMode===1?20:1;let x=s===js.Vertical?0:m.deltaX*y,C=s===js.Horizontal?0:m.deltaY*y;!Ah()&&m.shiftKey&&s!==js.Vertical&&(x=m.deltaY*y,C=0),o.translateBy(r,-(x/v)*l,-(C/v)*l,{internal:!0});const b=Gh(r.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling||(t.isPanScrolling=!0,h==null||h(m,b)),t.isPanScrolling&&(d==null||d(m,b),t.panScrollTimeout=setTimeout(()=>{p==null||p(m,b),t.isPanScrolling=!1},150))}}function CA({noWheelClassName:t,preventScrolling:n,d3ZoomHandler:r}){return function(o,s){if(!n&&o.type==="wheel"&&!o.ctrlKey||Fa(o,t))return null;o.preventDefault(),r.call(this,o,s)}}function EA({zoomPanValues:t,onDraggingChange:n,onPanZoomStart:r}){return o=>{var l,u,h;if((l=o.sourceEvent)!=null&&l.internal)return;const s=Gh(o.transform);t.mouseButton=((u=o.sourceEvent)==null?void 0:u.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=s,((h=o.sourceEvent)==null?void 0:h.type)==="mousedown"&&n(!0),r&&(r==null||r(o.sourceEvent,s))}}function PA({zoomPanValues:t,panOnDrag:n,onPaneContextMenu:r,onTransformChange:o,onPanZoom:s}){return l=>{var u,h;t.usedRightMouseButton=!!(r&&Lx(n,t.mouseButton??0)),(u=l.sourceEvent)!=null&&u.sync||o([l.transform.x,l.transform.y,l.transform.k]),s&&!((h=l.sourceEvent)!=null&&h.internal)&&(s==null||s(l.sourceEvent,Gh(l.transform)))}}function _A({zoomPanValues:t,panOnDrag:n,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:l}){return u=>{var h;if(!((h=u.sourceEvent)!=null&&h.internal)&&(t.isZoomingOrPanning=!1,l&&Lx(n,t.mouseButton??0)&&!t.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),t.usedRightMouseButton=!1,o(!1),s&&SA(t.prevViewport,u.transform))){const d=Gh(u.transform);t.prevViewport=d,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s==null||s(u.sourceEvent,d)},r?150:0)}}}function AA({zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:h,noPanClassName:d,lib:p}){return m=>{var C;const v=t||n,y=r&&m.ctrlKey;if(m.button===1&&m.type==="mousedown"&&(Fa(m,`${p}-flow__node`)||Fa(m,`${p}-flow__edge`)))return!0;if(!o&&!v&&!s&&!l&&!r||u||Fa(m,h)&&m.type==="wheel"||Fa(m,d)&&(m.type!=="wheel"||s&&m.type==="wheel"&&!t)||!r&&m.ctrlKey&&m.type==="wheel")return!1;if(!r&&m.type==="touchstart"&&((C=m.touches)==null?void 0:C.length)>1)return m.preventDefault(),!1;if(!v&&!s&&!y&&m.type==="wheel"||!o&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(o)&&!o.includes(m.button)&&m.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||m.type==="wheel")&&x}}function TA({domNode:t,minZoom:n,maxZoom:r,paneClickDistance:o,translateExtent:s,viewport:l,onPanZoom:u,onPanZoomStart:h,onPanZoomEnd:d,onDraggingChange:p}){const m={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=t.getBoundingClientRect(),y=ux().clickDistance(!Wr(o)||o<0?0:o).scaleExtent([n,r]).translateExtent(s),x=Yn(t).call(y);R({x:l.x,y:l.y,zoom:Wa(l.zoom,n,r)},[[0,0],[v.width,v.height]],s);const C=x.on("wheel.zoom"),b=x.on("dblclick.zoom");y.wheelDelta(Fx);function A(W,X){return x?new Promise(V=>{y==null||y.transform(qf(x,X==null?void 0:X.duration,()=>V(!0)),W)}):Promise.resolve(!1)}function _({noWheelClassName:W,noPanClassName:X,onPaneContextMenu:V,userSelectionActive:F,panOnScroll:j,panOnDrag:Y,panOnScrollMode:z,panOnScrollSpeed:G,preventScrolling:J,zoomOnPinch:q,zoomOnScroll:se,zoomOnDoubleClick:Ee,zoomActivationKeyPressed:be,lib:Ae,onTransformChange:Ne}){F&&!m.isZoomingOrPanning&&N();const Te=j&&!be&&!F?bA({zoomPanValues:m,noWheelClassName:W,d3Selection:x,d3Zoom:y,panOnScrollMode:z,panOnScrollSpeed:G,zoomOnPinch:q,onPanZoomStart:h,onPanZoom:u,onPanZoomEnd:d}):CA({noWheelClassName:W,preventScrolling:J,d3ZoomHandler:C});if(x.on("wheel.zoom",Te,{passive:!1}),!F){const Je=EA({zoomPanValues:m,onDraggingChange:p,onPanZoomStart:h});y.on("start",Je);const nt=PA({zoomPanValues:m,panOnDrag:Y,onPaneContextMenu:!!V,onPanZoom:u,onTransformChange:Ne});y.on("zoom",nt);const Fe=_A({zoomPanValues:m,panOnDrag:Y,panOnScroll:j,onPaneContextMenu:V,onPanZoomEnd:d,onDraggingChange:p});y.on("end",Fe)}const Ce=AA({zoomActivationKeyPressed:be,panOnDrag:Y,zoomOnScroll:se,panOnScroll:j,zoomOnDoubleClick:Ee,zoomOnPinch:q,userSelectionActive:F,noPanClassName:X,noWheelClassName:W,lib:Ae});y.filter(Ce),Ee?x.on("dblclick.zoom",b):x.on("dblclick.zoom",null)}function N(){y.on("zoom",null)}async function R(W,X,V){const F=Wf(W),j=y==null?void 0:y.constrain()(F,X,V);return j&&await A(j),new Promise(Y=>Y(j))}async function D(W,X){const V=Wf(W);return await A(V,X),new Promise(F=>F(V))}function Z(W){if(x){const X=Wf(W),V=x.property("__zoom");(V.k!==W.zoom||V.x!==W.x||V.y!==W.y)&&(y==null||y.transform(x,X,null,{sync:!0}))}}function ue(){const W=x?cx(x.node()):{x:0,y:0,k:1};return{x:W.x,y:W.y,zoom:W.k}}function K(W,X){return x?new Promise(V=>{y==null||y.scaleTo(qf(x,X==null?void 0:X.duration,()=>V(!0)),W)}):Promise.resolve(!1)}function ne(W,X){return x?new Promise(V=>{y==null||y.scaleBy(qf(x,X==null?void 0:X.duration,()=>V(!0)),W)}):Promise.resolve(!1)}function I(W){y==null||y.scaleExtent(W)}function M(W){y==null||y.translateExtent(W)}function H(W){const X=!Wr(W)||W<0?0:W;y==null||y.clickDistance(X)}return{update:_,destroy:N,setViewport:D,setViewportConstrained:R,getViewport:ue,scaleTo:K,scaleBy:ne,setScaleExtent:I,setTranslateExtent:M,syncViewport:Z,setClickDistance:H}}var Xl;(function(t){t.Line="line",t.Handle="handle"})(Xl||(Xl={}));function RA({width:t,prevWidth:n,height:r,prevHeight:o,affectsX:s,affectsY:l}){const u=t-n,h=r-o,d=[u>0?1:u<0?-1:0,h>0?1:h<0?-1:0];return u&&s&&(d[0]=d[0]*-1),h&&l&&(d[1]=d[1]*-1),d}function OA(t){const n=t.includes("right")||t.includes("left"),r=t.includes("bottom")||t.includes("top"),o=t.includes("left"),s=t.includes("top");return{isHorizontal:n,isVertical:r,affectsX:o,affectsY:s}}function ki(t,n){return Math.max(0,n-t)}function Ni(t,n){return Math.max(0,t-n)}function Wu(t,n,r){return Math.max(0,n-t,t-r)}function Yv(t,n){return t?!n:n}function kA(t,n,r,o,s,l,u,h){let{affectsX:d,affectsY:p}=n;const{isHorizontal:m,isVertical:v}=n,y=m&&v,{xSnapped:x,ySnapped:C}=r,{minWidth:b,maxWidth:A,minHeight:_,maxHeight:N}=o,{x:R,y:D,width:Z,height:ue,aspectRatio:K}=t;let ne=Math.floor(m?x-t.pointerX:0),I=Math.floor(v?C-t.pointerY:0);const M=Z+(d?-ne:ne),H=ue+(p?-I:I),W=-l[0]*Z,X=-l[1]*ue;let V=Wu(M,b,A),F=Wu(H,_,N);if(u){let z=0,G=0;d&&ne<0?z=ki(R+ne+W,u[0][0]):!d&&ne>0&&(z=Ni(R+M+W,u[1][0])),p&&I<0?G=ki(D+I+X,u[0][1]):!p&&I>0&&(G=Ni(D+H+X,u[1][1])),V=Math.max(V,z),F=Math.max(F,G)}if(h){let z=0,G=0;d&&ne>0?z=Ni(R+ne,h[0][0]):!d&&ne<0&&(z=ki(R+M,h[1][0])),p&&I>0?G=Ni(D+I,h[0][1]):!p&&I<0&&(G=ki(D+H,h[1][1])),V=Math.max(V,z),F=Math.max(F,G)}if(s){if(m){const z=Wu(M/K,_,N)*K;if(V=Math.max(V,z),u){let G=0;!d&&!p||d&&!p&&y?G=Ni(D+X+M/K,u[1][1])*K:G=ki(D+X+(d?ne:-ne)/K,u[0][1])*K,V=Math.max(V,G)}if(h){let G=0;!d&&!p||d&&!p&&y?G=ki(D+M/K,h[1][1])*K:G=Ni(D+(d?ne:-ne)/K,h[0][1])*K,V=Math.max(V,G)}}if(v){const z=Wu(H*K,b,A)/K;if(F=Math.max(F,z),u){let G=0;!d&&!p||p&&!d&&y?G=Ni(R+H*K+W,u[1][0])/K:G=ki(R+(p?I:-I)*K+W,u[0][0])/K,F=Math.max(F,G)}if(h){let G=0;!d&&!p||p&&!d&&y?G=ki(R+H*K,h[1][0])/K:G=Ni(R+(p?I:-I)*K,h[0][0])/K,F=Math.max(F,G)}}}I=I+(I<0?F:-F),ne=ne+(ne<0?V:-V),s&&(y?M>H*K?I=(Yv(d,p)?-ne:ne)/K:ne=(Yv(d,p)?-I:I)*K:m?(I=ne/K,p=d):(ne=I*K,d=p));const j=d?R+ne:R,Y=p?D+I:D;return{width:Z+(d?-ne:ne),height:ue+(p?-I:I),x:l[0]*ne*(d?-1:1)+j,y:l[1]*I*(p?-1:1)+Y}}const jx={width:0,height:0,x:0,y:0},NA={...jx,pointerX:0,pointerY:0,aspectRatio:1};function DA(t){return[[0,0],[t.measured.width,t.measured.height]]}function IA(t,n,r){const o=n.position.x+t.position.x,s=n.position.y+t.position.y,l=t.measured.width??0,u=t.measured.height??0,h=r[0]*l,d=r[1]*u;return[[o-h,s-d],[o+l-h,s+u-d]]}function MA({domNode:t,nodeId:n,getStoreItems:r,onChange:o,onEnd:s}){const l=Yn(t);function u({controlPosition:d,boundaries:p,keepAspectRatio:m,onResizeStart:v,onResize:y,onResizeEnd:x,shouldResize:C}){let b={...jx},A={...NA};const _=OA(d);let N,R=null,D=[],Z,ue,K;const ne=Yw().on("start",I=>{const{nodeLookup:M,transform:H,snapGrid:W,snapToGrid:X,nodeOrigin:V,paneDomNode:F}=r();if(N=M.get(n),!N)return;R=(F==null?void 0:F.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:Y}=Yl(I.sourceEvent,{transform:H,snapGrid:W,snapToGrid:X,containerBounds:R});b={width:N.measured.width??0,height:N.measured.height??0,x:N.position.x??0,y:N.position.y??0},A={...b,pointerX:j,pointerY:Y,aspectRatio:b.width/b.height},Z=void 0,N.parentId&&(N.extent==="parent"||N.expandParent)&&(Z=M.get(N.parentId),ue=Z&&N.extent==="parent"?DA(Z):void 0),D=[],K=void 0;for(const[z,G]of M)if(G.parentId===n&&(D.push({id:z,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const J=IA(G,N,G.origin??V);K?K=[[Math.min(J[0][0],K[0][0]),Math.min(J[0][1],K[0][1])],[Math.max(J[1][0],K[1][0]),Math.max(J[1][1],K[1][1])]]:K=J}v==null||v(I,{...b})}).on("drag",I=>{const{transform:M,snapGrid:H,snapToGrid:W,nodeOrigin:X}=r(),V=Yl(I.sourceEvent,{transform:M,snapGrid:H,snapToGrid:W,containerBounds:R}),F=[];if(!N)return;const{x:j,y:Y,width:z,height:G}=b,J={},q=N.origin??X,{width:se,height:Ee,x:be,y:Ae}=kA(A,_,V,p,m,q,ue,K),Ne=se!==z,$e=Ee!==G,Te=be!==j&&Ne,Ce=Ae!==Y&&$e;if(!Te&&!Ce&&!Ne&&!$e)return;if((Te||Ce||q[0]===1||q[1]===1)&&(J.x=Te?be:b.x,J.y=Ce?Ae:b.y,b.x=J.x,b.y=J.y,D.length>0)){const st=be-j,mt=Ae-Y;for(const xt of D)xt.position={x:xt.position.x-st+q[0]*(se-z),y:xt.position.y-mt+q[1]*(Ee-G)},F.push(xt)}if((Ne||$e)&&(J.width=Ne?se:b.width,J.height=$e?Ee:b.height,b.width=J.width,b.height=J.height),Z&&N.expandParent){const st=q[0]*(J.width??0);J.x&&J.x{x==null||x(I,{...b}),s==null||s()});l.call(ne)}function h(){l.on(".drag",null)}return{update:u,destroy:h}}var Gf={exports:{}},Kf={},Yf={exports:{}},Xf={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Xv;function LA(){if(Xv)return Xf;Xv=1;var t=vc();function n(v,y){return v===y&&(v!==0||1/v===1/y)||v!==v&&y!==y}var r=typeof Object.is=="function"?Object.is:n,o=t.useState,s=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue;function h(v,y){var x=y(),C=o({inst:{value:x,getSnapshot:y}}),b=C[0].inst,A=C[1];return l(function(){b.value=x,b.getSnapshot=y,d(b)&&A({inst:b})},[v,x,y]),s(function(){return d(b)&&A({inst:b}),v(function(){d(b)&&A({inst:b})})},[v]),u(x),x}function d(v){var y=v.getSnapshot;v=v.value;try{var x=y();return!r(v,x)}catch{return!0}}function p(v,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:h;return Xf.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:m,Xf}var Qv;function FA(){return Qv||(Qv=1,Yf.exports=LA()),Yf.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Jv;function jA(){if(Jv)return Kf;Jv=1;var t=vc(),n=FA();function r(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var o=typeof Object.is=="function"?Object.is:r,s=n.useSyncExternalStore,l=t.useRef,u=t.useEffect,h=t.useMemo,d=t.useDebugValue;return Kf.useSyncExternalStoreWithSelector=function(p,m,v,y,x){var C=l(null);if(C.current===null){var b={hasValue:!1,value:null};C.current=b}else b=C.current;C=h(function(){function _(ue){if(!N){if(N=!0,R=ue,ue=y(ue),x!==void 0&&b.hasValue){var K=b.value;if(x(K,ue))return D=K}return D=ue}if(K=D,o(R,ue))return K;var ne=y(ue);return x!==void 0&&x(K,ne)?(R=ue,K):(R=ue,D=ne)}var N=!1,R,D,Z=v===void 0?null:v;return[function(){return _(m())},Z===null?void 0:function(){return _(Z())}]},[m,v,y,x]);var A=s(p,C[0],C[1]);return u(function(){b.hasValue=!0,b.value=A},[A]),d(A),A},Kf}var Zv;function BA(){return Zv||(Zv=1,Gf.exports=jA()),Gf.exports}var $A=BA();const VA=yc($A),zA={},e0=t=>{let n;const r=new Set,o=(m,v)=>{const y=typeof m=="function"?m(n):m;if(!Object.is(y,n)){const x=n;n=v??(typeof y!="object"||y===null)?y:Object.assign({},n,y),r.forEach(C=>C(n,x))}},s=()=>n,d={setState:o,getState:s,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(zA?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},p=n=t(o,s,d);return d},HA=t=>t?e0(t):e0,{useDebugValue:UA}=en,{useSyncExternalStoreWithSelector:WA}=VA,qA=t=>t;function Bx(t,n=qA,r){const o=WA(t.subscribe,t.getState,t.getServerState||t.getInitialState,n,r);return UA(o),o}const t0=(t,n)=>{const r=HA(t),o=(s,l=n)=>Bx(r,s,l);return Object.assign(o,r),o},GA=(t,n)=>t?t0(t,n):t0;function Ft(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[o,s]of t)if(!Object.is(s,n.get(o)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const o of t)if(!n.has(o))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(n).length)return!1;for(const o of r)if(!Object.prototype.hasOwnProperty.call(n,o)||!Object.is(t[o],n[o]))return!1;return!0}var KA=Iw();const Kh=$.createContext(null),YA=Kh.Provider,$x=wo.error001();function ft(t,n){const r=$.useContext(Kh);if(r===null)throw new Error($x);return Bx(r,t,n)}function At(){const t=$.useContext(Kh);if(t===null)throw new Error($x);return $.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const n0={display:"none"},XA={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Vx="react-flow__node-desc",zx="react-flow__edge-desc",QA="react-flow__aria-live",JA=t=>t.ariaLiveMessage;function ZA({rfId:t}){const n=ft(JA);return O.jsx("div",{id:`${QA}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:XA,children:n})}function eT({rfId:t,disableKeyboardA11y:n}){return O.jsxs(O.Fragment,{children:[O.jsxs("div",{id:`${Vx}-${t}`,style:n0,children:["Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),O.jsx("div",{id:`${zx}-${t}`,style:n0,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!n&&O.jsx(ZA,{rfId:t})]})}const tT=t=>t.userSelectionActive?"none":"all",Ag=$.forwardRef(({position:t="top-left",children:n,className:r,style:o,...s},l)=>{const u=ft(tT),h=`${t}`.split("-");return O.jsx("div",{className:zt(["react-flow__panel",r,...h]),style:{...o,pointerEvents:u},ref:l,...s,children:n})});function nT({proOptions:t,position:n="bottom-right"}){return t!=null&&t.hideAttribution?null:O.jsx(Ag,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:O.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const rT=t=>{const n=[],r=[];for(const[,o]of t.nodeLookup)o.selected&&n.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&r.push(o);return{selectedNodes:n,selectedEdges:r}},qu=t=>t.id;function oT(t,n){return Ft(t.selectedNodes.map(qu),n.selectedNodes.map(qu))&&Ft(t.selectedEdges.map(qu),n.selectedEdges.map(qu))}function iT({onSelectionChange:t}){const n=At(),{selectedNodes:r,selectedEdges:o}=ft(rT,oT);return $.useEffect(()=>{const s={nodes:r,edges:o};t==null||t(s),n.getState().onSelectionChangeHandlers.forEach(l=>l(s))},[r,o,t]),null}const sT=t=>!!t.onSelectionChangeHandlers;function aT({onSelectionChange:t}){const n=ft(sT);return t||n?O.jsx(iT,{onSelectionChange:t}):null}const Hx=[0,0],lT={x:0,y:0,zoom:1},cT=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance"],r0=[...cT,"rfId"],uT=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setPaneClickDistance:t.setPaneClickDistance}),o0={translateExtent:oc,nodeOrigin:Hx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function hT(t){const{setNodes:n,setEdges:r,setMinZoom:o,setMaxZoom:s,setTranslateExtent:l,setNodeExtent:u,reset:h,setDefaultNodesAndEdges:d,setPaneClickDistance:p}=ft(uT,Ft),m=At();$.useEffect(()=>(d(t.defaultNodes,t.defaultEdges),()=>{v.current=o0,h()}),[]);const v=$.useRef(o0);return $.useEffect(()=>{for(const y of r0){const x=t[y],C=v.current[y];x!==C&&(typeof t[y]>"u"||(y==="nodes"?n(x):y==="edges"?r(x):y==="minZoom"?o(x):y==="maxZoom"?s(x):y==="translateExtent"?l(x):y==="nodeExtent"?u(x):y==="paneClickDistance"?p(x):y==="fitView"?m.setState({fitViewOnInit:x}):y==="fitViewOptions"?m.setState({fitViewOnInitOptions:x}):m.setState({[y]:x})))}v.current=t},r0.map(y=>t[y])),null}function i0(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dT(t){var o;const[n,r]=$.useState(t==="system"?null:t);return $.useEffect(()=>{if(t!=="system"){r(t);return}const s=i0(),l=()=>r(s!=null&&s.matches?"dark":"light");return l(),s==null||s.addEventListener("change",l),()=>{s==null||s.removeEventListener("change",l)}},[t]),n!==null?n:(o=i0())!=null&&o.matches?"dark":"light"}const s0=typeof document<"u"?document:null;function lc(t=null,n={target:s0,actInsideInputWithModifier:!0}){const[r,o]=$.useState(!1),s=$.useRef(!1),l=$.useRef(new Set([])),[u,h]=$.useMemo(()=>{if(t!==null){const p=(Array.isArray(t)?t:[t]).filter(v=>typeof v=="string").map(v=>v.replace("+",` -`).replace(` - -`,` -+`).split(` -`)),m=p.reduce((v,y)=>v.concat(...y),[]);return[p,m]}return[[],[]]},[t]);return $.useEffect(()=>{const d=(n==null?void 0:n.target)||s0;if(t!==null){const p=y=>{if(s.current=y.ctrlKey||y.metaKey||y.shiftKey,(!s.current||s.current&&!n.actInsideInputWithModifier)&&jp(y))return!1;const C=l0(y.code,h);l.current.add(y[C]),a0(u,l.current,!1)&&(y.preventDefault(),o(!0))},m=y=>{if((!s.current||s.current&&!n.actInsideInputWithModifier)&&jp(y))return!1;const C=l0(y.code,h);a0(u,l.current,!0)?(o(!1),l.current.clear()):l.current.delete(y[C]),y.key==="Meta"&&l.current.clear(),s.current=!1},v=()=>{l.current.clear(),o(!1)};return d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",m),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",m),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[t,o]),r}function a0(t,n,r){return t.filter(o=>r||o.length===n.size).some(o=>o.every(s=>n.has(s)))}function l0(t,n){return n.includes(t)?"code":"key"}const fT=()=>{const t=At();return $.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=t.getState();return r?r.scaleBy(1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=t.getState();return r?r.scaleBy(1/1.2,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:o}=t.getState();return o?o.scaleTo(n,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(n,r)=>{const{transform:[o,s,l],panZoom:u}=t.getState();return u?(await u.setViewport({x:n.x??o,y:n.y??s,zoom:n.zoom??l},{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,o]=t.getState().transform;return{x:n,y:r,zoom:o}},fitView:n=>{const{nodeLookup:r,minZoom:o,maxZoom:s,panZoom:l,domNode:u}=t.getState();if(!l||!u)return Promise.resolve(!1);const h=Mp(r,n),{width:d,height:p}=qh(u);return Lp({nodes:h,width:d,height:p,minZoom:o,maxZoom:s,panZoom:l},n)},setCenter:async(n,r,o)=>{const{width:s,height:l,maxZoom:u,panZoom:h}=t.getState(),d=typeof(o==null?void 0:o.zoom)<"u"?o.zoom:u,p=s/2-n*d,m=l/2-r*d;return h?(await h.setViewport({x:p,y:m,zoom:d},{duration:o==null?void 0:o.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(n,r)=>{const{width:o,height:s,minZoom:l,maxZoom:u,panZoom:h}=t.getState(),d=bg(n,o,s,l,u,(r==null?void 0:r.padding)??.1);return h?(await h.setViewport(d,{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={snapToGrid:!0})=>{const{transform:o,snapGrid:s,domNode:l}=t.getState();if(!l)return n;const{x:u,y:h}=l.getBoundingClientRect(),d={x:n.x-u,y:n.y-h};return Cc(d,o,r.snapToGrid,s)},flowToScreenPosition:n=>{const{transform:r,domNode:o}=t.getState();if(!o)return n;const{x:s,y:l}=o.getBoundingClientRect(),u=xx(n,r);return{x:u.x+s,y:u.y+l}}}),[])};function Ux(t,n){const r=[],o=new Map,s=[];for(const l of t)if(l.type==="add"){s.push(l);continue}else if(l.type==="remove"||l.type==="replace")o.set(l.id,[l]);else{const u=o.get(l.id);u?u.push(l):o.set(l.id,[l])}for(const l of n){const u=o.get(l.id);if(!u){r.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){r.push({...u[0].item});continue}const h={...l};for(const d of u)pT(d,h);r.push(h)}return s.length&&s.forEach(l=>{l.index!==void 0?r.splice(l.index,0,{...l.item}):r.push({...l.item})}),r}function pT(t,n){switch(t.type){case"select":{n.selected=t.selected;break}case"position":{typeof t.position<"u"&&(n.position=t.position),typeof t.dragging<"u"&&(n.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(n.measured??(n.measured={}),n.measured.width=t.dimensions.width,n.measured.height=t.dimensions.height,t.setAttributes&&(n.width=t.dimensions.width,n.height=t.dimensions.height)),typeof t.resizing=="boolean"&&(n.resizing=t.resizing);break}}}function Wx(t,n){return Ux(t,n)}function qx(t,n){return Ux(t,n)}function ks(t,n){return{id:t,type:"select",selected:n}}function ja(t,n=new Set,r=!1){const o=[];for(const[s,l]of t){const u=n.has(s);!(l.selected===void 0&&!u)&&l.selected!==u&&(r&&(l.selected=u),o.push(ks(l.id,u)))}return o}function c0({items:t=[],lookup:n}){var s;const r=[],o=new Map(t.map(l=>[l.id,l]));for(const[l,u]of t.entries()){const h=n.get(u.id),d=((s=h==null?void 0:h.internals)==null?void 0:s.userNode)??h;d!==void 0&&d!==u&&r.push({id:u.id,item:u,type:"replace"}),d===void 0&&r.push({item:u,type:"add",index:l})}for(const[l]of n)o.get(l)===void 0&&r.push({id:l,type:"remove"});return r}function u0(t){return{id:t.id,type:"remove"}}const h0=t=>W_(t),gT=t=>px(t);function Gx(t){return $.forwardRef(t)}const mT=typeof window<"u"?$.useLayoutEffect:$.useEffect;function d0(t){const[n,r]=$.useState(BigInt(0)),[o]=$.useState(()=>yT(()=>r(s=>s+BigInt(1))));return mT(()=>{const s=o.get();s.length&&(t(s),o.reset())},[n]),o}function yT(t){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),t()}}}const Kx=$.createContext(null);function vT({children:t}){const n=At(),r=$.useCallback(h=>{const{nodes:d=[],setNodes:p,hasDefaultNodes:m,onNodesChange:v,nodeLookup:y}=n.getState();let x=d;for(const C of h)x=typeof C=="function"?C(x):C;m?p(x):v&&v(c0({items:x,lookup:y}))},[]),o=d0(r),s=$.useCallback(h=>{const{edges:d=[],setEdges:p,hasDefaultEdges:m,onEdgesChange:v,edgeLookup:y}=n.getState();let x=d;for(const C of h)x=typeof C=="function"?C(x):C;m?p(x):v&&v(c0({items:x,lookup:y}))},[]),l=d0(s),u=$.useMemo(()=>({nodeQueue:o,edgeQueue:l}),[]);return O.jsx(Kx.Provider,{value:u,children:t})}function wT(){const t=$.useContext(Kx);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const xT=t=>!!t.panZoom;function Yh(){const t=fT(),n=At(),r=wT(),o=ft(xT),s=$.useMemo(()=>{const l=v=>n.getState().nodeLookup.get(v),u=v=>{r.nodeQueue.push(v)},h=v=>{r.edgeQueue.push(v)},d=v=>{var _,N;const{nodeLookup:y,nodeOrigin:x}=n.getState(),C=h0(v)?v:y.get(v.id),b=C.parentId?bx(C.position,C.measured,C.parentId,y,x):C.position,A={...C,position:b,width:((_=C.measured)==null?void 0:_.width)??C.width,height:((N=C.measured)==null?void 0:N.height)??C.height};return qa(A)},p=(v,y,x={replace:!1})=>{u(C=>C.map(b=>{if(b.id===v){const A=typeof y=="function"?y(b):y;return x.replace&&h0(A)?A:{...b,...A}}return b}))},m=(v,y,x={replace:!1})=>{h(C=>C.map(b=>{if(b.id===v){const A=typeof y=="function"?y(b):y;return x.replace&&gT(A)?A:{...b,...A}}return b}))};return{getNodes:()=>n.getState().nodes.map(v=>({...v})),getNode:v=>{var y;return(y=l(v))==null?void 0:y.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:v=[]}=n.getState();return v.map(y=>({...y}))},getEdge:v=>n.getState().edgeLookup.get(v),setNodes:u,setEdges:h,addNodes:v=>{const y=Array.isArray(v)?v:[v];r.nodeQueue.push(x=>[...x,...y])},addEdges:v=>{const y=Array.isArray(v)?v:[v];r.edgeQueue.push(x=>[...x,...y])},toObject:()=>{const{nodes:v=[],edges:y=[],transform:x}=n.getState(),[C,b,A]=x;return{nodes:v.map(_=>({..._})),edges:y.map(_=>({..._})),viewport:{x:C,y:b,zoom:A}}},deleteElements:async({nodes:v=[],edges:y=[]})=>{const{nodes:x,edges:C,onNodesDelete:b,onEdgesDelete:A,triggerNodeChanges:_,triggerEdgeChanges:N,onDelete:R,onBeforeDelete:D}=n.getState(),{nodes:Z,edges:ue}=await Y_({nodesToRemove:v,edgesToRemove:y,nodes:x,edges:C,onBeforeDelete:D}),K=ue.length>0,ne=Z.length>0;if(K){const I=ue.map(u0);A==null||A(ue),N(I)}if(ne){const I=Z.map(u0);b==null||b(Z),_(I)}return(ne||K)&&(R==null||R({nodes:Z,edges:ue})),{deletedNodes:Z,deletedEdges:ue}},getIntersectingNodes:(v,y=!0,x)=>{const C=jv(v),b=C?v:d(v),A=x!==void 0;return b?(x||n.getState().nodes).filter(_=>{const N=n.getState().nodeLookup.get(_.id);if(N&&!C&&(_.id===v.id||!N.internals.positionAbsolute))return!1;const R=qa(A?_:N),D=sc(R,b);return y&&D>0||D>=b.width*b.height}):[]},isNodeIntersecting:(v,y,x=!0)=>{const b=jv(v)?v:d(v);if(!b)return!1;const A=sc(b,y);return x&&A>0||A>=b.width*b.height},updateNode:p,updateNodeData:(v,y,x={replace:!1})=>{p(v,C=>{const b=typeof y=="function"?y(C):y;return x.replace?{...C,data:b}:{...C,data:{...C.data,...b}}},x)},updateEdge:m,updateEdgeData:(v,y,x={replace:!1})=>{m(v,C=>{const b=typeof y=="function"?y(C):y;return x.replace?{...C,data:b}:{...C,data:{...C.data,...b}}},x)},getNodesBounds:v=>{const{nodeLookup:y,nodeOrigin:x}=n.getState();return G_(v,{nodeLookup:y,nodeOrigin:x})},getHandleConnections:({type:v,id:y,nodeId:x})=>{var C;return Array.from(((C=n.getState().connectionLookup.get(`${x}-${v}${y?`-${y}`:""}`))==null?void 0:C.values())??[])},getNodeConnections:({type:v,handleId:y,nodeId:x})=>{var C;return Array.from(((C=n.getState().connectionLookup.get(`${x}${v?y?`-${v}-${y}`:`-${v}`:""}`))==null?void 0:C.values())??[])}}},[]);return $.useMemo(()=>({...s,...t,viewportInitialized:o}),[o])}const f0=t=>t.selected,ST={actInsideInputWithModifier:!1},bT=typeof window<"u"?window:void 0;function CT({deleteKeyCode:t,multiSelectionKeyCode:n}){const r=At(),{deleteElements:o}=Yh(),s=lc(t,ST),l=lc(n,{target:bT});$.useEffect(()=>{if(s){const{edges:u,nodes:h}=r.getState();o({nodes:h.filter(f0),edges:u.filter(f0)}),r.setState({nodesSelectionActive:!1})}},[s]),$.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])}function ET(t){const n=At();$.useEffect(()=>{const r=()=>{var s,l;if(!t.current)return!1;const o=qh(t.current);(o.height===0||o.width===0)&&((l=(s=n.getState()).onError)==null||l.call(s,"004",wo.error004())),n.setState({width:o.width||500,height:o.height||500})};if(t.current){r(),window.addEventListener("resize",r);const o=new ResizeObserver(()=>r());return o.observe(t.current),()=>{window.removeEventListener("resize",r),o&&t.current&&o.unobserve(t.current)}}},[])}const Xh={position:"absolute",width:"100%",height:"100%",top:0,left:0},PT=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib});function _T({onPaneContextMenu:t,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=js.Free,zoomOnDoubleClick:u=!0,panOnDrag:h=!0,defaultViewport:d,translateExtent:p,minZoom:m,maxZoom:v,zoomActivationKeyCode:y,preventScrolling:x=!0,children:C,noWheelClassName:b,noPanClassName:A,onViewportChange:_,isControlledViewport:N,paneClickDistance:R}){const D=At(),Z=$.useRef(null),{userSelectionActive:ue,lib:K}=ft(PT,Ft),ne=lc(y),I=$.useRef();ET(Z);const M=$.useCallback(H=>{_==null||_({x:H[0],y:H[1],zoom:H[2]}),N||D.setState({transform:H})},[_,N]);return $.useEffect(()=>{if(Z.current){I.current=TA({domNode:Z.current,minZoom:m,maxZoom:v,translateExtent:p,viewport:d,paneClickDistance:R,onDraggingChange:V=>D.setState({paneDragging:V}),onPanZoomStart:(V,F)=>{const{onViewportChangeStart:j,onMoveStart:Y}=D.getState();Y==null||Y(V,F),j==null||j(F)},onPanZoom:(V,F)=>{const{onViewportChange:j,onMove:Y}=D.getState();Y==null||Y(V,F),j==null||j(F)},onPanZoomEnd:(V,F)=>{const{onViewportChangeEnd:j,onMoveEnd:Y}=D.getState();Y==null||Y(V,F),j==null||j(F)}});const{x:H,y:W,zoom:X}=I.current.getViewport();return D.setState({panZoom:I.current,transform:[H,W,X],domNode:Z.current.closest(".react-flow")}),()=>{var V;(V=I.current)==null||V.destroy()}}},[]),$.useEffect(()=>{var H;(H=I.current)==null||H.update({onPaneContextMenu:t,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:o,panOnScrollSpeed:s,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:h,zoomActivationKeyPressed:ne,preventScrolling:x,noPanClassName:A,userSelectionActive:ue,noWheelClassName:b,lib:K,onTransformChange:M})},[t,n,r,o,s,l,u,h,ne,x,A,ue,b,K,M]),O.jsx("div",{className:"react-flow__renderer",ref:Z,style:Xh,children:C})}const AT=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function TT(){const{userSelectionActive:t,userSelectionRect:n}=ft(AT,Ft);return t&&n?O.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Qf=(t,n)=>r=>{r.target===n.current&&(t==null||t(r))},RT=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging});function OT({isSelecting:t,selectionKeyPressed:n,selectionMode:r=ic.Full,panOnDrag:o,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:h,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:v,onPaneMouseLeave:y,children:x}){const C=At(),{userSelectionActive:b,elementsSelectable:A,dragging:_}=ft(RT,Ft),N=A&&(t||b),R=$.useRef(null),D=$.useRef(),Z=$.useRef(new Set),ue=$.useRef(new Set),K=$.useRef(!1),ne=$.useRef(!1),I=j=>{if(K.current){K.current=!1;return}h==null||h(j),C.getState().resetSelectedElements(),C.setState({nodesSelectionActive:!1})},M=j=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){j.preventDefault();return}d==null||d(j)},H=p?j=>p(j):void 0,W=j=>{var q,se;const{resetSelectedElements:Y,domNode:z}=C.getState();if(D.current=z==null?void 0:z.getBoundingClientRect(),!A||!t||j.button!==0||j.target!==R.current||!D.current)return;(se=(q=j.target)==null?void 0:q.setPointerCapture)==null||se.call(q,j.pointerId),ne.current=!0,K.current=!1;const{x:G,y:J}=Xo(j.nativeEvent,D.current);Y(),C.setState({userSelectionRect:{width:0,height:0,startX:G,startY:J,x:G,y:J}}),l==null||l(j)},X=j=>{const{userSelectionRect:Y,transform:z,nodeLookup:G,edgeLookup:J,connectionLookup:q,triggerNodeChanges:se,triggerEdgeChanges:Ee,defaultEdgeOptions:be}=C.getState();if(!D.current||!Y)return;K.current=!0;const{x:Ae,y:Ne}=Xo(j.nativeEvent,D.current),{startX:$e,startY:Te}=Y,Ce={startX:$e,startY:Te,x:Ae<$e?Ae:$e,y:Nest.id)),ue.current=new Set;const Fe=(be==null?void 0:be.selectable)??!0;for(const st of Z.current){const mt=q.get(st);if(mt)for(const{edgeId:xt}of mt.values()){const tn=J.get(xt);tn&&(tn.selectable??Fe)&&ue.current.add(xt)}}if(!Bv(Je,Z.current)){const st=ja(G,Z.current,!0);se(st)}if(!Bv(nt,ue.current)){const st=ja(J,ue.current);Ee(st)}C.setState({userSelectionRect:Ce,userSelectionActive:!0,nodesSelectionActive:!1})},V=j=>{var z,G;if(j.button!==0||!ne.current)return;(G=(z=j.target)==null?void 0:z.releasePointerCapture)==null||G.call(z,j.pointerId);const{userSelectionRect:Y}=C.getState();!b&&Y&&j.target===R.current&&(I==null||I(j)),C.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:Z.current.size>0}),u==null||u(j),(n||s)&&(K.current=!1),ne.current=!1},F=o===!0||Array.isArray(o)&&o.includes(0);return O.jsxs("div",{className:zt(["react-flow__pane",{draggable:F,dragging:_,selection:t}]),onClick:N?void 0:Qf(I,R),onContextMenu:Qf(M,R),onWheel:Qf(H,R),onPointerEnter:N?void 0:m,onPointerDown:N?W:v,onPointerMove:N?X:v,onPointerUp:N?V:void 0,onPointerLeave:y,ref:R,style:Xh,children:[x,O.jsx(TT,{})]})}function Up({id:t,store:n,unselect:r=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:h,onError:d}=n.getState(),p=h.get(t);if(!p){d==null||d("012",wo.error012(t));return}n.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&u)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var m;return(m=o==null?void 0:o.current)==null?void 0:m.blur()})):s([t])}function Yx({nodeRef:t,disabled:n=!1,noDragClassName:r,handleSelector:o,nodeId:s,isSelectable:l,nodeClickDistance:u}){const h=At(),[d,p]=$.useState(!1),m=$.useRef();return $.useEffect(()=>{m.current=pA({getStoreItems:()=>h.getState(),onNodeMouseDown:v=>{Up({id:v,store:h,nodeRef:t})},onDragStart:()=>{p(!0)},onDragStop:()=>{p(!1)}})},[]),$.useEffect(()=>{var v,y;if(n)(v=m.current)==null||v.destroy();else if(t.current)return(y=m.current)==null||y.update({noDragClassName:r,handleSelector:o,domNode:t.current,isSelectable:l,nodeId:s,nodeClickDistance:u}),()=>{var x;(x=m.current)==null||x.destroy()}},[r,o,n,l,t,s]),d}const kT=t=>n=>n.selected&&(n.draggable||t&&typeof n.draggable>"u");function Xx(){const t=At();return $.useCallback(r=>{const{nodeExtent:o,snapToGrid:s,snapGrid:l,nodesDraggable:u,onError:h,updateNodePositions:d,nodeLookup:p,nodeOrigin:m}=t.getState(),v=new Map,y=kT(u),x=s?l[0]:5,C=s?l[1]:5,b=r.direction.x*x*r.factor,A=r.direction.y*C*r.factor;for(const[,_]of p){if(!y(_))continue;let N={x:_.internals.positionAbsolute.x+b,y:_.internals.positionAbsolute.y+A};s&&(N=Wh(N,l));const{position:R,positionAbsolute:D}=mx({nodeId:_.id,nextPosition:N,nodeLookup:p,nodeExtent:o,nodeOrigin:m,onError:h});_.position=R,_.internals.positionAbsolute=D,v.set(_.id,_)}d(v)},[])}const Tg=$.createContext(null),NT=Tg.Provider;Tg.Consumer;const Qh=()=>$.useContext(Tg),DT=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),IT=(t,n,r)=>o=>{const{connectionClickStartHandle:s,connectionMode:l,connection:u}=o,{fromHandle:h,toHandle:d,isValid:p}=u,m=(d==null?void 0:d.nodeId)===t&&(d==null?void 0:d.id)===n&&(d==null?void 0:d.type)===r;return{connectingFrom:(h==null?void 0:h.nodeId)===t&&(h==null?void 0:h.id)===n&&(h==null?void 0:h.type)===r,connectingTo:m,clickConnecting:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.id)===n&&(s==null?void 0:s.type)===r,isPossibleEndHandle:l===Ua.Strict?(h==null?void 0:h.type)!==r:t!==(h==null?void 0:h.nodeId)||n!==(h==null?void 0:h.id),connectionInProcess:!!h,valid:m&&p}};function MT({type:t="source",position:n=Ye.Top,isValidConnection:r,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:l=!0,id:u,onConnect:h,children:d,className:p,onMouseDown:m,onTouchStart:v,...y},x){var V,F;const C=u||null,b=t==="target",A=At(),_=Qh(),{connectOnClick:N,noPanClassName:R,rfId:D}=ft(DT,Ft),{connectingFrom:Z,connectingTo:ue,clickConnecting:K,isPossibleEndHandle:ne,connectionInProcess:I,valid:M}=ft(IT(_,C,t),Ft);_||(F=(V=A.getState()).onError)==null||F.call(V,"010",wo.error010());const H=j=>{const{defaultEdgeOptions:Y,onConnect:z,hasDefaultEdges:G}=A.getState(),J={...Y,...j};if(G){const{edges:q,setEdges:se}=A.getState();se(Bp(J,q))}z==null||z(J),h==null||h(J)},W=j=>{if(!_)return;const Y=Ex(j.nativeEvent);if(s&&(Y&&j.button===0||!Y)){const z=A.getState();Hp.onPointerDown(j.nativeEvent,{autoPanOnConnect:z.autoPanOnConnect,connectionMode:z.connectionMode,connectionRadius:z.connectionRadius,domNode:z.domNode,nodeLookup:z.nodeLookup,lib:z.lib,isTarget:b,handleId:C,nodeId:_,flowId:z.rfId,panBy:z.panBy,cancelConnection:z.cancelConnection,onConnectStart:z.onConnectStart,onConnectEnd:z.onConnectEnd,updateConnection:z.updateConnection,onConnect:H,isValidConnection:r||z.isValidConnection,getTransform:()=>A.getState().transform,getFromHandle:()=>A.getState().connection.fromHandle,autoPanSpeed:z.autoPanSpeed})}Y?m==null||m(j):v==null||v(j)},X=j=>{const{onClickConnectStart:Y,onClickConnectEnd:z,connectionClickStartHandle:G,connectionMode:J,isValidConnection:q,lib:se,rfId:Ee,nodeLookup:be,connection:Ae}=A.getState();if(!_||!G&&!s)return;if(!G){Y==null||Y(j.nativeEvent,{nodeId:_,handleId:C,handleType:t}),A.setState({connectionClickStartHandle:{nodeId:_,type:t,id:C}});return}const Ne=Cx(j.target),$e=r||q,{connection:Te,isValid:Ce}=Hp.isValid(j.nativeEvent,{handle:{nodeId:_,id:C,type:t},connectionMode:J,fromNodeId:G.nodeId,fromHandleId:G.id||null,fromType:G.type,isValidConnection:$e,flowId:Ee,doc:Ne,lib:se,nodeLookup:be});Ce&&Te&&H(Te);const Je=structuredClone(Ae);delete Je.inProgress,Je.toPosition=Je.toHandle?Je.toHandle.position:null,z==null||z(j,Je),A.setState({connectionClickStartHandle:null})};return O.jsx("div",{"data-handleid":C,"data-nodeid":_,"data-handlepos":n,"data-id":`${D}-${_}-${C}-${t}`,className:zt(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",R,p,{source:!b,target:b,connectable:o,connectablestart:s,connectableend:l,clickconnecting:K,connectingfrom:Z,connectingto:ue,valid:M,connectionindicator:o&&(!I||ne)&&(I?l:s)}]),onMouseDown:W,onTouchStart:W,onClick:N?X:void 0,ref:x,...y,children:d})}const cc=$.memo(Gx(MT));function LT({data:t,isConnectable:n,sourcePosition:r=Ye.Bottom}){return O.jsxs(O.Fragment,{children:[t==null?void 0:t.label,O.jsx(cc,{type:"source",position:r,isConnectable:n})]})}function FT({data:t,isConnectable:n,targetPosition:r=Ye.Top,sourcePosition:o=Ye.Bottom}){return O.jsxs(O.Fragment,{children:[O.jsx(cc,{type:"target",position:r,isConnectable:n}),t==null?void 0:t.label,O.jsx(cc,{type:"source",position:o,isConnectable:n})]})}function jT(){return null}function BT({data:t,isConnectable:n,targetPosition:r=Ye.Top}){return O.jsxs(O.Fragment,{children:[O.jsx(cc,{type:"target",position:r,isConnectable:n}),t==null?void 0:t.label]})}const Th={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},p0={input:LT,default:FT,output:BT,group:jT};function $T(t){var n,r,o,s;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((n=t.style)==null?void 0:n.width),height:t.height??t.initialHeight??((r=t.style)==null?void 0:r.height)}:{width:t.width??((o=t.style)==null?void 0:o.width),height:t.height??((s=t.style)==null?void 0:s.height)}}const VT=t=>{const{width:n,height:r,x:o,y:s}=bc(t.nodeLookup,{filter:l=>!!l.selected});return{width:Wr(n)?n:null,height:Wr(r)?r:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${o}px,${s}px)`}};function zT({onSelectionContextMenu:t,noPanClassName:n,disableKeyboardA11y:r}){const o=At(),{width:s,height:l,transformString:u,userSelectionActive:h}=ft(VT,Ft),d=Xx(),p=$.useRef(null);if($.useEffect(()=>{var y;r||(y=p.current)==null||y.focus({preventScroll:!0})},[r]),Yx({nodeRef:p}),h||!s||!l)return null;const m=t?y=>{const x=o.getState().nodes.filter(C=>C.selected);t(y,x)}:void 0,v=y=>{Object.prototype.hasOwnProperty.call(Th,y.key)&&(y.preventDefault(),d({direction:Th[y.key],factor:y.shiftKey?4:1}))};return O.jsx("div",{className:zt(["react-flow__nodesselection","react-flow__container",n]),style:{transform:u},children:O.jsx("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:r?void 0:-1,onKeyDown:r?void 0:v,style:{width:s,height:l}})})}const g0=typeof window<"u"?window:void 0,HT=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function Qx({children:t,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:h,deleteKeyCode:d,selectionKeyCode:p,selectionOnDrag:m,selectionMode:v,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:C,panActivationKeyCode:b,zoomActivationKeyCode:A,elementsSelectable:_,zoomOnScroll:N,zoomOnPinch:R,panOnScroll:D,panOnScrollSpeed:Z,panOnScrollMode:ue,zoomOnDoubleClick:K,panOnDrag:ne,defaultViewport:I,translateExtent:M,minZoom:H,maxZoom:W,preventScrolling:X,onSelectionContextMenu:V,noWheelClassName:F,noPanClassName:j,disableKeyboardA11y:Y,onViewportChange:z,isControlledViewport:G}){const{nodesSelectionActive:J,userSelectionActive:q}=ft(HT),se=lc(p,{target:g0}),Ee=lc(b,{target:g0}),be=Ee||ne,Ae=Ee||D,Ne=m&&be!==!0,$e=se||q||Ne;return CT({deleteKeyCode:d,multiSelectionKeyCode:C}),O.jsx(_T,{onPaneContextMenu:l,elementsSelectable:_,zoomOnScroll:N,zoomOnPinch:R,panOnScroll:Ae,panOnScrollSpeed:Z,panOnScrollMode:ue,zoomOnDoubleClick:K,panOnDrag:!se&&be,defaultViewport:I,translateExtent:M,minZoom:H,maxZoom:W,zoomActivationKeyCode:A,preventScrolling:X,noWheelClassName:F,noPanClassName:j,onViewportChange:z,isControlledViewport:G,paneClickDistance:h,children:O.jsxs(OT,{onSelectionStart:y,onSelectionEnd:x,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:be,isSelecting:!!$e,selectionMode:v,selectionKeyPressed:se,selectionOnDrag:Ne,children:[t,J&&O.jsx(zT,{onSelectionContextMenu:V,noPanClassName:j,disableKeyboardA11y:Y})]})})}Qx.displayName="FlowRenderer";const UT=$.memo(Qx),WT=t=>n=>t?gx(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function qT(t){return ft($.useCallback(WT(t),[t]),Ft)}const GT=t=>t.updateNodeInternals;function KT(){const t=ft(GT),[n]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const o=new Map;r.forEach(s=>{const l=s.target.getAttribute("data-id");o.set(l,{id:l,nodeElement:s.target,force:!0})}),t(o)}));return $.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function YT({node:t,nodeType:n,hasDimensions:r,resizeObserver:o}){const s=At(),l=$.useRef(null),u=$.useRef(null),h=$.useRef(t.sourcePosition),d=$.useRef(t.targetPosition),p=$.useRef(n),m=r&&!!t.internals.handleBounds;return $.useEffect(()=>{l.current&&!t.hidden&&(!m||u.current!==l.current)&&(u.current&&(o==null||o.unobserve(u.current)),o==null||o.observe(l.current),u.current=l.current)},[m,t.hidden]),$.useEffect(()=>()=>{u.current&&(o==null||o.unobserve(u.current),u.current=null)},[]),$.useEffect(()=>{if(l.current){const v=p.current!==n,y=h.current!==t.sourcePosition,x=d.current!==t.targetPosition;(v||y||x)&&(p.current=n,h.current=t.sourcePosition,d.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:l.current,force:!0}]])))}},[t.id,n,t.sourcePosition,t.targetPosition]),l}function XT({id:t,onClick:n,onMouseEnter:r,onMouseMove:o,onMouseLeave:s,onContextMenu:l,onDoubleClick:u,nodesDraggable:h,elementsSelectable:d,nodesConnectable:p,nodesFocusable:m,resizeObserver:v,noDragClassName:y,noPanClassName:x,disableKeyboardA11y:C,rfId:b,nodeTypes:A,nodeExtent:_,nodeClickDistance:N,onError:R}){const{node:D,internals:Z,isParent:ue}=ft(Te=>{const Ce=Te.nodeLookup.get(t),Je=Te.parentLookup.has(t);return{node:Ce,internals:Ce.internals,isParent:Je}},Ft);let K=D.type||"default",ne=(A==null?void 0:A[K])||p0[K];ne===void 0&&(R==null||R("003",wo.error003(K)),K="default",ne=p0.default);const I=!!(D.draggable||h&&typeof D.draggable>"u"),M=!!(D.selectable||d&&typeof D.selectable>"u"),H=!!(D.connectable||p&&typeof D.connectable>"u"),W=!!(D.focusable||m&&typeof D.focusable>"u"),X=At(),V=Sx(D),F=YT({node:D,nodeType:K,hasDimensions:V,resizeObserver:v}),j=Yx({nodeRef:F,disabled:D.hidden||!I,noDragClassName:y,handleSelector:D.dragHandle,nodeId:t,isSelectable:M,nodeClickDistance:N}),Y=Xx();if(D.hidden)return null;const z=ti(D),G=$T(D),J=M||I||n||r||o||s,q=r?Te=>r(Te,{...Z.userNode}):void 0,se=o?Te=>o(Te,{...Z.userNode}):void 0,Ee=s?Te=>s(Te,{...Z.userNode}):void 0,be=l?Te=>l(Te,{...Z.userNode}):void 0,Ae=u?Te=>u(Te,{...Z.userNode}):void 0,Ne=Te=>{const{selectNodesOnDrag:Ce,nodeDragThreshold:Je}=X.getState();M&&(!Ce||!I||Je>0)&&Up({id:t,store:X,nodeRef:F}),n&&n(Te,{...Z.userNode})},$e=Te=>{if(!(jp(Te.nativeEvent)||C))if(hx.includes(Te.key)&&M){const Ce=Te.key==="Escape";Up({id:t,store:X,unselect:Ce,nodeRef:F})}else I&&D.selected&&Object.prototype.hasOwnProperty.call(Th,Te.key)&&(Te.preventDefault(),X.setState({ariaLiveMessage:`Moved selected node ${Te.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~Z.positionAbsolute.x}, y: ${~~Z.positionAbsolute.y}`}),Y({direction:Th[Te.key],factor:Te.shiftKey?4:1}))};return O.jsx("div",{className:zt(["react-flow__node",`react-flow__node-${K}`,{[x]:I},D.className,{selected:D.selected,selectable:M,parent:ue,draggable:I,dragging:j}]),ref:F,style:{zIndex:Z.z,transform:`translate(${Z.positionAbsolute.x}px,${Z.positionAbsolute.y}px)`,pointerEvents:J?"all":"none",visibility:V?"visible":"hidden",...D.style,...G},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:q,onMouseMove:se,onMouseLeave:Ee,onContextMenu:be,onClick:Ne,onDoubleClick:Ae,onKeyDown:W?$e:void 0,tabIndex:W?0:void 0,role:W?"button":void 0,"aria-describedby":C?void 0:`${Vx}-${b}`,"aria-label":D.ariaLabel,children:O.jsx(NT,{value:t,children:O.jsx(ne,{id:t,data:D.data,type:K,positionAbsoluteX:Z.positionAbsolute.x,positionAbsoluteY:Z.positionAbsolute.y,selected:D.selected??!1,selectable:M,draggable:I,deletable:D.deletable??!0,isConnectable:H,sourcePosition:D.sourcePosition,targetPosition:D.targetPosition,dragging:j,dragHandle:D.dragHandle,zIndex:Z.z,parentId:D.parentId,...z})})})}const QT=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Jx(t){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:s,onError:l}=ft(QT,Ft),u=qT(t.onlyRenderVisibleElements),h=KT();return O.jsx("div",{className:"react-flow__nodes",style:Xh,children:u.map(d=>O.jsx(XT,{id:d,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:h,nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:l},d))})}Jx.displayName="NodeRenderer";const JT=$.memo(Jx);function ZT(t){return ft($.useCallback(r=>{if(!t)return r.edges.map(s=>s.id);const o=[];if(r.width&&r.height)for(const s of r.edges){const l=r.nodeLookup.get(s.source),u=r.nodeLookup.get(s.target);l&&u&&Z_({sourceNode:l,targetNode:u,width:r.width,height:r.height,transform:r.transform})&&o.push(s.id)}return o},[t]),Ft)}const eR=({color:t="none",strokeWidth:n=1})=>O.jsx("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),tR=({color:t="none",strokeWidth:n=1})=>O.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),m0={[Ph.Arrow]:eR,[Ph.ArrowClosed]:tR};function nR(t){const n=At();return $.useMemo(()=>{var s,l;return Object.prototype.hasOwnProperty.call(m0,t)?m0[t]:((l=(s=n.getState()).onError)==null||l.call(s,"009",wo.error009(t)),null)},[t])}const rR=({id:t,type:n,color:r,width:o=12.5,height:s=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:h="auto-start-reverse"})=>{const d=nR(n);return d?O.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:h,refX:"0",refY:"0",children:O.jsx(d,{color:r,strokeWidth:u})}):null},Zx=({defaultColor:t,rfId:n})=>{const r=ft(l=>l.edges),o=ft(l=>l.defaultEdgeOptions),s=$.useMemo(()=>sA(r,{id:n,defaultColor:t,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[r,o,n,t]);return s.length?O.jsx("svg",{className:"react-flow__marker",children:O.jsx("defs",{children:s.map(l=>O.jsx(rR,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};Zx.displayName="MarkerDefinitions";var oR=$.memo(Zx);function eS({x:t,y:n,label:r,labelStyle:o={},labelShowBg:s=!0,labelBgStyle:l={},labelBgPadding:u=[2,4],labelBgBorderRadius:h=2,children:d,className:p,...m}){const[v,y]=$.useState({x:1,y:0,width:0,height:0}),x=zt(["react-flow__edge-textwrapper",p]),C=$.useRef(null);return $.useEffect(()=>{if(C.current){const b=C.current.getBBox();y({x:b.x,y:b.y,width:b.width,height:b.height})}},[r]),typeof r>"u"||!r?null:O.jsxs("g",{transform:`translate(${t-v.width/2} ${n-v.height/2})`,className:x,visibility:v.width?"visible":"hidden",...m,children:[s&&O.jsx("rect",{width:v.width+2*u[0],x:-u[0],y:-u[1],height:v.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:h,ry:h}),O.jsx("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:C,style:o,children:r}),d]})}eS.displayName="EdgeText";const iR=$.memo(eS);function Jh({path:t,labelX:n,labelY:r,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d,interactionWidth:p=20,...m}){return O.jsxs(O.Fragment,{children:[O.jsx("path",{...m,d:t,fill:"none",className:zt(["react-flow__edge-path",m.className])}),p&&O.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),o&&Wr(n)&&Wr(r)?O.jsx(iR,{x:n,y:r,label:o,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:d}):null]})}function y0({pos:t,x1:n,y1:r,x2:o,y2:s}){return t===Ye.Left||t===Ye.Right?[.5*(n+o),r]:[n,.5*(r+s)]}function tS({sourceX:t,sourceY:n,sourcePosition:r=Ye.Bottom,targetX:o,targetY:s,targetPosition:l=Ye.Top}){const[u,h]=y0({pos:r,x1:t,y1:n,x2:o,y2:s}),[d,p]=y0({pos:l,x1:o,y1:s,x2:t,y2:n}),[m,v,y,x]=Px({sourceX:t,sourceY:n,targetX:o,targetY:s,sourceControlX:u,sourceControlY:h,targetControlX:d,targetControlY:p});return[`M${t},${n} C${u},${h} ${d},${p} ${o},${s}`,m,v,y,x]}function nS(t){return $.memo(({id:n,sourceX:r,sourceY:o,targetX:s,targetY:l,sourcePosition:u=Ye.Bottom,targetPosition:h=Ye.Top,label:d,labelStyle:p,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:C,markerEnd:b,markerStart:A,interactionWidth:_})=>{const[N,R,D]=tS({sourceX:r,sourceY:o,sourcePosition:u,targetX:s,targetY:l,targetPosition:h}),Z=t.isInternal?void 0:n;return O.jsx(Jh,{id:Z,path:N,labelX:R,labelY:D,label:d,labelStyle:p,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:C,markerEnd:b,markerStart:A,interactionWidth:_})})}const sR=nS({isInternal:!1}),rS=nS({isInternal:!0});sR.displayName="SimpleBezierEdge";rS.displayName="SimpleBezierEdgeInternal";function oS(t){return $.memo(({id:n,sourceX:r,sourceY:o,targetX:s,targetY:l,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:v,style:y,sourcePosition:x=Ye.Bottom,targetPosition:C=Ye.Top,markerEnd:b,markerStart:A,pathOptions:_,interactionWidth:N})=>{const[R,D,Z]=$p({sourceX:r,sourceY:o,sourcePosition:x,targetX:s,targetY:l,targetPosition:C,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset}),ue=t.isInternal?void 0:n;return O.jsx(Jh,{id:ue,path:R,labelX:D,labelY:Z,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:b,markerStart:A,interactionWidth:N})})}const iS=oS({isInternal:!1}),sS=oS({isInternal:!0});iS.displayName="SmoothStepEdge";sS.displayName="SmoothStepEdgeInternal";function aS(t){return $.memo(({id:n,...r})=>{var s;const o=t.isInternal?void 0:n;return O.jsx(iS,{...r,id:o,pathOptions:$.useMemo(()=>{var l;return{borderRadius:0,offset:(l=r.pathOptions)==null?void 0:l.offset}},[(s=r.pathOptions)==null?void 0:s.offset])})})}const aR=aS({isInternal:!1}),lS=aS({isInternal:!0});aR.displayName="StepEdge";lS.displayName="StepEdgeInternal";function cS(t){return $.memo(({id:n,sourceX:r,sourceY:o,targetX:s,targetY:l,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:x,markerStart:C,interactionWidth:b})=>{const[A,_,N]=Tx({sourceX:r,sourceY:o,targetX:s,targetY:l}),R=t.isInternal?void 0:n;return O.jsx(Jh,{id:R,path:A,labelX:_,labelY:N,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:v,style:y,markerEnd:x,markerStart:C,interactionWidth:b})})}const lR=cS({isInternal:!1}),uS=cS({isInternal:!0});lR.displayName="StraightEdge";uS.displayName="StraightEdgeInternal";function hS(t){return $.memo(({id:n,sourceX:r,sourceY:o,targetX:s,targetY:l,sourcePosition:u=Ye.Bottom,targetPosition:h=Ye.Top,label:d,labelStyle:p,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:C,markerEnd:b,markerStart:A,pathOptions:_,interactionWidth:N})=>{const[R,D,Z]=_x({sourceX:r,sourceY:o,sourcePosition:u,targetX:s,targetY:l,targetPosition:h,curvature:_==null?void 0:_.curvature}),ue=t.isInternal?void 0:n;return O.jsx(Jh,{id:ue,path:R,labelX:D,labelY:Z,label:d,labelStyle:p,labelShowBg:m,labelBgStyle:v,labelBgPadding:y,labelBgBorderRadius:x,style:C,markerEnd:b,markerStart:A,interactionWidth:N})})}const cR=hS({isInternal:!1}),dS=hS({isInternal:!0});cR.displayName="BezierEdge";dS.displayName="BezierEdgeInternal";const v0={default:dS,straight:uS,step:lS,smoothstep:sS,simplebezier:rS},w0={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},uR=(t,n,r)=>r===Ye.Left?t-n:r===Ye.Right?t+n:t,hR=(t,n,r)=>r===Ye.Top?t-n:r===Ye.Bottom?t+n:t,x0="react-flow__edgeupdater";function S0({position:t,centerX:n,centerY:r,radius:o=10,onMouseDown:s,onMouseEnter:l,onMouseOut:u,type:h}){return O.jsx("circle",{onMouseDown:s,onMouseEnter:l,onMouseOut:u,className:zt([x0,`${x0}-${h}`]),cx:uR(n,o,t),cy:hR(r,o,t),r:o,stroke:"transparent",fill:"transparent"})}function dR({isReconnectable:t,reconnectRadius:n,edge:r,sourceX:o,sourceY:s,targetX:l,targetY:u,sourcePosition:h,targetPosition:d,onReconnect:p,onReconnectStart:m,onReconnectEnd:v,setReconnecting:y,setUpdateHover:x}){const C=At(),b=(D,Z)=>{if(D.button!==0)return;const{autoPanOnConnect:ue,domNode:K,isValidConnection:ne,connectionMode:I,connectionRadius:M,lib:H,onConnectStart:W,onConnectEnd:X,cancelConnection:V,nodeLookup:F,rfId:j,panBy:Y,updateConnection:z}=C.getState(),G=Z.type==="target";y(!0),m==null||m(D,r,Z.type);const J=(se,Ee)=>{y(!1),v==null||v(se,r,Z.type,Ee)},q=se=>p==null?void 0:p(r,se);Hp.onPointerDown(D.nativeEvent,{autoPanOnConnect:ue,connectionMode:I,connectionRadius:M,domNode:K,handleId:Z.id,nodeId:Z.nodeId,nodeLookup:F,isTarget:G,edgeUpdaterType:Z.type,lib:H,flowId:j,cancelConnection:V,panBy:Y,isValidConnection:ne,onConnect:q,onConnectStart:W,onConnectEnd:X,onReconnectEnd:J,updateConnection:z,getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle})},A=D=>b(D,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),_=D=>b(D,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),N=()=>x(!0),R=()=>x(!1);return O.jsxs(O.Fragment,{children:[(t===!0||t==="source")&&O.jsx(S0,{position:h,centerX:o,centerY:s,radius:n,onMouseDown:A,onMouseEnter:N,onMouseOut:R,type:"source"}),(t===!0||t==="target")&&O.jsx(S0,{position:d,centerX:l,centerY:u,radius:n,onMouseDown:_,onMouseEnter:N,onMouseOut:R,type:"target"})]})}function fR({id:t,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:o,onClick:s,onDoubleClick:l,onContextMenu:u,onMouseEnter:h,onMouseMove:d,onMouseLeave:p,reconnectRadius:m,onReconnect:v,onReconnectStart:y,onReconnectEnd:x,rfId:C,edgeTypes:b,noPanClassName:A,onError:_,disableKeyboardA11y:N}){let R=ft(Fe=>Fe.edgeLookup.get(t));const D=ft(Fe=>Fe.defaultEdgeOptions);R=D?{...D,...R}:R;let Z=R.type||"default",ue=(b==null?void 0:b[Z])||v0[Z];ue===void 0&&(_==null||_("011",wo.error011(Z)),Z="default",ue=v0.default);const K=!!(R.focusable||n&&typeof R.focusable>"u"),ne=typeof v<"u"&&(R.reconnectable||r&&typeof R.reconnectable>"u"),I=!!(R.selectable||o&&typeof R.selectable>"u"),M=$.useRef(null),[H,W]=$.useState(!1),[X,V]=$.useState(!1),F=At(),{zIndex:j,sourceX:Y,sourceY:z,targetX:G,targetY:J,sourcePosition:q,targetPosition:se}=ft($.useCallback(Fe=>{const st=Fe.nodeLookup.get(R.source),mt=Fe.nodeLookup.get(R.target);if(!st||!mt)return{zIndex:R.zIndex,...w0};const xt=iA({id:t,sourceNode:st,targetNode:mt,sourceHandle:R.sourceHandle||null,targetHandle:R.targetHandle||null,connectionMode:Fe.connectionMode,onError:_});return{zIndex:J_({selected:R.selected,zIndex:R.zIndex,sourceNode:st,targetNode:mt,elevateOnSelect:Fe.elevateEdgesOnSelect}),...xt||w0}},[R.source,R.target,R.sourceHandle,R.targetHandle,R.selected,R.zIndex]),Ft),Ee=$.useMemo(()=>R.markerStart?`url('#${Vp(R.markerStart,C)}')`:void 0,[R.markerStart,C]),be=$.useMemo(()=>R.markerEnd?`url('#${Vp(R.markerEnd,C)}')`:void 0,[R.markerEnd,C]);if(R.hidden||Y===null||z===null||G===null||J===null)return null;const Ae=Fe=>{var tn;const{addSelectedEdges:st,unselectNodesAndEdges:mt,multiSelectionActive:xt}=F.getState();I&&(F.setState({nodesSelectionActive:!1}),R.selected&&xt?(mt({nodes:[],edges:[R]}),(tn=M.current)==null||tn.blur()):st([t])),s&&s(Fe,R)},Ne=l?Fe=>{l(Fe,{...R})}:void 0,$e=u?Fe=>{u(Fe,{...R})}:void 0,Te=h?Fe=>{h(Fe,{...R})}:void 0,Ce=d?Fe=>{d(Fe,{...R})}:void 0,Je=p?Fe=>{p(Fe,{...R})}:void 0,nt=Fe=>{var st;if(!N&&hx.includes(Fe.key)&&I){const{unselectNodesAndEdges:mt,addSelectedEdges:xt}=F.getState();Fe.key==="Escape"?((st=M.current)==null||st.blur(),mt({edges:[R]})):xt([t])}};return O.jsx("svg",{style:{zIndex:j},children:O.jsxs("g",{className:zt(["react-flow__edge",`react-flow__edge-${Z}`,R.className,A,{selected:R.selected,animated:R.animated,inactive:!I&&!s,updating:H,selectable:I}]),onClick:Ae,onDoubleClick:Ne,onContextMenu:$e,onMouseEnter:Te,onMouseMove:Ce,onMouseLeave:Je,onKeyDown:K?nt:void 0,tabIndex:K?0:void 0,role:K?"button":"img","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":R.ariaLabel===null?void 0:R.ariaLabel||`Edge from ${R.source} to ${R.target}`,"aria-describedby":K?`${zx}-${C}`:void 0,ref:M,children:[!X&&O.jsx(ue,{id:t,source:R.source,target:R.target,type:R.type,selected:R.selected,animated:R.animated,selectable:I,deletable:R.deletable??!0,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,sourceX:Y,sourceY:z,targetX:G,targetY:J,sourcePosition:q,targetPosition:se,data:R.data,style:R.style,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerStart:Ee,markerEnd:be,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth}),ne&&O.jsx(dR,{edge:R,isReconnectable:ne,reconnectRadius:m,onReconnect:v,onReconnectStart:y,onReconnectEnd:x,sourceX:Y,sourceY:z,targetX:G,targetY:J,sourcePosition:q,targetPosition:se,setUpdateHover:W,setReconnecting:V})]})})}const pR=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function fS({defaultMarkerColor:t,onlyRenderVisibleElements:n,rfId:r,edgeTypes:o,noPanClassName:s,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:h,onEdgeMouseMove:d,onEdgeMouseLeave:p,onEdgeClick:m,reconnectRadius:v,onEdgeDoubleClick:y,onReconnectStart:x,onReconnectEnd:C,disableKeyboardA11y:b}){const{edgesFocusable:A,edgesReconnectable:_,elementsSelectable:N,onError:R}=ft(pR,Ft),D=ZT(n);return O.jsxs("div",{className:"react-flow__edges",children:[O.jsx(oR,{defaultColor:t,rfId:r}),D.map(Z=>O.jsx(fR,{id:Z,edgesFocusable:A,edgesReconnectable:_,elementsSelectable:N,noPanClassName:s,onReconnect:l,onContextMenu:u,onMouseEnter:h,onMouseMove:d,onMouseLeave:p,onClick:m,reconnectRadius:v,onDoubleClick:y,onReconnectStart:x,onReconnectEnd:C,rfId:r,onError:R,edgeTypes:o,disableKeyboardA11y:b},Z))]})}fS.displayName="EdgeRenderer";const gR=$.memo(fS),mR=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function yR({children:t}){const n=ft(mR);return O.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}function vR(t){const n=Yh(),r=$.useRef(!1);$.useEffect(()=>{!r.current&&n.viewportInitialized&&t&&(setTimeout(()=>t(n),1),r.current=!0)},[t,n.viewportInitialized])}const wR=t=>{var n;return(n=t.panZoom)==null?void 0:n.syncViewport};function xR(t){const n=ft(wR),r=At();return $.useEffect(()=>{t&&(n==null||n(t),r.setState({transform:[t.x,t.y,t.zoom]}))},[t,n]),null}function SR(t){return t.connection.inProgress?{...t.connection,to:Cc(t.connection.to,t.transform)}:{...t.connection}}function bR(t){return SR}function CR(t){const n=bR();return ft(n,Ft)}const ER=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function PR({containerStyle:t,style:n,type:r,component:o}){const{nodesConnectable:s,width:l,height:u,isValid:h,inProgress:d}=ft(ER,Ft);return!(l&&s&&d)?null:O.jsx("svg",{style:t,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:O.jsx("g",{className:zt(["react-flow__connection",fx(h)]),children:O.jsx(pS,{style:n,type:r,CustomComponent:o,isValid:h})})})}const pS=({style:t,type:n=Mi.Bezier,CustomComponent:r,isValid:o})=>{const{inProgress:s,from:l,fromNode:u,fromHandle:h,fromPosition:d,to:p,toNode:m,toHandle:v,toPosition:y}=CR();if(!s)return;if(r)return O.jsx(r,{connectionLineType:n,connectionLineStyle:t,fromNode:u,fromHandle:h,fromX:l.x,fromY:l.y,toX:p.x,toY:p.y,fromPosition:d,toPosition:y,connectionStatus:fx(o),toNode:m,toHandle:v});let x="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:d,targetX:p.x,targetY:p.y,targetPosition:y};switch(n){case Mi.Bezier:[x]=_x(C);break;case Mi.SimpleBezier:[x]=tS(C);break;case Mi.Step:[x]=$p({...C,borderRadius:0});break;case Mi.SmoothStep:[x]=$p(C);break;default:[x]=Tx(C)}return O.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:t})};pS.displayName="ConnectionLine";const _R={};function b0(t=_R){$.useRef(t),At(),$.useEffect(()=>{},[t])}function AR(){At(),$.useRef(!1),$.useEffect(()=>{},[])}function gS({nodeTypes:t,edgeTypes:n,onInit:r,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:p,onNodeContextMenu:m,onSelectionContextMenu:v,onSelectionStart:y,onSelectionEnd:x,connectionLineType:C,connectionLineStyle:b,connectionLineComponent:A,connectionLineContainerStyle:_,selectionKeyCode:N,selectionOnDrag:R,selectionMode:D,multiSelectionKeyCode:Z,panActivationKeyCode:ue,zoomActivationKeyCode:K,deleteKeyCode:ne,onlyRenderVisibleElements:I,elementsSelectable:M,defaultViewport:H,translateExtent:W,minZoom:X,maxZoom:V,preventScrolling:F,defaultMarkerColor:j,zoomOnScroll:Y,zoomOnPinch:z,panOnScroll:G,panOnScrollSpeed:J,panOnScrollMode:q,zoomOnDoubleClick:se,panOnDrag:Ee,onPaneClick:be,onPaneMouseEnter:Ae,onPaneMouseMove:Ne,onPaneMouseLeave:$e,onPaneScroll:Te,onPaneContextMenu:Ce,paneClickDistance:Je,nodeClickDistance:nt,onEdgeContextMenu:Fe,onEdgeMouseEnter:st,onEdgeMouseMove:mt,onEdgeMouseLeave:xt,reconnectRadius:tn,onReconnect:bo,onReconnectStart:ri,onReconnectEnd:Co,noDragClassName:mn,noWheelClassName:jt,noPanClassName:er,disableKeyboardA11y:_n,nodeExtent:Eo,rfId:An,viewport:nn,onViewportChange:tr}){return b0(t),b0(n),AR(),vR(r),xR(nn),O.jsx(UT,{onPaneClick:be,onPaneMouseEnter:Ae,onPaneMouseMove:Ne,onPaneMouseLeave:$e,onPaneContextMenu:Ce,onPaneScroll:Te,paneClickDistance:Je,deleteKeyCode:ne,selectionKeyCode:N,selectionOnDrag:R,selectionMode:D,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:Z,panActivationKeyCode:ue,zoomActivationKeyCode:K,elementsSelectable:M,zoomOnScroll:Y,zoomOnPinch:z,zoomOnDoubleClick:se,panOnScroll:G,panOnScrollSpeed:J,panOnScrollMode:q,panOnDrag:Ee,defaultViewport:H,translateExtent:W,minZoom:X,maxZoom:V,onSelectionContextMenu:v,preventScrolling:F,noDragClassName:mn,noWheelClassName:jt,noPanClassName:er,disableKeyboardA11y:_n,onViewportChange:tr,isControlledViewport:!!nn,children:O.jsxs(yR,{children:[O.jsx(gR,{edgeTypes:n,onEdgeClick:s,onEdgeDoubleClick:u,onReconnect:bo,onReconnectStart:ri,onReconnectEnd:Co,onlyRenderVisibleElements:I,onEdgeContextMenu:Fe,onEdgeMouseEnter:st,onEdgeMouseMove:mt,onEdgeMouseLeave:xt,reconnectRadius:tn,defaultMarkerColor:j,noPanClassName:er,disableKeyboardA11y:_n,rfId:An}),O.jsx(PR,{style:b,type:C,component:A,containerStyle:_}),O.jsx("div",{className:"react-flow__edgelabel-renderer"}),O.jsx(JT,{nodeTypes:t,onNodeClick:o,onNodeDoubleClick:l,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:p,onNodeContextMenu:m,nodeClickDistance:nt,onlyRenderVisibleElements:I,noPanClassName:er,noDragClassName:mn,disableKeyboardA11y:_n,nodeExtent:Eo,rfId:An}),O.jsx("div",{className:"react-flow__viewport-portal"})]})})}gS.displayName="GraphView";const TR=$.memo(gS),C0=({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:l,fitView:u,nodeOrigin:h,nodeExtent:d}={})=>{const p=new Map,m=new Map,v=new Map,y=new Map,x=o??n??[],C=r??t??[],b=h??[0,0],A=d??oc;Ox(v,y,x),zp(C,p,m,{nodeOrigin:b,nodeExtent:A,elevateNodesOnSelect:!1});let _=[0,0,1];if(u&&s&&l){const N=bc(p,{filter:ue=>!!((ue.width||ue.initialWidth)&&(ue.height||ue.initialHeight))}),{x:R,y:D,zoom:Z}=bg(N,s,l,.5,2,.1);_=[R,D,Z]}return{rfId:"1",width:0,height:0,transform:_,nodes:C,nodeLookup:p,parentLookup:m,edges:x,edgeLookup:y,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:oc,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ua.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connection:{...dx},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:X_,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},RR=({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:l,fitView:u,nodeOrigin:h,nodeExtent:d})=>GA((p,m)=>({...C0({nodes:t,edges:n,width:s,height:l,fitView:u,nodeOrigin:h,nodeExtent:d,defaultNodes:r,defaultEdges:o}),setNodes:v=>{const{nodeLookup:y,parentLookup:x,nodeOrigin:C,elevateNodesOnSelect:b}=m();zp(v,y,x,{nodeOrigin:C,nodeExtent:d,elevateNodesOnSelect:b,checkEquality:!0}),p({nodes:v})},setEdges:v=>{const{connectionLookup:y,edgeLookup:x}=m();Ox(y,x,v),p({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:x}=m();x(v),p({hasDefaultNodes:!0})}if(y){const{setEdges:x}=m();x(y),p({hasDefaultEdges:!0})}},updateNodeInternals:(v,y={triggerFitView:!0})=>{const{triggerNodeChanges:x,nodeLookup:C,parentLookup:b,fitViewOnInit:A,fitViewDone:_,fitViewOnInitOptions:N,domNode:R,nodeOrigin:D,nodeExtent:Z,debug:ue,fitViewSync:K}=m(),{changes:ne,updatedInternals:I}=hA(v,C,b,R,D,Z);if(I){if(lA(C,b,{nodeOrigin:D,nodeExtent:Z}),y.triggerFitView){let M=_;!_&&A&&(M=K({...N,nodes:N==null?void 0:N.nodes})),p({fitViewDone:M})}else p({});(ne==null?void 0:ne.length)>0&&(ue&&console.log("React Flow: trigger node changes",ne),x==null||x(ne))}},updateNodePositions:(v,y=!1)=>{const x=[],C=[];for(const[b,A]of v){const _=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(A!=null&&A.position)),N={id:b,type:"position",position:_?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:y};_&&x.push({id:b,parentId:A.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width,height:A.measured.height}}),C.push(N)}if(x.length>0){const{nodeLookup:b,parentLookup:A,nodeOrigin:_}=m(),N=_g(x,b,A,_);C.push(...N)}m().triggerNodeChanges(C)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:x,nodes:C,hasDefaultNodes:b,debug:A}=m();if(v!=null&&v.length){if(b){const _=Wx(v,C);x(_)}A&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:x,edges:C,hasDefaultEdges:b,debug:A}=m();if(v!=null&&v.length){if(b){const _=qx(v,C);x(_)}A&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:C,triggerNodeChanges:b,triggerEdgeChanges:A}=m();if(y){const _=v.map(N=>ks(N,!0));b(_);return}b(ja(C,new Set([...v]),!0)),A(ja(x))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:x,nodeLookup:C,triggerNodeChanges:b,triggerEdgeChanges:A}=m();if(y){const _=v.map(N=>ks(N,!0));A(_);return}A(ja(x,new Set([...v]))),b(ja(C,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:x,nodes:C,nodeLookup:b,triggerNodeChanges:A,triggerEdgeChanges:_}=m(),N=v||C,R=y||x,D=N.map(ue=>{const K=b.get(ue.id);return K&&(K.selected=!1),ks(ue.id,!1)}),Z=R.map(ue=>ks(ue.id,!1));A(D),_(Z)},setMinZoom:v=>{const{panZoom:y,maxZoom:x}=m();y==null||y.setScaleExtent([v,x]),p({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:x}=m();y==null||y.setScaleExtent([x,v]),p({maxZoom:v})},setTranslateExtent:v=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(v),p({translateExtent:v})},setPaneClickDistance:v=>{var y;(y=m().panZoom)==null||y.setClickDistance(v)},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:x,triggerEdgeChanges:C}=m(),b=y.reduce((_,N)=>N.selected?[..._,ks(N.id,!1)]:_,[]),A=v.reduce((_,N)=>N.selected?[..._,ks(N.id,!1)]:_,[]);x(b),C(A)},setNodeExtent:v=>{const{nodes:y,nodeLookup:x,parentLookup:C,nodeOrigin:b,elevateNodesOnSelect:A,nodeExtent:_}=m();v[0][0]===_[0][0]&&v[0][1]===_[0][1]&&v[1][0]===_[1][0]&&v[1][1]===_[1][1]||(zp(y,x,C,{nodeOrigin:b,nodeExtent:v,elevateNodesOnSelect:A,checkEquality:!1}),p({nodeExtent:v}))},panBy:v=>{const{transform:y,width:x,height:C,panZoom:b,translateExtent:A}=m();return dA({delta:v,panZoom:b,transform:y,translateExtent:A,width:x,height:C})},fitView:v=>{const{panZoom:y,width:x,height:C,minZoom:b,maxZoom:A,nodeLookup:_}=m();if(!y)return Promise.resolve(!1);const N=Mp(_,v);return Lp({nodes:N,width:x,height:C,panZoom:y,minZoom:b,maxZoom:A},v)},fitViewSync:v=>{const{panZoom:y,width:x,height:C,minZoom:b,maxZoom:A,nodeLookup:_}=m();if(!y)return!1;const N=Mp(_,v);return Lp({nodes:N,width:x,height:C,panZoom:y,minZoom:b,maxZoom:A},v),N.size>0},cancelConnection:()=>{p({connection:{...dx}})},updateConnection:v=>{p({connection:v})},reset:()=>p({...C0()})}),Object.is);function mS({initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:s,initialHeight:l,fitView:u,nodeOrigin:h,nodeExtent:d,children:p}){const[m]=$.useState(()=>RR({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:l,fitView:u,nodeOrigin:h,nodeExtent:d}));return O.jsx(YA,{value:m,children:O.jsx(vT,{children:p})})}function OR({children:t,nodes:n,edges:r,defaultNodes:o,defaultEdges:s,width:l,height:u,fitView:h,nodeOrigin:d,nodeExtent:p}){return $.useContext(Kh)?O.jsx(O.Fragment,{children:t}):O.jsx(mS,{initialNodes:n,initialEdges:r,defaultNodes:o,defaultEdges:s,initialWidth:l,initialHeight:u,fitView:h,nodeOrigin:d,nodeExtent:p,children:t})}const kR={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function NR({nodes:t,edges:n,defaultNodes:r,defaultEdges:o,className:s,nodeTypes:l,edgeTypes:u,onNodeClick:h,onEdgeClick:d,onInit:p,onMove:m,onMoveStart:v,onMoveEnd:y,onConnect:x,onConnectStart:C,onConnectEnd:b,onClickConnectStart:A,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:R,onNodeMouseLeave:D,onNodeContextMenu:Z,onNodeDoubleClick:ue,onNodeDragStart:K,onNodeDrag:ne,onNodeDragStop:I,onNodesDelete:M,onEdgesDelete:H,onDelete:W,onSelectionChange:X,onSelectionDragStart:V,onSelectionDrag:F,onSelectionDragStop:j,onSelectionContextMenu:Y,onSelectionStart:z,onSelectionEnd:G,onBeforeDelete:J,connectionMode:q,connectionLineType:se=Mi.Bezier,connectionLineStyle:Ee,connectionLineComponent:be,connectionLineContainerStyle:Ae,deleteKeyCode:Ne="Backspace",selectionKeyCode:$e="Shift",selectionOnDrag:Te=!1,selectionMode:Ce=ic.Full,panActivationKeyCode:Je="Space",multiSelectionKeyCode:nt=Ah()?"Meta":"Control",zoomActivationKeyCode:Fe=Ah()?"Meta":"Control",snapToGrid:st,snapGrid:mt,onlyRenderVisibleElements:xt=!1,selectNodesOnDrag:tn,nodesDraggable:bo,nodesConnectable:ri,nodesFocusable:Co,nodeOrigin:mn=Hx,edgesFocusable:jt,edgesReconnectable:er,elementsSelectable:_n=!0,defaultViewport:Eo=lT,minZoom:An=.5,maxZoom:nn=2,translateExtent:tr=oc,preventScrolling:nr=!0,nodeExtent:Zr,defaultMarkerColor:rr="#b1b1b7",zoomOnScroll:yn=!0,zoomOnPinch:oi=!0,panOnScroll:ii=!1,panOnScrollSpeed:Fn=.5,panOnScrollMode:We=js.Free,zoomOnDoubleClick:br=!0,panOnDrag:jn=!0,onPaneClick:eo,onPaneMouseEnter:Be,onPaneMouseMove:Po,onPaneMouseLeave:Cr,onPaneScroll:or,onPaneContextMenu:Qi,paneClickDistance:_o=0,nodeClickDistance:Ks=0,children:Ys,onReconnect:Er,onReconnectStart:ir,onReconnectEnd:si,onEdgeContextMenu:sr,onEdgeDoubleClick:vt,onEdgeMouseEnter:Ct,onEdgeMouseMove:el,onEdgeMouseLeave:ar,reconnectRadius:Pr=10,onNodesChange:_r,onEdgesChange:Ji,noDragClassName:lr="nodrag",noWheelClassName:to="nowheel",noPanClassName:Bn="nopan",fitView:vn,fitViewOptions:Xs,connectOnClick:$n,attributionPosition:Qs,proOptions:cr,defaultEdgeOptions:Zi,elevateNodesOnSelect:ai,elevateEdgesOnSelect:Et,disableKeyboardA11y:ur=!1,autoPanOnConnect:Vn,autoPanOnNodeDrag:Pt,autoPanSpeed:no,connectionRadius:ro,isValidConnection:li,onError:oo,style:Ar,id:ci,nodeDragThreshold:Tr,viewport:wn,onViewportChange:ct,width:rn,height:Js,colorMode:Zs="light",debug:wt,...hr},dr){const on=ci||"1",io=dT(Zs);return O.jsx("div",{"data-testid":"rf__wrapper",...hr,style:{...Ar,...kR},ref:dr,className:zt(["react-flow",s,io]),id:ci,children:O.jsxs(OR,{nodes:t,edges:n,width:rn,height:Js,fitView:vn,nodeOrigin:mn,nodeExtent:Zr,children:[O.jsx(TR,{onInit:p,onNodeClick:h,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:R,onNodeMouseLeave:D,onNodeContextMenu:Z,onNodeDoubleClick:ue,nodeTypes:l,edgeTypes:u,connectionLineType:se,connectionLineStyle:Ee,connectionLineComponent:be,connectionLineContainerStyle:Ae,selectionKeyCode:$e,selectionOnDrag:Te,selectionMode:Ce,deleteKeyCode:Ne,multiSelectionKeyCode:nt,panActivationKeyCode:Je,zoomActivationKeyCode:Fe,onlyRenderVisibleElements:xt,defaultViewport:Eo,translateExtent:tr,minZoom:An,maxZoom:nn,preventScrolling:nr,zoomOnScroll:yn,zoomOnPinch:oi,zoomOnDoubleClick:br,panOnScroll:ii,panOnScrollSpeed:Fn,panOnScrollMode:We,panOnDrag:jn,onPaneClick:eo,onPaneMouseEnter:Be,onPaneMouseMove:Po,onPaneMouseLeave:Cr,onPaneScroll:or,onPaneContextMenu:Qi,paneClickDistance:_o,nodeClickDistance:Ks,onSelectionContextMenu:Y,onSelectionStart:z,onSelectionEnd:G,onReconnect:Er,onReconnectStart:ir,onReconnectEnd:si,onEdgeContextMenu:sr,onEdgeDoubleClick:vt,onEdgeMouseEnter:Ct,onEdgeMouseMove:el,onEdgeMouseLeave:ar,reconnectRadius:Pr,defaultMarkerColor:rr,noDragClassName:lr,noWheelClassName:to,noPanClassName:Bn,rfId:on,disableKeyboardA11y:ur,nodeExtent:Zr,viewport:wn,onViewportChange:ct}),O.jsx(hT,{nodes:t,edges:n,defaultNodes:r,defaultEdges:o,onConnect:x,onConnectStart:C,onConnectEnd:b,onClickConnectStart:A,onClickConnectEnd:_,nodesDraggable:bo,nodesConnectable:ri,nodesFocusable:Co,edgesFocusable:jt,edgesReconnectable:er,elementsSelectable:_n,elevateNodesOnSelect:ai,elevateEdgesOnSelect:Et,minZoom:An,maxZoom:nn,nodeExtent:Zr,onNodesChange:_r,onEdgesChange:Ji,snapToGrid:st,snapGrid:mt,connectionMode:q,translateExtent:tr,connectOnClick:$n,defaultEdgeOptions:Zi,fitView:vn,fitViewOptions:Xs,onNodesDelete:M,onEdgesDelete:H,onDelete:W,onNodeDragStart:K,onNodeDrag:ne,onNodeDragStop:I,onSelectionDrag:F,onSelectionDragStart:V,onSelectionDragStop:j,onMove:m,onMoveStart:v,onMoveEnd:y,noPanClassName:Bn,nodeOrigin:mn,rfId:on,autoPanOnConnect:Vn,autoPanOnNodeDrag:Pt,autoPanSpeed:no,onError:oo,connectionRadius:ro,isValidConnection:li,selectNodesOnDrag:tn,nodeDragThreshold:Tr,onBeforeDelete:J,paneClickDistance:_o,debug:wt}),O.jsx(aT,{onSelectionChange:X}),Ys,O.jsx(nT,{proOptions:cr,position:Qs}),O.jsx(eT,{rfId:on,disableKeyboardA11y:ur})]})})}var DR=Gx(NR);function IR(){const t=At();return $.useCallback(n=>{const{domNode:r,updateNodeInternals:o}=t.getState(),s=Array.isArray(n)?n:[n],l=new Map;s.forEach(u=>{const h=r==null?void 0:r.querySelector(`.react-flow__node[data-id="${u}"]`);h&&l.set(u,{id:u,nodeElement:h,force:!0})}),requestAnimationFrame(()=>o(l,{triggerFitView:!1}))},[])}function MR({onStart:t,onChange:n,onEnd:r}){const o=At();$.useEffect(()=>{o.setState({onViewportChangeStart:t})},[t]),$.useEffect(()=>{o.setState({onViewportChange:n})},[n]),$.useEffect(()=>{o.setState({onViewportChangeEnd:r})},[r])}const LR=wo.error014();function FR({id:t,handleType:n,handleId:r,onConnect:o,onDisconnect:s}={}){const l=Qh(),u=t??l;if(!u)throw new Error(LR);const h=$.useRef(null),d=ft(p=>p.connectionLookup.get(`${u}${n?r?`-${n}-${r}`:`-${n}`:""}`),U_);return $.useEffect(()=>{if(h.current&&h.current!==d){const p=d??new Map;Lv(h.current,p,s),Lv(p,h.current,o)}h.current=d??new Map},[d,o,s]),$.useMemo(()=>Array.from((d==null?void 0:d.values())??[]),[d])}function jR({dimensions:t,lineWidth:n,variant:r,className:o}){return O.jsx("path",{strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:zt(["react-flow__background-pattern",r,o])})}function BR({radius:t,className:n}){return O.jsx("circle",{cx:t,cy:t,r:t,className:zt(["react-flow__background-pattern","dots",n])})}var ji;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(ji||(ji={}));const $R={[ji.Dots]:1,[ji.Lines]:1,[ji.Cross]:6},VR=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function yS({id:t,variant:n=ji.Dots,gap:r=20,size:o,lineWidth:s=1,offset:l=0,color:u,bgColor:h,style:d,className:p,patternClassName:m}){const v=$.useRef(null),{transform:y,patternId:x}=ft(VR,Ft),C=o||$R[n],b=n===ji.Dots,A=n===ji.Cross,_=Array.isArray(r)?r:[r,r],N=[_[0]*y[2]||1,_[1]*y[2]||1],R=C*y[2],D=Array.isArray(l)?l:[l,l],Z=A?[R,R]:N,ue=[D[0]*y[2]||1+Z[0]/2,D[1]*y[2]||1+Z[1]/2],K=`${x}${t||""}`;return O.jsxs("svg",{className:zt(["react-flow__background",p]),style:{...d,...Xh,"--xy-background-color-props":h,"--xy-background-pattern-color-props":u},ref:v,"data-testid":"rf__background",children:[O.jsx("pattern",{id:K,x:y[0]%N[0],y:y[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${ue[0]},-${ue[1]})`,children:b?O.jsx(BR,{radius:R/2,className:m}):O.jsx(jR,{dimensions:Z,lineWidth:s,variant:n,className:m})}),O.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${K})`})]})}yS.displayName="Background";const zR=$.memo(yS);function HR(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:O.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function UR(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:O.jsx("path",{d:"M0 0h32v4.2H0z"})})}function WR(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:O.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function qR(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function GR(){return O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:O.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Gu({children:t,className:n,...r}){return O.jsx("button",{type:"button",className:zt(["react-flow__controls-button",n]),...r,children:t})}const KR=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom});function vS({style:t,showZoom:n=!0,showFitView:r=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:l,onZoomOut:u,onFitView:h,onInteractiveChange:d,className:p,children:m,position:v="bottom-left",orientation:y="vertical","aria-label":x="React Flow controls"}){const C=At(),{isInteractive:b,minZoomReached:A,maxZoomReached:_}=ft(KR,Ft),{zoomIn:N,zoomOut:R,fitView:D}=Yh(),Z=()=>{N(),l==null||l()},ue=()=>{R(),u==null||u()},K=()=>{D(s),h==null||h()},ne=()=>{C.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},I=y==="horizontal"?"horizontal":"vertical";return O.jsxs(Ag,{className:zt(["react-flow__controls",I,p]),position:v,style:t,"data-testid":"rf__controls","aria-label":x,children:[n&&O.jsxs(O.Fragment,{children:[O.jsx(Gu,{onClick:Z,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_,children:O.jsx(HR,{})}),O.jsx(Gu,{onClick:ue,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:A,children:O.jsx(UR,{})})]}),r&&O.jsx(Gu,{className:"react-flow__controls-fitview",onClick:K,title:"fit view","aria-label":"fit view",children:O.jsx(WR,{})}),o&&O.jsx(Gu,{className:"react-flow__controls-interactive",onClick:ne,title:"toggle interactivity","aria-label":"toggle interactivity",children:b?O.jsx(GR,{}):O.jsx(qR,{})}),m]})}vS.displayName="Controls";const YR=$.memo(vS);function XR({id:t,x:n,y:r,width:o,height:s,style:l,color:u,strokeColor:h,strokeWidth:d,className:p,borderRadius:m,shapeRendering:v,selected:y,onClick:x}){const{background:C,backgroundColor:b}=l||{},A=u||C||b;return O.jsx("rect",{className:zt(["react-flow__minimap-node",{selected:y},p]),x:n,y:r,rx:m,ry:m,width:o,height:s,style:{fill:A,stroke:h,strokeWidth:d},shapeRendering:v,onClick:x?_=>x(_,t):void 0})}const QR=$.memo(XR),JR=t=>t.nodes.map(n=>n.id),Jf=t=>t instanceof Function?t:()=>t;function ZR({nodeStrokeColor:t,nodeColor:n,nodeClassName:r="",nodeBorderRadius:o=5,nodeStrokeWidth:s,nodeComponent:l=QR,onClick:u}){const h=ft(JR,Ft),d=Jf(n),p=Jf(t),m=Jf(r),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return O.jsx(O.Fragment,{children:h.map(y=>O.jsx(tO,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:p,nodeClassNameFunc:m,nodeBorderRadius:o,nodeStrokeWidth:s,NodeComponent:l,onClick:u,shapeRendering:v},y))})}function eO({id:t,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:o,nodeBorderRadius:s,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:h,onClick:d}){const{node:p,x:m,y:v,width:y,height:x}=ft(C=>{const b=C.nodeLookup.get(t),{x:A,y:_}=b.internals.positionAbsolute,{width:N,height:R}=ti(b);return{node:b,x:A,y:_,width:N,height:R}},Ft);return!p||p.hidden||!Sx(p)?null:O.jsx(h,{x:m,y:v,width:y,height:x,style:p.style,selected:!!p.selected,className:o(p),color:n(p),borderRadius:s,strokeColor:r(p),strokeWidth:l,shapeRendering:u,onClick:d,id:p.id})}const tO=$.memo(eO);var nO=$.memo(ZR);const rO=200,oO=150,iO=t=>{const n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:t.nodeLookup.size>0?wx(bc(t.nodeLookup),n):n,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height}},sO="react-flow__minimap-desc";function wS({style:t,className:n,nodeStrokeColor:r,nodeColor:o,nodeClassName:s="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:h,bgColor:d,maskColor:p,maskStrokeColor:m,maskStrokeWidth:v,position:y="bottom-right",onClick:x,onNodeClick:C,pannable:b=!1,zoomable:A=!1,ariaLabel:_="React Flow mini map",inversePan:N,zoomStep:R=10,offsetScale:D=5}){const Z=At(),ue=$.useRef(null),{boundingRect:K,viewBB:ne,rfId:I,panZoom:M,translateExtent:H,flowWidth:W,flowHeight:X}=ft(iO,Ft),V=(t==null?void 0:t.width)??rO,F=(t==null?void 0:t.height)??oO,j=K.width/V,Y=K.height/F,z=Math.max(j,Y),G=z*V,J=z*F,q=D*z,se=K.x-(G-K.width)/2-q,Ee=K.y-(J-K.height)/2-q,be=G+q*2,Ae=J+q*2,Ne=`${sO}-${I}`,$e=$.useRef(0),Te=$.useRef();$e.current=z,$.useEffect(()=>{if(ue.current&&M)return Te.current=xA({domNode:ue.current,panZoom:M,getTransform:()=>Z.getState().transform,getViewScale:()=>$e.current}),()=>{var nt;(nt=Te.current)==null||nt.destroy()}},[M]),$.useEffect(()=>{var nt;(nt=Te.current)==null||nt.update({translateExtent:H,width:W,height:X,inversePan:N,pannable:b,zoomStep:R,zoomable:A})},[b,A,N,R,H,W,X]);const Ce=x?nt=>{var mt;const[Fe,st]=((mt=Te.current)==null?void 0:mt.pointer(nt))||[0,0];x(nt,{x:Fe,y:st})}:void 0,Je=C?$.useCallback((nt,Fe)=>{const st=Z.getState().nodeLookup.get(Fe);C(nt,st)},[]):void 0;return O.jsx(Ag,{position:y,style:{...t,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof v=="number"?v*z:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="string"?u:void 0},className:zt(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:O.jsxs("svg",{width:V,height:F,viewBox:`${se} ${Ee} ${be} ${Ae}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Ne,ref:ue,onClick:Ce,children:[_&&O.jsx("title",{id:Ne,children:_}),O.jsx(nO,{onClick:Je,nodeColor:o,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:s,nodeStrokeWidth:u,nodeComponent:h}),O.jsx("path",{className:"react-flow__minimap-mask",d:`M${se-q},${Ee-q}h${be+q*2}v${Ae+q*2}h${-be-q*2}z - M${ne.x},${ne.y}h${ne.width}v${ne.height}h${-ne.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}wS.displayName="MiniMap";$.memo(wS);function aO({nodeId:t,position:n,variant:r=Xl.Handle,className:o,style:s={},children:l,color:u,minWidth:h=10,minHeight:d=10,maxWidth:p=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:v=!1,shouldResize:y,onResizeStart:x,onResize:C,onResizeEnd:b}){const A=Qh(),_=typeof t=="string"?t:A,N=At(),R=$.useRef(null),D=r===Xl.Line?"right":"bottom-right",Z=n??D,ue=$.useRef(null);$.useEffect(()=>{if(!(!R.current||!_))return ue.current||(ue.current=MA({domNode:R.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:M,transform:H,snapGrid:W,snapToGrid:X,nodeOrigin:V,domNode:F}=N.getState();return{nodeLookup:M,transform:H,snapGrid:W,snapToGrid:X,nodeOrigin:V,paneDomNode:F}},onChange:(M,H)=>{const{triggerNodeChanges:W,nodeLookup:X,parentLookup:V,nodeOrigin:F}=N.getState(),j=[],Y={x:M.x,y:M.y},z=X.get(_);if(z&&z.expandParent&&z.parentId){const G=z.origin??F,J=M.width??z.measured.width,q=M.height??z.measured.height,se={id:z.id,parentId:z.parentId,rect:{width:J,height:q,...bx({x:M.x??z.position.x,y:M.y??z.position.y},{width:J,height:q},z.parentId,X,G)}},Ee=_g([se],X,V,F);j.push(...Ee),Y.x=M.x?Math.max(G[0]*J,M.x):void 0,Y.y=M.y?Math.max(G[1]*q,M.y):void 0}if(Y.x!==void 0&&Y.y!==void 0){const G={id:_,type:"position",position:{...Y}};j.push(G)}if(M.width!==void 0&&M.height!==void 0){const G={id:_,type:"dimensions",resizing:!0,setAttributes:!0,dimensions:{width:M.width,height:M.height}};j.push(G)}for(const G of H){const J={...G,type:"position"};j.push(J)}W(j)},onEnd:()=>{const M={id:_,type:"dimensions",resizing:!1};N.getState().triggerNodeChanges([M])}})),ue.current.update({controlPosition:Z,boundaries:{minWidth:h,minHeight:d,maxWidth:p,maxHeight:m},keepAspectRatio:v,onResizeStart:x,onResize:C,onResizeEnd:b,shouldResize:y}),()=>{var M;(M=ue.current)==null||M.destroy()}},[Z,h,d,p,m,v,x,C,b,y]);const K=Z.split("-"),ne=r===Xl.Line?"borderColor":"backgroundColor",I=u?{...s,[ne]:u}:s;return O.jsx("div",{className:zt(["react-flow__resize-control","nodrag",...K,r,o]),ref:R,style:I,children:l})}$.memo(aO);function xS(t,n){let r;try{r=t()}catch{return}return{getItem:s=>{var l;const u=d=>d===null?null:JSON.parse(d,void 0),h=(l=r.getItem(s))!=null?l:null;return h instanceof Promise?h.then(u):u(h)},setItem:(s,l)=>r.setItem(s,JSON.stringify(l,void 0)),removeItem:s=>r.removeItem(s)}}const Wp=t=>n=>{try{const r=t(n);return r instanceof Promise?r:{then(o){return Wp(o)(r)},catch(o){return this}}}catch(r){return{then(o){return this},catch(o){return Wp(o)(r)}}}},lO=(t,n)=>(r,o,s)=>{let l={storage:xS(()=>localStorage),partialize:b=>b,version:0,merge:(b,A)=>({...A,...b}),...n},u=!1;const h=new Set,d=new Set;let p=l.storage;if(!p)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),r(...b)},o,s);const m=()=>{const b=l.partialize({...o()});return p.setItem(l.name,{state:b,version:l.version})},v=s.setState;s.setState=(b,A)=>{v(b,A),m()};const y=t((...b)=>{r(...b),m()},o,s);s.getInitialState=()=>y;let x;const C=()=>{var b,A;if(!p)return;u=!1,h.forEach(N=>{var R;return N((R=o())!=null?R:y)});const _=((A=l.onRehydrateStorage)==null?void 0:A.call(l,(b=o())!=null?b:y))||void 0;return Wp(p.getItem.bind(p))(l.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==l.version){if(l.migrate){const R=l.migrate(N.state,N.version);return R instanceof Promise?R.then(D=>[!0,D]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var R;const[D,Z]=N;if(x=l.merge(Z,(R=o())!=null?R:y),r(x,!0),D)return m()}).then(()=>{_==null||_(x,void 0),x=o(),u=!0,d.forEach(N=>N(x))}).catch(N=>{_==null||_(void 0,N)})};return s.persist={setOptions:b=>{l={...l,...b},b.storage&&(p=b.storage)},clearStorage:()=>{p==null||p.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>C(),hasHydrated:()=>u,onHydrate:b=>(h.add(b),()=>{h.delete(b)}),onFinishHydration:b=>(d.add(b),()=>{d.delete(b)})},l.skipHydration||C(),x||y},cO=lO,E0=t=>Symbol.iterator in t,P0=t=>"entries"in t,_0=(t,n)=>{const r=t instanceof Map?t:new Map(t.entries()),o=n instanceof Map?n:new Map(n.entries());if(r.size!==o.size)return!1;for(const[s,l]of r)if(!Object.is(l,o.get(s)))return!1;return!0},uO=(t,n)=>{const r=t[Symbol.iterator](),o=n[Symbol.iterator]();let s=r.next(),l=o.next();for(;!s.done&&!l.done;){if(!Object.is(s.value,l.value))return!1;s=r.next(),l=o.next()}return!!s.done&&!!l.done};function hO(t,n){return Object.is(t,n)?!0:typeof t!="object"||t===null||typeof n!="object"||n===null?!1:!E0(t)||!E0(n)?_0({entries:()=>Object.entries(t)},{entries:()=>Object.entries(n)}):P0(t)&&P0(n)?_0(t,n):uO(t,n)}function SS(t){const n=en.useRef(void 0);return r=>{const o=t(r);return hO(n.current,o)?n.current:n.current=o}}const A0={x:0,y:0,zoom:.5},T0=f1()(cO((t,n)=>({flows:{},flowMetadata:{},currentFlowId:"",nodeTypes:{},createFlow:(r,o,s,l)=>{t(u=>({flows:{...u.flows,[r]:{nodes:s,edges:l,viewport:A0}},currentFlowId:r,flowMetadata:{...u.flowMetadata,[r]:o}}))},updateFlowMetadata:(r,o)=>{n().flows[r]&&t(s=>({flowMetadata:{...s.flowMetadata,[r]:{...s.flowMetadata[r],...o}}}))},setCurrentFlow:r=>{n().flows[r]&&t({currentFlowId:r})},updateNodeTypes:r=>{t({nodeTypes:r})},renameCurrentFlow:r=>{const{currentFlowId:o,flows:s}=n();if(!s[o])return;const l={...s,[r]:s[o]};delete l[o],t({flows:l,currentFlowId:r})},deleteFlow:r=>{t(o=>{const s={...o.flows},l={...o.flowMetadata};return delete s[r],delete l[r],{flows:s,flowMetadata:l,currentFlowId:Object.keys(s)[0]||""}})},currentFlow:()=>n().flows[n().currentFlowId]||null,onNodesChange:r=>{t(o=>{const s=o.flows[o.currentFlowId];return s?{flows:{...o.flows,[o.currentFlowId]:{...s,nodes:Wx(r,s.nodes)}}}:{}})},onEdgesChange:r=>{t(o=>{const s=o.flows[o.currentFlowId];return s?{flows:{...o.flows,[o.currentFlowId]:{...s,edges:qx(r,s.edges)}}}:{}})},onConnect:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],edges:Bp({...r,type:"smoothstep"},s[o].edges)}}})},setNodes:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],nodes:r}}})},setEdges:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],edges:r}}})},addEdge:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],edges:Bp({...r,type:"smoothstep"},s[o].edges)}}})},setViewport:r=>{t(o=>{const s=o.flows[o.currentFlowId];return s?{flows:{...o.flows,[o.currentFlowId]:{...s,viewport:r}}}:{}})},clearState:()=>{const{currentFlowId:r,flows:o}=n();o[r]&&t({flows:{...o,[r]:{nodes:[],edges:[],viewport:A0}}})},addNode:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],nodes:[...s[o].nodes,r]}}})},removeNode:r=>{const{currentFlowId:o,flows:s}=n();s[o]&&t({flows:{...s,[o]:{...s[o],nodes:s[o].nodes.filter(l=>l.id!==r)}}})},updateNodePosition:(r,o)=>{const{currentFlowId:s,flows:l}=n();l[s]&&t({flows:{...l,[s]:{...l[s],nodes:l[s].nodes.map(u=>u.id===r?{...u,position:o}:u)}}})},updateNodeData:(r,o)=>{const{currentFlowId:s,flows:l}=n();l[s]&&t({flows:{...l,[s]:{...l[s],nodes:l[s].nodes.map(u=>u.id===r?{...u,data:{...u.data,...o}}:u)}}})}}),{name:"multi-flow-state",storage:xS(()=>localStorage),partialize:t=>({flows:t.flows,currentFlowId:t.currentFlowId,flowMetadata:t.flowMetadata})})),bS=t=>({flows:t.flows,currentFlowId:t.currentFlowId,flowMetadata:t.flowMetadata,updateFlowMetadata:t.updateFlowMetadata,createFlow:t.createFlow,setCurrentFlow:t.setCurrentFlow,renameCurrentFlow:t.renameCurrentFlow,deleteFlow:t.deleteFlow,currentFlow:t.currentFlow,onNodesChange:t.onNodesChange,onEdgesChange:t.onEdgesChange,onConnect:t.onConnect,addNode:t.addNode,updateNodePosition:t.updateNodePosition,addEdge:t.addEdge,setViewport:t.setViewport,clearStore:t.clearStore,updateNodeData:t.updateNodeData,updateNodeTypes:t.updateNodeTypes,nodeTypes:t.nodeTypes,setNodes:t.setNodes,setEdges:t.setEdges}),dO=t=>({nodes:t.flows[t.currentFlowId].nodes,edges:t.flows[t.currentFlowId].edges,viewport:t.flows[t.currentFlowId].viewport,onNodesChange:t.onNodesChange,onEdgesChange:t.onEdgesChange,onConnect:t.onConnect,addNode:t.addNode,updateNodePosition:t.updateNodePosition,addEdge:t.addEdge,setViewport:t.setViewport,updateNodeData:t.updateNodeData,updateNodeTypes:t.updateNodeTypes,nodeTypes:t.nodeTypes,setNodes:t.setNodes,setEdges:t.setEdges}),Qr=()=>{const t=IF(),n=T0(SS(bS));return t!=null&&t.isParent?dO(n):T0()},fO=[{value:"authorships.author.id",label:"Author ID",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.author.orcid",label:"Author ORCID",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.institutions.country_code",label:"Institution Country Code",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.institutions.id",label:"Institution ID",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.institutions.ror",label:"Institution ROR",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.institutions.type",label:"Institution Type",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"authorships.is_corresponding",label:"Is Corresponding",groupLabel:"Authorship",group:"authorship",inputType:"boolean"},{value:"apc_list.value",label:"APC Value",groupLabel:"APC",group:"apc",inputType:"range"},{value:"apc_list.currency",label:"APC Currency",groupLabel:"APC",group:"apc",inputType:"term"},{value:"apc_list.provenance",label:"APC Provenance",groupLabel:"APC",group:"apc",inputType:"term"},{value:"apc_list.value_usd",label:"APC Value USD",groupLabel:"APC",group:"apc",inputType:"range"},{value:"apc_paid.value",label:"APC Paid Value",groupLabel:"APC",group:"apc",inputType:"range"},{value:"apc_paid.currency",label:"APC Paid Currency",groupLabel:"APC",group:"apc",inputType:"term"},{value:"apc_paid.provenance",label:"APC Paid Provenance",groupLabel:"APC",group:"apc",inputType:"term"},{value:"apc_paid.value_usd",label:"APC Paid Value USD",groupLabel:"APC",group:"apc",inputType:"range"},{value:"best_oa_location.license",label:"Best OA Location License",groupLabel:"Open Access",group:"open_access",inputType:"OA-license"},{value:"best_oa_location.source.id",label:"Best OA Location Source ID",groupLabel:"Open Access",group:"open_access",inputType:"term"},{value:"best_oa_location.source.is_in_doaj",label:"Best OA Location Source In DOAJ",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"best_oa_location.source.issn",label:"Best OA Location Source ISSN",groupLabel:"Open Access",group:"open_access",inputType:"term"},{value:"best_oa_location.source.host_organization",label:"Best OA Location Source Host Organization",groupLabel:"Open Access",group:"open_access",inputType:"term"},{value:"best_oa_location.source.type",label:"Best OA Location Source Type",groupLabel:"Open Access",group:"open_access",inputType:"select"},{value:"best_oa_location.version",label:"Best OA Location Version",groupLabel:"Open Access",group:"open_access",inputType:"select"},{value:"cited_by_count",label:"Cited By Count",groupLabel:"Citations",group:"citations",inputType:"range"},{value:"concepts.id",label:"Concept ID",groupLabel:"Concepts",group:"concepts",inputType:"term"},{value:"concepts.wikidata",label:"Concept Wikidata ID",groupLabel:"Concepts",group:"concepts",inputType:"terms"},{value:"corresponding_author_ids",label:"Corresponding Author IDs",groupLabel:"Correspondance",group:"correspondance",inputType:"terms"},{value:"corresponding_institution_ids",label:"Corresponding Institution IDs",groupLabel:"Correspondance",group:"correspondance",inputType:"terms"},{value:"doi",label:"DOI",groupLabel:"Identifiers",group:"identifiers",inputType:"term"},{value:"grants.award_id",label:"Grant Award ID",groupLabel:"Funding",group:"funding",inputType:"term"},{value:"grants.funder",label:"Grant Funder",groupLabel:"Funding",group:"funding",inputType:"term"},{value:"ids.pmcid",label:"PMCID",groupLabel:"Identifiers",group:"identifiers",inputType:"term"},{value:"ids.pmid",label:"PMID",groupLabel:"Identifiers",group:"identifiers",inputType:"term"},{value:"ids.openalex",label:"OpenAlex ID",groupLabel:"Identifiers",group:"identifiers",inputType:"term"},{value:"ids.mag",label:"MAG ID",groupLabel:"Identifiers",group:"identifiers",inputType:"term"},{value:"is_paratext",label:"Is Paratext",groupLabel:"Identifiers",group:"identifiers",inputType:"boolean"},{value:"is_retracted",label:"Is Retracted",groupLabel:"Core",group:"core",inputType:"boolean"},{value:"language",label:"Language",groupLabel:"Core",group:"core",inputType:"language_code"},{value:"locations.is_oa",label:"Location is OA",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"locations.license",label:"Location License",groupLabel:"Open Access",group:"open_access",inputType:"OA-license"},{value:"locations.source.id",label:"Location Source ID",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"locations.source.is_in_doaj",label:"Location Source In DOAJ",groupLabel:"Publication",group:"publication",inputType:"boolean"},{value:"locations.source.issn",label:"Location Source ISSN",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"locations.source.host_organization",label:"Location Source Host Organization",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"locations.source.type",label:"Location Source Type",groupLabel:"Publication",group:"publication",inputType:"select"},{value:"locations.version",label:"Location Version",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"locations_count",label:"Location Count",groupLabel:"Publication",group:"publication",inputType:"range"},{value:"open_access.any_repository_has_fulltext",label:"Any Repository has Fulltext",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"open_access.is_oa",label:"Is OA",groupLabel:"Core",group:"core",inputType:"boolean"},{value:"open_access.oa_status",label:"OA Status",groupLabel:"Core",group:"core",inputType:"OA-license"},{value:"primary_location.is_oa",label:"Primary Location is OA",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"primary_location.license",label:"Primary Location License",groupLabel:"Open Access",group:"open_access",inputType:"OA-license"},{value:"primary_location.source.id",label:"Primary Location Source ID",groupLabel:"Open Access",group:"open_access",inputType:"term"},{value:"primary_location.source.is_in_doaj",label:"Primary Location Source In DOAJ",groupLabel:"Publication",group:"publication",inputType:"boolean"},{value:"primary_location.source.issn",label:"Primary Location Source ISSN",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"primary_location.source.host_organization",label:"Primary Location Source Host Organization",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"primary_location.source.type",label:"Primary Location Source Type",groupLabel:"Publication",group:"publication",inputType:"OA-license"},{value:"primary_location.version",label:"Primary Location Version",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"publication_year",label:"Publication Year",groupLabel:"Core",group:"core",inputType:"year"},{value:"publication_date",label:"Publication Date",groupLabel:"Core",group:"core",inputType:"date"},{value:"type",label:"Type",groupLabel:"Core",group:"core",inputType:"OA-pub_type"},{value:"abstract.search",label:"Abstract",groupLabel:"Search Fields",group:"search_fields",inputType:"term"},{value:"authors_count",label:"Author Count",groupLabel:"Authorship",group:"authorship",inputType:"range"},{value:"authorships.institutions.continent",label:"Institution Continent",groupLabel:"Authorship",group:"authorship",inputType:"country_code"},{value:"authorships.institutions.is_global_south",label:"Institution is Global South",groupLabel:"Authorship",group:"authorship",inputType:"boolean"},{value:"best_open_version",label:"Best Open Version",groupLabel:"Open Access",group:"open_access",inputType:"OA-license"},{value:"cited_by",label:"Cited By",groupLabel:"Citations",group:"citations",inputType:"term"},{value:"cites",label:"Cites",groupLabel:"Citations",group:"citations",inputType:"term"},{value:"concepts_count",label:"Concept Count",groupLabel:"Concepts",group:"concepts",inputType:"range"},{value:"default.search",label:"Default Search",groupLabel:"Search Fields",group:"search_fields",inputType:"term"},{value:"display_name.search",label:"Display Name Search",groupLabel:"Authorship",group:"authorship",inputType:"term"},{value:"from_created_date",label:"From Created Date",groupLabel:"Publication Dates",group:"publication_dates",inputType:"date"},{value:"from_publication_date",label:"From Publication Date",groupLabel:"Publication Dates",group:"publication_dates",inputType:"date"},{value:"from_updated_date",label:"From Updated Date",groupLabel:"Publication Dates",group:"publication_dates",inputType:"date"},{value:"fulltext.search",label:"Fulltext Search",groupLabel:"Search Fields",group:"search_fields",inputType:"term"},{value:"has_abstract",label:"Has Abstract",groupLabel:"Core",group:"core",inputType:"boolean"},{value:"has_doi",label:"Has DOI",groupLabel:"Core",group:"core",inputType:"boolean"},{value:"has_oa_accepted_or_published_version",label:"Has OA Accepted/Published Version",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"has_oa_submitted_version",label:"Has OA Submitted Version",groupLabel:"Open Access",group:"open_access",inputType:"boolean"},{value:"has_orcid",label:"Has ORCID",groupLabel:"Identifiers",group:"identifiers",inputType:"boolean"},{value:"has_pmcid",label:"Has PMCID",groupLabel:"Identifiers",group:"identifiers",inputType:"boolean"},{value:"has_pmid",label:"Has PMID",groupLabel:"Identifiers",group:"identifiers",inputType:"boolean"},{value:"has_fulltext",label:"Has FullText",groupLabel:"Misc",group:"misc",inputType:"boolean"},{value:"has_references",label:"Has References",groupLabel:"Citations",group:"citations",inputType:"boolean"},{value:"journal",label:"Journal",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"locations.source.host_institution_lineage",label:"Location Source Host Institution Lineage",groupLabel:"Publication",group:"publication",inputType:"boolean"},{value:"locations.source.publisher_lineage",label:"Location Source Publisher Lineage",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"primary_location.source.has_issn",label:"Primary Location Source Has ISSN",groupLabel:"Publication",group:"publication",inputType:"boolean"},{value:"primary_location.source.publisher_lineage",label:"Primary Location Source Publisher Lineage",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"raw_affiliation_string.search",label:"Raw Affiliation String Search",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"related_to",label:"Related To",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"repository",label:"Repository",groupLabel:"Publication",group:"publication",inputType:"term"},{value:"to_publication_date",label:"To Publication Date",groupLabel:"Publication Dates",group:"publication_dates",inputType:"date"},{value:"version",label:"Version",groupLabel:"Publication",group:"publication",inputType:"date"}],R0=["Search Fields","Core","Authorship","Publication","Concepts","Open Access","Citations","Identifiers","APC","Correspondance","Funding",void 0,"Publication Dates","Misc"],pO={items:fO},gO=Object.values(pO.items.reduce((t,n)=>(t[n.group]||(t[n.group]={filterType:n.group,filterTypeLabel:n.groupLabel,items:[]}),t[n.group].items.push(n),t),{})),mO=gO.sort((t,n)=>{if(!t.groupLabel&&!n.groupLabel)return 0;if(!t.groupLabel)return 1;if(!n.groupLabel)return-1;const r=R0.indexOf(t.groupLabel),o=R0.indexOf(n.groupLabel);return r===-1&&o===-1?0:r===-1?1:o===-1?-1:r-o}),yO=Symbol(),Rg=Symbol(),Kl="a",CS="f",O0="p",ES="c",PS="t",_S="h",hh="w",AS="o",TS="k";let vO=(t,n)=>new Proxy(t,n);const qp=Object.getPrototypeOf,Gp=new WeakMap,RS=t=>t&&(Gp.has(t)?Gp.get(t):qp(t)===Object.prototype||qp(t)===Array.prototype),k0=t=>typeof t=="object"&&t!==null,wO=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(n=>!n.configurable&&!n.writable),xO=t=>{if(Array.isArray(t))return Array.from(t);const n=Object.getOwnPropertyDescriptors(t);return Object.values(n).forEach(r=>{r.configurable=!0}),Object.create(qp(t),n)},SO=(t,n)=>{const r={[CS]:n};let o=!1;const s=(h,d)=>{if(!o){let p=r[Kl].get(t);if(p||(p={},r[Kl].set(t,p)),h===hh)p[hh]=!0;else{let m=p[h];m||(m=new Set,p[h]=m),m.add(d)}}},l=()=>{o=!0,r[Kl].delete(t)},u={get(h,d){return d===Rg?t:(s(TS,d),kS(Reflect.get(h,d),r[Kl],r[ES],r[PS]))},has(h,d){return d===yO?(l(),!0):(s(_S,d),Reflect.has(h,d))},getOwnPropertyDescriptor(h,d){return s(AS,d),Reflect.getOwnPropertyDescriptor(h,d)},ownKeys(h){return s(hh),Reflect.ownKeys(h)}};return n&&(u.set=u.deleteProperty=()=>!1),[u,r]},OS=t=>t[Rg]||t,kS=(t,n,r,o)=>{if(!RS(t))return t;let s=o&&o.get(t);if(!s){const d=OS(t);wO(d)?s=[d,xO(d)]:s=[d],o==null||o.set(t,s)}const[l,u]=s;let h=r&&r.get(l);return(!h||h[1][CS]!==!!u)&&(h=SO(l,!!u),h[1][O0]=vO(u||l,h[0]),r&&r.set(l,h)),h[1][Kl]=n,h[1][ES]=r,h[1][PS]=o,h[1][O0]},bO=(t,n)=>{const r=Reflect.ownKeys(t),o=Reflect.ownKeys(n);return r.length!==o.length||r.some((s,l)=>s!==o[l])},NS=(t,n,r,o,s=Object.is)=>{if(s(t,n))return!1;if(!k0(t)||!k0(n))return!0;const l=r.get(OS(t));if(!l)return!0;if(o){if(o.get(t)===n)return!1;o.set(t,n)}let u=null;for(const h of l[_S]||[])if(u=Reflect.has(t,h)!==Reflect.has(n,h),u)return u;if(l[hh]===!0){if(u=bO(t,n),u)return u}else for(const h of l[AS]||[]){const d=!!Reflect.getOwnPropertyDescriptor(t,h),p=!!Reflect.getOwnPropertyDescriptor(n,h);if(u=d!==p,u)return u}for(const h of l[TS]||[])if(u=NS(t[h],n[h],r,o,s),u)return u;if(u===null)throw new Error("invalid used");return u},CO=t=>RS(t)&&t[Rg]||null,N0=(t,n=!0)=>{Gp.set(t,n)};function EO(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Og(t,n){const r=EO();return r?(r[t]||(r[t]=n()),r[t]):n()}var Ql=Og("__zag__refSet",()=>new WeakSet),PO=t=>typeof t=="object"&&t!==null&&"$$typeof"in t&&"props"in t,_O=t=>typeof t=="object"&&t!==null&&"__v_isVNode"in t,AO=t=>typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeName=="string",TO=t=>PO(t)||_O(t)||AO(t),Kp=t=>t!==null&&typeof t=="object",Yp=t=>Kp(t)&&!Ql.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!TO(t)&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise);function D0(t,n,r){typeof r.value=="object"&&!Yp(r.value)&&(r.value=Ls(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||n==="__proto__"?Object.defineProperty(t,n,r):t[n]=r.value}function Ls(t){if(typeof t!="object")return t;var n=0,r,o,s,l=Object.prototype.toString.call(t);if(l==="[object Object]"?s=Object.create(Object.getPrototypeOf(t)||null):l==="[object Array]"?s=Array(t.length):l==="[object Set]"?(s=new Set,t.forEach(function(u){s.add(Ls(u))})):l==="[object Map]"?(s=new Map,t.forEach(function(u,h){s.set(Ls(h),Ls(u))})):l==="[object Date]"?s=new Date(+t):l==="[object RegExp]"?s=new RegExp(t.source,t.flags):l==="[object DataView]"?s=new t.constructor(Ls(t.buffer)):l==="[object ArrayBuffer]"?s=t.slice(0):l==="[object Blob]"?s=t.slice():l.slice(-6)==="Array]"&&(s=new t.constructor(t)),s){for(o=Object.getOwnPropertySymbols(t);nnew WeakMap),RO=(t=Object.is,n=(h,d)=>new Proxy(h,d),r=new WeakMap,o=(h,d)=>{const p=r.get(h);if((p==null?void 0:p[0])===d)return p[1];const m=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return N0(m,!0),r.set(h,[d,m]),Reflect.ownKeys(h).forEach(v=>{const y=Reflect.get(h,v);Ql.has(y)?(N0(y,!1),m[v]=y):Is.has(y)?m[v]=Li(y):m[v]=y}),Object.freeze(m)},s=new WeakMap,l=[1,1],u=h=>{if(!Kp(h))throw new Error("object required");const d=s.get(h);if(d)return d;let p=l[0];const m=new Set,v=(K,ne=++l[0])=>{p!==ne&&(p=ne,m.forEach(I=>I(K,ne)))};let y=l[1];const x=(K=++l[1])=>(y!==K&&!m.size&&(y=K,b.forEach(([ne])=>{const I=ne[1](K);I>p&&(p=I)})),p),C=K=>(ne,I)=>{const M=[...ne];M[1]=[K,...M[1]],v(M,I)},b=new Map,A=(K,ne)=>{if(m.size){const I=ne[3](C(K));b.set(K,[ne,I])}else b.set(K,[ne])},_=K=>{var I;const ne=b.get(K);ne&&(b.delete(K),(I=ne[1])==null||I.call(ne))},N=K=>(m.add(K),m.size===1&&b.forEach(([I,M],H)=>{const W=I[3](C(H));b.set(H,[I,W])}),()=>{m.delete(K),m.size===0&&b.forEach(([I,M],H)=>{M&&(M(),b.set(H,[I]))})}),R=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),Z=n(R,{deleteProperty(K,ne){const I=Reflect.get(K,ne);_(ne);const M=Reflect.deleteProperty(K,ne);return M&&v(["delete",[ne],I]),M},set(K,ne,I,M){var V;const H=Reflect.has(K,ne),W=Reflect.get(K,ne,M);if(H&&(t(W,I)||s.has(I)&&t(W,s.get(I))))return!0;_(ne),Kp(I)&&(I=CO(I)||I);let X=I;if(!((V=Object.getOwnPropertyDescriptor(K,ne))!=null&&V.set)){!Is.has(I)&&Yp(I)&&(X=kg(I));const F=!Ql.has(X)&&Is.get(X);F&&A(ne,F)}return Reflect.set(K,ne,X,M),v(["set",[ne],I,W]),!0}});s.set(h,Z);const ue=[R,x,o,N];return Is.set(Z,ue),Reflect.ownKeys(h).forEach(K=>{const ne=Object.getOwnPropertyDescriptor(h,K);ne.get||ne.set?Object.defineProperty(R,K,ne):Z[K]=h[K]}),Z})=>[u,Is,Ql,t,n,Yp,r,o,s,l],[OO]=RO();function kg(t={}){return OO(t)}function Xp(t,n,r){const o=Is.get(t);let s;const l=[],u=o[3];let h=!1;const p=u(m=>{if(l.push(m),r){n(l.splice(0));return}s||(s=Promise.resolve().then(()=>{s=void 0,h&&n(l.splice(0))}))});return h=!0,()=>{h=!1,p()}}function Li(t){const n=Is.get(t),[r,o,s]=n;return s(r,o())}function Rh(t){return Ql.add(t),t}function kO(t,n){Object.keys(n).forEach(s=>{if(Object.getOwnPropertyDescriptor(t,s))throw new Error("object property already defined");const l=n[s],{get:u,set:h}=typeof l=="function"?{get:l}:l,d={};d.get=()=>u(Li(o)),h&&(d.set=p=>h(o,p)),Object.defineProperty(t,s,d)});const o=kg(t);return o}var NO=t=>t[0],DO=t=>t[t.length-1];function IO(t){for(;t.length>0;)t.pop();return t}var I0=t=>(t==null?void 0:t.constructor.name)==="Array",MO=(t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r{if(Object.is(t,n))return!0;if(t==null&&n!=null||t!=null&&n==null)return!1;if(typeof(t==null?void 0:t.isEqual)=="function"&&typeof(n==null?void 0:n.isEqual)=="function")return t.isEqual(n);if(typeof t=="function"&&typeof n=="function")return t.toString()===n.toString();if(I0(t)&&I0(n))return MO(Array.from(t),Array.from(n));if(typeof t!="object"||typeof n!="object")return!1;const r=Object.keys(n??Object.create(null)),o=r.length;for(let s=0;s(typeof t=="function"?t(...n):t)??void 0,Go=t=>t,DS=()=>{},Jp=(...t)=>(...n)=>{t.forEach(function(r){r==null||r(...n)})},M0=(()=>{let t=0;return()=>(t++,t.toString(36))})(),Oh=t=>Array.isArray(t),IS=t=>t!=null&&typeof t=="object",dh=t=>IS(t)&&!Oh(t),Ng=t=>typeof t=="number"&&!Number.isNaN(t),Xn=t=>typeof t=="string",hc=t=>typeof t=="function",LO=t=>t==null,MS=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),FO=t=>Object.prototype.toString.call(t),LS=Function.prototype.toString,jO=LS.call(Object),Ku=t=>{if(!IS(t)||FO(t)!="[object Object]")return!1;const n=Object.getPrototypeOf(t);if(n===null)return!0;const r=MS(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&LS.call(r)==jO};function Yi(t){if(!BO(t)||t===void 0)return t;const n=Reflect.ownKeys(t).filter(o=>typeof o=="string"),r={};for(const o of n){const s=t[o];s!==void 0&&(r[o]=Yi(s))}return r}var BO=t=>t&&typeof t=="object"&&t.constructor===Object;function fh(...t){t.length===1?t[0]:t[1],t.length===2&&t[0]}function ph(...t){t.length===1?t[0]:t[1],t.length===2&&t[0]}var $O=Object.defineProperty,VO=(t,n,r)=>n in t?$O(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,Ke=(t,n,r)=>VO(t,typeof n!="symbol"?n+"":n,r);function FS(t,...n){if(!Ku(t))throw new TypeError("Source argument must be a plain object");for(const r of n){if(!Ku(r))continue;const o=Yi(r);for(const s in o){if(!Object.prototype.hasOwnProperty.call(o,s)||s==="__proto__"||s==="constructor"||s==="prototype")continue;const l=t[s],u=r[s];Ku(u)?t[s]=Ku(l)?FS(l,u):{...u}:t[s]=u}}return t}function Br(t){return Xn(t)?{type:t}:t}function Di(t){return t?Oh(t)?t.slice():[t]:[]}function jS(t){return dh(t)&&t.predicate!=null}var zO=()=>!0;function BS(t,n,r,o){return s=>{var l;return Xn(s)?!!((l=t[s])!=null&&l.call(t,n,r,o)):hc(s)?s(n,r,o):s.predicate(t)(n,r,o)}}function HO(...t){return{predicate:n=>(r,o,s)=>t.map(BS(n,r,o,s)).every(Boolean)}}function UO(t){return{predicate:n=>(r,o,s)=>!BS(n,r,o,s)(t)}}var $S={and:HO,not:UO};function VS(t,n){return t=t??zO,(r,o,s)=>{if(Xn(t)){const l=n[t];return hc(l)?l(r,o,s):l}return jS(t)?t.predicate(n)(r,o,s):t==null?void 0:t(r,o,s)}}function Zf(t,n){return(r,o,s)=>jS(t)?t.predicate(n)(r,o,s):t}function WO(t){var l,u;const n=t.computed??Go({}),r=t.context??Go({}),o=t.initial?(u=(l=t.states)==null?void 0:l[t.initial])==null?void 0:u.tags:[],s=kg({value:t.initial??"",previousValue:"",event:Go({}),previousEvent:Go({}),context:kO(r,n),done:!1,tags:o??[],hasTag(h){return this.tags.includes(h)},matches(...h){return h.includes(this.value)},can(h){return Go(this).nextEvents.includes(h)},get nextEvents(){var p,m;const h=((m=(p=t.states)==null?void 0:p[this.value])==null?void 0:m.on)??{},d=(t==null?void 0:t.on)??{};return Object.keys({...h,...d})},get changed(){return this.event.value==="machine.init"||!this.previousValue?!1:this.value!==this.previousValue}});return Go(s)}function Ml(t,n){return(r,o)=>{if(Ng(t))return t;if(hc(t))return t(r,o);if(Xn(t)){const s=Number.parseFloat(t);if(!Number.isNaN(s))return s;if(n){const l=n==null?void 0:n[t];return ph(l==null,`[@zag-js/core > determine-delay] Cannot determine delay for \`${t}\`. It doesn't exist in \`options.delays\``),hc(l)?l(r,o):l}}}}function qO(t){return Xn(t)?{target:t}:t}function GO(t,n){return(r,o,s)=>Di(t).map(qO).find(l=>VS(l.guard,n)(r,o,s)??l.target??l.actions)}var KO=class{constructor(t,n){var r,o,s,l,u;Ke(this,"status","Not Started"),Ke(this,"state"),Ke(this,"initialState"),Ke(this,"initialContext"),Ke(this,"id"),Ke(this,"type","machine"),Ke(this,"activityEvents",new Map),Ke(this,"delayedEvents",new Map),Ke(this,"stateListeners",new Set),Ke(this,"doneListeners",new Set),Ke(this,"contextWatchers",new Set),Ke(this,"removeStateListener",DS),Ke(this,"parent"),Ke(this,"children",new Map),Ke(this,"guardMap"),Ke(this,"actionMap"),Ke(this,"delayMap"),Ke(this,"activityMap"),Ke(this,"sync"),Ke(this,"options"),Ke(this,"config"),Ke(this,"_created",()=>{if(!this.config.created)return;const h=Br("machine.created");this.executeActions(this.config.created,h)}),Ke(this,"start",h=>{if(this.state.value="",this.state.tags=[],this.status==="Running")return this;this.status="Running",this.removeStateListener=Xp(this.state,()=>{this.stateListeners.forEach(x=>{x(this.stateSnapshot)})},this.sync),this.setupContextWatchers(),this.executeActivities(Br("machine.start"),Di(this.config.activities),"machine.start"),this.executeActions(this.config.entry,Br("machine.start"));const d=Br("machine.init"),p=dh(h)?h.value:h,m=dh(h)?h.context:void 0;m&&this.setContext(m);const v={target:p??this.config.initial},y=this.getNextStateInfo(v,d);return this.initialState=y,this.performStateChangeEffects(this.state.value,y,d),this}),Ke(this,"setupContextWatchers",()=>{const{watch:h}=this.config;if(!h)return;let d=Li(this.state.context);const p=Xp(this.state.context,()=>{var v;const m=Li(this.state.context);for(const[y,x]of Object.entries(h))(((v=this.options.compareFns)==null?void 0:v[y])??Object.is)(d[y],m[y])||this.executeActions(x,this.state.event);d=m});this.contextWatchers.add(p)}),Ke(this,"stop",()=>{if(this.status!=="Stopped")return this.performExitEffects(this.state.value,Br("machine.stop")),this.executeActions(this.config.exit,Br("machine.stop")),this.setState(""),this.setEvent("machine.stop"),this.stopStateListeners(),this.stopChildren(),this.stopActivities(),this.stopDelayedEvents(),this.stopContextWatchers(),this.status="Stopped",this}),Ke(this,"stopStateListeners",()=>{this.removeStateListener(),this.stateListeners.clear()}),Ke(this,"stopContextWatchers",()=>{this.contextWatchers.forEach(h=>h()),this.contextWatchers.clear()}),Ke(this,"stopDelayedEvents",()=>{this.delayedEvents.forEach(h=>{h.forEach(d=>d())}),this.delayedEvents.clear()}),Ke(this,"stopActivities",h=>{var d,p;h?((d=this.activityEvents.get(h))==null||d.forEach(m=>m()),(p=this.activityEvents.get(h))==null||p.clear(),this.activityEvents.delete(h)):(this.activityEvents.forEach(m=>{m.forEach(v=>v()),m.clear()}),this.activityEvents.clear())}),Ke(this,"sendChild",(h,d)=>{const p=Br(h),m=Qp(d,this.contextSnapshot),v=this.children.get(m);v||ph(`[@zag-js/core] Cannot send '${p.type}' event to unknown child`),v.send(p)}),Ke(this,"stopChild",h=>{this.children.has(h)||ph(`[@zag-js/core > stop-child] Cannot stop unknown child ${h}`),this.children.get(h).stop(),this.children.delete(h)}),Ke(this,"removeChild",h=>{this.children.delete(h)}),Ke(this,"stopChildren",()=>{this.children.forEach(h=>h.stop()),this.children.clear()}),Ke(this,"setParent",h=>{this.parent=h}),Ke(this,"spawn",(h,d)=>{const p=Qp(h);return d&&(p.id=d),p.type="machine.actor",p.setParent(this),this.children.set(p.id,Go(p)),p.onDone(()=>{this.removeChild(p.id)}).start(),Go(Rh(p))}),Ke(this,"stopActivity",h=>{var p;if(!this.state.value)return;const d=this.activityEvents.get(this.state.value);(p=d==null?void 0:d.get(h))==null||p(),d==null||d.delete(h)}),Ke(this,"addActivityCleanup",(h,d,p)=>{var m;h&&(this.activityEvents.has(h)?(m=this.activityEvents.get(h))==null||m.set(d,p):this.activityEvents.set(h,new Map([[d,p]])))}),Ke(this,"setState",h=>{this.state.previousValue=this.state.value,this.state.value=h;const d=this.getStateNode(h);h==null?IO(this.state.tags):this.state.tags=Di(d==null?void 0:d.tags)}),Ke(this,"setContext",h=>{h&&FS(this.state.context,h)}),Ke(this,"setOptions",h=>{const d=Yi(h);this.actionMap={...this.actionMap,...d.actions},this.delayMap={...this.delayMap,...d.delays},this.activityMap={...this.activityMap,...d.activities},this.guardMap={...this.guardMap,...d.guards}}),Ke(this,"getStateNode",h=>{var d;if(h)return(d=this.config.states)==null?void 0:d[h]}),Ke(this,"getNextStateInfo",(h,d)=>{const p=this.determineTransition(h,d),m=!(p!=null&&p.target),v=(p==null?void 0:p.target)??this.state.value,y=this.state.value!==v,x=this.getStateNode(v),b={reenter:!m&&!y&&!(p!=null&&p.internal),transition:p,stateNode:x,target:v,changed:y};return this.log("NextState:",`[${d.type}]`,this.state.value,"---->",b.target),b}),Ke(this,"getAfterActions",(h,d)=>{let p;const m=this.state.value;return{entry:()=>{p=globalThis.setTimeout(()=>{const v=this.getNextStateInfo(h,this.state.event);this.performStateChangeEffects(m,v,this.state.event)},d)},exit:()=>{globalThis.clearTimeout(p)}}}),Ke(this,"getDelayedEventActions",h=>{const d=this.getStateNode(h),p=this.state.event;if(!d||!d.after)return;const m=[],v=[];if(Oh(d.after)){const y=this.determineTransition(d.after,p);if(!y)return;if(!MS(y,"delay"))throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(y)}`);const C=Ml(y.delay,this.delayMap)(this.contextSnapshot,p),b=this.getAfterActions(y,C);return m.push(b.entry),v.push(b.exit),{entries:m,exits:v}}if(dh(d.after))for(const y in d.after){const x=d.after[y],b=Ml(y,this.delayMap)(this.contextSnapshot,p),A=this.getAfterActions(x,b);m.push(A.entry),v.push(A.exit)}return{entries:m,exits:v}}),Ke(this,"executeActions",(h,d)=>{var m;const p=Zf(h,this.guardMap)(this.contextSnapshot,d,this.guardMeta);for(const v of Di(p)){const y=Xn(v)?(m=this.actionMap)==null?void 0:m[v]:v;fh(Xn(v)&&!y,`[@zag-js/core > execute-actions] No implementation found for action: \`${v}\``),y==null||y(this.state.context,d,this.meta)}}),Ke(this,"executeActivities",(h,d,p)=>{var m;for(const v of d){const y=Xn(v)?(m=this.activityMap)==null?void 0:m[v]:v;if(!y){fh(`[@zag-js/core > execute-activity] No implementation found for activity: \`${v}\``);continue}const x=y(this.state.context,h,this.meta);if(x){const C=Xn(v)?v:v.name||M0();this.addActivityCleanup(p??this.state.value,C,x)}}}),Ke(this,"createEveryActivities",(h,d)=>{if(h)if(Oh(h)){const p=Di(h).find(x=>{const C=x.delay,A=Ml(C,this.delayMap)(this.contextSnapshot,this.state.event);return VS(x.guard,this.guardMap)(this.contextSnapshot,this.state.event,this.guardMeta)??A!=null});if(!p)return;const v=Ml(p.delay,this.delayMap)(this.contextSnapshot,this.state.event);d(()=>{const x=globalThis.setInterval(()=>{this.executeActions(p.actions,this.state.event)},v);return()=>{globalThis.clearInterval(x)}})}else for(const p in h){const m=h==null?void 0:h[p],y=Ml(p,this.delayMap)(this.contextSnapshot,this.state.event);d(()=>{const C=globalThis.setInterval(()=>{this.executeActions(m,this.state.event)},y);return()=>{globalThis.clearInterval(C)}})}}),Ke(this,"setEvent",h=>{this.state.previousEvent=this.state.event,this.state.event=Rh(Br(h))}),Ke(this,"performExitEffects",(h,d)=>{const p=this.state.value;if(p==="")return;const m=h?this.getStateNode(h):void 0;this.stopActivities(p);const v=Zf(m==null?void 0:m.exit,this.guardMap)(this.contextSnapshot,d,this.guardMeta),y=Di(v),x=this.delayedEvents.get(p);x&&y.push(...x),this.executeActions(y,d),this.delayedEvents.delete(p)}),Ke(this,"performEntryEffects",(h,d)=>{const p=this.getStateNode(h),m=Di(p==null?void 0:p.activities);this.createEveryActivities(p==null?void 0:p.every,C=>{m.unshift(C)}),m.length>0&&this.executeActivities(d,m);const v=Zf(p==null?void 0:p.entry,this.guardMap)(this.contextSnapshot,d,this.guardMeta),y=Di(v),x=this.getDelayedEventActions(h);p!=null&&p.after&&x&&(this.delayedEvents.set(h,x==null?void 0:x.exits),y.push(...x.entries)),this.executeActions(y,d),(p==null?void 0:p.type)==="final"&&(this.state.done=!0,this.doneListeners.forEach(C=>{C(this.stateSnapshot)}),this.stop())}),Ke(this,"performTransitionEffects",(h,d)=>{const p=this.determineTransition(h,d);this.executeActions(p==null?void 0:p.actions,d)}),Ke(this,"performStateChangeEffects",(h,d,p)=>{this.setEvent(p);const m=d.changed||d.reenter;m&&this.performExitEffects(h,p),this.performTransitionEffects(d.transition,p),this.setState(d.target),m&&this.performEntryEffects(d.target,p)}),Ke(this,"determineTransition",(h,d)=>{const p=GO(h,this.guardMap);return p==null?void 0:p(this.contextSnapshot,d,this.guardMeta)}),Ke(this,"sendParent",h=>{var p;this.parent||ph("[@zag-js/core > send-parent] Cannot send event to an unknown parent");const d=Br(h);(p=this.parent)==null||p.send(d)}),Ke(this,"log",(...h)=>{}),Ke(this,"send",h=>{const d=Br(h);this.transition(this.state.value,d)}),Ke(this,"transition",(h,d)=>{var x,C;const p=Xn(h)?this.getStateNode(h):h==null?void 0:h.stateNode,m=Br(d);if(!p&&!this.config.on){const b=this.status==="Stopped"?"[@zag-js/core > transition] Cannot transition a stopped machine":`[@zag-js/core > transition] State does not have a definition for \`state\`: ${h}, \`event\`: ${m.type}`;fh(b);return}const v=((x=p==null?void 0:p.on)==null?void 0:x[m.type])??((C=this.config.on)==null?void 0:C[m.type]),y=this.getNextStateInfo(v,m);return this.performStateChangeEffects(this.state.value,y,m),y.stateNode}),Ke(this,"subscribe",h=>(this.stateListeners.add(h),this.status==="Running"&&h(this.stateSnapshot),()=>{this.stateListeners.delete(h)})),Ke(this,"onDone",h=>(this.doneListeners.add(h),this)),Ke(this,"onTransition",h=>(this.stateListeners.add(h),this.status==="Running"&&h(this.stateSnapshot),this)),this.config=Ls(t),this.options=Ls(n??{}),this.id=this.config.id??`machine-${M0()}`,this.guardMap=((r=this.options)==null?void 0:r.guards)??{},this.actionMap=((o=this.options)==null?void 0:o.actions)??{},this.delayMap=((s=this.options)==null?void 0:s.delays)??{},this.activityMap=((l=this.options)==null?void 0:l.activities)??{},this.sync=((u=this.options)==null?void 0:u.sync)??!1,this.state=WO(this.config),this.initialContext=Li(this.state.context)}get stateSnapshot(){return Go(Li(this.state))}getState(){return this.stateSnapshot}get contextSnapshot(){return this.stateSnapshot.context}get self(){const t=this;return{id:this.id,send:this.send.bind(this),sendParent:this.sendParent.bind(this),sendChild:this.sendChild.bind(this),stop:this.stop.bind(this),stopChild:this.stopChild.bind(this),spawn:this.spawn.bind(this),stopActivity:this.stopActivity.bind(this),get state(){return t.stateSnapshot},get initialContext(){return t.initialContext},get initialState(){var n;return((n=t.initialState)==null?void 0:n.target)??""}}}get meta(){var t;return{state:this.stateSnapshot,guards:this.guardMap,send:this.send.bind(this),self:this.self,initialContext:this.initialContext,initialState:((t=this.initialState)==null?void 0:t.target)??"",getState:()=>this.stateSnapshot,getAction:n=>this.actionMap[n],getGuard:n=>this.guardMap[n]}}get guardMeta(){return{state:this.stateSnapshot}}get[Symbol.toStringTag](){return"Machine"}getHydrationState(){const t=this.getState();return{value:t.value,tags:t.tags}}},Ec=(t,n)=>new KO(t,n),YO=(...t)=>t.map(n=>{var r;return(r=n==null?void 0:n.trim)==null?void 0:r.call(n)}).filter(Boolean).join(" "),XO=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,L0=t=>{const n={};let r;for(;r=XO.exec(t);)n[r[1]]=r[2];return n},QO=(t,n)=>{if(Xn(t)){if(Xn(n))return`${t};${n}`;t=L0(t)}else Xn(n)&&(n=L0(n));return Object.assign({},t??{},n??{})};function Qt(...t){let n={};for(let r of t){for(let o in n){if(o.startsWith("on")&&typeof n[o]=="function"&&typeof r[o]=="function"){n[o]=Jp(r[o],n[o]);continue}if(o==="className"||o==="class"){n[o]=YO(n[o],r[o]);continue}if(o==="style"){n[o]=QO(n[o],r[o]);continue}n[o]=r[o]!==void 0?r[o]:n[o]}for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n}function JO(t){return new Proxy({},{get(){return t}})}var Us=()=>t=>Array.from(new Set(t)),Zh=JO(t=>t),F0=t=>(t==null?void 0:t.constructor.name)==="Array",ZO=(t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r{if(Object.is(t,n))return!0;if(t==null&&n!=null||t!=null&&n==null)return!1;if(typeof(t==null?void 0:t.isEqual)=="function"&&typeof(n==null?void 0:n.isEqual)=="function")return t.isEqual(n);if(typeof t=="function"&&typeof n=="function")return t.toString()===n.toString();if(F0(t)&&F0(n))return ZO(Array.from(t),Array.from(n));if(typeof t!="object"||typeof n!="object")return!1;const r=Object.keys(n??Object.create(null)),o=r.length;for(let s=0;stypeof o=="string"),r={};for(const o of n){const s=t[o];s!==void 0&&(r[o]=zS(s))}return r}var tk=t=>t&&typeof t=="object"&&t.constructor===Object;function nk(t,n){const r=$.useRef(!1),o=$.useRef(!1);$.useEffect(()=>{if(r.current&&o.current)return t();o.current=!0},n),$.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])}var rk=Og("__zag__targetCache",()=>new WeakMap);function ok(t,n){const{actions:r,context:o,sync:s}=n??{},l=$.useRef(void 0),u=$.useRef(void 0),h=$.useSyncExternalStore($.useCallback(v=>Xp(t.state,v,s),[s]),()=>{const v=Li(t.state);try{if(l.current&&u.current&&!NS(l.current,v,u.current,new WeakMap))return l.current}catch{}return v},()=>Li(t.state));t.setOptions({actions:r});const d=$.useMemo(()=>zS(o??{}),[o]);nk(()=>{const v=Object.entries(d),y=t.contextSnapshot??{};v.map(([b,A])=>({key:b,curr:A,prev:y[b],equal:Dg(y[b],A)})).every(({equal:b})=>b)||t.setContext(d)},[d]);const p=new WeakMap;$.useEffect(()=>{l.current=h,u.current=p});const m=$.useMemo(()=>new WeakMap,[]);return kS(h,p,m,rk)}function ik(t){const n=$.useRef(void 0);return n.current||(n.current={v:t()}),n.current.v}var sk=typeof document<"u"?$.useLayoutEffect:$.useEffect;function ak(t,n){const{state:r,context:o}=n??{},s=ik(()=>{const u=typeof t=="function"?t():t;return o&&u.setContext(o),u._created(),u}),l=$.useRef(void 0);return sk(()=>{const u=r??l.current;return s.start(u),()=>{s.stop()}},[]),s}function Pc(t,n){const r=ak(t,n);return[ok(r,n),r.send,r]}function lk(t,n){typeof t=="function"?t(n):t!=null&&(t.current=n)}function _c(...t){return n=>{for(const r of t)lk(r,n)}}function ck(t){var o,s;let n=(o=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const ep=t=>{const n=$.memo($.forwardRef((r,o)=>{const{asChild:s,children:l,...u}=r;if(!s)return $.createElement(t,{...u,ref:o},l);const h=$.Children.only(l);if(!$.isValidElement(h))return null;const d=ck(h);return $.cloneElement(h,{...Qt(u,h.props),ref:o?_c(o,d):d})}));return n.displayName=t.displayName||t.name,n},uk=()=>{const t=new Map;return new Proxy(ep,{apply(n,r,o){return ep(o[0])},get(n,r){const o=r;return t.has(o)||t.set(o,ep(o)),t.get(o)}})},Pn=uk();function hk(t,n){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${n}`}function Ws(t={}){const{name:n,strict:r=!0,hookName:o="useContext",providerName:s="Provider",errorMessage:l,defaultValue:u}=t,h=$.createContext(u);h.displayName=n;function d(){var m;const p=$.useContext(h);if(!p&&r){const v=new Error(l??hk(o,s));throw v.name="ContextError",(m=Error.captureStackTrace)==null||m.call(Error,v,d),v}return p}return[h.Provider,d,h]}const[dk,Ac]=Ws({name:"HoverCardContext",hookName:"useHoverCardContext",providerName:""}),HS=$.forwardRef((t,n)=>{const r=Ac(),o=Qt(r.getArrowProps(),t);return O.jsx(Pn.div,{...o,ref:n})});HS.displayName="HoverCardArrow";const US=$.forwardRef((t,n)=>{const r=Ac(),o=Qt(r.getArrowTipProps(),t);return O.jsx(Pn.div,{...o,ref:n})});US.displayName="HoverCardArrowTip";const[Ig,ed]=Ws({name:"PresenceContext",hookName:"usePresenceContext",providerName:""}),WS=$.forwardRef((t,n)=>{const r=Ac(),o=ed(),s=Qt(r.getContentProps(),o.getPresenceProps(),t);return o.unmounted?null:O.jsx(Pn.div,{...s,ref:_c(o.ref,n)})});WS.displayName="HoverCardContent";const qS=$.forwardRef((t,n)=>{const r=Ac(),o=Qt(r.getPositionerProps(),t);return ed().unmounted?null:O.jsx(Pn.div,{...o,ref:n})});qS.displayName="HoverCardPositioner";const Tc=()=>(t,n)=>n.reduce((r,o)=>{const[s,l]=r,u=o;return l[u]!==void 0&&(s[u]=l[u]),delete l[u],[s,l]},[{},{...t}]),GS=t=>Tc()(t,["immediate","lazyMount","onExitComplete","present","unmountOnExit"]);function fk(t,n,r){const o=t.matches("mounted","unmountSuspended");return{skip:!t.context.initial&&o,present:o,setNode(s){s&&n({type:"NODE.SET",node:s})},unmount(){n({type:"UNMOUNT"})}}}function pk(t){return Ec({initial:t.present?"mounted":"unmounted",context:{node:null,styles:null,unmountAnimationName:null,prevAnimationName:null,present:!1,initial:!1,...t},exit:["clearInitial","cleanupNode"],watch:{present:["setInitial","syncPresence"]},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]},"UNMOUNT.SUSPEND":"unmountSuspended"}},unmountSuspended:{activities:["trackAnimationEvents"],after:{ANIMATION_DURATION:{target:"unmounted",actions:["invokeOnExitComplete"]}},on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]}}},unmounted:{entry:["clearPrevAnimationName"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}}},{delays:{ANIMATION_DURATION(n){var r,o;return j0((r=n.styles)==null?void 0:r.animationDuration)+j0((o=n.styles)==null?void 0:o.animationDelay)+gk}},actions:{setInitial(n){n.initial=!0},clearInitial(n){n.initial=!1},cleanupNode(n){n.node=null,n.styles=null},invokeOnExitComplete(n){var r;(r=n.onExitComplete)==null||r.call(n)},setNode(n,r){n.node=Rh(r.node)},setStyles(n,r){const o=r.node.ownerDocument.defaultView||window;n.styles=Rh(o.getComputedStyle(r.node))},syncPresence(n,r,{send:o}){var u;if(n.present){o({type:"MOUNT",src:"presence.changed"});return}if(!n.present&&((u=n.node)==null?void 0:u.ownerDocument.visibilityState)==="hidden"){o({type:"UNMOUNT",src:"visibilitychange"});return}const s=Yu(n.styles);(n.immediate?queueMicrotask:requestAnimationFrame)(()=>{var h,d;n.unmountAnimationName=s,s==="none"||s===n.prevAnimationName||((h=n.styles)==null?void 0:h.display)==="none"||((d=n.styles)==null?void 0:d.animationDuration)==="0s"?o({type:"UNMOUNT",src:"presence.changed"}):o({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName(n){(n.immediate?queueMicrotask:requestAnimationFrame)(()=>{n.prevAnimationName=Yu(n.styles)})},clearPrevAnimationName(n){n.prevAnimationName=null}},activities:{trackAnimationEvents(n,r,{send:o}){const s=n.node;if(!s)return;const l=h=>{var p,m;(((m=(p=h.composedPath)==null?void 0:p.call(h))==null?void 0:m[0])??h.target)===s&&(n.prevAnimationName=Yu(n.styles))},u=h=>{var m,v;const d=Yu(n.styles);(((v=(m=h.composedPath)==null?void 0:m.call(h))==null?void 0:v[0])??h.target)===s&&d===n.unmountAnimationName&&o({type:"UNMOUNT",src:"animationend"})};return s.addEventListener("animationstart",l),s.addEventListener("animationcancel",u),s.addEventListener("animationend",u),()=>{s.removeEventListener("animationstart",l),s.removeEventListener("animationcancel",u),s.removeEventListener("animationend",u)}}}})}function Yu(t){return(t==null?void 0:t.animationName)||"none"}function j0(t){return parseFloat(t||"0")*1e3}var gk=16.667;Us()(["onExitComplete","present","immediate"]);function Bi(t,n={}){const{sync:r=!1}=n,o=mk(t);return $.useCallback((...s)=>{var l;return r?queueMicrotask(()=>{var u;return(u=o.current)==null?void 0:u.call(o,...s)}):(l=o.current)==null?void 0:l.call(o,...s)},[r,o])}function mk(t){const n=$.useRef(t);return n.current=t,n}const td=t=>{const{lazyMount:n,unmountOnExit:r,present:o,...s}=t,l=$.useRef(!1),u={...s,present:o,onExitComplete:Bi(t.onExitComplete)},[h,d]=Pc(pk(u),{context:u}),p=fk(h,d);p.present&&(l.current=!0);const m=!p.present&&!l.current&&n||r&&!p.present&&l.current,v=()=>({"data-state":o?"open":"closed",hidden:!p.present});return{ref:p.setNode,getPresenceProps:v,present:p.present,unmounted:m}};var Bs=(t,n=[])=>({parts:(...r)=>{if(yk(n))return Bs(t,r);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...r)=>Bs(t,[...n,...r]),rename:r=>Bs(r,n),keys:()=>n,build:()=>[...new Set(n)].reduce((r,o)=>Object.assign(r,{[o]:{selector:[`&[data-scope="${Ia(t)}"][data-part="${Ia(o)}"]`,`& [data-scope="${Ia(t)}"][data-part="${Ia(o)}"]`].join(", "),attrs:{"data-scope":Ia(t),"data-part":Ia(o)}}}),{})}),Ia=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),yk=t=>t.length===0;const vk=["top","right","bottom","left"],Hi=Math.min,Kn=Math.max,kh=Math.round,Xu=Math.floor,mo=t=>({x:t,y:t}),wk={left:"right",right:"left",bottom:"top",top:"bottom"},xk={start:"end",end:"start"};function Zp(t,n,r){return Kn(t,Hi(n,r))}function Zo(t,n){return typeof t=="function"?t(n):t}function ei(t){return t.split("-")[0]}function Ya(t){return t.split("-")[1]}function Mg(t){return t==="x"?"y":"x"}function Lg(t){return t==="y"?"height":"width"}function Ui(t){return["top","bottom"].includes(ei(t))?"y":"x"}function Fg(t){return Mg(Ui(t))}function Sk(t,n,r){r===void 0&&(r=!1);const o=Ya(t),s=Fg(t),l=Lg(s);let u=s==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(u=Nh(u)),[u,Nh(u)]}function bk(t){const n=Nh(t);return[eg(t),n,eg(n)]}function eg(t){return t.replace(/start|end/g,n=>xk[n])}function Ck(t,n,r){const o=["left","right"],s=["right","left"],l=["top","bottom"],u=["bottom","top"];switch(t){case"top":case"bottom":return r?n?s:o:n?o:s;case"left":case"right":return n?l:u;default:return[]}}function Ek(t,n,r,o){const s=Ya(t);let l=Ck(ei(t),r==="start",o);return s&&(l=l.map(u=>u+"-"+s),n&&(l=l.concat(l.map(eg)))),l}function Nh(t){return t.replace(/left|right|bottom|top/g,n=>wk[n])}function Pk(t){return{top:0,right:0,bottom:0,left:0,...t}}function KS(t){return typeof t!="number"?Pk(t):{top:t,right:t,bottom:t,left:t}}function Dh(t){const{x:n,y:r,width:o,height:s}=t;return{width:o,height:s,top:r,left:n,right:n+o,bottom:r+s,x:n,y:r}}function B0(t,n,r){let{reference:o,floating:s}=t;const l=Ui(n),u=Fg(n),h=Lg(u),d=ei(n),p=l==="y",m=o.x+o.width/2-s.width/2,v=o.y+o.height/2-s.height/2,y=o[h]/2-s[h]/2;let x;switch(d){case"top":x={x:m,y:o.y-s.height};break;case"bottom":x={x:m,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:v};break;case"left":x={x:o.x-s.width,y:v};break;default:x={x:o.x,y:o.y}}switch(Ya(n)){case"start":x[u]-=y*(r&&p?-1:1);break;case"end":x[u]+=y*(r&&p?-1:1);break}return x}const _k=async(t,n,r)=>{const{placement:o="bottom",strategy:s="absolute",middleware:l=[],platform:u}=r,h=l.filter(Boolean),d=await(u.isRTL==null?void 0:u.isRTL(n));let p=await u.getElementRects({reference:t,floating:n,strategy:s}),{x:m,y:v}=B0(p,o,d),y=o,x={},C=0;for(let b=0;b({name:"arrow",options:t,async fn(n){const{x:r,y:o,placement:s,rects:l,platform:u,elements:h,middlewareData:d}=n,{element:p,padding:m=0}=Zo(t,n)||{};if(p==null)return{};const v=KS(m),y={x:r,y:o},x=Fg(s),C=Lg(x),b=await u.getDimensions(p),A=x==="y",_=A?"top":"left",N=A?"bottom":"right",R=A?"clientHeight":"clientWidth",D=l.reference[C]+l.reference[x]-y[x]-l.floating[C],Z=y[x]-l.reference[x],ue=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let K=ue?ue[R]:0;(!K||!await(u.isElement==null?void 0:u.isElement(ue)))&&(K=h.floating[R]||l.floating[C]);const ne=D/2-Z/2,I=K/2-b[C]/2-1,M=Hi(v[_],I),H=Hi(v[N],I),W=M,X=K-b[C]-H,V=K/2-b[C]/2+ne,F=Zp(W,V,X),j=!d.arrow&&Ya(s)!=null&&V!==F&&l.reference[C]/2-(VV<=0)){var H,W;const V=(((H=l.flip)==null?void 0:H.index)||0)+1,F=K[V];if(F)return{data:{index:V,overflows:M},reset:{placement:F}};let j=(W=M.filter(Y=>Y.overflows[0]<=0).sort((Y,z)=>Y.overflows[1]-z.overflows[1])[0])==null?void 0:W.placement;if(!j)switch(x){case"bestFit":{var X;const Y=(X=M.filter(z=>{if(ue){const G=Ui(z.placement);return G===N||G==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(G=>G>0).reduce((G,J)=>G+J,0)]).sort((z,G)=>z[1]-G[1])[0])==null?void 0:X[0];Y&&(j=Y);break}case"initialPlacement":j=h;break}if(s!==j)return{reset:{placement:j}}}return{}}}};function $0(t,n){return{top:t.top-n.height,right:t.right-n.width,bottom:t.bottom-n.height,left:t.left-n.width}}function V0(t){return vk.some(n=>t[n]>=0)}const Rk=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(n){const{rects:r}=n,{strategy:o="referenceHidden",...s}=Zo(t,n);switch(o){case"referenceHidden":{const l=await dc(n,{...s,elementContext:"reference"}),u=$0(l,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:V0(u)}}}case"escaped":{const l=await dc(n,{...s,altBoundary:!0}),u=$0(l,r.floating);return{data:{escapedOffsets:u,escaped:V0(u)}}}default:return{}}}}};async function Ok(t,n){const{placement:r,platform:o,elements:s}=t,l=await(o.isRTL==null?void 0:o.isRTL(s.floating)),u=ei(r),h=Ya(r),d=Ui(r)==="y",p=["left","top"].includes(u)?-1:1,m=l&&d?-1:1,v=Zo(n,t);let{mainAxis:y,crossAxis:x,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return h&&typeof C=="number"&&(x=h==="end"?C*-1:C),d?{x:x*m,y:y*p}:{x:y*p,y:x*m}}const kk=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var r,o;const{x:s,y:l,placement:u,middlewareData:h}=n,d=await Ok(n,t);return u===((r=h.offset)==null?void 0:r.placement)&&(o=h.arrow)!=null&&o.alignmentOffset?{}:{x:s+d.x,y:l+d.y,data:{...d,placement:u}}}}},Nk=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:r,y:o,placement:s}=n,{mainAxis:l=!0,crossAxis:u=!1,limiter:h={fn:A=>{let{x:_,y:N}=A;return{x:_,y:N}}},...d}=Zo(t,n),p={x:r,y:o},m=await dc(n,d),v=Ui(ei(s)),y=Mg(v);let x=p[y],C=p[v];if(l){const A=y==="y"?"top":"left",_=y==="y"?"bottom":"right",N=x+m[A],R=x-m[_];x=Zp(N,x,R)}if(u){const A=v==="y"?"top":"left",_=v==="y"?"bottom":"right",N=C+m[A],R=C-m[_];C=Zp(N,C,R)}const b=h.fn({...n,[y]:x,[v]:C});return{...b,data:{x:b.x-r,y:b.y-o,enabled:{[y]:l,[v]:u}}}}}},Dk=function(t){return t===void 0&&(t={}),{options:t,fn(n){const{x:r,y:o,placement:s,rects:l,middlewareData:u}=n,{offset:h=0,mainAxis:d=!0,crossAxis:p=!0}=Zo(t,n),m={x:r,y:o},v=Ui(s),y=Mg(v);let x=m[y],C=m[v];const b=Zo(h,n),A=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const R=y==="y"?"height":"width",D=l.reference[y]-l.floating[R]+A.mainAxis,Z=l.reference[y]+l.reference[R]-A.mainAxis;xZ&&(x=Z)}if(p){var _,N;const R=y==="y"?"width":"height",D=["top","left"].includes(ei(s)),Z=l.reference[v]-l.floating[R]+(D&&((_=u.offset)==null?void 0:_[v])||0)+(D?0:A.crossAxis),ue=l.reference[v]+l.reference[R]+(D?0:((N=u.offset)==null?void 0:N[v])||0)-(D?A.crossAxis:0);Cue&&(C=ue)}return{[y]:x,[v]:C}}}},Ik=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(n){var r,o;const{placement:s,rects:l,platform:u,elements:h}=n,{apply:d=()=>{},...p}=Zo(t,n),m=await dc(n,p),v=ei(s),y=Ya(s),x=Ui(s)==="y",{width:C,height:b}=l.floating;let A,_;v==="top"||v==="bottom"?(A=v,_=y===(await(u.isRTL==null?void 0:u.isRTL(h.floating))?"start":"end")?"left":"right"):(_=v,A=y==="end"?"top":"bottom");const N=b-m.top-m.bottom,R=C-m.left-m.right,D=Hi(b-m[A],N),Z=Hi(C-m[_],R),ue=!n.middlewareData.shift;let K=D,ne=Z;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(ne=R),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(K=N),ue&&!y){const M=Kn(m.left,0),H=Kn(m.right,0),W=Kn(m.top,0),X=Kn(m.bottom,0);x?ne=C-2*(M!==0||H!==0?M+H:Kn(m.left,m.right)):K=b-2*(W!==0||X!==0?W+X:Kn(m.top,m.bottom))}await d({...n,availableWidth:ne,availableHeight:K});const I=await u.getDimensions(h.floating);return C!==I.width||b!==I.height?{reset:{rects:!0}}:{}}}};function nd(){return typeof window<"u"}function Xa(t){return YS(t)?(t.nodeName||"").toLowerCase():"#document"}function Qn(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function xo(t){var n;return(n=(YS(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function YS(t){return nd()?t instanceof Node||t instanceof Qn(t).Node:!1}function Gr(t){return nd()?t instanceof Element||t instanceof Qn(t).Element:!1}function yo(t){return nd()?t instanceof HTMLElement||t instanceof Qn(t).HTMLElement:!1}function z0(t){return!nd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qn(t).ShadowRoot}function Rc(t){const{overflow:n,overflowX:r,overflowY:o,display:s}=Kr(t);return/auto|scroll|overlay|hidden|clip/.test(n+o+r)&&!["inline","contents"].includes(s)}function Mk(t){return["table","td","th"].includes(Xa(t))}function rd(t){return[":popover-open",":modal"].some(n=>{try{return t.matches(n)}catch{return!1}})}function jg(t){const n=Bg(),r=Gr(t)?Kr(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>r[o]?r[o]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!n&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!n&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(r.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(r.contain||"").includes(o))}function Lk(t){let n=Wi(t);for(;yo(n)&&!Ka(n);){if(jg(n))return n;if(rd(n))return null;n=Wi(n)}return null}function Bg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ka(t){return["html","body","#document"].includes(Xa(t))}function Kr(t){return Qn(t).getComputedStyle(t)}function od(t){return Gr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Wi(t){if(Xa(t)==="html")return t;const n=t.assignedSlot||t.parentNode||z0(t)&&t.host||xo(t);return z0(n)?n.host:n}function XS(t){const n=Wi(t);return Ka(n)?t.ownerDocument?t.ownerDocument.body:t.body:yo(n)&&Rc(n)?n:XS(n)}function fc(t,n,r){var o;n===void 0&&(n=[]),r===void 0&&(r=!0);const s=XS(t),l=s===((o=t.ownerDocument)==null?void 0:o.body),u=Qn(s);if(l){const h=tg(u);return n.concat(u,u.visualViewport||[],Rc(s)?s:[],h&&r?fc(h):[])}return n.concat(s,fc(s,[],r))}function tg(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function QS(t){const n=Kr(t);let r=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const s=yo(t),l=s?t.offsetWidth:r,u=s?t.offsetHeight:o,h=kh(r)!==l||kh(o)!==u;return h&&(r=l,o=u),{width:r,height:o,$:h}}function $g(t){return Gr(t)?t:t.contextElement}function Va(t){const n=$g(t);if(!yo(n))return mo(1);const r=n.getBoundingClientRect(),{width:o,height:s,$:l}=QS(n);let u=(l?kh(r.width):r.width)/o,h=(l?kh(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!h||!Number.isFinite(h))&&(h=1),{x:u,y:h}}const Fk=mo(0);function JS(t){const n=Qn(t);return!Bg()||!n.visualViewport?Fk:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function jk(t,n,r){return n===void 0&&(n=!1),!r||n&&r!==Qn(t)?!1:n}function Hs(t,n,r,o){n===void 0&&(n=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),l=$g(t);let u=mo(1);n&&(o?Gr(o)&&(u=Va(o)):u=Va(t));const h=jk(l,r,o)?JS(l):mo(0);let d=(s.left+h.x)/u.x,p=(s.top+h.y)/u.y,m=s.width/u.x,v=s.height/u.y;if(l){const y=Qn(l),x=o&&Gr(o)?Qn(o):o;let C=y,b=tg(C);for(;b&&o&&x!==C;){const A=Va(b),_=b.getBoundingClientRect(),N=Kr(b),R=_.left+(b.clientLeft+parseFloat(N.paddingLeft))*A.x,D=_.top+(b.clientTop+parseFloat(N.paddingTop))*A.y;d*=A.x,p*=A.y,m*=A.x,v*=A.y,d+=R,p+=D,C=Qn(b),b=tg(C)}}return Dh({width:m,height:v,x:d,y:p})}function Vg(t,n){const r=od(t).scrollLeft;return n?n.left+r:Hs(xo(t)).left+r}function ZS(t,n,r){r===void 0&&(r=!1);const o=t.getBoundingClientRect(),s=o.left+n.scrollLeft-(r?0:Vg(t,o)),l=o.top+n.scrollTop;return{x:s,y:l}}function Bk(t){let{elements:n,rect:r,offsetParent:o,strategy:s}=t;const l=s==="fixed",u=xo(o),h=n?rd(n.floating):!1;if(o===u||h&&l)return r;let d={scrollLeft:0,scrollTop:0},p=mo(1);const m=mo(0),v=yo(o);if((v||!v&&!l)&&((Xa(o)!=="body"||Rc(u))&&(d=od(o)),yo(o))){const x=Hs(o);p=Va(o),m.x=x.x+o.clientLeft,m.y=x.y+o.clientTop}const y=u&&!v&&!l?ZS(u,d,!0):mo(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-d.scrollLeft*p.x+m.x+y.x,y:r.y*p.y-d.scrollTop*p.y+m.y+y.y}}function $k(t){return Array.from(t.getClientRects())}function Vk(t){const n=xo(t),r=od(t),o=t.ownerDocument.body,s=Kn(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),l=Kn(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let u=-r.scrollLeft+Vg(t);const h=-r.scrollTop;return Kr(o).direction==="rtl"&&(u+=Kn(n.clientWidth,o.clientWidth)-s),{width:s,height:l,x:u,y:h}}function zk(t,n){const r=Qn(t),o=xo(t),s=r.visualViewport;let l=o.clientWidth,u=o.clientHeight,h=0,d=0;if(s){l=s.width,u=s.height;const p=Bg();(!p||p&&n==="fixed")&&(h=s.offsetLeft,d=s.offsetTop)}return{width:l,height:u,x:h,y:d}}function Hk(t,n){const r=Hs(t,!0,n==="fixed"),o=r.top+t.clientTop,s=r.left+t.clientLeft,l=yo(t)?Va(t):mo(1),u=t.clientWidth*l.x,h=t.clientHeight*l.y,d=s*l.x,p=o*l.y;return{width:u,height:h,x:d,y:p}}function H0(t,n,r){let o;if(n==="viewport")o=zk(t,r);else if(n==="document")o=Vk(xo(t));else if(Gr(n))o=Hk(n,r);else{const s=JS(t);o={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return Dh(o)}function eb(t,n){const r=Wi(t);return r===n||!Gr(r)||Ka(r)?!1:Kr(r).position==="fixed"||eb(r,n)}function Uk(t,n){const r=n.get(t);if(r)return r;let o=fc(t,[],!1).filter(h=>Gr(h)&&Xa(h)!=="body"),s=null;const l=Kr(t).position==="fixed";let u=l?Wi(t):t;for(;Gr(u)&&!Ka(u);){const h=Kr(u),d=jg(u);!d&&h.position==="fixed"&&(s=null),(l?!d&&!s:!d&&h.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Rc(u)&&!d&&eb(t,u))?o=o.filter(m=>m!==u):s=h,u=Wi(u)}return n.set(t,o),o}function Wk(t){let{element:n,boundary:r,rootBoundary:o,strategy:s}=t;const u=[...r==="clippingAncestors"?rd(n)?[]:Uk(n,this._c):[].concat(r),o],h=u[0],d=u.reduce((p,m)=>{const v=H0(n,m,s);return p.top=Kn(v.top,p.top),p.right=Hi(v.right,p.right),p.bottom=Hi(v.bottom,p.bottom),p.left=Kn(v.left,p.left),p},H0(n,h,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function qk(t){const{width:n,height:r}=QS(t);return{width:n,height:r}}function Gk(t,n,r){const o=yo(n),s=xo(n),l=r==="fixed",u=Hs(t,!0,l,n);let h={scrollLeft:0,scrollTop:0};const d=mo(0);if(o||!o&&!l)if((Xa(n)!=="body"||Rc(s))&&(h=od(n)),o){const y=Hs(n,!0,l,n);d.x=y.x+n.clientLeft,d.y=y.y+n.clientTop}else s&&(d.x=Vg(s));const p=s&&!o&&!l?ZS(s,h):mo(0),m=u.left+h.scrollLeft-d.x-p.x,v=u.top+h.scrollTop-d.y-p.y;return{x:m,y:v,width:u.width,height:u.height}}function tp(t){return Kr(t).position==="static"}function U0(t,n){if(!yo(t)||Kr(t).position==="fixed")return null;if(n)return n(t);let r=t.offsetParent;return xo(t)===r&&(r=r.ownerDocument.body),r}function tb(t,n){const r=Qn(t);if(rd(t))return r;if(!yo(t)){let s=Wi(t);for(;s&&!Ka(s);){if(Gr(s)&&!tp(s))return s;s=Wi(s)}return r}let o=U0(t,n);for(;o&&Mk(o)&&tp(o);)o=U0(o,n);return o&&Ka(o)&&tp(o)&&!jg(o)?r:o||Lk(t)||r}const Kk=async function(t){const n=this.getOffsetParent||tb,r=this.getDimensions,o=await r(t.floating);return{reference:Gk(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Yk(t){return Kr(t).direction==="rtl"}const Xk={convertOffsetParentRelativeRectToViewportRelativeRect:Bk,getDocumentElement:xo,getClippingRect:Wk,getOffsetParent:tb,getElementRects:Kk,getClientRects:$k,getDimensions:qk,getScale:Va,isElement:Gr,isRTL:Yk};function nb(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function Qk(t,n){let r=null,o;const s=xo(t);function l(){var h;clearTimeout(o),(h=r)==null||h.disconnect(),r=null}function u(h,d){h===void 0&&(h=!1),d===void 0&&(d=1),l();const p=t.getBoundingClientRect(),{left:m,top:v,width:y,height:x}=p;if(h||n(),!y||!x)return;const C=Xu(v),b=Xu(s.clientWidth-(m+y)),A=Xu(s.clientHeight-(v+x)),_=Xu(m),R={rootMargin:-C+"px "+-b+"px "+-A+"px "+-_+"px",threshold:Kn(0,Hi(1,d))||1};let D=!0;function Z(ue){const K=ue[0].intersectionRatio;if(K!==d){if(!D)return u();K?u(!1,K):o=setTimeout(()=>{u(!1,1e-7)},1e3)}K===1&&!nb(p,t.getBoundingClientRect())&&u(),D=!1}try{r=new IntersectionObserver(Z,{...R,root:s.ownerDocument})}catch{r=new IntersectionObserver(Z,R)}r.observe(t)}return u(!0),l}function Jk(t,n,r,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,p=$g(t),m=s||l?[...p?fc(p):[],...fc(n)]:[];m.forEach(_=>{s&&_.addEventListener("scroll",r,{passive:!0}),l&&_.addEventListener("resize",r)});const v=p&&h?Qk(p,r):null;let y=-1,x=null;u&&(x=new ResizeObserver(_=>{let[N]=_;N&&N.target===p&&x&&(x.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var R;(R=x)==null||R.observe(n)})),r()}),p&&!d&&x.observe(p),x.observe(n));let C,b=d?Hs(t):null;d&&A();function A(){const _=Hs(t);b&&!nb(b,_)&&r(),b=_,C=requestAnimationFrame(A)}return r(),()=>{var _;m.forEach(N=>{s&&N.removeEventListener("scroll",r),l&&N.removeEventListener("resize",r)}),v==null||v(),(_=x)==null||_.disconnect(),x=null,d&&cancelAnimationFrame(C)}}const Zk=kk,eN=Nk,tN=Tk,nN=Ik,rN=Rk,oN=Ak,iN=Dk,sN=(t,n,r)=>{const o=new Map,s={platform:Xk,...r},l={...s.platform,_c:o};return _k(t,n,{...s,platform:l})};var id=t=>typeof t=="object"&&t!==null,Ts=t=>t?"":void 0,aN=1,lN=9,cN=11,gn=t=>id(t)&&t.nodeType===aN&&typeof t.nodeName=="string",zg=t=>id(t)&&t.nodeType===lN,uN=t=>id(t)&&t===t.window,rb=t=>gn(t)?t.localName||"":"#document";function hN(t){return["html","body","#document"].includes(rb(t))}var dN=t=>id(t)&&t.nodeType!==void 0,pc=t=>dN(t)&&t.nodeType===cN&&"host"in t,fN=t=>gn(t)&&t.localName==="input",pN=t=>!!(t!=null&&t.matches("a[href]")),gN=t=>gn(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,mN=/(textarea|select)/;function yN(t){if(t==null||!gn(t))return!1;try{return fN(t)&&t.selectionStart!=null||mN.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function gc(t,n){var o;if(!t||!n||!gn(t)||!gn(n))return!1;const r=(o=n.getRootNode)==null?void 0:o.call(n);if(t===n||t.contains(n))return!0;if(r&&pc(r)){let s=n;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function ni(t){return zg(t)?t:uN(t)?t.document:(t==null?void 0:t.ownerDocument)??document}function vN(t){return ni(t).documentElement}function Qa(t){var n;return pc(t)?Qa(t.host):zg(t)?t.defaultView??window:gn(t)?((n=t.ownerDocument)==null?void 0:n.defaultView)??window:window}function ob(t){let n=t.activeElement;for(;n!=null&&n.shadowRoot;){const r=n.shadowRoot.activeElement;if(r===n)break;n=r}return n}function wN(t){if(rb(t)==="html")return t;const n=t.assignedSlot||t.parentNode||pc(t)&&t.host||vN(t);return pc(n)?n.host:n}var np=new WeakMap;function ib(t){return np.has(t)||np.set(t,Qa(t).getComputedStyle(t)),np.get(t)}var Hg=()=>typeof document<"u";function xN(){const t=navigator.userAgentData;return(t==null?void 0:t.platform)??navigator.platform}function SN(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:n,version:r})=>`${n}/${r}`).join(" "):navigator.userAgent}var Ug=t=>Hg()&&t.test(xN()),bN=t=>Hg()&&t.test(SN()),CN=t=>Hg()&&t.test(navigator.vendor),EN=()=>Ug(/^Mac/),PN=()=>AN()&&CN(/apple/i),_N=()=>bN(/firefox\//i),AN=()=>Ug(/mac|iphone|ipad|ipod/i),TN=()=>Ug(/iP(hone|ad|od)|iOS/);function RN(t){var n,r,o;return((n=t.composedPath)==null?void 0:n.call(t))??((o=(r=t.nativeEvent)==null?void 0:r.composedPath)==null?void 0:o.call(r))}function Yo(t){const n=RN(t);return(n==null?void 0:n[0])??t.target}var ON=t=>gc(t.currentTarget,Yo(t));function kN(t){return MN(t).isComposing}var NN=t=>t.button===2||EN()&&t.ctrlKey&&t.button===0,DN={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},W0={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function IN(t,n={}){const{dir:r="ltr",orientation:o="horizontal"}=n;let s=t.key;return s=DN[s]??s,r==="rtl"&&o==="horizontal"&&s in W0&&(s=W0[s]),s}function MN(t){return t.nativeEvent??t}var po=(t,n,r,o)=>{const s=typeof t=="function"?t():t;return s==null||s.addEventListener(n,r,o),()=>{s==null||s.removeEventListener(n,r,o)}};function LN(t,n){const{type:r="HTMLInputElement",property:o="value"}=n,s=Qa(t)[r].prototype;return Object.getOwnPropertyDescriptor(s,o)??{}}function FN(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function jN(t,n,r="value"){var s;const o=FN(t);o&&((s=LN(t,{type:o,property:r}).set)==null||s.call(t,n)),t.setAttribute(r,n)}var sb=t=>gn(t)&&t.tagName==="IFRAME",BN=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),$N=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,Wg="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",qg=(t,n=!1)=>{if(!t)return[];const r=Array.from(t.querySelectorAll(Wg));(n==!0||n=="if-empty"&&r.length===0)&&gn(t)&&$i(t)&&r.unshift(t);const s=r.filter($i);return s.forEach((l,u)=>{if(sb(l)&&l.contentDocument){const h=l.contentDocument.body;s.splice(u,1,...qg(h))}}),s};function $i(t){return!t||t.closest("[inert]")?!1:t.matches(Wg)&&gN(t)}function ab(t,n){if(!t)return[];const o=Array.from(t.querySelectorAll(Wg)).filter(Ns);return o.forEach((s,l)=>{if(sb(s)&&s.contentDocument){const u=s.contentDocument.body,h=ab(u);o.splice(l,1,...h)}}),o.length,o}function Ns(t){return t!=null&&t.tabIndex>0?!0:$i(t)&&!$N(t)}function Ll(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||yN(t))&&!BN(t)?0:t.tabIndex}function q0(t){const n=new Set;function r(o){const s=globalThis.requestAnimationFrame(o);n.add(()=>globalThis.cancelAnimationFrame(s))}return r(()=>r(t)),function(){n.forEach(s=>s())}}function En(t){const n=globalThis.requestAnimationFrame(t);return()=>{globalThis.cancelAnimationFrame(n)}}function VN(t,n,r){const o=En(()=>{t.removeEventListener(n,s,!0),r()}),s=()=>{o(),r()};return t.addEventListener(n,s,{once:!0,capture:!0}),o}function zN(t){const n=()=>t.click();_N()?VN(t,"keyup",n):queueMicrotask(n)}function ng(t){const n=wN(t);return hN(n)?ni(n).body:gn(n)&&UN(n)?n:ng(n)}var HN=/auto|scroll|overlay|hidden|clip/;function UN(t){const n=Qa(t),{overflow:r,overflowX:o,overflowY:s,display:l}=n.getComputedStyle(t);return HN.test(r+s+o)&&!["inline","contents"].includes(l)}function WN(t,n){return Array.from((t==null?void 0:t.querySelectorAll(n))??[])}var lb=t=>t.id;function cb(t,n,r=lb){return t.find(o=>r(o)===n)}function ub(t,n,r=lb){const o=cb(t,n,r);return o?t.indexOf(o):-1}function qN(t,n,r=!0){let o=ub(t,n);return o=r?(o+1)%t.length:Math.min(o+1,t.length-1),t[o]}function GN(t,n,r=!0){let o=ub(t,n);return o===-1?r?t[t.length-1]:null:(o=r?(o-1+t.length)%t.length:Math.max(0,o-1),t[o])}function sd(t){const n={getRootNode:r=>{var o;return((o=r.getRootNode)==null?void 0:o.call(r))??document},getDoc:r=>ni(n.getRootNode(r)),getWin:r=>n.getDoc(r).defaultView??window,getActiveElement:r=>ob(n.getRootNode(r)),isActiveElement:(r,o)=>o===n.getActiveElement(r),getById:(r,o)=>n.getRootNode(r).getElementById(o),setValue:(r,o)=>{r==null||o==null||jN(r,o.toString())}};return{...n,...t}}var rp=new WeakMap;function KN(t,n,r){rp.has(t)||rp.set(t,new Map);const o=rp.get(t),s=o.get(n);if(!s)return o.set(n,r()),()=>{var h;(h=o.get(n))==null||h(),o.delete(n)};const l=r(),u=()=>{l(),s(),o.delete(n)};return o.set(n,u),()=>{o.get(n)===u&&(l(),o.set(n,s))}}function YN(t,n){return t?KN(t,"style",()=>{const o=t.style.cssText;return Object.assign(t.style,n),()=>{t.style.cssText=o}}):()=>{}}var XN=1e3/60;function QN(t,n){const r=t();if(gn(r)&&r.isConnected)return n(r),()=>{};{const o=setInterval(()=>{const s=t();gn(s)&&s.isConnected&&(n(s),clearInterval(o))},XN);return()=>clearInterval(o)}}function JN(t,n){const r=[];return t==null||t.forEach(o=>{const s=QN(o,n);r.push(s)}),()=>{r.forEach(o=>o())}}function G0(t=0,n=0,r=0,o=0){if(typeof DOMRect=="function")return new DOMRect(t,n,r,o);const s={x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:n+o,left:t};return{...s,toJSON:()=>s}}function ZN(t){if(!t)return G0();const{x:n,y:r,width:o,height:s}=t;return G0(n,r,o,s)}function eD(t,n){return{contextElement:gn(t)?t:void 0,getBoundingClientRect:()=>{const r=t,o=n==null?void 0:n(r);return o||!r?ZN(o):r.getBoundingClientRect()}}}var Fl=t=>({variable:t,reference:`var(${t})`}),Wo={arrowSize:Fl("--arrow-size"),arrowSizeHalf:Fl("--arrow-size-half"),arrowBg:Fl("--arrow-background"),transformOrigin:Fl("--transform-origin"),arrowOffset:Fl("--arrow-offset")},tD=t=>({top:"bottom center","top-start":t?`${t.x}px bottom`:"left bottom","top-end":t?`${t.x}px bottom`:"right bottom",bottom:"top center","bottom-start":t?`${t.x}px top`:"top left","bottom-end":t?`${t.x}px top`:"top right",left:"right center","left-start":t?`right ${t.y}px`:"right top","left-end":t?`right ${t.y}px`:"right bottom",right:"left center","right-start":t?`left ${t.y}px`:"left top","right-end":t?`left ${t.y}px`:"left bottom"}),nD={name:"transformOrigin",fn({placement:t,elements:n,middlewareData:r}){const{arrow:o}=r,s=tD(o)[t],{floating:l}=n;return l.style.setProperty(Wo.transformOrigin.variable,s),{data:{transformOrigin:s}}}},rD={name:"rects",fn({rects:t}){return{data:t}}},oD=t=>{if(t)return{name:"shiftArrow",fn({placement:n,middlewareData:r}){if(!r.arrow)return{};const{x:o,y:s}=r.arrow,l=n.split("-")[0];return Object.assign(t.style,{left:o!=null?`${o}px`:"",top:s!=null?`${s}px`:"",[l]:`calc(100% + ${Wo.arrowOffset.reference})`}),{}}}};function iD(t){const[n,r]=t.split("-");return{side:n,align:r,hasAlign:r!=null}}var sD={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function K0(t,n){const r=t.devicePixelRatio||1;return Math.round(n*r)/r}function hb(t){return Qp(t.boundary)}function aD(t,n){if(t)return oN({element:t,padding:n.arrowPadding})}function lD(t,n){if(!LO(n.offset??n.gutter))return Zk(({placement:r})=>{var p,m;const o=((t==null?void 0:t.clientHeight)||0)/2,s=((p=n.offset)==null?void 0:p.mainAxis)??n.gutter,l=typeof s=="number"?s+o:s??o,{hasAlign:u}=iD(r),h=u?void 0:n.shift,d=((m=n.offset)==null?void 0:m.crossAxis)??h;return Yi({crossAxis:d,mainAxis:l,alignmentAxis:n.shift})})}function cD(t){if(t.flip)return tN({boundary:hb(t),padding:t.overflowPadding,fallbackPlacements:t.flip===!0?void 0:t.flip})}function uD(t){if(!(!t.slide&&!t.overlap))return eN({boundary:hb(t),mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding,limiter:iN()})}function hD(t){return nN({padding:t.overflowPadding,apply({elements:n,rects:r,availableHeight:o,availableWidth:s}){const l=n.floating,u=Math.round(r.reference.width);s=Math.floor(s),o=Math.floor(o),l.style.setProperty("--reference-width",`${u}px`),l.style.setProperty("--available-width",`${s}px`),l.style.setProperty("--available-height",`${o}px`)}})}function dD(t){var n;if(t.hideWhenDetached)return rN({strategy:"referenceHidden",boundary:((n=t.boundary)==null?void 0:n.call(t))??"clippingAncestors"})}function fD(t){return t?t===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:t:{}}function pD(t,n,r={}){const o=eD(t,r.getAnchorRect);if(!n||!o)return;const s=Object.assign({},sD,r),l=n.querySelector("[data-part=arrow]"),u=[lD(l,s),cD(s),uD(s),aD(l,s),oD(l),nD,hD(s),dD(s),rD],{placement:h,strategy:d,onComplete:p,onPositioned:m}=s,v=async()=>{var D;if(!o||!n)return;const b=await sN(o,n,{placement:h,middleware:u,strategy:d});p==null||p(b),m==null||m({placed:!0});const A=Qa(n),_=K0(A,b.x),N=K0(A,b.y);n.style.setProperty("--x",`${_}px`),n.style.setProperty("--y",`${N}px`),s.hideWhenDetached&&(((D=b.middlewareData.hide)==null?void 0:D.referenceHidden)?(n.style.setProperty("visibility","hidden"),n.style.setProperty("pointer-events","none")):(n.style.removeProperty("visibility"),n.style.removeProperty("pointer-events")));const R=n.firstElementChild;if(R){const Z=ib(R);n.style.setProperty("--z-index",Z.zIndex)}},y=async()=>{r.updatePosition?(await r.updatePosition({updatePosition:v}),m==null||m({placed:!0})):await v()},x=fD(s.listeners),C=s.listeners?Jk(o,n,y,x):DS;return y(),()=>{C==null||C(),m==null||m({placed:!1})}}function Y0(t,n,r={}){const{defer:o,...s}=r,l=o?En:h=>h(),u=[];return u.push(l(()=>{const h=typeof t=="function"?t():t,d=typeof n=="function"?n():n;u.push(pD(h,d,s))})),()=>{u.forEach(h=>h==null?void 0:h())}}var gD={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function mD(t={}){const{placement:n,sameWidth:r,fitViewport:o,strategy:s="absolute"}=t;return{arrow:{position:"absolute",width:Wo.arrowSize.reference,height:Wo.arrowSize.reference,[Wo.arrowSizeHalf.variable]:`calc(${Wo.arrowSize.reference} / 2)`,[Wo.arrowOffset.variable]:`calc(${Wo.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:n?gD[n.split("-")[0]]:void 0,background:Wo.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:s,isolation:"isolate",minWidth:r?void 0:"max-content",width:r?"var(--reference-width)":void 0,maxWidth:o?"var(--available-width)":void 0,maxHeight:o?"var(--available-height)":void 0,top:"0px",left:"0px",transform:n?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}function yD(t){const n={each(r){var o;for(let s=0;s<((o=t.frames)==null?void 0:o.length);s+=1){const l=t.frames[s];l&&r(l)}},addEventListener(r,o,s){return n.each(l=>{try{l.document.addEventListener(r,o,s)}catch{}}),()=>{try{n.removeEventListener(r,o,s)}catch{}}},removeEventListener(r,o,s){n.each(l=>{try{l.document.removeEventListener(r,o,s)}catch{}})}};return n}function vD(t){const n=t.frameElement!=null?t.parent:null;return{addEventListener:(r,o,s)=>{try{n==null||n.addEventListener(r,o,s)}catch{}return()=>{try{n==null||n.removeEventListener(r,o,s)}catch{}}},removeEventListener:(r,o,s)=>{try{n==null||n.removeEventListener(r,o,s)}catch{}}}}var X0="pointerdown.outside",Q0="focus.outside";function wD(t){for(const n of t)if(gn(n)&&$i(n))return!0;return!1}var db=t=>"clientY"in t;function xD(t,n){if(!db(n)||!t)return!1;const r=t.getBoundingClientRect();return r.width===0||r.height===0?!1:r.top<=n.clientY&&n.clientY<=r.top+r.height&&r.left<=n.clientX&&n.clientX<=r.left+r.width}function SD(t,n){return t.y<=n.y&&n.y<=t.y+t.height&&t.x<=n.x&&n.x<=t.x+t.width}function J0(t,n){if(!n||!db(t))return!1;const r=n.scrollHeight>n.clientHeight,o=r&&t.clientX>n.offsetLeft+n.clientWidth,s=n.scrollWidth>n.clientWidth,l=s&&t.clientY>n.offsetTop+n.clientHeight,u={x:n.offsetLeft,y:n.offsetTop,width:n.clientWidth+(r?16:0),height:n.clientHeight+(s?16:0)},h={x:t.clientX,y:t.clientY};return SD(u,h)?o||l:!1}function bD(t,n){const{exclude:r,onFocusOutside:o,onPointerDownOutside:s,onInteractOutside:l,defer:u}=n;if(!t)return;const h=ni(t),d=Qa(t),p=yD(d),m=vD(d);function v(_){const N=Yo(_);if(!gn(N)||!N.isConnected||gc(t,N)||xD(t,_))return!1;const R=h.querySelector(`[aria-controls="${t.id}"]`);if(R){const Z=ng(R);if(J0(_,Z))return!1}const D=ng(t);return J0(_,D)?!1:!(r!=null&&r(N))}const y=new Set;function x(_){function N(){var Z;const R=u?En:ue=>ue(),D=((Z=_.composedPath)==null?void 0:Z.call(_))??[_.target];R(()=>{if(!(!t||!v(_))){if(s||l){const ue=Jp(s,l);t.addEventListener(X0,ue,{once:!0})}Z0(t,X0,{bubbles:!1,cancelable:!0,detail:{originalEvent:_,contextmenu:NN(_),focusable:wD(D)}})}})}_.pointerType==="touch"?(y.forEach(R=>R()),y.add(po(h,"click",N,{once:!0})),y.add(m.addEventListener("click",N,{once:!0})),y.add(p.addEventListener("click",N,{once:!0}))):N()}const C=new Set,b=setTimeout(()=>{C.add(po(h,"pointerdown",x,!0)),C.add(m.addEventListener("pointerdown",x,!0)),C.add(p.addEventListener("pointerdown",x,!0))},0);function A(_){(u?En:R=>R())(()=>{if(!(!t||!v(_))){if(o||l){const R=Jp(o,l);t.addEventListener(Q0,R,{once:!0})}Z0(t,Q0,{bubbles:!1,cancelable:!0,detail:{originalEvent:_,contextmenu:!1,focusable:$i(Yo(_))}})}})}return C.add(po(h,"focusin",A,!0)),C.add(m.addEventListener("focusin",A,!0)),C.add(p.addEventListener("focusin",A,!0)),()=>{clearTimeout(b),y.forEach(_=>_()),C.forEach(_=>_())}}function CD(t,n){const{defer:r}=n,o=r?En:l=>l(),s=[];return s.push(o(()=>{const l=typeof t=="function"?t():t;s.push(bD(l,n))})),()=>{s.forEach(l=>l==null?void 0:l())}}function Z0(t,n,r){const o=t.ownerDocument.defaultView||window,s=new o.CustomEvent(n,r);return t.dispatchEvent(s)}function ED(t,n){const r=o=>{o.key==="Escape"&&(o.isComposing||n==null||n(o))};return po(ni(t),"keydown",r,{capture:!0})}var Vr={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(t=>t.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(t){var o;const n=this.indexOf(t),r=this.topMostPointerBlockingLayer()?this.indexOf((o=this.topMostPointerBlockingLayer())==null?void 0:o.node):-1;return ngc(r.node,n))},isInBranch(t){return Array.from(this.branches).some(n=>gc(n,t))},add(t){const n=this.layers.push(t);t.node.style.setProperty("--layer-index",`${n}`)},addBranch(t){this.branches.push(t)},remove(t){const n=this.indexOf(t);n<0||(no.dismiss()),this.layers.splice(n,1),t.style.removeProperty("--layer-index"))},removeBranch(t){const n=this.branches.indexOf(t);n>=0&&this.branches.splice(n,1)},indexOf(t){return this.layers.findIndex(n=>n.node===t)},dismiss(t){var n;(n=this.layers[this.indexOf(t)])==null||n.dismiss()},clear(){this.remove(this.layers[0].node)}},ew;function tw(){Vr.layers.forEach(({node:t})=>{t.style.pointerEvents=Vr.isBelowPointerBlockingLayer(t)?"none":"auto"})}function PD(t){t.style.pointerEvents=""}function _D(t,n){const r=ni(t),o=[];if(Vr.hasPointerBlockingLayer()&&!r.body.hasAttribute("data-inert")&&(ew=document.body.style.pointerEvents,queueMicrotask(()=>{r.body.style.pointerEvents="none",r.body.setAttribute("data-inert","")})),n){const s=JN(n,l=>{o.push(YN(l,{pointerEvents:"auto"}))});o.push(s)}return()=>{Vr.hasPointerBlockingLayer()||(queueMicrotask(()=>{r.body.style.pointerEvents=ew,r.body.removeAttribute("data-inert"),r.body.style.length===0&&r.body.removeAttribute("style")}),o.forEach(s=>s()))}}function AD(t,n){if(!t){fh("[@zag-js/dismissable] node is `null` or `undefined`");return}const{onDismiss:r,pointerBlocking:o,exclude:s,debug:l}=n,u={dismiss:r,node:t,pointerBlocking:o};Vr.add(u),tw();function h(y){var C,b;const x=Yo(y.detail.originalEvent);Vr.isBelowPointerBlockingLayer(t)||Vr.isInBranch(x)||((C=n.onPointerDownOutside)==null||C.call(n,y),(b=n.onInteractOutside)==null||b.call(n,y),!y.defaultPrevented&&(l&&console.log("onPointerDownOutside:",y.detail.originalEvent),r==null||r()))}function d(y){var C,b;const x=Yo(y.detail.originalEvent);Vr.isInBranch(x)||((C=n.onFocusOutside)==null||C.call(n,y),(b=n.onInteractOutside)==null||b.call(n,y),!y.defaultPrevented&&(l&&console.log("onFocusOutside:",y.detail.originalEvent),r==null||r()))}function p(y){var x;Vr.isTopMost(t)&&((x=n.onEscapeKeyDown)==null||x.call(n,y),!y.defaultPrevented&&r&&(y.preventDefault(),r()))}function m(y){var A;if(!t)return!1;const x=typeof s=="function"?s():s,C=Array.isArray(x)?x:[x],b=(A=n.persistentElements)==null?void 0:A.map(_=>_()).filter(gn);return b&&C.push(...b),C.some(_=>gc(_,y))||Vr.isInNestedLayer(t,y)}const v=[o?_D(t,n.persistentElements):void 0,ED(t,p),CD(t,{exclude:m,onFocusOutside:d,onPointerDownOutside:h,defer:n.defer})];return()=>{Vr.remove(t),tw(),PD(t),v.forEach(y=>y==null?void 0:y())}}function fb(t,n){const{defer:r}=n,o=r?En:l=>l(),s=[];return s.push(o(()=>{const l=hc(t)?t():t;s.push(AD(l,n))})),()=>{s.forEach(l=>l==null?void 0:l())}}var TD=Bs("hoverCard").parts("arrow","arrowTip","trigger","positioner","content"),jl=TD.build(),pn=sd({getTriggerId:t=>{var n;return((n=t.ids)==null?void 0:n.trigger)??`hover-card:${t.id}:trigger`},getContentId:t=>{var n;return((n=t.ids)==null?void 0:n.content)??`hover-card:${t.id}:content`},getPositionerId:t=>{var n;return((n=t.ids)==null?void 0:n.positioner)??`hover-card:${t.id}:popper`},getArrowId:t=>{var n;return((n=t.ids)==null?void 0:n.arrow)??`hover-card:${t.id}:arrow`},getTriggerEl:t=>pn.getById(t,pn.getTriggerId(t)),getContentEl:t=>pn.getById(t,pn.getContentId(t)),getPositionerEl:t=>pn.getById(t,pn.getPositionerId(t))});function RD(t,n,r){const o=t.hasTag("open"),s=mD({...t.context.positioning,placement:t.context.currentPlacement});return{open:o,setOpen(l){l!==o&&n(l?"OPEN":"CLOSE")},reposition(l={}){n({type:"POSITIONING.SET",options:l})},getArrowProps(){return r.element({id:pn.getArrowId(t.context),...jl.arrow.attrs,dir:t.context.dir,style:s.arrow})},getArrowTipProps(){return r.element({...jl.arrowTip.attrs,dir:t.context.dir,style:s.arrowTip})},getTriggerProps(){return r.element({...jl.trigger.attrs,dir:t.context.dir,"data-placement":t.context.currentPlacement,id:pn.getTriggerId(t.context),"data-state":o?"open":"closed",onPointerEnter(l){l.pointerType!=="touch"&&n({type:"POINTER_ENTER",src:"trigger"})},onPointerLeave(l){l.pointerType!=="touch"&&n({type:"POINTER_LEAVE",src:"trigger"})},onFocus(){n("TRIGGER_FOCUS")},onBlur(){n("TRIGGER_BLUR")}})},getPositionerProps(){return r.element({id:pn.getPositionerId(t.context),...jl.positioner.attrs,dir:t.context.dir,style:s.floating})},getContentProps(){return r.element({...jl.content.attrs,dir:t.context.dir,id:pn.getContentId(t.context),hidden:!o,"data-state":o?"open":"closed","data-placement":t.context.currentPlacement,onPointerEnter(l){l.pointerType!=="touch"&&n({type:"POINTER_ENTER",src:"content"})},onPointerLeave(l){l.pointerType!=="touch"&&n({type:"POINTER_LEAVE",src:"content"})}})}}}var{not:Qu,and:nw}=$S;function OD(t){const n=Yi(t);return Ec({id:"hover-card",initial:n.open?"open":"closed",context:{openDelay:700,closeDelay:300,currentPlacement:void 0,...n,positioning:{placement:"bottom",...n.positioning}},watch:{open:["toggleVisibility"]},states:{closed:{tags:["closed"],entry:["clearIsPointer"],on:{"CONTROLLED.OPEN":"open",POINTER_ENTER:{target:"opening",actions:["setIsPointer"]},TRIGGER_FOCUS:"opening",OPEN:"opening"}},opening:{tags:["closed"],after:{OPEN_DELAY:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]},on:{"CONTROLLED.OPEN":"open","CONTROLLED.CLOSE":"closed",POINTER_LEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose","toggleVisibility"]},{target:"closed",actions:["invokeOnClose"]}],TRIGGER_BLUR:[{guard:nw("isOpenControlled",Qu("isPointer")),actions:["invokeOnClose","toggleVisibility"]},{guard:Qu("isPointer"),target:"closed",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose","toggleVisibility"]},{target:"closed",actions:["invokeOnClose"]}]}},open:{tags:["open"],activities:["trackDismissableElement","trackPositioning"],on:{"CONTROLLED.CLOSE":"closed",POINTER_ENTER:{actions:["setIsPointer"]},POINTER_LEAVE:"closing",CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TRIGGER_BLUR:[{guard:nw("isOpenControlled",Qu("isPointer")),actions:["invokeOnClose"]},{guard:Qu("isPointer"),target:"closed",actions:["invokeOnClose"]}],"POSITIONING.SET":{actions:"reposition"}}},closing:{tags:["open"],activities:["trackPositioning"],after:{CLOSE_DELAY:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]},on:{"CONTROLLED.CLOSE":"closed","CONTROLLED.OPEN":"open",POINTER_ENTER:{target:"open",actions:["setIsPointer"]}}}}},{delays:{OPEN_DELAY:r=>r.openDelay,CLOSE_DELAY:r=>r.closeDelay},guards:{isPointer:r=>!!r.isPointer,isOpenControlled:r=>!!r["open.controlled"]},activities:{trackPositioning(r){r.currentPlacement||(r.currentPlacement=r.positioning.placement);const o=()=>pn.getPositionerEl(r);return Y0(pn.getTriggerEl(r),o,{...r.positioning,defer:!0,onComplete(s){r.currentPlacement=s.placement}})},trackDismissableElement(r,o,{send:s}){return fb(()=>pn.getContentEl(r),{defer:!0,exclude:[pn.getTriggerEl(r)],onDismiss(){s({type:"CLOSE",src:"interact-outside"})},onFocusOutside(u){u.preventDefault()}})}},actions:{invokeOnClose(r){var o;(o=r.onOpenChange)==null||o.call(r,{open:!1})},invokeOnOpen(r){var o;(o=r.onOpenChange)==null||o.call(r,{open:!0})},setIsPointer(r){r.isPointer=!0},clearIsPointer(r){r.isPointer=!1},reposition(r,o){const s=()=>pn.getPositionerEl(r);Y0(pn.getTriggerEl(r),s,{...r.positioning,...o.options,defer:!0,listeners:!1,onComplete(l){r.currentPlacement=l.placement}})},toggleVisibility(r,o,{send:s}){queueMicrotask(()=>{s({type:r.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:o})})}}})}Us()(["closeDelay","dir","getRootNode","id","ids","onOpenChange","open.controlled","open","openDelay","positioning"]);const[HF,Oc]=Ws({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),[UF,ad]=Ws({name:"LocaleContext",hookName:"useLocaleContext",providerName:"",strict:!1,defaultValue:{dir:"ltr",locale:"en-US"}}),kD=(t={})=>{const{getRootNode:n}=Oc(),{dir:r}=ad(),o={id:$.useId(),dir:r,getRootNode:n,open:t.defaultOpen,"open.controlled":t.open!==void 0,...t},s={...o,open:t.open,onOpenChange:Bi(t.onOpenChange,{sync:!0})},[l,u]=Pc(OD(o),{context:s});return RD(l,u,Zh)},ND=t=>{const[n,{children:r,...o}]=GS(t),s=kD(o),l=td(Qt({present:s.open},n));return O.jsx(dk,{value:s,children:O.jsx(Ig,{value:l,children:r})})},pb=$.forwardRef((t,n)=>{const r=Ac(),o=Qt(r.getTriggerProps(),t);return O.jsx(Pn.button,{...o,ref:n})});pb.displayName="HoverCardTrigger";const Gg=t=>{var d;const{children:n,disabled:r}=t,[o,s]=$.useState((d=t.container)==null?void 0:d.current),l=$.useSyncExternalStore(ID,()=>!1,()=>!0),{getRootNode:u}=Oc();if($.useEffect(()=>{s(()=>{var p;return(p=t.container)==null?void 0:p.current})},[t.container]),l||r)return O.jsx(O.Fragment,{children:n});const h=o??DD(u);return O.jsx(O.Fragment,{children:$.Children.map(n,p=>KA.createPortal(p,h))})},DD=t=>{const n=t==null?void 0:t(),r=n.getRootNode();return pc(r)?r:ni(n).body},ID=()=>()=>{},[gb,mb]=Ws({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:""}),yb=t=>Tc()(t,["lazyMount","unmountOnExit"]);function MD(t,n){const[r,o]=$.useState(t);return $.useEffect(()=>{const s=setTimeout(()=>{o(t)},n);return()=>{clearTimeout(s)}},[t,n]),r}const[LD,Kg]=Ws({name:"TabsContext",hookName:"useTabsContext",providerName:""}),Vi=$.forwardRef((t,n)=>{const[r,o]=Tc()(t,["value"]),s=Kg(),l=mb(),u=td({...l,present:MD(s.value===t.value,0),immediate:!0}),h=Qt(s.getContentProps(r),u.getPresenceProps(),o);return O.jsx(Ig,{value:u,children:u.unmounted?null:O.jsx(Pn.div,{...h,ref:_c(u.ref,n)})})});Vi.displayName="TabContent";const ld=$.forwardRef((t,n)=>{const r=Kg(),o=Qt(r.getListProps(),t);return O.jsx(Pn.div,{...o,ref:n})});ld.displayName="TabList";const zi=$.forwardRef((t,n)=>{const[r,o]=Tc()(t,["disabled","value"]),s=Kg(),l=Qt(s.getTriggerProps(r),o);return O.jsx(Pn.button,{...l,ref:n})});zi.displayName="TabTrigger";var rg,Ds=new Map,FD=t=>t.getBoundingClientRect();function jD(t,n){const{scope:r="rect",getRect:o=FD,onChange:s}=n,l=BD({scope:r,getRect:o}),u=Ds.get(t);return u?(u.callbacks.push(s),s(o(t))):(Ds.set(t,{rect:{},callbacks:[s]}),Ds.size===1&&(rg=requestAnimationFrame(l))),function(){const d=Ds.get(t);if(!d)return;const p=d.callbacks.indexOf(s);p>-1&&d.callbacks.splice(p,1),d.callbacks.length===0&&(Ds.delete(t),Ds.size===0&&cancelAnimationFrame(rg))}}function BD(t){const{scope:n,getRect:r}=t,o=VD(n);return function s(){const l=[];Ds.forEach((u,h)=>{const d=r(h);o(u.rect,d)||(u.rect=d,l.push(u))}),l.forEach(u=>{u.callbacks.forEach(h=>h(u.rect))}),rg=requestAnimationFrame(s)}}var vb=(t,n)=>t.width===n.width&&t.height===n.height,wb=(t,n)=>t.top===n.top&&t.left===n.left,$D=(t,n)=>vb(t,n)&&wb(t,n);function VD(t){return t==="size"?vb:t==="position"?wb:$D}var zD=Bs("tabs").parts("root","list","trigger","content","indicator"),Bl=zD.build(),it=sd({getRootId:t=>{var n;return((n=t.ids)==null?void 0:n.root)??`tabs:${t.id}`},getListId:t=>{var n;return((n=t.ids)==null?void 0:n.list)??`tabs:${t.id}:list`},getContentId:(t,n)=>{var r;return((r=t.ids)==null?void 0:r.content)??`tabs:${t.id}:content-${n}`},getTriggerId:(t,n)=>{var r;return((r=t.ids)==null?void 0:r.trigger)??`tabs:${t.id}:trigger-${n}`},getIndicatorId:t=>{var n;return((n=t.ids)==null?void 0:n.indicator)??`tabs:${t.id}:indicator`},getListEl:t=>it.getById(t,it.getListId(t)),getContentEl:(t,n)=>it.getById(t,it.getContentId(t,n)),getTriggerEl:(t,n)=>it.getById(t,it.getTriggerId(t,n)),getIndicatorEl:t=>it.getById(t,it.getIndicatorId(t)),getElements:t=>{const r=`[role=tab][data-ownedby='${CSS.escape(it.getListId(t))}']:not([disabled])`;return WN(it.getListEl(t),r)},getFirstTriggerEl:t=>NO(it.getElements(t)),getLastTriggerEl:t=>DO(it.getElements(t)),getNextTriggerEl:(t,n)=>qN(it.getElements(t),it.getTriggerId(t,n),t.loopFocus),getPrevTriggerEl:(t,n)=>GN(it.getElements(t),it.getTriggerId(t,n),t.loopFocus),getSelectedContentEl:t=>{if(t.value)return it.getContentEl(t,t.value)},getSelectedTriggerEl:t=>{if(t.value)return it.getTriggerEl(t,t.value)},getOffsetRect:t=>({left:(t==null?void 0:t.offsetLeft)??0,top:(t==null?void 0:t.offsetTop)??0,width:(t==null?void 0:t.offsetWidth)??0,height:(t==null?void 0:t.offsetHeight)??0}),getRectById:(t,n)=>{const r=cb(it.getElements(t),it.getTriggerId(t,n));return it.resolveRect(it.getOffsetRect(r))},resolveRect:t=>({width:`${t.width}px`,height:`${t.height}px`,left:`${t.left}px`,top:`${t.top}px`})});function HD(t,n,r){const o=t.context.translations,s=t.matches("focused"),l=t.context.orientation==="vertical",u=t.context.orientation==="horizontal",h=t.context.composite,d=t.context.indicatorState;function p(m){return{selected:t.context.value===m.value,focused:t.context.focusedValue===m.value,disabled:!!m.disabled}}return{value:t.context.value,focusedValue:t.context.focusedValue,setValue(m){n({type:"SET_VALUE",value:m})},clearValue(){n({type:"CLEAR_VALUE"})},setIndicatorRect(m){const v=it.getTriggerId(t.context,m);n({type:"SET_INDICATOR_RECT",id:v})},syncTabIndex(){n("SYNC_TAB_INDEX")},selectNext(m){n({type:"TAB_FOCUS",value:m,src:"selectNext"}),n({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(m){n({type:"TAB_FOCUS",value:m,src:"selectPrev"}),n({type:"ARROW_PREV",src:"selectPrev"})},focus(){var m;(m=it.getSelectedTriggerEl(t.context))==null||m.focus()},getRootProps(){return r.element({...Bl.root.attrs,id:it.getRootId(t.context),"data-orientation":t.context.orientation,"data-focus":Ts(s),dir:t.context.dir})},getListProps(){return r.element({...Bl.list.attrs,id:it.getListId(t.context),role:"tablist",dir:t.context.dir,"data-focus":Ts(s),"aria-orientation":t.context.orientation,"data-orientation":t.context.orientation,"aria-label":o==null?void 0:o.listLabel,onKeyDown(m){if(m.defaultPrevented||!ON(m)||kN(m))return;const v={ArrowDown(){u||n({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){u||n({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){l||n({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){l||n({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){n("HOME")},End(){n("END")},Enter(){n({type:"ENTER"})}};let y=IN(m,t.context);const x=v[y];x&&(m.preventDefault(),x(m))}})},getTriggerState:p,getTriggerProps(m){const{value:v,disabled:y}=m,x=p(m);return r.button({...Bl.trigger.attrs,role:"tab",type:"button",disabled:y,dir:t.context.dir,"data-orientation":t.context.orientation,"data-disabled":Ts(y),"aria-disabled":y,"data-value":v,"aria-selected":x.selected,"data-selected":Ts(x.selected),"data-focus":Ts(x.focused),"aria-controls":x.selected?it.getContentId(t.context,v):void 0,"data-ownedby":it.getListId(t.context),"data-ssr":Ts(t.context.ssr),id:it.getTriggerId(t.context,v),tabIndex:x.selected&&h?0:-1,onFocus(){n({type:"TAB_FOCUS",value:v})},onBlur(C){const b=C.relatedTarget;(b==null?void 0:b.getAttribute("role"))!=="tab"&&n({type:"TAB_BLUR"})},onClick(C){C.defaultPrevented||y||(PN()&&C.currentTarget.focus(),n({type:"TAB_CLICK",value:v}))}})},getContentProps(m){const{value:v}=m,y=t.context.value===v;return r.element({...Bl.content.attrs,dir:t.context.dir,id:it.getContentId(t.context,v),tabIndex:h?0:-1,"aria-labelledby":it.getTriggerId(t.context,v),role:"tabpanel","data-ownedby":it.getListId(t.context),"data-selected":Ts(y),"data-orientation":t.context.orientation,hidden:!y})},getIndicatorProps(){var m,v,y,x;return r.element({id:it.getIndicatorId(t.context),...Bl.indicator.attrs,dir:t.context.dir,"data-orientation":t.context.orientation,style:{"--transition-property":"left, right, top, bottom, width, height","--left":(m=d.rect)==null?void 0:m.left,"--top":(v=d.rect)==null?void 0:v.top,"--width":(y=d.rect)==null?void 0:y.width,"--height":(x=d.rect)==null?void 0:x.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:d.transition?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[u?"left":"top"]:u?"var(--left)":"var(--top)"}})}}}var{not:UD}=$S;function WD(t){const n=Yi(t);return Ec({initial:"idle",context:{dir:"ltr",orientation:"horizontal",activationMode:"automatic",value:null,loopFocus:!0,composite:!0,navigate(r){zN(r.node)},...n,focusedValue:n.value??null,ssr:!0,indicatorState:{rendered:!1,transition:!1,rect:{left:"0px",top:"0px",width:"0px",height:"0px"}}},watch:{value:["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","navigateIfNeeded"],dir:["syncIndicatorRect"],orientation:["syncIndicatorRect"]},on:{SET_VALUE:{actions:"setValue"},CLEAR_VALUE:{actions:"clearValue"},SET_INDICATOR_RECT:{actions:"setIndicatorRect"},SYNC_TAB_INDEX:{actions:"syncTabIndex"}},created:["syncFocusedValue"],entry:["checkRenderedElements","syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:"setFocusedValue"},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:"focusPrevTab"}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:"focusNextTab"}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:"focusFirstTab"}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:"focusLastTab"}],ENTER:{guard:UD("selectOnFocus"),actions:"selectFocusedTab"},TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:"clearFocusedValue"}}}}},{guards:{selectOnFocus:r=>r.activationMode==="automatic"},actions:{syncFocusedValue(r){r.value!=null&&r.focusedValue==null&&(r.focusedValue=r.value)},selectFocusedTab(r){En(()=>{const s=r.deselectable&&r.value===r.focusedValue?null:r.focusedValue;Rs.value(r,s)})},setFocusedValue(r,o){o.value!=null&&Rs.focusedValue(r,o.value)},clearFocusedValue(r){Rs.focusedValue(r,null)},setValue(r,o){const l=r.deselectable&&r.value===r.focusedValue?null:o.value;Rs.value(r,l)},clearValue(r){Rs.value(r,null)},focusFirstTab(r){En(()=>{var o;(o=it.getFirstTriggerEl(r))==null||o.focus()})},focusLastTab(r){En(()=>{var o;(o=it.getLastTriggerEl(r))==null||o.focus()})},focusNextTab(r){if(!r.focusedValue)return;const o=it.getNextTriggerEl(r,r.focusedValue);En(()=>{r.composite?o==null||o.focus():(o==null?void 0:o.dataset.value)!=null&&Rs.focusedValue(r,o.dataset.value)})},focusPrevTab(r){if(!r.focusedValue)return;const o=it.getPrevTriggerEl(r,r.focusedValue);En(()=>{r.composite?o==null||o.focus():(o==null?void 0:o.dataset.value)!=null&&Rs.focusedValue(r,o.dataset.value)})},checkRenderedElements(r){r.indicatorState.rendered=!!it.getIndicatorEl(r)},syncTabIndex(r){En(()=>{const o=it.getSelectedContentEl(r);if(!o)return;qg(o).length>0?o.removeAttribute("tabindex"):o.setAttribute("tabindex","0")})},cleanupObserver(r){var o;(o=r.indicatorCleanup)==null||o.call(r)},allowIndicatorTransition(r){r.indicatorState.transition=!0},setIndicatorRect(r,o){const s=o.id??r.value;!r.indicatorState.rendered||!s||!it.getTriggerEl(r,s)||(r.indicatorState.rect=it.getRectById(r,s),q0(()=>{r.indicatorState.transition=!1}))},syncSsr(r){r.ssr=!1},syncIndicatorRect(r){var l;(l=r.indicatorCleanup)==null||l.call(r);const o=r.value;if(!r.indicatorState.rendered||!o)return;const s=it.getSelectedTriggerEl(r);s&&(r.indicatorCleanup=jD(s,{getRect(u){return it.getOffsetRect(u)},onChange(u){r.indicatorState.rect=it.resolveRect(u),q0(()=>{r.indicatorState.transition=!1})}}))},navigateIfNeeded(r){const o=it.getSelectedTriggerEl(r);pN(o)&&r.navigate({value:r.value,node:o})}}})}var rw={change:t=>{var n;t.value!=null&&((n=t.onValueChange)==null||n.call(t,{value:t.value}))},focusChange:t=>{var n;t.focusedValue!=null&&((n=t.onFocusChange)==null||n.call(t,{focusedValue:t.focusedValue}))}},Rs={value:(t,n)=>{uc(n,t.value)||(t.value=n,rw.change(t))},focusedValue:(t,n)=>{uc(n,t.focusedValue)||(t.focusedValue=n,rw.focusChange(t))}};Us()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]);Us()(["disabled","value"]);Us()(["value"]);const qD=(t={})=>{const{getRootNode:n}=Oc(),{dir:r}=ad(),o={id:$.useId(),dir:r,getRootNode:n,value:t.defaultValue,...t},s={...o,value:t.value,onValueChange:Bi(t.onValueChange,{sync:!0}),onFocusChange:Bi(t.onFocusChange)},[l,u]=Pc(WD(o),{context:s});return HD(l,u,Zh)},cd=$.forwardRef((t,n)=>{const[r,o]=yb(t),[s,l]=Tc()(o,["activationMode","composite","defaultValue","deselectable","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]),u=qD(s),h=Qt(u.getRootProps(),l);return O.jsx(LD,{value:u,children:O.jsx(gb,{value:r,children:O.jsx(Pn.div,{...h,ref:n})})})});cd.displayName="TabsRoot";var xb={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ow=en.createContext&&en.createContext(xb),GD=["attr","size","title"];function KD(t,n){if(t==null)return{};var r=YD(t,n),o,s;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(r[o]=t[o])}return r}function YD(t,n){if(t==null)return{};var r={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(n.indexOf(o)>=0)continue;r[o]=t[o]}return r}function Ih(){return Ih=Object.assign?Object.assign.bind():function(t){for(var n=1;nen.createElement(n.tag,Mh({key:r},n.attr),Sb(n.child)))}function Sr(t){return n=>en.createElement(ZD,Ih({attr:Mh({},t.attr)},n),Sb(t.child))}function ZD(t){var n=r=>{var{attr:o,size:s,title:l}=t,u=KD(t,GD),h=s||r.size||"1em",d;return r.className&&(d=r.className),t.className&&(d=(d?d+" ":"")+t.className),en.createElement("svg",Ih({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,u,{className:d,style:Mh(Mh({color:t.color||r.color},r.style),t.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),l&&en.createElement("title",null,l),t.children)};return ow!==void 0?en.createElement(ow.Consumer,null,r=>n(r)):n(xb)}function eI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12 1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"},child:[]}]})(t)}function tI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5a2.5 2.5 0 0 0-5 0V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5a2.5 2.5 0 0 0 0-5z"},child:[]}]})(t)}function nI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M13 3a9 9 0 0 0-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0 0 13 21a9 9 0 0 0 0-18zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"},child:[]}]})(t)}function rI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"},child:[]}]})(t)}function oI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9H9V9h10v2zm-4 4H9v-2h6v2zm4-8H9V5h10v2z"},child:[]}]})(t)}function iI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83zM6.21 18H5v-1.21l8.66-8.66 1.21 1.21L6.21 18zM11 20l4-4h6v4H11z"},child:[]}]})(t)}function sI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"},child:[]}]})(t)}function aI(t){return Sr({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19.88 18.47c.44-.7.7-1.51.7-2.39 0-2.49-2.01-4.5-4.5-4.5s-4.5 2.01-4.5 4.5 2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7L21.58 23 23 21.58l-3.12-3.11zm-3.8.11a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5zm-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.8 6.18-3.01-3.52-3.63 5.81L1 17l5-8 3 3.5L13 6l2.72 4.08zm2.59.5c-.64-.28-1.33-.45-2.05-.49L21.38 2 23 3.18l-4.69 7.4z"},child:[]}]})(t)}function bb(t){var n,r,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(n=0;n{const[s,l]=$.useState("favorites"),u=["OA-sink","Search Fields","Open Access","Publication","Authorship","Concepts"];let h=t.slice(10)??[];return O.jsxs(cd,{value:s,onValueChange:d=>l(d.value),className:"mh-60 w-30 translate-x-1/2",children:[O.jsxs(ld,{className:"flex stretch",children:[O.jsx(zi,{value:"favorites",className:`tabTrigger ${s==="favorites"?"bg-gray-50":"!bg-gray-200"}`,children:O.jsx(sI,{className:"w-3 h-3"})}),O.jsx(zi,{value:"recent",className:`tabTrigger ${s==="recent"?"bg-gray-50":"!bg-gray-200"}`,children:O.jsx(nI,{className:"w-3 h-3"})})]}),O.jsx(Vi,{value:"recent",className:"tabContent !height-[20px]",children:h.map((d,p)=>O.jsx("div",{onClick:()=>o(r,d),className:"hover:bg-white p-1 cursor-pointer",children:d},p))}),O.jsx(Vi,{value:"favorites",className:"tabContent !height-[20px]",children:u.map((d,p)=>O.jsx("div",{onClick:()=>o(r,d),className:"hover:bg-white p-1 cursor-pointer",children:d},p))})]})},cI=({children:t,handlePosition:n,createNode:r,recentNodeTypes:o,nodeTypes:s})=>O.jsxs(ND,{children:[O.jsx(pb,{children:t}),O.jsx(Gg,{children:O.jsx(qS,{children:O.jsxs(WS,{children:[O.jsx(HS,{children:O.jsx(US,{})}),O.jsx(lI,{handlePosition:n,createNode:r,recentNodeTypes:o,nodeTypes:s})]})})})]}),uI=({handleId:t,position:n,type:r,id:o,connectState:s,createNode:l,recentNodeTypes:u,nodeTypes:h})=>{const[d,p]=$.useState(!1);Yg("flex",{"pr-10":t==="incomingL","pb-10":t==="incomingT","pl-10":t==="outgoingR","pt-10":t==="outgoingB"});const m=$.useMemo(()=>s==="connectable"?{borderColor:d?"blue":"black",opacity:d?.6:.5,backgroundColor:"white",borderRadius:"0.5rem",width:"3rem",height:"3rem",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"1.5rem",color:"grey",transition:"all 0.2s ease-in-out"}:{},[s,d]);return O.jsx(cc,{style:m,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),type:r,position:n,id:t,children:s==="connectable"&&O.jsx(cI,{handlePosition:n,createNode:l,recentNodeTypes:u,nodeTypes:h,children:O.jsx("div",{className:"w-[2rem] text-black text-bold h-[2rem] border-1 border-gray-200 hover:border-blue-600 text-2xl rounded-md justify-center hover:bg-blue-200",children:"+"})})})},Cb=$.createContext(null),hI=({children:t,incoming:n,outgoing:r})=>{const o=Qh(),s=FR({id:o}),l=IR(),{nodes:u,nodeTypes:h}=Qr(),d=[...new Set(u.map(b=>b.name))].slice(-10),p=$.useContext(Cb),m=(b,A)=>{p(o,b,A)},v=$.useMemo(()=>{const b={},A=_=>s.some(N=>N.targetHandle===_&&N.target===o||N.sourceHandle===_&&N.source===o);return b.l=A("incomingL")?"connected":"connectable",b.t=A("incomingT")?"connected":"connectable",b.b=A("outgoingB")?"connected":"connectable",b.r=A("outgoingR")?"connected":"connectable",b.l==="connected"&&(b.t="disabled"),b.t==="connected"&&(b.l="disabled"),b.r==="connected"&&(b.b="disabled"),b.b==="connected"&&(b.r="disabled"),b},[s,o]),y=[{position:Ye.Left,type:"target",id:"incomingL",p:"l"},{position:Ye.Right,type:"source",id:"outgoingR",p:"r"},{position:Ye.Top,type:"target",id:"incomingT",p:"t"},{position:Ye.Bottom,type:"source",id:"outgoingB",p:"b"}],x=$.useMemo(()=>y.map(({position:b,type:A,id:_,p:N})=>{const R=v[N];return l(o),A==="target"&&n||A==="source"&&r?O.jsx(uI,{position:b,type:A,handleId:_,createNode:m,connectState:R,nodeTypes:h,recentNodeTypes:d},_):O.jsx("div",{})}),[s,v]),C=en.useMemo(()=>t,[t]);return O.jsxs("div",{className:"relative flex flex-col items-center",children:[O.jsx("div",{className:`absolute top-1/2 transform -translate-y-1/2 - ${v.l!=="connected"?"left-[-50px]":"left-[-0px]"} - ${v.l!=="connectable"?"[visibility:hidden]":""}`,children:x[0]}),O.jsxs("div",{className:"flex",children:[O.jsx("div",{className:`absolute left-1/2 transform -translate-y-1/2 - ${v.t!=="connected"?"top-[-50px]":"top-[-0px]"} - ${v.t!=="connectable"?"[visibility:hidden]":""}`,children:x[2]}),O.jsx("div",{className:"node-container",children:C}),O.jsx("div",{className:`absolute left-1/2 transform -translate-x-1/2 - ${v.b!=="connected"?"bottom-[-50px]":"bottom-[0px]"} - ${v.b!=="connectable"?"[visibility:hidden]":""}`,children:x[3]})]}),O.jsx("div",{className:`absolute top-1/2 transform -translate-y-1/2 - ${v.r!=="connected"?"right-[-50px]":"right-[-0px]"} - ${v.r!=="connectable"?"[visibility:hidden]":""}`,children:x[1]})]})},Xg=en.memo(hI),dI=({children:t,filterType:n})=>O.jsx(Xg,{incoming:!0,outgoing:!0,children:O.jsxs("div",{className:"flex row",children:[O.jsx("div",{className:"node-group bg-orange-100",children:n.groupLabel}),t]})}),fI=en.memo(dI),pI=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),o=$.useCallback(l=>{r(t,{filter_value:l.target.value})},[n]),s=["true","false"];return O.jsx(O.Fragment,{children:O.jsx("select",{value:n.filter_value,onChange:o,className:"filter-input",children:s.map(l=>O.jsx("option",{value:l,className:"filter-option",children:l},l))})})},gI=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),o=$.useCallback(s=>{r(t,{filter_value:s.target.value})},[n]);return O.jsx(O.Fragment,{children:O.jsx("input",{className:"filter-input",defaultValue:n.filter_value,onChange:o})})},mI=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),o=$.useCallback(s=>{r(t,{filter_value:s.target.value})},[n]);return O.jsx(O.Fragment,{children:O.jsx("input",{label:"date",id:"year",name:"date",min:"1800",max:"2050",className:"filter-input",defaultValue:n.filter_value,onChange:o})})},yI=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),o=$.useCallback(s=>{r(t,{filter_value:s.target.value})},[n]);return O.jsx(O.Fragment,{children:O.jsx("input",{label:"date",id:"year",type:"date",min:"1800-01-01",max:"2050-01-01",className:"filter-input",defaultValue:n.filter_value,onChange:o})})},vI=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),[o,s]=$.useState(n.filter_value.from??null),[l,u]=$.useState(n.filter_value.to??null);return $.useEffect(()=>{r(t,{filter_value:{to:l,from:o}})},[o,l]),O.jsxs("div",{className:"flex flex-row w-40",children:[O.jsx("input",{className:"filter-input",id:"to",defaultValue:l,onChange:h=>u(e.target.value)}),O.jsx("div",{className:"!justify-text-center !text-2xl",children:"-"}),O.jsx("input",{className:"filter-input",id:"from",defaultValue:o,onChange:h=>s(e.target.value)})]})},wI=({id:t,filterType:n,itemsCollection:r})=>{const{updateNodeData:o,nodes:s}=Qr(),l=Object(s.find(d=>d.id===t)).data,u=$.useCallback(d=>{o(t,{filter:d.target.value})},[t,o]);$.useEffect(()=>{l.filter||o(t,{filter:r.items[0].value})},[]);const h=$.useMemo(()=>r.items.map(d=>O.jsx("option",{value:d.value,className:"filter-option",children:d.label},d.value)),[n,r]);return O.jsx("select",{id:"select-filter",defaultValue:l.filter,onChange:u,className:"filter-input",children:h})},xI=t=>{const{filterTypeLabel:n,itemsCollection:r,data:o}=t,s=r.items.find(l=>l.value===o.filter)||r.items[0];return O.jsx(fI,{label:n,lazyMount:!0,filterType:s,children:O.jsxs("div",{className:"node-content",children:[O.jsx(wI,{...t}),(s==null?void 0:s.inputType)==="boolean"?O.jsx(pI,{...t}):(s==null?void 0:s.inputType)==="range"?O.jsx(vI,{...t}):(s==null?void 0:s.inputType)==="year"?O.jsx(mI,{...t}):(s==null?void 0:s.inputType)==="date"?O.jsx(yI,{...t}):s?O.jsx(gI,{...t}):null]})})},SI=()=>mO.map(({filterType:t,filterTypeLabel:n,items:r})=>{const o={items:r};return{source:"OpenAlex",source_short:"OA",group:"Repository",type:"Input",label:t,component:l=>O.jsx(xI,{...l,filterType:t,filterTypeLabel:n,itemsCollection:o})}}),bI=Object.freeze(Object.defineProperty({__proto__:null,factory:SI},Symbol.toStringTag,{value:"Module"})),CI=({type:t,children:n,group:r})=>O.jsx(Xg,{incoming:!1,outgoing:!0,children:O.jsxs("div",{className:"flex absoluterow",children:[O.jsx("div",{className:"node-group bold bg-blue-200",children:r}),O.jsxs("div",{className:"node-content !w-[400px]",children:[O.jsx("h1",{className:"node-title",children:t}),O.jsx("div",{className:"flex",children:n})]})]})}),qs=({id:t,data:n})=>{const{updateNodeData:r}=Qr(),o=$.useCallback(s=>{r(t,{filter_value:s.target.value,filter:"abstract.search"})},[t,r]);return O.jsx(CI,{type:"Open Alex",group:qs.group,children:O.jsxs("div",{className:"flex flex-row text-2xl w-[40vw]",children:[O.jsx("p",{children:"Base Term"}),O.jsx("input",{placeholder:"",className:"filter-input",value:n.filter_value||"",onChange:o})]})},t)};qs.source="OpenAlex";qs.source_short="OA";qs.group="Repository";qs.label="base_term";qs.type="Input";const EI=Object.freeze(Object.defineProperty({__proto__:null,default:qs},Symbol.toStringTag,{value:"Module"})),PI=({type:t,children:n,group:r})=>O.jsx(Xg,{incoming:!0,outgoing:!0,children:O.jsxs("div",{className:"flex",children:[O.jsx("div",{className:"node-group bold bg-fuchsia-200",children:t}),O.jsx("div",{className:"flex flex-col w-[240px] h-[120px]",children:n})]})}),_I=en.memo(PI),Eb=(t,n,r,o=new Set)=>{const s=n.find(u=>u.id===t);return!s||o.has(t)?[]:(o.add(t),q_(s,n,r).reduce((u,h)=>[...u,h,...Eb(h.id,n,r,o)],[]))};function AI(t){const n=t.split(" ");if(n.length===1)return{givenName:"",familyName:n[0]};const r=n.pop()||"";return{givenName:n.join(" "),familyName:r}}function TI(t){return{article:"JournalArticle",book:"Book","book-chapter":"BookChapter","conference-paper":"ConferencePaper",dataset:"Dataset",preprint:"Preprint"}[t]||"Other"}function RI(t){return!t||!t.length?[]:t.map(n=>({subject:n.display_name,schemeUri:n.wikidata||"",valueUri:n.id,subjectScheme:"OpenAlex",lang:"en",classificationCode:n.id.split("/").pop()||""}))}function OI(t){const n=[];return t.openalex&&n.push({alternateIdentifier:t.openalex,alternateIdentifierType:"OpenAlex"}),t.mag&&n.push({alternateIdentifier:t.mag.toString(),alternateIdentifierType:"MAG"}),t.pmid&&n.push({alternateIdentifier:t.pmid,alternateIdentifierType:"PMID"}),t.pmcid&&n.push({alternateIdentifier:t.pmcid,alternateIdentifierType:"PMCID"}),n}function kI(t){return!t||!t.length?[]:t.map(n=>({relationType:"References",relatedIdentifier:n,relatedIdentifierType:"URL",resourceTypeGeneral:"JournalArticle"}))}function NI(t){return!t||!t.length?[]:t.map(n=>({funderName:n.funder_display_name,funderIdentifier:n.funder,funderIdentifierType:"ROR",awardNumber:n.award_id||"",awardTitle:"",awardUri:"",schemeURI:""}))}function DI(t){if(!t)return"";const n=Object.keys(t);Object.values(t).flat();const r=n.flatMap(o=>t[o].map(l=>({word:o,position:l})));return r.sort((o,s)=>o.position-s.position),r.map(o=>o.word).join(" ")}function II(t){var u,h,d,p;const n=t.authorships.map(m=>{var x;const{givenName:v,familyName:y}=AI(m.author.display_name);return{name:m.author.display_name,nameType:"Personal",givenName:v,familyName:y,nameIdentifiers:m.author.orcid?[{nameIdentifier:m.author.orcid,nameIdentifierScheme:"ORCID",schemeUri:"https://orcid.org"}]:[],affiliation:((x=m.institutions)==null?void 0:x.map(C=>({name:C.display_name,affiliationIdentifier:C.id,affiliationIdentifierScheme:"OpenAlex",schemeUri:C.ror||""})))||[],language:"en"}}),r=((u=t.primary_location)==null?void 0:u.source.display_name)||"",o=((h=t.primary_location)==null?void 0:h.source.id)||"",s={rights:t.open_access.is_oa?`Open Access (${t.open_access.oa_status})`:"Closed Access",rightsUri:t.open_access.oa_url||"",schemeUri:"",rightsIdentifier:((d=t.primary_location)==null?void 0:d.license)||"",rightsIdentifierScheme:"License",lang:"en"};return{id:t.id,Identifier:{identifier:t.doi||t.id,identifierType:"DOI"},Creators:n,Titles:[{title:t.title,lang:"en"}],Publisher:{name:r,publisherIdentifier:o,publisherIdentifierScheme:"OpenAlex",schemeURI:""},PublicationYear:t.publication_year.toString(),Subjects:RI(t.concepts),Contributors:[],Dates:[{date:t.publication_date||t.created_date,dateType:"Issued",dateInformation:"Publication date"},{date:t.updated_date,dateType:"Updated",dateInformation:"Last updated in OpenAlex"}],Language:t.language||"en",ResourceType:{resourceType:t.type,resourceTypeGeneral:TI(t.type)},AlternateIdentifiers:OI(t.ids),RelatedIdentifiers:kI(t.referenced_works),Sizes:[],Format:"",Version:((p=t.primary_location)==null?void 0:p.version)||"",Rights:s,Description:t.abstract_inverted_index?[{description:DI(t.abstract_inverted_index),descriptionType:"Abstract",lang:"en"}]:[],GeoLocation:[],FundingReferences:NI(t.grants),RelatedItems:[]}}function MI(t){try{return II(t)}catch(n){throw console.error("Error processing OpenAlex file:",n),n}}var gh={exports:{}},LI=gh.exports,sw;function FI(){return sw||(sw=1,function(t,n){(function(r,o){t.exports=o()})(LI,function(){var r=function(f,w){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var k in T)Object.prototype.hasOwnProperty.call(T,k)&&(E[k]=T[k])})(f,w)},o=function(){return(o=Object.assign||function(f){for(var w,E=1,T=arguments.length;E"u"||l.Promise||(l.Promise=Promise);var p=Object.getPrototypeOf,m={}.hasOwnProperty;function v(f,w){return m.call(f,w)}function y(f,w){typeof w=="function"&&(w=w(p(f))),(typeof Reflect>"u"?u:Reflect.ownKeys)(w).forEach(function(E){C(f,E,w[E])})}var x=Object.defineProperty;function C(f,w,E,T){x(f,w,d(E&&v(E,"get")&&typeof E.get=="function"?{get:E.get,set:E.set,configurable:!0}:{value:E,configurable:!0,writable:!0},T))}function b(f){return{from:function(w){return f.prototype=Object.create(w.prototype),C(f.prototype,"constructor",f),{extend:y.bind(null,f.prototype)}}}}var A=Object.getOwnPropertyDescriptor,_=[].slice;function N(f,w,E){return _.call(f,w,E)}function R(f,w){return w(f)}function D(f){if(!f)throw new Error("Assertion Failed")}function Z(f){l.setImmediate?setImmediate(f):setTimeout(f,0)}function ue(f,w){if(typeof w=="string"&&v(f,w))return f[w];if(!w)return f;if(typeof w!="string"){for(var E=[],T=0,k=w.length;T"u"?[]:function(){var f=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[f,p(f),f];var w=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[w,p(w),f]}(),An=xn[0],Rn=xn[1],xn=xn[2],Rn=Rn&&Rn.then,nn=An&&An.constructor,tr=!!xn,nr=function(f,w){br.push([f,w]),rr&&(queueMicrotask(Ys),rr=!1)},Zr=!0,rr=!0,yn=[],oi=[],ii=st,Fn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Fe,pgp:!1,env:{},finalize:Fe},We=Fn,br=[],jn=0,eo=[];function Be(f){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var w=this._PSD=We;if(typeof f!="function"){if(f!==_n)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&or(this,this._value))}this._state=null,this._value=null,++w.ref,function E(T,k){try{k(function(B){if(T._state===null){if(B===T)throw new TypeError("A promise cannot be resolved with itself.");var U=T._lib&&Er();B&&typeof B.then=="function"?E(T,function(ee,oe){B instanceof Be?B._then(ee,oe):B.then(ee,oe)}):(T._state=!0,T._value=B,Qi(T)),U&&ir()}},or.bind(null,T))}catch(B){or(T,B)}}(this,f)}var Po={get:function(){var f=We,w=_r;function E(T,k){var B=this,U=!f.global&&(f!==We||w!==_r),ee=U&&!Bn(),oe=new Be(function(ae,de){_o(B,new Cr(Zi(T,f,U,ee),Zi(k,f,U,ee),ae,de,f))});return this._consoleTask&&(oe._consoleTask=this._consoleTask),oe}return E.prototype=_n,E},set:function(f){C(this,"then",f&&f.prototype===_n?Po:{get:function(){return f},set:Po.set})}};function Cr(f,w,E,T,k){this.onFulfilled=typeof f=="function"?f:null,this.onRejected=typeof w=="function"?w:null,this.resolve=E,this.reject=T,this.psd=k}function or(f,w){var E,T;oi.push(w),f._state===null&&(E=f._lib&&Er(),w=ii(w),f._state=!1,f._value=w,T=f,yn.some(function(k){return k._value===T._value})||yn.push(T),Qi(f),E&&ir())}function Qi(f){var w=f._listeners;f._listeners=[];for(var E=0,T=w.length;E.",Pt="String expected.",no=[],ro="__dbnames",li="readonly",oo="readwrite";function Ar(f,w){return f?w?function(){return f.apply(this,arguments)&&w.apply(this,arguments)}:f:w}var ci={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Tr(f){return typeof f!="string"||/\./.test(f)?function(w){return w}:function(w){return w[f]===void 0&&f in w&&delete(w=X(w))[f],w}}function wn(){throw Ce.Type()}function ct(f,w){try{var E=rn(f),T=rn(w);if(E!==T)return E==="Array"?1:T==="Array"?-1:E==="binary"?1:T==="binary"?-1:E==="string"?1:T==="string"?-1:E==="Date"?1:T!=="Date"?NaN:-1;switch(E){case"number":case"Date":case"string":return wxe+Se&&me(xe+de)})})}var we=on(E)&&E.limit===1/0&&(typeof f!="function"||f===oa)&&{index:E.index,range:E.range};return me(0).then(function(){if(0=fe})).length!==0?(de.forEach(function(me){pe.push(function(){var we=ce,xe=me._cfg.dbschema;Gt(te,we,he),Gt(te,xe,he),ce=te._dbSchema=xe;var Se=pi(we,xe);Se.add.forEach(function(je){aa(he,je[0],je[1].primKey,je[1].indexes)}),Se.change.forEach(function(je){if(je.recreate)throw new Ce.Upgrade("Not yet support for changing primary key");var Ie=he.objectStore(je.name);je.add.forEach(function(Ve){return Oo(Ie,Ve)}),je.change.forEach(function(Ve){Ie.deleteIndex(Ve.name),Oo(Ie,Ve)}),je.del.forEach(function(Ve){return Ie.deleteIndex(Ve)})});var Oe=me._cfg.contentUpgrade;if(Oe&&me._cfg.version>fe){fi(te,he),ie._memoizedTables={};var Le=ne(xe);Se.del.forEach(function(je){Le[je]=we[je]}),is(te,[te.Transaction.prototype]),Ro(te,[te.Transaction.prototype],u(Le),Le),ie.schema=Le;var ke,De=q(Oe);return De&&to(),Se=Be.follow(function(){var je;(ke=Oe(ie))&&De&&(je=Bn.bind(null,null),ke.then(je,je))}),ke&&typeof ke.then=="function"?Be.resolve(ke):Se.then(function(){return ke})}}),pe.push(function(we){var xe,Se,Oe=me._cfg.dbschema;xe=Oe,Se=we,[].slice.call(Se.db.objectStoreNames).forEach(function(Le){return xe[Le]==null&&Se.db.deleteObjectStore(Le)}),is(te,[te.Transaction.prototype]),Ro(te,[te.Transaction.prototype],te._storeNames,te._dbSchema),ie.schema=te._dbSchema}),pe.push(function(we){te.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(te.idbdb.version/10)===me._cfg.version?(te.idbdb.deleteObjectStore("$meta"),delete te._dbSchema.$meta,te._storeNames=te._storeNames.filter(function(xe){return xe!=="$meta"})):we.objectStore("$meta").put(me._cfg.version,"version"))})}),function me(){return pe.length?Be.resolve(pe.shift()(ie.idbtrans)).then(me):Be.resolve()}().then(function(){ss(ce,he)})):Be.resolve();var te,fe,ie,he,pe,ce}).catch(U)):(u(k).forEach(function(de){aa(E,de,k[de].primKey,k[de].indexes)}),fi(f,E),void Be.follow(function(){return f.on.populate.fire(B)}).catch(U));var oe,ae})}function ol(f,w){ss(f._dbSchema,w),w.db.version%10!=0||w.objectStoreNames.contains("$meta")||w.db.createObjectStore("$meta").add(Math.ceil(w.db.version/10-1),"version");var E=as(0,f.idbdb,w);Gt(f,f._dbSchema,w);for(var T=0,k=pi(E,f._dbSchema).change;TMath.pow(2,62)?0:ce.oldVersion,te=ce<1,f.idbdb=pe.result,B&&ol(f,de),ao(f,ce/10,de,ie))},ie),pe.onsuccess=vt(function(){de=null;var ce,me,we,xe,Se,Oe=f.idbdb=pe.result,Le=N(Oe.objectStoreNames);if(0"u"?Be.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(fe){function ie(){return indexedDB.databases().finally(fe)}oe=setInterval(ie,100),ie()}).finally(function(){return clearInterval(oe)}):Promise.resolve()).then(ee)]).then(function(){return U(),w.onReadyBeingFired=[],Be.resolve(cs(function(){return f.on.ready.fire(f.vip)})).then(function fe(){if(0w.limit?fe.length=w.limit:f.length===w.limit&&fe.length=me.limit&&(!me.values||Oe.req.values)&&Wc(Oe.req.query.range,me.query.range)}),!1,we,xe];case"count":return Se=xe.find(function(Oe){return Uc(Oe.req.query.range,me.query.range)}),[Se,!!Se,we,xe]}}(w,E,"query",B),de=ae[0],te=ae[1],fe=ae[2],ie=ae[3];return de&&te?de.obsSet=B.obsSet:(te=T.query(B).then(function(he){var pe=he.result;if(de&&(de.res=pe),U){for(var ce=0,me=pe.length;ce{async function u(){try{o(!0);const h=new BI;n(h),l(null)}catch(h){console.error("Database initialization failed:",h),l(h instanceof Error?h:new Error("Unknown database error"))}finally{o(!1)}}u()},[]),{db:t,isLoading:r,error:s}}var $I=Bs("progress").parts("root","label","track","range","valueText","view","circle","circleTrack","circleRange"),Uo=$I.build(),Ju=sd({getRootId:t=>{var n;return((n=t.ids)==null?void 0:n.root)??`progress-${t.id}`},getTrackId:t=>{var n;return((n=t.ids)==null?void 0:n.track)??`progress-${t.id}-track`},getLabelId:t=>{var n;return((n=t.ids)==null?void 0:n.label)??`progress-${t.id}-label`},getCircleId:t=>{var n;return((n=t.ids)==null?void 0:n.circle)??`progress-${t.id}-circle`}});function VI(t,n,r){const o=t.context.percent,s=t.context.isIndeterminate?"":`${o}%`,l=t.context.max,u=t.context.min,h=t.context.orientation,d=t.context.translations,p=t.context.isIndeterminate,m=t.context.value,v=d.value({value:m,max:l,percent:o,min:u}),y=zI(m,l),x={role:"progressbar","aria-label":v,"data-max":l,"aria-valuemin":u,"aria-valuemax":l,"aria-valuenow":m??void 0,"data-orientation":h,"data-state":y},C=HI(t.context);return{value:m,valueAsString:v,min:u,max:l,percent:o,percentAsString:s,indeterminate:p,setValue(b){n({type:"VALUE.SET",value:b})},setToMax(){n({type:"VALUE.SET",value:l})},setToMin(){n({type:"VALUE.SET",value:u})},getRootProps(){return r.element({dir:t.context.dir,...Uo.root.attrs,id:Ju.getRootId(t.context),"data-max":l,"data-value":m??void 0,"data-state":y,"data-orientation":h,style:{"--percent":p?void 0:o}})},getLabelProps(){return r.element({dir:t.context.dir,id:Ju.getLabelId(t.context),...Uo.label.attrs,"data-orientation":h})},getValueTextProps(){return r.element({dir:t.context.dir,"aria-live":"polite",...Uo.valueText.attrs})},getTrackProps(){return r.element({dir:t.context.dir,id:Ju.getTrackId(t.context),...Uo.track.attrs,...x})},getRangeProps(){return r.element({dir:t.context.dir,...Uo.range.attrs,"data-orientation":h,"data-state":y,style:{[t.context.isHorizontal?"width":"height"]:p?void 0:`${o}%`}})},getCircleProps(){return r.element({dir:t.context.dir,id:Ju.getCircleId(t.context),...Uo.circle.attrs,...x,...C.root})},getCircleTrackProps(){return r.element({dir:t.context.dir,"data-orientation":h,...Uo.circleTrack.attrs,...C.track})},getCircleRangeProps(){return r.element({dir:t.context.dir,...Uo.circleRange.attrs,...C.range,"data-state":y})},getViewProps(b){return r.element({dir:t.context.dir,...Uo.view.attrs,"data-state":b.state,hidden:b.state!==y})}}}function zI(t,n){return t==null?"indeterminate":t===n?"complete":"loading"}function HI(t){const n={style:{"--radius":"calc(var(--size) / 2 - var(--thickness) / 2)",cx:"calc(var(--size) / 2)",cy:"calc(var(--size) / 2)",r:"var(--radius)",fill:"transparent",strokeWidth:"var(--thickness)"}};return{root:{style:{width:"var(--size)",height:"var(--size)"}},track:n,range:{opacity:t.value===0?0:void 0,style:{...n.style,"--percent":t.percent,"--circumference":"calc(2 * 3.14159 * var(--radius))","--offset":"calc(var(--circumference) * (100 - var(--percent)) / 100)",strokeDashoffset:"calc(var(--circumference) * ((100 - var(--percent)) / 100))",strokeDasharray:t.isIndeterminate?void 0:"var(--circumference)",transformOrigin:"center",transform:"rotate(-90deg)"}}}}function UI(t,n){return t+(n-t)/2}function WI(t){const n=Yi(t);return Ec({id:"progress",initial:"idle",context:{max:n.max??100,min:n.min??0,value:UI(n.min??0,n.max??100),orientation:"horizontal",translations:{value:({percent:r})=>r===-1?"loading...":`${r} percent`,...n.translations},...n},created:["validateContext"],computed:{isIndeterminate:r=>r.value===null,percent(r){return Ng(r.value)?Math.round((r.value-r.min)/(r.max-r.min)*100):-1},isAtMax:r=>r.value===r.max,isHorizontal:r=>r.orientation==="horizontal",isRtl:r=>r.dir==="rtl"},states:{idle:{on:{"VALUE.SET":{actions:["setValue"]}}}}},{actions:{setValue:(r,o)=>{KI.value(r,o.value)},validateContext:r=>{if(r.value!=null){if(!Jg(r.max))throw new Error(`[progress] The max value passed \`${r.max}\` is not a valid number`);if(!qI(r.value,r.max))throw new Error(`[progress] The value passed \`${r.value}\` exceeds the max value \`${r.max}\``);if(!GI(r.value,r.min))throw new Error(`[progress] The value passed \`${r.value}\` exceeds the min value \`${r.min}\``)}}}})}function Jg(t){return Ng(t)&&!isNaN(t)}function qI(t,n){return Jg(t)&&t<=n}function GI(t,n){return Jg(t)&&t>=n}var KI={value(t,n){var r;uc(t.value,n)||(t.value=n===null?null:Math.max(0,Math.min(n,t.max)),(r=t.onValueChange)==null||r.call(t,{value:n}))}};Us()(["dir","getRootNode","id","ids","max","min","orientation","translations","value","onValueChange"]);const YI=(t={})=>{const{getRootNode:n}=Oc(),{dir:r}=ad(),o={id:$.useId(),dir:r,getRootNode:n,value:t.defaultValue,...t},s={...o,value:t.value,onValueChange:Bi(t.onValueChange,{sync:!0})},[l,u]=Pc(WI(o),{context:s});return VI(l,u,Zh)},Pb=({value:t=50,min:n=0,max:r=100,label:o="Progress"})=>(YI(),O.jsx("div",{className:"w-4 h-4 border-2 border-black border-b-transparent rounded-full animate-spin"})),qi=({id:t})=>{const n="https://api.openalex.org/works?per-page=20&filter=",{nodes:r,edges:o}=Qr(),[s,l]=$.useState(),[u,h]=$.useState(!1),[d,p]=$.useState(),{db:m}=Qg(),[v,y]=$.useState(!1),x=async _=>{if(m)try{await m.metadata.add(_);const N=await m.metadata.toArray();y(!0)}catch(N){console.error("Error adding data:",N)}},C=()=>{h(!0);let R=A.map(D=>D.data).map(D=>D.filter+":"+D.filter_value).join(",");fetch(n+R).then(D=>{if(D.ok)return D.json();throw new Error("Something went wrong!")}).then(D=>{p(D)}).catch(D=>{console.error(D)})};function b(){if(d){let _=Object(d);if(l(_.meta.count),_.results[0])for(let N of _.results){const R=MI(N);x(R)}h(!1)}}$.useEffect(()=>b(),[d]);const A=$.useMemo(()=>Eb(t,r,o),[r,o]);return O.jsx(_I,{type:qi.name,group:qi.group,children:O.jsxs("div",{className:"flex flex-col flex-grow items-stretch justify-between",children:[O.jsx("div",{className:"flex flex-grow justify-center items-center text-xl",children:u?O.jsx(Pb,{}):`n = ${s?s.toLocaleString():"?"}`}),O.jsxs("div",{className:"flex flex-shrink flex-row justify-center border-t-2 rounded-b-md gap-4 text-2xl px-2 py-2 items-center",children:[O.jsx(aI,{className:"border-1 border-black rounded-sm text-4xl bg-green-100",onClick:()=>C()}),O.jsx(oI,{className:"border-1 border-black rounded-sm text-4xl"}),O.jsx(rI,{className:"border-1 border-black rounded-sm text-4xl"})]})]})},t)};qi.source="OpenAlex";qi.source_short="OA";qi.group="Repository";qi.label="sink";qi.type="Computation";const XI=Object.freeze(Object.defineProperty({__proto__:null,Loader:Pb,default:qi},Symbol.toStringTag,{value:"Module"})),_b="nodeRegistry",Hr={};async function QI(){const t=Object.assign({"/src/flow/core/FilterFactory/nodes/FilterNodeFactory.jsx":bI,"/src/flow/core/OpenAlex/nodes/BaseTermNode.jsx":EI,"/src/flow/core/OpenAlex/nodes/SinkNode.jsx":XI});for(const n in t){const r=t[n];if(r.default){const o=r.default;if(!o.name){console.warn(`Skipping invalid core node module: ${n}`);continue}lw(o.source_short+"-"+o.label,o||{});continue}if(r.factory){if(typeof r.factory!="function"){console.warn(`Skipping invalid factory in ${n}`);continue}const o=r.factory();if(!Array.isArray(o)){console.warn(`Factory in ${n} did not return an array of nodes.`);continue}o.forEach(s=>{if(!s||!s.label){console.warn(`Skipping invalid node in factory from ${n}`);return}lw(s.source+"-"+s.label,s.component||{})})}}}function JI(){const t=localStorage.getItem(_b);if(t)try{const n=JSON.parse(t);Object.keys(n).forEach(r=>{Hr[r]&&(Hr[r].config=n[r])})}catch(n){console.error("Failed to parse registry from storage:",n)}}function ZI(){const t={};Object.keys(Hr).forEach(n=>{t[n]=Hr[n].config});try{localStorage.setItem(_b,JSON.stringify(t,null,2))}catch(n){console.error("Failed to save registry to storage:",n)}}function lw(t,n,r={}){Hr[t]?(Hr[t].config={...Hr[t].config,...r},Hr[t].component=n):Hr[t]={component:n,config:r},ZI()}function eM(){const t={};return Object.keys(Hr).forEach(n=>{t[n]=Hr[n].component}),t}async function tM(){JI(),await QI()}const nM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ig=(t=21)=>{let n="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)n+=nM[r[t]&63];return n};const rM=({title:t,children:n,footer:r,onClick:o,className:s=""})=>O.jsxs("div",{onClickCapture:o,className:Yg("h-50 w-100 bg-white p-4 rounded-lg shadow-md flex flex-col",s),children:[O.jsx("div",{className:"font-semibold text-lg border-b pb-2",children:t}),O.jsx("div",{className:"flex-1 flex py-4",children:n}),r&&O.jsx("div",{className:"border-t pt-2 text-sm text-gray-600",children:r})]});function oM(t){return Sr({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(t)}function iM(t){return Sr({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416.3 256c0-21 13.1-38.9 31.7-46.1-4.9-20.5-13-39.7-23.7-57.1-6.4 2.8-13.2 4.3-20.1 4.3-12.6 0-25.2-4.8-34.9-14.4-14.9-14.9-18.2-36.8-10.2-55-17.3-10.7-36.6-18.8-57-23.7C295 82.5 277 95.7 256 95.7S217 82.5 209.9 64c-20.5 4.9-39.7 13-57.1 23.7 8.1 18.1 4.7 40.1-10.2 55-9.6 9.6-22.3 14.4-34.9 14.4-6.9 0-13.7-1.4-20.1-4.3C77 170.3 68.9 189.5 64 210c18.5 7.1 31.7 25 31.7 46.1 0 21-13.1 38.9-31.6 46.1 4.9 20.5 13 39.7 23.7 57.1 6.4-2.8 13.2-4.2 20-4.2 12.6 0 25.2 4.8 34.9 14.4 14.8 14.8 18.2 36.8 10.2 54.9 17.4 10.7 36.7 18.8 57.1 23.7 7.1-18.5 25-31.6 46-31.6s38.9 13.1 46 31.6c20.5-4.9 39.7-13 57.1-23.7-8-18.1-4.6-40 10.2-54.9 9.6-9.6 22.2-14.4 34.9-14.4 6.8 0 13.7 1.4 20 4.2 10.7-17.4 18.8-36.7 23.7-57.1-18.4-7.2-31.6-25.1-31.6-46.2zm-159.4 79.9c-44.3 0-80-35.9-80-80s35.7-80 80-80 80 35.9 80 80-35.7 80-80 80z"},child:[]}]})(t)}const sM=({id:t,description:n,name:r,onClick:o,onSaveEdit:s,setShowDialogue:l,className:u,flowID:h})=>{const[d,p]=$.useState(r),[m,v]=$.useState(n),[y,x]=$.useState(!1),[C,b]=$.useState(!0),A=$.useCallback(()=>{(!y||C)&&o()});return O.jsxs("div",{className:Yg("flex flex-col w-full bg-white p-4 rounded-lg shadow-md",{"cursor-pointer hover:bg-blue-200/40":C},u),onClick:A,children:[O.jsxs("div",{className:"flex justify-between font-semibold text-md border-b pb-2",children:[O.jsxs("div",{className:"self-start h-auto min-h-[1rem] break-words overflow-hidden",children:[!y&&d,y&&O.jsx("input",{className:"text-blue-200 border-1 border-gray-200",value:d,onChange:_=>p(_.target.value)},"nameInput")]}),O.jsxs("div",{className:"flex flex-row rounded-md",onMouseOver:()=>{b(!1)},onMouseOutCapture:()=>{y||b(!0)},children:[O.jsx(iM,{className:"w-6 h-6 hover:bg-blue-200/40 p-1"}),!C&&O.jsx(iI,{className:"w-6 h-6 hover:bg-blue-200/40 p-1",onClick:_=>{_.stopPropagation(),x(!y)}}),!C&&O.jsx(eI,{onClick:_=>{_.stopPropagation(),l(!0)},className:"w-6 h-6 hover:bg-blue-200/40 p-1"})]})]}),O.jsx("div",{className:"flex break-words overflow-hidden h-full min-h-[rem]",children:O.jsxs("div",{className:"break-words overflow-hidden",children:[!y&&m,y&&O.jsx("textarea",{className:"w-full h-full text-blue-200 border-1 border-gray-200",value:m,onChange:_=>v(_.target.value)},"descriptionInput")]})}),O.jsxs("div",{className:"text-xs text-gray-400 justify-content-end",children:["ID: ",h]})]})},[aM,Ja]=Ws({name:"DialogContext",hookName:"useDialogContext",providerName:""}),Zg=$.forwardRef((t,n)=>{const r=Ja(),o=mb(),s=td({...o,present:r.open}),l=Qt(r.getBackdropProps(),s.getPresenceProps(),t);return s.unmounted?null:O.jsx(Pn.div,{...l,ref:_c(s.ref,n)})});Zg.displayName="DialogBackdrop";const em=$.forwardRef((t,n)=>{const r=Ja(),o=Qt(r.getCloseTriggerProps(),t);return O.jsx(Pn.button,{...o,ref:n})});em.displayName="DialogCloseTrigger";const tm=$.forwardRef((t,n)=>{const r=Ja(),o=ed(),s=Qt(r.getContentProps(),o.getPresenceProps(),t);return o.unmounted?null:O.jsx(Pn.div,{...s,ref:_c(o.ref,n)})});tm.displayName="DialogContent";const nm=$.forwardRef((t,n)=>{const r=Ja(),o=Qt(r.getDescriptionProps(),t);return O.jsx(Pn.div,{...o,ref:n})});nm.displayName="DialogDescription";const rm=$.forwardRef((t,n)=>{const r=Ja(),o=Qt(r.getPositionerProps(),t);return ed().unmounted?null:O.jsx(Pn.div,{...o,ref:n})});rm.displayName="DialogPositioner";var Ma=new WeakMap,Zu=new WeakMap,eh={},op=0,Ab=t=>t&&(t.host||Ab(t.parentNode)),lM=(t,n)=>n.map(r=>{if(t.contains(r))return r;const o=Ab(r);return o&&t.contains(o)?o:(console.error("[zag-js > ariaHidden] target",r,"in not contained inside",t,". Doing nothing"),null)}).filter(r=>!!r),cM=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),uM=(t,n)=>{const{parentNode:r,markerName:o,controlAttribute:s,explicitBooleanValue:l}=n,u=lM(r,Array.isArray(t)?t:[t]);eh[o]||(eh[o]=new WeakMap);const h=eh[o],d=[],p=new Set,m=new Set(u),v=x=>{!x||p.has(x)||(p.add(x),v(x.parentNode))};u.forEach(v);const y=x=>{!x||m.has(x)||Array.prototype.forEach.call(x.children,C=>{if(p.has(C))y(C);else try{if(cM(C))return;const b=C.getAttribute(s),A=l?b==="true":b!==null&&b!=="false",_=(Ma.get(C)||0)+1,N=(h.get(C)||0)+1;Ma.set(C,_),h.set(C,N),d.push(C),_===1&&A&&Zu.set(C,!0),N===1&&C.setAttribute(o,""),A||C.setAttribute(s,l?"true":"")}catch(b){console.error("[zag-js > ariaHidden] cannot operate on ",C,b)}})};return y(r),p.clear(),op++,()=>{d.forEach(x=>{const C=Ma.get(x)-1,b=h.get(x)-1;Ma.set(x,C),h.set(x,b),C||(Zu.has(x)||x.removeAttribute(s),Zu.delete(x)),b||x.removeAttribute(o)}),op--,op||(Ma=new WeakMap,Ma=new WeakMap,Zu=new WeakMap,eh={})}},hM=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,dM=(t,n=hM(t),r="data-aria-hidden")=>{if(n)return uM(t,{parentNode:n,markerName:r,controlAttribute:"aria-hidden",explicitBooleanValue:!0})},fM=t=>{const n=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(n)};function pM(t,n={}){const{defer:r=!0}=n,o=r?fM:l=>l(),s=[];return s.push(o(()=>{const u=(typeof t=="function"?t():t).filter(Boolean);u.length!==0&&s.push(dM(u))})),()=>{s.forEach(l=>l==null?void 0:l())}}var gM=Object.defineProperty,mM=(t,n,r)=>n in t?gM(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,It=(t,n,r)=>mM(t,typeof n!="symbol"?n+"":n,r),cw={activateTrap(t,n){if(t.length>0){const o=t[t.length-1];o!==n&&o.pause()}const r=t.indexOf(n);r===-1||t.splice(r,1),t.push(n)},deactivateTrap(t,n){const r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},yM=[],vM=class{constructor(t,n){It(this,"trapStack"),It(this,"config"),It(this,"doc"),It(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),It(this,"listenerCleanups",[]),It(this,"handleFocus",o=>{const s=Yo(o),l=this.findContainerIndex(s,o)>=0;if(l||zg(s))l&&(this.state.mostRecentlyFocusedNode=s);else{o.stopImmediatePropagation();let u,h=!0;if(this.state.mostRecentlyFocusedNode)if(Ll(this.state.mostRecentlyFocusedNode)>0){const d=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:p}=this.state.containerGroups[d];if(p.length>0){const m=p.findIndex(v=>v===this.state.mostRecentlyFocusedNode);m>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?m+1=0&&(u=p[m-1],h=!1))}}else this.state.containerGroups.some(d=>d.tabbableNodes.some(p=>Ll(p)>0))||(h=!1);else h=!1;h&&(u=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),u?this.tryFocus(u):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),It(this,"handlePointerDown",o=>{const s=Yo(o);if(!(this.findContainerIndex(s,o)>=0)){if(Vl(this.config.clickOutsideDeactivates,o)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}Vl(this.config.allowOutsideClick,o)||o.preventDefault()}}),It(this,"handleClick",o=>{const s=Yo(o);this.findContainerIndex(s,o)>=0||Vl(this.config.clickOutsideDeactivates,o)||Vl(this.config.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())}),It(this,"handleTabKey",o=>{if(this.config.isKeyForward(o)||this.config.isKeyBackward(o)){this.state.recentNavEvent=o;const s=this.config.isKeyBackward(o),l=this.findNextNavNode({event:o,isBackward:s});if(!l)return;$l(o)&&o.preventDefault(),this.tryFocus(l)}}),It(this,"handleEscapeKey",o=>{wM(o)&&Vl(this.config.escapeDeactivates,o)!==!1&&(o.preventDefault(),this.deactivate())}),It(this,"_mutationObserver"),It(this,"setupMutationObserver",()=>{const o=this.doc.defaultView||window;this._mutationObserver=new o.MutationObserver(s=>{s.some(u=>Array.from(u.removedNodes).some(d=>d===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),It(this,"updateObservedNodes",()=>{var o;(o=this._mutationObserver)==null||o.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(s=>{var l;(l=this._mutationObserver)==null||l.observe(s,{subtree:!0,childList:!0})})}),It(this,"getInitialFocusNode",()=>{let o=this.getNodeForOption("initialFocus",{hasFallback:!0});if(o===!1)return!1;if(o===void 0||o&&!$i(o))if(this.findContainerIndex(this.doc.activeElement)>=0)o=this.doc.activeElement;else{const s=this.state.tabbableGroups[0];o=s&&s.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else o===null&&(o=this.getNodeForOption("fallbackFocus"));if(!o)throw new Error("Your focus-trap needs to have at least one focusable element");return o.isConnected||(o=this.getNodeForOption("fallbackFocus")),o}),It(this,"tryFocus",o=>{if(o!==!1&&o!==ob(this.doc)){if(!o||!o.focus){this.tryFocus(this.getInitialFocusNode());return}o.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=o,xM(o)&&o.select()}}),It(this,"deactivate",o=>{if(!this.state.active)return this;const s={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...o};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),cw.deactivateTrap(this.trapStack,this);const l=this.getOption(s,"onDeactivate"),u=this.getOption(s,"onPostDeactivate"),h=this.getOption(s,"checkCanReturnFocus"),d=this.getOption(s,"returnFocus","returnFocusOnDeactivate");l==null||l();const p=()=>{uw(()=>{if(d){const m=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(m)}u==null||u()})};if(d&&h){const m=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return h(m).then(p,p),this}return p(),this}),It(this,"pause",o=>{if(this.state.paused||!this.state.active)return this;const s=this.getOption(o,"onPause"),l=this.getOption(o,"onPostPause");return this.state.paused=!0,s==null||s(),this.removeListeners(),this.updateObservedNodes(),l==null||l(),this}),It(this,"unpause",o=>{if(!this.state.paused||!this.state.active)return this;const s=this.getOption(o,"onUnpause"),l=this.getOption(o,"onPostUnpause");return this.state.paused=!1,s==null||s(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),l==null||l(),this}),It(this,"updateContainerElements",o=>(this.state.containers=Array.isArray(o)?o.filter(Boolean):[o].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),It(this,"getReturnFocusNode",o=>{const s=this.getNodeForOption("setReturnFocus",{params:[o]});return s||(s===!1?!1:o)}),It(this,"getOption",(o,s,l)=>o&&o[s]!==void 0?o[s]:this.config[l||s]),It(this,"getNodeForOption",(o,{hasFallback:s=!1,params:l=[]}={})=>{let u=this.config[o];if(typeof u=="function"&&(u=u(...l)),u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error(`\`${o}\` was specified but was not a node, or did not return a node`)}let h=u;if(typeof u=="string"){try{h=this.doc.querySelector(u)}catch(d){throw new Error(`\`${o}\` appears to be an invalid selector; error="${d.message}"`)}if(!h&&!s)throw new Error(`\`${o}\` as selector refers to no known node`)}return h}),It(this,"findNextNavNode",o=>{const{event:s,isBackward:l=!1}=o,u=o.target||Yo(s);this.updateTabbableNodes();let h=null;if(this.state.tabbableGroups.length>0){const d=this.findContainerIndex(u,s),p=d>=0?this.state.containerGroups[d]:void 0;if(d<0)l?h=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:h=this.state.tabbableGroups[0].firstTabbableNode;else if(l){let m=this.state.tabbableGroups.findIndex(({firstTabbableNode:v})=>u===v);if(m<0&&((p==null?void 0:p.container)===u||$i(u)&&!Ns(u)&&!(p!=null&&p.nextTabbableNode(u,!1)))&&(m=d),m>=0){const v=m===0?this.state.tabbableGroups.length-1:m-1,y=this.state.tabbableGroups[v];h=Ll(u)>=0?y.lastTabbableNode:y.lastDomTabbableNode}else $l(s)||(h=p==null?void 0:p.nextTabbableNode(u,!1))}else{let m=this.state.tabbableGroups.findIndex(({lastTabbableNode:v})=>u===v);if(m<0&&((p==null?void 0:p.container)===u||$i(u)&&!Ns(u)&&!(p!=null&&p.nextTabbableNode(u)))&&(m=d),m>=0){const v=m===this.state.tabbableGroups.length-1?0:m+1,y=this.state.tabbableGroups[v];h=Ll(u)>=0?y.firstTabbableNode:y.firstDomTabbableNode}else $l(s)||(h=p==null?void 0:p.nextTabbableNode(u))}}else h=this.getNodeForOption("fallbackFocus");return h}),this.trapStack=n.trapStack||yM;const r={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(o){return $l(o)&&!o.shiftKey},isKeyBackward(o){return $l(o)&&o.shiftKey},...n};this.doc=r.document||ni(Array.isArray(t)?t[0]:t),this.config=r,this.updateContainerElements(t),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(t,n){const r=typeof(n==null?void 0:n.composedPath)=="function"?n.composedPath():void 0;return this.state.containerGroups.findIndex(({container:o,tabbableNodes:s})=>o.contains(t)||(r==null?void 0:r.includes(o))||s.find(l=>l===t))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(t=>{const n=ab(t),r=qg(t),o=n.length>0?n[0]:void 0,s=n.length>0?n[n.length-1]:void 0,l=r.find(p=>Ns(p)),u=r.slice().reverse().find(p=>Ns(p)),h=!!n.find(p=>Ll(p)>0);function d(p,m=!0){const v=n.indexOf(p);return v<0?m?r.slice(r.indexOf(p)+1).find(y=>Ns(y)):r.slice(0,r.indexOf(p)).reverse().find(y=>Ns(y)):n[v+(m?1:-1)]}return{container:t,tabbableNodes:n,focusableNodes:r,posTabIndexesFound:h,firstTabbableNode:o,lastTabbableNode:s,firstDomTabbableNode:l,lastDomTabbableNode:u,nextTabbableNode:d}}),this.state.tabbableGroups=this.state.containerGroups.filter(t=>t.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(t=>t.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return cw.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?uw(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(po(this.doc,"focusin",this.handleFocus,!0),po(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),po(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),po(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),po(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),po(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(t=>t()),this.listenerCleanups=[],this}activate(t){if(this.state.active)return this;const n=this.getOption(t,"onActivate"),r=this.getOption(t,"onPostActivate"),o=this.getOption(t,"checkCanFocusTrap");o||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,n==null||n();const s=()=>{o&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),r==null||r()};return o?(o(this.state.containers.concat()).then(s,s),this):(s(),this)}},$l=t=>t.key==="Tab",Vl=(t,...n)=>typeof t=="function"?t(...n):t,wM=t=>!t.isComposing&&t.key==="Escape",uw=t=>setTimeout(t,0),xM=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function SM(t,n={}){let r;const o=En(()=>{const s=typeof t=="function"?t():t;if(s){r=new vM(s,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:s,...n,document:ni(s)});try{r.activate()}catch{}}});return function(){r==null||r.deactivate(),o()}}var ip="data-scroll-lock";function hw(t,n){if(!t)return;const r=Object.keys(n).reduce((o,s)=>(o[s]=t.style.getPropertyValue(s),o),{});return Object.assign(t.style,n),()=>{Object.assign(t.style,r)}}function bM(t,n,r){if(!t)return;const o=t.style.getPropertyValue(n);return t.style.setProperty(n,r),()=>{o?t.style.setProperty(n,o):t.style.removeProperty(n)}}function CM(t){const n=t.getBoundingClientRect().left;return Math.round(n)+t.scrollLeft?"paddingLeft":"paddingRight"}function EM(t){const n=t??document,r=n.defaultView??window,{documentElement:o,body:s}=n;if(s.hasAttribute(ip))return;s.setAttribute(ip,"");const u=r.innerWidth-o.clientWidth,h=()=>bM(o,"--scrollbar-width",`${u}px`),d=CM(o),p=()=>hw(s,{overflow:"hidden",[d]:`${u}px`}),m=()=>{const{scrollX:y,scrollY:x,visualViewport:C}=r,b=(C==null?void 0:C.offsetLeft)??0,A=(C==null?void 0:C.offsetTop)??0,_=hw(s,{position:"fixed",overflow:"hidden",top:`${-(x-Math.floor(A))}px`,left:`${-(y-Math.floor(b))}px`,right:"0",[d]:`${u}px`});return()=>{_==null||_(),r.scrollTo({left:y,top:x,behavior:"instant"})}},v=[h(),TN()?m():p()];return()=>{v.forEach(y=>y==null?void 0:y()),s.removeAttribute(ip)}}var PM=Bs("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),Os=PM.build(),dt=sd({getPositionerId:t=>{var n;return((n=t.ids)==null?void 0:n.positioner)??`dialog:${t.id}:positioner`},getBackdropId:t=>{var n;return((n=t.ids)==null?void 0:n.backdrop)??`dialog:${t.id}:backdrop`},getContentId:t=>{var n;return((n=t.ids)==null?void 0:n.content)??`dialog:${t.id}:content`},getTriggerId:t=>{var n;return((n=t.ids)==null?void 0:n.trigger)??`dialog:${t.id}:trigger`},getTitleId:t=>{var n;return((n=t.ids)==null?void 0:n.title)??`dialog:${t.id}:title`},getDescriptionId:t=>{var n;return((n=t.ids)==null?void 0:n.description)??`dialog:${t.id}:description`},getCloseTriggerId:t=>{var n;return((n=t.ids)==null?void 0:n.closeTrigger)??`dialog:${t.id}:close`},getContentEl:t=>dt.getById(t,dt.getContentId(t)),getPositionerEl:t=>dt.getById(t,dt.getPositionerId(t)),getBackdropEl:t=>dt.getById(t,dt.getBackdropId(t)),getTriggerEl:t=>dt.getById(t,dt.getTriggerId(t)),getTitleEl:t=>dt.getById(t,dt.getTitleId(t)),getDescriptionEl:t=>dt.getById(t,dt.getDescriptionId(t)),getCloseTriggerEl:t=>dt.getById(t,dt.getCloseTriggerId(t))});function _M(t,n,r){const o=t.context["aria-label"],s=t.matches("open"),l=t.context.renderedElements;return{open:s,setOpen(u){u!==s&&n(u?"OPEN":"CLOSE")},getTriggerProps(){return r.button({...Os.trigger.attrs,dir:t.context.dir,id:dt.getTriggerId(t.context),"aria-haspopup":"dialog",type:"button","aria-expanded":s,"data-state":s?"open":"closed","aria-controls":dt.getContentId(t.context),onClick(u){u.defaultPrevented||n("TOGGLE")}})},getBackdropProps(){return r.element({...Os.backdrop.attrs,dir:t.context.dir,hidden:!s,id:dt.getBackdropId(t.context),"data-state":s?"open":"closed"})},getPositionerProps(){return r.element({...Os.positioner.attrs,dir:t.context.dir,id:dt.getPositionerId(t.context),style:{pointerEvents:s?void 0:"none"}})},getContentProps(){return r.element({...Os.content.attrs,dir:t.context.dir,role:t.context.role,hidden:!s,id:dt.getContentId(t.context),tabIndex:-1,"data-state":s?"open":"closed","aria-modal":!0,"aria-label":o||void 0,"aria-labelledby":o||!l.title?void 0:dt.getTitleId(t.context),"aria-describedby":l.description?dt.getDescriptionId(t.context):void 0})},getTitleProps(){return r.element({...Os.title.attrs,dir:t.context.dir,id:dt.getTitleId(t.context)})},getDescriptionProps(){return r.element({...Os.description.attrs,dir:t.context.dir,id:dt.getDescriptionId(t.context)})},getCloseTriggerProps(){return r.button({...Os.closeTrigger.attrs,dir:t.context.dir,id:dt.getCloseTriggerId(t.context),type:"button",onClick(u){u.defaultPrevented||(u.stopPropagation(),n("CLOSE"))}})}}}function AM(t){const n=Yi(t);return Ec({id:"dialog",initial:n.open?"open":"closed",context:{role:"dialog",renderedElements:{title:!0,description:!0},modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!0,closeOnEscape:!0,restoreFocus:!0,...n},created:["setAlertDialogProps"],watch:{open:["toggleVisibility"]},states:{open:{entry:["checkRenderedElements","syncZIndex"],activities:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}}},{guards:{isOpenControlled:r=>!!r["open.controlled"]},activities:{trackDismissableElement(r,o,{send:s}){return fb(()=>dt.getContentEl(r),{defer:!0,pointerBlocking:r.modal,exclude:[dt.getTriggerEl(r)],onInteractOutside(u){var h;(h=r.onInteractOutside)==null||h.call(r,u),r.closeOnInteractOutside||u.preventDefault()},persistentElements:r.persistentElements,onFocusOutside:r.onFocusOutside,onPointerDownOutside:r.onPointerDownOutside,onEscapeKeyDown(u){var h;(h=r.onEscapeKeyDown)==null||h.call(r,u),r.closeOnEscape||u.preventDefault()},onDismiss(){s({type:"CLOSE",src:"interact-outside"})}})},preventScroll(r){if(r.preventScroll)return EM(dt.getDoc(r))},trapFocus(r){return!r.trapFocus||!r.modal?void 0:SM(()=>dt.getContentEl(r),{preventScroll:!0,returnFocusOnDeactivate:!!r.restoreFocus,initialFocus:r.initialFocusEl,setReturnFocus:s=>{var l;return((l=r.finalFocusEl)==null?void 0:l.call(r))??s}})},hideContentBelow(r){return r.modal?pM(()=>[dt.getContentEl(r)],{defer:!0}):void 0}},actions:{setAlertDialogProps(r){r.role==="alertdialog"&&(r.initialFocusEl||(r.initialFocusEl=()=>dt.getCloseTriggerEl(r)),r.closeOnInteractOutside=!1)},checkRenderedElements(r){En(()=>{r.renderedElements.title=!!dt.getTitleEl(r),r.renderedElements.description=!!dt.getDescriptionEl(r)})},syncZIndex(r){En(()=>{const o=dt.getContentEl(r);if(!o)return;const s=ib(o);[dt.getPositionerEl(r),dt.getBackdropEl(r)].forEach(u=>{u==null||u.style.setProperty("--z-index",s.zIndex)})})},invokeOnClose(r){var o;(o=r.onOpenChange)==null||o.call(r,{open:!1})},invokeOnOpen(r){var o;(o=r.onOpenChange)==null||o.call(r,{open:!0})},toggleVisibility(r,o,{send:s}){s({type:r.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:o})}}})}Us()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open.controlled","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const TM=(t={})=>{const{getRootNode:n}=Oc(),{dir:r}=ad(),o={id:$.useId(),getRootNode:n,dir:r,open:t.defaultOpen,"open.controlled":t.open!==void 0,...t},s={...o,open:t.open,onOpenChange:Bi(t.onOpenChange,{sync:!0}),onEscapeKeyDown:Bi(t.onEscapeKeyDown),onInteractOutside:Bi(t.onInteractOutside)},[l,u]=Pc(AM(o),{context:s});return _M(l,u,Zh)},Tb=t=>{const[n,{children:r,...o}]=GS(t),[s]=yb(n),l=TM(o),u=td(Qt({present:l.open},n));return O.jsx(aM,{value:l,children:O.jsx(gb,{value:s,children:O.jsx(Ig,{value:u,children:r})})})},om=$.forwardRef((t,n)=>{const r=Ja(),o=Qt(r.getTitleProps(),t);return O.jsx(Pn.h2,{...o,ref:n})});om.displayName="DialogTitle";const RM=({showDialogue:t,setShowDialogue:n,onDelete:r,flowForDel:o})=>O.jsx(Tb,{className:"relative z-50",open:t,onOpenChange:s=>n(s.open),children:O.jsxs(Gg,{children:[O.jsx(Zg,{className:"fixed inset-0 bg-black opacity-50"}),O.jsx(rm,{className:"fixed top-0 left-1/2 transform -translate-x-1/2 mt-10 z-50",children:O.jsxs(tm,{className:"bg-white p-6 rounded-lg shadow-lg w-96",children:[O.jsxs(om,{className:"text-xl font-semibold",children:["Delete ",o,"?"]}),O.jsx(nm,{className:"text-gray-700 mt-2",children:"Are you sure you want to delete this research flow?"}),O.jsxs("div",{className:"mt-4 flex flex-col gap-6",children:[O.jsx("button",{onClick:s=>{s.stopPropagation(),r()},className:"bg-gray-100 text-black rounded hover:bg-gray-200 w-40",children:"Delete Research Flow"}),O.jsx(em,{className:"bg-gray-300 py-2 px-4 rounded hover:bg-gray-400",children:"Cancel"})]})]})})]})}),Rb=({title:t="Dialog Title",closeText:n="Close",contentClassName:r="",backdropClassName:o="",submitButton:s=null,isOpen:l=!1,setIsOpen:u=()=>{},children:h})=>O.jsx(Tb,{open:l,onOpenChange:d=>u(d.open),children:O.jsxs(Gg,{children:[O.jsx(Zg,{className:`fixed inset-0 bg-black opacity-20 ${o}`}),O.jsx(rm,{className:"fixed inset-0 flex justify-center items-center",children:O.jsxs(tm,{className:`bg-white p-6 rounded-lg shadow-xl w-96 ${r}`,children:[O.jsx(om,{className:"text-xl font-semibold text-gray-800",children:t}),h,O.jsx(nm,{}),O.jsxs("div",{className:"mt-4 flex justify-between items-center",children:[O.jsx(em,{className:"cancel-button",children:n}),h&&O.jsx("div",{children:s})]})]})})]})}),OM=({nodeMenuVisible:t,setNodeMenuVisible:n})=>($.useCallback(),O.jsx(Rb,{isOpen:t,setIsOpen:n,closeText:"Close",title:"Add Node",children:O.jsx("div",{className:"flex flex-col mt-2 gap-2"})}));tM();const th=eM(),kM=({nodesIn:t,edgesIn:n,...r})=>{const o=$.useRef(null),{viewport:s,onNodesChange:l,onEdgesChange:u,onConnect:h,addNode:d,updateNodePosition:p,addEdge:m,setViewport:v,clearStore:y,updateNodeTypes:x,nodeTypes:C,setNodes:b,setEdges:A}=Qr();$.useMemo(()=>x(Object.keys(th)),[]),console.log(th);const _=t,N=n,[R,D]=$.useState(!1),Z=Yh(),ue=$.useCallback((K,ne,I)=>{if(!Object.keys(th).includes(I))return;let M=Z.getNodes().find(z=>z.id==K),H=M.position.x,W=M.position.y;const X=M.measured.width,V=M.measured.height,F=40,j=40,Y=ig();ne==="right"&&(H=H+F+X),ne==="left"&&(H=H-F-X),ne==="top"&&(W=W-j-V),ne==="bottom"&&(W=W+j+V),d({id:Y,type:I,position:{x:H,y:W},data:{}}),ne==="left"&&m({source:Y,sourceHandle:"outgoingR",target:K,targetHandle:"incomingL"}),ne==="right"&&m({source:K,sourceHandle:"outgoingR",target:Y,targetHandle:"incomingL"}),ne==="top"&&m({source:Y,sourceHandle:"outgoingB",target:K,targetHandle:"incomingT"}),ne==="bottom"&&m({id:ig(),source:K,sourceHandle:"outgoingB",target:Y,targetHandle:"incomingT"})});return MR({onEnd:K=>v(K)}),O.jsxs("div",{className:"flow",children:[O.jsx(OM,{nodeMenuVisible:R,setNodeMenuVisible:D}),O.jsx("div",{ref:o,className:"reactflow-wrapper",children:O.jsx(Cb.Provider,{value:ue,children:O.jsxs(DR,{nodes:_,defaultViewport:s,edges:N,nodeTypes:th,onNodesChange:l,onEdgesChange:u,onConnect:h,nodeOrigin:[.5,.5],snapToGrid:!0,snapGrid:[8,8],minZoom:.2,connectionLineType:"smoothstep",children:[O.jsx(YR,{}),O.jsx(zR,{gap:8})]})})})]})};class NM extends $.Component{constructor(n){super(n),this.state={hasError:!1,errorMessage:""}}static getDerivedStateFromError(n){return{hasError:!0,errorMessage:n.toString()}}componentDidCatch(n,r){console.error("ErrorBoundary caught an error:",n,r)}render(){return this.state.hasError?O.jsxs("div",{style:{padding:"20px",color:"red",backgroundColor:"#ffe6e6"},children:[O.jsx("h2",{children:"Something went wrong."}),O.jsx("p",{children:this.state.errorMessage})]}):this.props.children}}$.createContext([null,t=>{}]);$.createContext(null);const DM=({nodes:t,edges:n})=>{const[r,o]=$.useState();return O.jsx(O.Fragment,{children:O.jsx(NM,{children:O.jsx(mS,{children:O.jsx(kM,{nodesIn:t,edgesIn:n})})})})};var zl={},dw;function IM(){if(dw)return zl;dw=1,Object.defineProperty(zl,"__esModule",{value:!0}),zl.parse=u,zl.serialize=p;const t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/,s=Object.prototype.toString,l=(()=>{const y=function(){};return y.prototype=Object.create(null),y})();function u(y,x){const C=new l,b=y.length;if(b<2)return C;const A=(x==null?void 0:x.decode)||m;let _=0;do{const N=y.indexOf("=",_);if(N===-1)break;const R=y.indexOf(";",_),D=R===-1?b:R;if(N>D){_=y.lastIndexOf(";",N-1)+1;continue}const Z=h(y,_,N),ue=d(y,N,Z),K=y.slice(Z,ue);if(C[K]===void 0){let ne=h(y,N+1,D),I=d(y,D,ne);const M=A(y.slice(ne,I));C[K]=M}_=D+1}while(_C;){const b=y.charCodeAt(--x);if(b!==32&&b!==9)return x+1}return C}function p(y,x,C){const b=(C==null?void 0:C.encode)||encodeURIComponent;if(!t.test(y))throw new TypeError(`argument name is invalid: ${y}`);const A=b(x);if(!n.test(A))throw new TypeError(`argument val is invalid: ${x}`);let _=y+"="+A;if(!C)return _;if(C.maxAge!==void 0){if(!Number.isInteger(C.maxAge))throw new TypeError(`option maxAge is invalid: ${C.maxAge}`);_+="; Max-Age="+C.maxAge}if(C.domain){if(!r.test(C.domain))throw new TypeError(`option domain is invalid: ${C.domain}`);_+="; Domain="+C.domain}if(C.path){if(!o.test(C.path))throw new TypeError(`option path is invalid: ${C.path}`);_+="; Path="+C.path}if(C.expires){if(!v(C.expires)||!Number.isFinite(C.expires.valueOf()))throw new TypeError(`option expires is invalid: ${C.expires}`);_+="; Expires="+C.expires.toUTCString()}if(C.httpOnly&&(_+="; HttpOnly"),C.secure&&(_+="; Secure"),C.partitioned&&(_+="; Partitioned"),C.priority)switch(typeof C.priority=="string"?C.priority.toLowerCase():void 0){case"low":_+="; Priority=Low";break;case"medium":_+="; Priority=Medium";break;case"high":_+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${C.priority}`)}if(C.sameSite)switch(typeof C.sameSite=="string"?C.sameSite.toLowerCase():C.sameSite){case!0:case"strict":_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"none":_+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${C.sameSite}`)}return _}function m(y){if(y.indexOf("%")===-1)return y;try{return decodeURIComponent(y)}catch{return y}}function v(y){return s.call(y)==="[object Date]"}return zl}IM();/** - * react-router v7.1.5 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var fw="popstate";function MM(t={}){function n(s,l){let{pathname:u="/",search:h="",hash:d=""}=Gs(s.location.hash.substring(1));return!u.startsWith("/")&&!u.startsWith(".")&&(u="/"+u),sg("",{pathname:u,search:h,hash:d},l.state&&l.state.usr||null,l.state&&l.state.key||"default")}function r(s,l){let u=s.document.querySelector("base"),h="";if(u&&u.getAttribute("href")){let d=s.location.href,p=d.indexOf("#");h=p===-1?d:d.slice(0,p)}return h+"#"+(typeof l=="string"?l:mc(l))}function o(s,l){Yr(s.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(l)})`)}return FM(n,r,o,t)}function Mt(t,n){if(t===!1||t===null||typeof t>"u")throw new Error(n)}function Yr(t,n){if(!t){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function LM(){return Math.random().toString(36).substring(2,10)}function pw(t,n){return{usr:t.state,key:t.key,idx:n}}function sg(t,n,r=null,o){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof n=="string"?Gs(n):n,state:r,key:n&&n.key||o||LM()}}function mc({pathname:t="/",search:n="",hash:r=""}){return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Gs(t){let n={};if(t){let r=t.indexOf("#");r>=0&&(n.hash=t.substring(r),t=t.substring(0,r));let o=t.indexOf("?");o>=0&&(n.search=t.substring(o),t=t.substring(0,o)),t&&(n.pathname=t)}return n}function FM(t,n,r,o={}){let{window:s=document.defaultView,v5Compat:l=!1}=o,u=s.history,h="POP",d=null,p=m();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function m(){return(u.state||{idx:null}).idx}function v(){h="POP";let A=m(),_=A==null?null:A-p;p=A,d&&d({action:h,location:b.location,delta:_})}function y(A,_){h="PUSH";let N=sg(b.location,A,_);r&&r(N,A),p=m()+1;let R=pw(N,p),D=b.createHref(N);try{u.pushState(R,"",D)}catch(Z){if(Z instanceof DOMException&&Z.name==="DataCloneError")throw Z;s.location.assign(D)}l&&d&&d({action:h,location:b.location,delta:1})}function x(A,_){h="REPLACE";let N=sg(b.location,A,_);r&&r(N,A),p=m();let R=pw(N,p),D=b.createHref(N);u.replaceState(R,"",D),l&&d&&d({action:h,location:b.location,delta:0})}function C(A){let _=s.location.origin!=="null"?s.location.origin:s.location.href,N=typeof A=="string"?A:mc(A);return N=N.replace(/ $/,"%20"),Mt(_,`No window.location.(origin|href) available to create URL for href: ${N}`),new URL(N,_)}let b={get action(){return h},get location(){return t(s,u)},listen(A){if(d)throw new Error("A history only accepts one active listener");return s.addEventListener(fw,v),d=A,()=>{s.removeEventListener(fw,v),d=null}},createHref(A){return n(s,A)},createURL:C,encodeLocation(A){let _=C(A);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:y,replace:x,go(A){return u.go(A)}};return b}function Ob(t,n,r="/"){return jM(t,n,r,!1)}function jM(t,n,r,o){let s=typeof n=="string"?Gs(n):n,l=Gi(s.pathname||"/",r);if(l==null)return null;let u=kb(t);BM(u);let h=null;for(let d=0;h==null&&d{let d={relativePath:h===void 0?l.path||"":h,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};d.relativePath.startsWith("/")&&(Mt(d.relativePath.startsWith(o),`Absolute route path "${d.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(o.length));let p=Qo([o,d.relativePath]),m=r.concat(d);l.children&&l.children.length>0&&(Mt(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),kb(l.children,n,m,p)),!(l.path==null&&!l.index)&&n.push({path:p,score:qM(p,l.index),routesMeta:m})};return t.forEach((l,u)=>{var h;if(l.path===""||!((h=l.path)!=null&&h.includes("?")))s(l,u);else for(let d of Nb(l.path))s(l,u,d)}),n}function Nb(t){let n=t.split("/");if(n.length===0)return[];let[r,...o]=n,s=r.endsWith("?"),l=r.replace(/\?$/,"");if(o.length===0)return s?[l,""]:[l];let u=Nb(o.join("/")),h=[];return h.push(...u.map(d=>d===""?l:[l,d].join("/"))),s&&h.push(...u),h.map(d=>t.startsWith("/")&&d===""?"/":d)}function BM(t){t.sort((n,r)=>n.score!==r.score?r.score-n.score:GM(n.routesMeta.map(o=>o.childrenIndex),r.routesMeta.map(o=>o.childrenIndex)))}var $M=/^:[\w-]+$/,VM=3,zM=2,HM=1,UM=10,WM=-2,gw=t=>t==="*";function qM(t,n){let r=t.split("/"),o=r.length;return r.some(gw)&&(o+=WM),n&&(o+=zM),r.filter(s=>!gw(s)).reduce((s,l)=>s+($M.test(l)?VM:l===""?HM:UM),o)}function GM(t,n){return t.length===n.length&&t.slice(0,-1).every((o,s)=>o===n[s])?t[t.length-1]-n[n.length-1]:0}function KM(t,n,r=!1){let{routesMeta:o}=t,s={},l="/",u=[];for(let h=0;h{if(m==="*"){let C=h[y]||"";u=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const x=h[y];return v&&!x?p[m]=void 0:p[m]=(x||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:u,pattern:t}}function YM(t,n=!1,r=!0){Yr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let o=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,h,d)=>(o.push({paramName:h,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(o.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,n?void 0:"i"),o]}function XM(t){try{return t.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Yr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),t}}function Gi(t,n){if(n==="/")return t;if(!t.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,o=t.charAt(r);return o&&o!=="/"?null:t.slice(r)||"/"}function QM(t,n="/"){let{pathname:r,search:o="",hash:s=""}=typeof t=="string"?Gs(t):t;return{pathname:r?r.startsWith("/")?r:JM(r,n):n,search:t2(o),hash:n2(s)}}function JM(t,n){let r=n.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function sp(t,n,r,o){return`Cannot include a '${t}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function ZM(t){return t.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Db(t){let n=ZM(t);return n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase)}function Ib(t,n,r,o=!1){let s;typeof t=="string"?s=Gs(t):(s={...t},Mt(!s.pathname||!s.pathname.includes("?"),sp("?","pathname","search",s)),Mt(!s.pathname||!s.pathname.includes("#"),sp("#","pathname","hash",s)),Mt(!s.search||!s.search.includes("#"),sp("#","search","hash",s)));let l=t===""||s.pathname==="",u=l?"/":s.pathname,h;if(u==null)h=r;else{let v=n.length-1;if(!o&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),v-=1;s.pathname=y.join("/")}h=v>=0?n[v]:"/"}let d=QM(s,h),p=u&&u!=="/"&&u.endsWith("/"),m=(l||u===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(p||m)&&(d.pathname+="/"),d}var Qo=t=>t.join("/").replace(/\/\/+/g,"/"),e2=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),t2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,n2=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function r2(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var Mb=["POST","PUT","PATCH","DELETE"];new Set(Mb);var o2=["GET",...Mb];new Set(o2);var Za=$.createContext(null);Za.displayName="DataRouter";var ud=$.createContext(null);ud.displayName="DataRouterState";var Lb=$.createContext({isTransitioning:!1});Lb.displayName="ViewTransition";var i2=$.createContext(new Map);i2.displayName="Fetchers";var s2=$.createContext(null);s2.displayName="Await";var So=$.createContext(null);So.displayName="Navigation";var kc=$.createContext(null);kc.displayName="Location";var Jr=$.createContext({outlet:null,matches:[],isDataRoute:!1});Jr.displayName="Route";var im=$.createContext(null);im.displayName="RouteError";function a2(t,{relative:n}={}){Mt(Nc(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:o}=$.useContext(So),{hash:s,pathname:l,search:u}=Dc(t,{relative:n}),h=l;return r!=="/"&&(h=l==="/"?r:Qo([r,l])),o.createHref({pathname:h,search:u,hash:s})}function Nc(){return $.useContext(kc)!=null}function Xi(){return Mt(Nc(),"useLocation() may be used only in the context of a component."),$.useContext(kc).location}var Fb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jb(t){$.useContext(So).static||$.useLayoutEffect(t)}function sm(){let{isDataRoute:t}=$.useContext(Jr);return t?C2():l2()}function l2(){Mt(Nc(),"useNavigate() may be used only in the context of a component.");let t=$.useContext(Za),{basename:n,navigator:r}=$.useContext(So),{matches:o}=$.useContext(Jr),{pathname:s}=Xi(),l=JSON.stringify(Db(o)),u=$.useRef(!1);return jb(()=>{u.current=!0}),$.useCallback((d,p={})=>{if(Yr(u.current,Fb),!u.current)return;if(typeof d=="number"){r.go(d);return}let m=Ib(d,JSON.parse(l),s,p.relative==="path");t==null&&n!=="/"&&(m.pathname=m.pathname==="/"?n:Qo([n,m.pathname])),(p.replace?r.replace:r.push)(m,p.state,p)},[n,r,l,s,t])}var c2=$.createContext(null);function u2(t){let n=$.useContext(Jr).outlet;return n&&$.createElement(c2.Provider,{value:t},n)}function h2(){let{matches:t}=$.useContext(Jr),n=t[t.length-1];return n?n.params:{}}function Dc(t,{relative:n}={}){let{matches:r}=$.useContext(Jr),{pathname:o}=Xi(),s=JSON.stringify(Db(r));return $.useMemo(()=>Ib(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function d2(t,n){return Bb(t,n)}function Bb(t,n,r,o){var N;Mt(Nc(),"useRoutes() may be used only in the context of a component.");let{navigator:s,static:l}=$.useContext(So),{matches:u}=$.useContext(Jr),h=u[u.length-1],d=h?h.params:{},p=h?h.pathname:"/",m=h?h.pathnameBase:"/",v=h&&h.route;{let R=v&&v.path||"";$b(p,!v||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${p}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let y=Xi(),x;if(n){let R=typeof n=="string"?Gs(n):n;Mt(m==="/"||((N=R.pathname)==null?void 0:N.startsWith(m)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${R.pathname}" was given in the \`location\` prop.`),x=R}else x=y;let C=x.pathname||"/",b=C;if(m!=="/"){let R=m.replace(/^\//,"").split("/");b="/"+C.replace(/^\//,"").split("/").slice(R.length).join("/")}let A=!l&&r&&r.matches&&r.matches.length>0?r.matches:Ob(t,{pathname:b});Yr(v||A!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Yr(A==null||A[A.length-1].route.element!==void 0||A[A.length-1].route.Component!==void 0||A[A.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let _=y2(A&&A.map(R=>Object.assign({},R,{params:Object.assign({},d,R.params),pathname:Qo([m,s.encodeLocation?s.encodeLocation(R.pathname).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?m:Qo([m,s.encodeLocation?s.encodeLocation(R.pathnameBase).pathname:R.pathnameBase])})),u,r,o);return n&&_?$.createElement(kc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...x},navigationType:"POP"}},_):_}function f2(){let t=b2(),n=r2(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:o},l={padding:"2px 4px",backgroundColor:o},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=$.createElement($.Fragment,null,$.createElement("p",null,"💿 Hey developer 👋"),$.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",$.createElement("code",{style:l},"ErrorBoundary")," or"," ",$.createElement("code",{style:l},"errorElement")," prop on your route.")),$.createElement($.Fragment,null,$.createElement("h2",null,"Unexpected Application Error!"),$.createElement("h3",{style:{fontStyle:"italic"}},n),r?$.createElement("pre",{style:s},r):null,u)}var p2=$.createElement(f2,null),g2=class extends $.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?$.createElement(Jr.Provider,{value:this.props.routeContext},$.createElement(im.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function m2({routeContext:t,match:n,children:r}){let o=$.useContext(Za);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),$.createElement(Jr.Provider,{value:t},r)}function y2(t,n=[],r=null,o=null){if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,l=r==null?void 0:r.errors;if(l!=null){let d=s.findIndex(p=>p.route.id&&(l==null?void 0:l[p.route.id])!==void 0);Mt(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),s=s.slice(0,Math.min(s.length,d+1))}let u=!1,h=-1;if(r)for(let d=0;d=0?s=s.slice(0,h+1):s=[s[0]];break}}}return s.reduceRight((d,p,m)=>{let v,y=!1,x=null,C=null;r&&(v=l&&p.route.id?l[p.route.id]:void 0,x=p.route.errorElement||p2,u&&(h<0&&m===0?($b("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,C=null):h===m&&(y=!0,C=p.route.hydrateFallbackElement||null)));let b=n.concat(s.slice(0,m+1)),A=()=>{let _;return v?_=x:y?_=C:p.route.Component?_=$.createElement(p.route.Component,null):p.route.element?_=p.route.element:_=d,$.createElement(m2,{match:p,routeContext:{outlet:d,matches:b,isDataRoute:r!=null},children:_})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?$.createElement(g2,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:A(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):A()},null)}function am(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v2(t){let n=$.useContext(Za);return Mt(n,am(t)),n}function w2(t){let n=$.useContext(ud);return Mt(n,am(t)),n}function x2(t){let n=$.useContext(Jr);return Mt(n,am(t)),n}function lm(t){let n=x2(t),r=n.matches[n.matches.length-1];return Mt(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function S2(){return lm("useRouteId")}function b2(){var o;let t=$.useContext(im),n=w2("useRouteError"),r=lm("useRouteError");return t!==void 0?t:(o=n.errors)==null?void 0:o[r]}function C2(){let{router:t}=v2("useNavigate"),n=lm("useNavigate"),r=$.useRef(!1);return jb(()=>{r.current=!0}),$.useCallback(async(s,l={})=>{Yr(r.current,Fb),r.current&&(typeof s=="number"?t.navigate(s):await t.navigate(s,{fromRouteId:n,...l}))},[t,n])}var mw={};function $b(t,n,r){!n&&!mw[t]&&(mw[t]=!0,Yr(!1,r))}$.memo(E2);function E2({routes:t,future:n,state:r}){return Bb(t,void 0,r,n)}function Vb(t){return u2(t.context)}function La(t){Mt(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function P2({basename:t="/",children:n=null,location:r,navigationType:o="POP",navigator:s,static:l=!1}){Mt(!Nc(),"You cannot render a inside another . You should never have more than one in your app.");let u=t.replace(/^\/*/,"/"),h=$.useMemo(()=>({basename:u,navigator:s,static:l,future:{}}),[u,s,l]);typeof r=="string"&&(r=Gs(r));let{pathname:d="/",search:p="",hash:m="",state:v=null,key:y="default"}=r,x=$.useMemo(()=>{let C=Gi(d,u);return C==null?null:{location:{pathname:C,search:p,hash:m,state:v,key:y},navigationType:o}},[u,d,p,m,v,y,o]);return Yr(x!=null,` is not able to match the URL "${d}${p}${m}" because it does not start with the basename, so the won't render anything.`),x==null?null:$.createElement(So.Provider,{value:h},$.createElement(kc.Provider,{children:n,value:x}))}function _2({children:t,location:n}){return d2(ag(t),n)}function ag(t,n=[]){let r=[];return $.Children.forEach(t,(o,s)=>{if(!$.isValidElement(o))return;let l=[...n,s];if(o.type===$.Fragment){r.push.apply(r,ag(o.props.children,l));return}Mt(o.type===La,`[${typeof o.type=="string"?o.type:o.type.name}] is not a component. All component children of must be a or `),Mt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let u={id:o.props.id||l.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(u.children=ag(o.props.children,l)),r.push(u)}),r}var mh="get",yh="application/x-www-form-urlencoded";function hd(t){return t!=null&&typeof t.tagName=="string"}function A2(t){return hd(t)&&t.tagName.toLowerCase()==="button"}function T2(t){return hd(t)&&t.tagName.toLowerCase()==="form"}function R2(t){return hd(t)&&t.tagName.toLowerCase()==="input"}function O2(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function k2(t,n){return t.button===0&&(!n||n==="_self")&&!O2(t)}var nh=null;function N2(){if(nh===null)try{new FormData(document.createElement("form"),0),nh=!1}catch{nh=!0}return nh}var D2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ap(t){return t!=null&&!D2.has(t)?(Yr(!1,`"${t}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${yh}"`),null):t}function I2(t,n){let r,o,s,l,u;if(T2(t)){let h=t.getAttribute("action");o=h?Gi(h,n):null,r=t.getAttribute("method")||mh,s=ap(t.getAttribute("enctype"))||yh,l=new FormData(t)}else if(A2(t)||R2(t)&&(t.type==="submit"||t.type==="image")){let h=t.form;if(h==null)throw new Error('Cannot submit a