@foresthubai/workflow-cli 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ function jI(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xh={exports:{}},_a={},wh={exports:{}},Ve={};var d0;function OI(){if(d0)return Ve;d0=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),h=Symbol.iterator;function v(F){return F===null||typeof F!="object"?null:(F=h&&F[h]||F["@@iterator"],typeof F=="function"?F:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function E(F,V,X){this.props=F,this.context=V,this.refs=w,this.updater=X||x}E.prototype.isReactComponent={},E.prototype.setState=function(F,V){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,V,"setState")},E.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function b(){}b.prototype=E.prototype;function N(F,V,X){this.props=F,this.context=V,this.refs=w,this.updater=X||x}var k=N.prototype=new b;k.constructor=N,S(k,E.prototype),k.isPureReactComponent=!0;var P=Array.isArray,A=Object.prototype.hasOwnProperty,I={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function j(F,V,X){var Q,ee={},ne=null,K=null;if(V!=null)for(Q in V.ref!==void 0&&(K=V.ref),V.key!==void 0&&(ne=""+V.key),V)A.call(V,Q)&&!R.hasOwnProperty(Q)&&(ee[Q]=V[Q]);var q=arguments.length-2;if(q===1)ee.children=X;else if(1<q){for(var oe=Array(q),ce=0;ce<q;ce++)oe[ce]=arguments[ce+2];ee.children=oe}if(F&&F.defaultProps)for(Q in q=F.defaultProps,q)ee[Q]===void 0&&(ee[Q]=q[Q]);return{$$typeof:e,type:F,key:ne,ref:K,props:ee,_owner:I.current}}function L(F,V){return{$$typeof:e,type:F.type,key:V,ref:F.ref,props:F.props,_owner:F._owner}}function U(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function $(F){var V={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(X){return V[X]})}var B=/\/+/g;function G(F,V){return typeof F=="object"&&F!==null&&F.key!=null?$(""+F.key):V.toString(36)}function _(F,V,X,Q,ee){var ne=typeof F;(ne==="undefined"||ne==="boolean")&&(F=null);var K=!1;if(F===null)K=!0;else switch(ne){case"string":case"number":K=!0;break;case"object":switch(F.$$typeof){case e:case t:K=!0}}if(K)return K=F,ee=ee(K),F=Q===""?"."+G(K,0):Q,P(ee)?(X="",F!=null&&(X=F.replace(B,"$&/")+"/"),_(ee,V,X,"",function(ce){return ce})):ee!=null&&(U(ee)&&(ee=L(ee,X+(!ee.key||K&&K.key===ee.key?"":(""+ee.key).replace(B,"$&/")+"/")+F)),V.push(ee)),1;if(K=0,Q=Q===""?".":Q+":",P(F))for(var q=0;q<F.length;q++){ne=F[q];var oe=Q+G(ne,q);K+=_(ne,V,X,oe,ee)}else if(oe=v(F),typeof oe=="function")for(F=oe.call(F),q=0;!(ne=F.next()).done;)ne=ne.value,oe=Q+G(ne,q++),K+=_(ne,V,X,oe,ee);else if(ne==="object")throw V=String(F),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return K}function O(F,V,X){if(F==null)return F;var Q=[],ee=0;return _(F,Q,"","",function(ne){return V.call(X,ne,ee++)}),Q}function M(F){if(F._status===-1){var V=F._result;V=V(),V.then(function(X){(F._status===0||F._status===-1)&&(F._status=1,F._result=X)},function(X){(F._status===0||F._status===-1)&&(F._status=2,F._result=X)}),F._status===-1&&(F._status=0,F._result=V)}if(F._status===1)return F._result.default;throw F._result}var z={current:null},H={transition:null},W={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:H,ReactCurrentOwner:I};function Z(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:O,forEach:function(F,V,X){O(F,function(){V.apply(this,arguments)},X)},count:function(F){var V=0;return O(F,function(){V++}),V},toArray:function(F){return O(F,function(V){return V})||[]},only:function(F){if(!U(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},Ve.Component=E,Ve.Fragment=n,Ve.Profiler=o,Ve.PureComponent=N,Ve.StrictMode=r,Ve.Suspense=d,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,Ve.act=Z,Ve.cloneElement=function(F,V,X){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var Q=S({},F.props),ee=F.key,ne=F.ref,K=F._owner;if(V!=null){if(V.ref!==void 0&&(ne=V.ref,K=I.current),V.key!==void 0&&(ee=""+V.key),F.type&&F.type.defaultProps)var q=F.type.defaultProps;for(oe in V)A.call(V,oe)&&!R.hasOwnProperty(oe)&&(Q[oe]=V[oe]===void 0&&q!==void 0?q[oe]:V[oe])}var oe=arguments.length-2;if(oe===1)Q.children=X;else if(1<oe){q=Array(oe);for(var ce=0;ce<oe;ce++)q[ce]=arguments[ce+2];Q.children=q}return{$$typeof:e,type:F.type,key:ee,ref:ne,props:Q,_owner:K}},Ve.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:i,_context:F},F.Consumer=F},Ve.createElement=j,Ve.createFactory=function(F){var V=j.bind(null,F);return V.type=F,V},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(F){return{$$typeof:c,render:F}},Ve.isValidElement=U,Ve.lazy=function(F){return{$$typeof:g,_payload:{_status:-1,_result:F},_init:M}},Ve.memo=function(F,V){return{$$typeof:f,type:F,compare:V===void 0?null:V}},Ve.startTransition=function(F){var V=H.transition;H.transition={};try{F()}finally{H.transition=V}},Ve.unstable_act=Z,Ve.useCallback=function(F,V){return z.current.useCallback(F,V)},Ve.useContext=function(F){return z.current.useContext(F)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(F){return z.current.useDeferredValue(F)},Ve.useEffect=function(F,V){return z.current.useEffect(F,V)},Ve.useId=function(){return z.current.useId()},Ve.useImperativeHandle=function(F,V,X){return z.current.useImperativeHandle(F,V,X)},Ve.useInsertionEffect=function(F,V){return z.current.useInsertionEffect(F,V)},Ve.useLayoutEffect=function(F,V){return z.current.useLayoutEffect(F,V)},Ve.useMemo=function(F,V){return z.current.useMemo(F,V)},Ve.useReducer=function(F,V,X){return z.current.useReducer(F,V,X)},Ve.useRef=function(F){return z.current.useRef(F)},Ve.useState=function(F){return z.current.useState(F)},Ve.useSyncExternalStore=function(F,V,X){return z.current.useSyncExternalStore(F,V,X)},Ve.useTransition=function(){return z.current.useTransition()},Ve.version="18.3.1",Ve}var f0;function wl(){return f0||(f0=1,wh.exports=OI()),wh.exports}var p0;function $I(){if(p0)return _a;p0=1;var e=wl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(c,d,f){var g,h={},v=null,x=null;f!==void 0&&(v=""+f),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(x=d.ref);for(g in d)r.call(d,g)&&!i.hasOwnProperty(g)&&(h[g]=d[g]);if(c&&c.defaultProps)for(g in d=c.defaultProps,d)h[g]===void 0&&(h[g]=d[g]);return{$$typeof:t,type:c,key:v,ref:x,props:h,_owner:o.current}}return _a.Fragment=n,_a.jsx=l,_a.jsxs=l,_a}var h0;function LI(){return h0||(h0=1,xh.exports=$I()),xh.exports}var p=LI(),m=wl();const Ze=lm(m),wd=jI({__proto__:null,default:Ze},[m]);var su={},bh={exports:{}},Kt={},Sh={exports:{}},Ch={};var g0;function FI(){return g0||(g0=1,(function(e){function t(H,W){var Z=H.length;H.push(W);e:for(;0<Z;){var F=Z-1>>>1,V=H[F];if(0<o(V,W))H[F]=W,H[Z]=V,Z=F;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var W=H[0],Z=H.pop();if(Z!==W){H[0]=Z;e:for(var F=0,V=H.length,X=V>>>1;F<X;){var Q=2*(F+1)-1,ee=H[Q],ne=Q+1,K=H[ne];if(0>o(ee,Z))ne<V&&0>o(K,ee)?(H[F]=K,H[ne]=Z,F=ne):(H[F]=ee,H[Q]=Z,F=Q);else if(ne<V&&0>o(K,Z))H[F]=K,H[ne]=Z,F=ne;else break e}}return W}function o(H,W){var Z=H.sortIndex-W.sortIndex;return Z!==0?Z:H.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var d=[],f=[],g=1,h=null,v=3,x=!1,S=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,b=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 k(H){for(var W=n(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=H)r(f),W.sortIndex=W.expirationTime,t(d,W);else break;W=n(f)}}function P(H){if(w=!1,k(H),!S)if(n(d)!==null)S=!0,M(A);else{var W=n(f);W!==null&&z(P,W.startTime-H)}}function A(H,W){S=!1,w&&(w=!1,b(j),j=-1),x=!0;var Z=v;try{for(k(W),h=n(d);h!==null&&(!(h.expirationTime>W)||H&&!$());){var F=h.callback;if(typeof F=="function"){h.callback=null,v=h.priorityLevel;var V=F(h.expirationTime<=W);W=e.unstable_now(),typeof V=="function"?h.callback=V:h===n(d)&&r(d),k(W)}else r(d);h=n(d)}if(h!==null)var X=!0;else{var Q=n(f);Q!==null&&z(P,Q.startTime-W),X=!1}return X}finally{h=null,v=Z,x=!1}}var I=!1,R=null,j=-1,L=5,U=-1;function $(){return!(e.unstable_now()-U<L)}function B(){if(R!==null){var H=e.unstable_now();U=H;var W=!0;try{W=R(!0,H)}finally{W?G():(I=!1,R=null)}}else I=!1}var G;if(typeof N=="function")G=function(){N(B)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,O=_.port2;_.port1.onmessage=B,G=function(){O.postMessage(null)}}else G=function(){E(B,0)};function M(H){R=H,I||(I=!0,G())}function z(H,W){j=E(function(){H(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,M(A))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(H){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var Z=v;v=W;try{return H()}finally{v=Z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,W){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var Z=v;v=H;try{return W()}finally{v=Z}},e.unstable_scheduleCallback=function(H,W,Z){var F=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?F+Z:F):Z=F,H){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=Z+V,H={id:g++,callback:W,priorityLevel:H,startTime:Z,expirationTime:V,sortIndex:-1},Z>F?(H.sortIndex=Z,t(f,H),n(d)===null&&H===n(f)&&(w?(b(j),j=-1):w=!0,z(P,Z-F))):(H.sortIndex=V,t(d,H),S||x||(S=!0,M(A))),H},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(H){var W=v;return function(){var Z=v;v=W;try{return H.apply(this,arguments)}finally{v=Z}}}})(Ch)),Ch}var m0;function zI(){return m0||(m0=1,Sh.exports=FI()),Sh.exports}var y0;function VI(){if(y0)return Kt;y0=1;var e=wl(),t=zI();function n(s){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+s,u=1;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function i(s,a){l(s,a),l(s+"Capture",a)}function l(s,a){for(o[s]=a,s=0;s<a.length;s++)r.add(a[s])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,g={},h={};function v(s){return d.call(h,s)?!0:d.call(g,s)?!1:f.test(s)?h[s]=!0:(g[s]=!0,!1)}function x(s,a,u,y){if(u!==null&&u.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return y?!1:u!==null?!u.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function S(s,a,u,y){if(a===null||typeof a>"u"||x(s,a,u,y))return!0;if(y)return!1;if(u!==null)switch(u.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 w(s,a,u,y,C,T,D){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=y,this.attributeNamespace=C,this.mustUseProperty=u,this.propertyName=s,this.type=a,this.sanitizeURL=T,this.removeEmptyString=D}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){E[s]=new w(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var a=s[0];E[a]=new w(a,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){E[s]=new w(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){E[s]=new w(s,2,!1,s,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(s){E[s]=new w(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){E[s]=new w(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){E[s]=new w(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){E[s]=new w(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){E[s]=new w(s,5,!1,s.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function N(s){return s[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(s){var a=s.replace(b,N);E[a]=new w(a,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var a=s.replace(b,N);E[a]=new w(a,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var a=s.replace(b,N);E[a]=new w(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){E[s]=new w(s,1,!1,s.toLowerCase(),null,!1,!1)}),E.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){E[s]=new w(s,1,!1,s.toLowerCase(),null,!0,!0)});function k(s,a,u,y){var C=E.hasOwnProperty(a)?E[a]:null;(C!==null?C.type!==0:y||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(S(a,u,C,y)&&(u=null),y||C===null?v(a)&&(u===null?s.removeAttribute(a):s.setAttribute(a,""+u)):C.mustUseProperty?s[C.propertyName]=u===null?C.type===3?!1:"":u:(a=C.attributeName,y=C.attributeNamespace,u===null?s.removeAttribute(a):(C=C.type,u=C===3||C===4&&u===!0?"":""+u,y?s.setAttributeNS(y,a,u):s.setAttribute(a,u))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),I=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),$=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),H=Symbol.iterator;function W(s){return s===null||typeof s!="object"?null:(s=H&&s[H]||s["@@iterator"],typeof s=="function"?s:null)}var Z=Object.assign,F;function V(s){if(F===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);F=a&&a[1]||""}return`
2
+ `+F+s}var X=!1;function Q(s,a){if(!s||X)return"";X=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ie){var y=ie}Reflect.construct(s,[],a)}else{try{a.call()}catch(ie){y=ie}s.call(a.prototype)}else{try{throw Error()}catch(ie){y=ie}s()}}catch(ie){if(ie&&y&&typeof ie.stack=="string"){for(var C=ie.stack.split(`
3
+ `),T=y.stack.split(`
4
+ `),D=C.length-1,Y=T.length-1;1<=D&&0<=Y&&C[D]!==T[Y];)Y--;for(;1<=D&&0<=Y;D--,Y--)if(C[D]!==T[Y]){if(D!==1||Y!==1)do if(D--,Y--,0>Y||C[D]!==T[Y]){var J=`
5
+ `+C[D].replace(" at new "," at ");return s.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",s.displayName)),J}while(1<=D&&0<=Y);break}}}finally{X=!1,Error.prepareStackTrace=u}return(s=s?s.displayName||s.name:"")?V(s):""}function ee(s){switch(s.tag){case 5:return V(s.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return s=Q(s.type,!1),s;case 11:return s=Q(s.type.render,!1),s;case 1:return s=Q(s.type,!0),s;default:return""}}function ne(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case R:return"Fragment";case I:return"Portal";case L:return"Profiler";case j:return"StrictMode";case G:return"Suspense";case _:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case $:return(s.displayName||"Context")+".Consumer";case U:return(s._context.displayName||"Context")+".Provider";case B:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case O:return a=s.displayName||null,a!==null?a:ne(s.type)||"Memo";case M:a=s._payload,s=s._init;try{return ne(s(a))}catch{}}return null}function K(s){var a=s.type;switch(s.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 s=a.render,s=s.displayName||s.name||"",a.displayName||(s!==""?"ForwardRef("+s+")":"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===j?"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 q(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function oe(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ce(s){var a=oe(s)?"checked":"value",u=Object.getOwnPropertyDescriptor(s.constructor.prototype,a),y=""+s[a];if(!s.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var C=u.get,T=u.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return C.call(this)},set:function(D){y=""+D,T.call(this,D)}}),Object.defineProperty(s,a,{enumerable:u.enumerable}),{getValue:function(){return y},setValue:function(D){y=""+D},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function ge(s){s._valueTracker||(s._valueTracker=ce(s))}function ye(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),y="";return s&&(y=oe(s)?s.checked?"true":"false":s.value),s=y,s!==u?(a.setValue(s),!0):!1}function me(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ee(s,a){var u=a.checked;return Z({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??s._wrapperState.initialChecked})}function Le(s,a){var u=a.defaultValue==null?"":a.defaultValue,y=a.checked!=null?a.checked:a.defaultChecked;u=q(a.value!=null?a.value:u),s._wrapperState={initialChecked:y,initialValue:u,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Fe(s,a){a=a.checked,a!=null&&k(s,"checked",a,!1)}function Ke(s,a){Fe(s,a);var u=q(a.value),y=a.type;if(u!=null)y==="number"?(u===0&&s.value===""||s.value!=u)&&(s.value=""+u):s.value!==""+u&&(s.value=""+u);else if(y==="submit"||y==="reset"){s.removeAttribute("value");return}a.hasOwnProperty("value")?Se(s,a.type,u):a.hasOwnProperty("defaultValue")&&Se(s,a.type,q(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function le(s,a,u){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var y=a.type;if(!(y!=="submit"&&y!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+s._wrapperState.initialValue,u||a===s.value||(s.value=a),s.defaultValue=a}u=s.name,u!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,u!==""&&(s.name=u)}function Se(s,a,u){(a!=="number"||me(s.ownerDocument)!==s)&&(u==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+u&&(s.defaultValue=""+u))}var Oe=Array.isArray;function qe(s,a,u,y){if(s=s.options,a){a={};for(var C=0;C<u.length;C++)a["$"+u[C]]=!0;for(u=0;u<s.length;u++)C=a.hasOwnProperty("$"+s[u].value),s[u].selected!==C&&(s[u].selected=C),C&&y&&(s[u].defaultSelected=!0)}else{for(u=""+q(u),a=null,C=0;C<s.length;C++){if(s[C].value===u){s[C].selected=!0,y&&(s[C].defaultSelected=!0);return}a!==null||s[C].disabled||(a=s[C])}a!==null&&(a.selected=!0)}}function yt(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return Z({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Dt(s,a){var u=a.value;if(u==null){if(u=a.children,a=a.defaultValue,u!=null){if(a!=null)throw Error(n(92));if(Oe(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}s._wrapperState={initialValue:q(u)}}function Qe(s,a){var u=q(a.value),y=q(a.defaultValue);u!=null&&(u=""+u,u!==s.value&&(s.value=u),a.defaultValue==null&&s.defaultValue!==u&&(s.defaultValue=u)),y!=null&&(s.defaultValue=""+y)}function So(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function nr(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function rr(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?nr(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Co,Vl=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,u,y,C){MSApp.execUnsafeLocalFunction(function(){return s(a,u,y,C)})}:s})(function(s,a){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=a;else{for(Co=Co||document.createElement("div"),Co.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Co.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function or(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var Eo={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},Tf=["Webkit","ms","Moz","O"];Object.keys(Eo).forEach(function(s){Tf.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Eo[a]=Eo[s]})});function Hl(s,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||Eo.hasOwnProperty(s)&&Eo[s]?(""+a).trim():a+"px"}function Bl(s,a){s=s.style;for(var u in a)if(a.hasOwnProperty(u)){var y=u.indexOf("--")===0,C=Hl(u,a[u],y);u==="float"&&(u="cssFloat"),y?s.setProperty(u,C):s[u]=C}}var Pf=Z({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 Vi(s,a){if(a){if(Pf[s]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function Hi(s,a){if(s.indexOf("-")===-1)return typeof a.is=="string";switch(s){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 Bi=null;function Wi(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ui=null,_r=null,Ar=null;function Wl(s){if(s=ma(s)){if(typeof Ui!="function")throw Error(n(280));var a=s.stateNode;a&&(a=wc(a),Ui(s.stateNode,s.type,a))}}function Ul(s){_r?Ar?Ar.push(s):Ar=[s]:_r=s}function Kl(){if(_r){var s=_r,a=Ar;if(Ar=_r=null,Wl(s),a)for(s=0;s<a.length;s++)Wl(a[s])}}function Gl(s,a){return s(a)}function Yl(){}var Ki=!1;function Xl(s,a,u){if(Ki)return s(a,u);Ki=!0;try{return Gl(s,a,u)}finally{Ki=!1,(_r!==null||Ar!==null)&&(Yl(),Kl())}}function No(s,a){var u=s.stateNode;if(u===null)return null;var y=wc(u);if(y===null)return null;u=y[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(s=s.type,y=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!y;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,a,typeof u));return u}var Gi=!1;if(c)try{var ko={};Object.defineProperty(ko,"passive",{get:function(){Gi=!0}}),window.addEventListener("test",ko,ko),window.removeEventListener("test",ko,ko)}catch{Gi=!1}function Rf(s,a,u,y,C,T,D,Y,J){var ie=Array.prototype.slice.call(arguments,3);try{a.apply(u,ie)}catch(fe){this.onError(fe)}}var To=!1,ys=null,vs=!1,Yi=null,If={onError:function(s){To=!0,ys=s}};function _f(s,a,u,y,C,T,D,Y,J){To=!1,ys=null,Rf.apply(If,arguments)}function Af(s,a,u,y,C,T,D,Y,J){if(_f.apply(this,arguments),To){if(To){var ie=ys;To=!1,ys=null}else throw Error(n(198));vs||(vs=!0,Yi=ie)}}function Fn(s){var a=s,u=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(u=a.return),s=a.return;while(s)}return a.tag===3?u:null}function Xi(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function qi(s){if(Fn(s)!==s)throw Error(n(188))}function Mf(s){var a=s.alternate;if(!a){if(a=Fn(s),a===null)throw Error(n(188));return a!==s?null:s}for(var u=s,y=a;;){var C=u.return;if(C===null)break;var T=C.alternate;if(T===null){if(y=C.return,y!==null){u=y;continue}break}if(C.child===T.child){for(T=C.child;T;){if(T===u)return qi(C),s;if(T===y)return qi(C),a;T=T.sibling}throw Error(n(188))}if(u.return!==y.return)u=C,y=T;else{for(var D=!1,Y=C.child;Y;){if(Y===u){D=!0,u=C,y=T;break}if(Y===y){D=!0,y=C,u=T;break}Y=Y.sibling}if(!D){for(Y=T.child;Y;){if(Y===u){D=!0,u=T,y=C;break}if(Y===y){D=!0,y=T,u=C;break}Y=Y.sibling}if(!D)throw Error(n(189))}}if(u.alternate!==y)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:a}function ql(s){return s=Mf(s),s!==null?Zl(s):null}function Zl(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=Zl(s);if(a!==null)return a;s=s.sibling}return null}var Ql=t.unstable_scheduleCallback,Jl=t.unstable_cancelCallback,Df=t.unstable_shouldYield,ec=t.unstable_requestPaint,at=t.unstable_now,jf=t.unstable_getCurrentPriorityLevel,Zi=t.unstable_ImmediatePriority,tc=t.unstable_UserBlockingPriority,xs=t.unstable_NormalPriority,Of=t.unstable_LowPriority,nc=t.unstable_IdlePriority,Po=null,dn=null;function $f(s){if(dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(Po,s,void 0,(s.current.flags&128)===128)}catch{}}var Zt=Math.clz32?Math.clz32:zf,Lf=Math.log,Ff=Math.LN2;function zf(s){return s>>>=0,s===0?32:31-(Lf(s)/Ff|0)|0}var ws=64,bs=4194304;function Mr(s){switch(s&-s){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 s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Ss(s,a){var u=s.pendingLanes;if(u===0)return 0;var y=0,C=s.suspendedLanes,T=s.pingedLanes,D=u&268435455;if(D!==0){var Y=D&~C;Y!==0?y=Mr(Y):(T&=D,T!==0&&(y=Mr(T)))}else D=u&~C,D!==0?y=Mr(D):T!==0&&(y=Mr(T));if(y===0)return 0;if(a!==0&&a!==y&&(a&C)===0&&(C=y&-y,T=a&-a,C>=T||C===16&&(T&4194240)!==0))return a;if((y&4)!==0&&(y|=u&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=y;0<a;)u=31-Zt(a),C=1<<u,y|=s[u],a&=~C;return y}function rc(s,a){switch(s){case 1:case 2:case 4:return a+250;case 8:case 16:case 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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vf(s,a){for(var u=s.suspendedLanes,y=s.pingedLanes,C=s.expirationTimes,T=s.pendingLanes;0<T;){var D=31-Zt(T),Y=1<<D,J=C[D];J===-1?((Y&u)===0||(Y&y)!==0)&&(C[D]=rc(Y,a)):J<=a&&(s.expiredLanes|=Y),T&=~Y}}function Qi(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Cs(){var s=ws;return ws<<=1,(ws&4194240)===0&&(ws=64),s}function Ji(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function Ro(s,a,u){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-Zt(a),s[a]=u}function oc(s,a){var u=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var y=s.eventTimes;for(s=s.expirationTimes;0<u;){var C=31-Zt(u),T=1<<C;a[C]=0,y[C]=-1,s[C]=-1,u&=~T}}function Hf(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var y=31-Zt(u),C=1<<y;C&a|s[y]&a&&(s[y]|=a),u&=~C}}var Ge=0;function By(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Wy,Bf,Uy,Ky,Gy,Wf=!1,sc=[],Dr=null,jr=null,Or=null,ea=new Map,ta=new Map,$r=[],rR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yy(s,a){switch(s){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":jr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":ea.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ta.delete(a.pointerId)}}function na(s,a,u,y,C,T){return s===null||s.nativeEvent!==T?(s={blockedOn:a,domEventName:u,eventSystemFlags:y,nativeEvent:T,targetContainers:[C]},a!==null&&(a=ma(a),a!==null&&Bf(a)),s):(s.eventSystemFlags|=y,a=s.targetContainers,C!==null&&a.indexOf(C)===-1&&a.push(C),s)}function oR(s,a,u,y,C){switch(a){case"focusin":return Dr=na(Dr,s,a,u,y,C),!0;case"dragenter":return jr=na(jr,s,a,u,y,C),!0;case"mouseover":return Or=na(Or,s,a,u,y,C),!0;case"pointerover":var T=C.pointerId;return ea.set(T,na(ea.get(T)||null,s,a,u,y,C)),!0;case"gotpointercapture":return T=C.pointerId,ta.set(T,na(ta.get(T)||null,s,a,u,y,C)),!0}return!1}function Xy(s){var a=Io(s.target);if(a!==null){var u=Fn(a);if(u!==null){if(a=u.tag,a===13){if(a=Xi(u),a!==null){s.blockedOn=a,Gy(s.priority,function(){Uy(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function ic(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var u=Kf(s.domEventName,s.eventSystemFlags,a[0],s.nativeEvent);if(u===null){u=s.nativeEvent;var y=new u.constructor(u.type,u);Bi=y,u.target.dispatchEvent(y),Bi=null}else return a=ma(u),a!==null&&Bf(a),s.blockedOn=u,!1;a.shift()}return!0}function qy(s,a,u){ic(s)&&u.delete(a)}function sR(){Wf=!1,Dr!==null&&ic(Dr)&&(Dr=null),jr!==null&&ic(jr)&&(jr=null),Or!==null&&ic(Or)&&(Or=null),ea.forEach(qy),ta.forEach(qy)}function ra(s,a){s.blockedOn===a&&(s.blockedOn=null,Wf||(Wf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,sR)))}function oa(s){function a(C){return ra(C,s)}if(0<sc.length){ra(sc[0],s);for(var u=1;u<sc.length;u++){var y=sc[u];y.blockedOn===s&&(y.blockedOn=null)}}for(Dr!==null&&ra(Dr,s),jr!==null&&ra(jr,s),Or!==null&&ra(Or,s),ea.forEach(a),ta.forEach(a),u=0;u<$r.length;u++)y=$r[u],y.blockedOn===s&&(y.blockedOn=null);for(;0<$r.length&&(u=$r[0],u.blockedOn===null);)Xy(u),u.blockedOn===null&&$r.shift()}var Es=P.ReactCurrentBatchConfig,ac=!0;function iR(s,a,u,y){var C=Ge,T=Es.transition;Es.transition=null;try{Ge=1,Uf(s,a,u,y)}finally{Ge=C,Es.transition=T}}function aR(s,a,u,y){var C=Ge,T=Es.transition;Es.transition=null;try{Ge=4,Uf(s,a,u,y)}finally{Ge=C,Es.transition=T}}function Uf(s,a,u,y){if(ac){var C=Kf(s,a,u,y);if(C===null)cp(s,a,y,lc,u),Yy(s,y);else if(oR(C,s,a,u,y))y.stopPropagation();else if(Yy(s,y),a&4&&-1<rR.indexOf(s)){for(;C!==null;){var T=ma(C);if(T!==null&&Wy(T),T=Kf(s,a,u,y),T===null&&cp(s,a,y,lc,u),T===C)break;C=T}C!==null&&y.stopPropagation()}else cp(s,a,y,null,u)}}var lc=null;function Kf(s,a,u,y){if(lc=null,s=Wi(y),s=Io(s),s!==null)if(a=Fn(s),a===null)s=null;else if(u=a.tag,u===13){if(s=Xi(a),s!==null)return s;s=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null);return lc=s,null}function Zy(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jf()){case Zi:return 1;case tc:return 4;case xs:case Of:return 16;case nc:return 536870912;default:return 16}default:return 16}}var Lr=null,Gf=null,cc=null;function Qy(){if(cc)return cc;var s,a=Gf,u=a.length,y,C="value"in Lr?Lr.value:Lr.textContent,T=C.length;for(s=0;s<u&&a[s]===C[s];s++);var D=u-s;for(y=1;y<=D&&a[u-y]===C[T-y];y++);return cc=C.slice(s,1<y?1-y:void 0)}function uc(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function dc(){return!0}function Jy(){return!1}function Qt(s){function a(u,y,C,T,D){this._reactName=u,this._targetInst=C,this.type=y,this.nativeEvent=T,this.target=D,this.currentTarget=null;for(var Y in s)s.hasOwnProperty(Y)&&(u=s[Y],this[Y]=u?u(T):T[Y]);return this.isDefaultPrevented=(T.defaultPrevented!=null?T.defaultPrevented:T.returnValue===!1)?dc:Jy,this.isPropagationStopped=Jy,this}return Z(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=dc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=dc)},persist:function(){},isPersistent:dc}),a}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yf=Qt(Ns),sa=Z({},Ns,{view:0,detail:0}),lR=Qt(sa),Xf,qf,ia,fc=Z({},sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qf,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ia&&(ia&&s.type==="mousemove"?(Xf=s.screenX-ia.screenX,qf=s.screenY-ia.screenY):qf=Xf=0,ia=s),Xf)},movementY:function(s){return"movementY"in s?s.movementY:qf}}),ev=Qt(fc),cR=Z({},fc,{dataTransfer:0}),uR=Qt(cR),dR=Z({},sa,{relatedTarget:0}),Zf=Qt(dR),fR=Z({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),pR=Qt(fR),hR=Z({},Ns,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),gR=Qt(hR),mR=Z({},Ns,{data:0}),tv=Qt(mR),yR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wR(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=xR[s])?!!a[s]:!1}function Qf(){return wR}var bR=Z({},sa,{key:function(s){if(s.key){var a=yR[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=uc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?vR[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qf,charCode:function(s){return s.type==="keypress"?uc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?uc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),SR=Qt(bR),CR=Z({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nv=Qt(CR),ER=Z({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qf}),NR=Qt(ER),kR=Z({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),TR=Qt(kR),PR=Z({},fc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),RR=Qt(PR),IR=[9,13,27,32],Jf=c&&"CompositionEvent"in window,aa=null;c&&"documentMode"in document&&(aa=document.documentMode);var _R=c&&"TextEvent"in window&&!aa,rv=c&&(!Jf||aa&&8<aa&&11>=aa),ov=" ",sv=!1;function iv(s,a){switch(s){case"keyup":return IR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function av(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ks=!1;function AR(s,a){switch(s){case"compositionend":return av(a);case"keypress":return a.which!==32?null:(sv=!0,ov);case"textInput":return s=a.data,s===ov&&sv?null:s;default:return null}}function MR(s,a){if(ks)return s==="compositionend"||!Jf&&iv(s,a)?(s=Qy(),cc=Gf=Lr=null,ks=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return rv&&a.locale!=="ko"?null:a.data;default:return null}}var DR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function lv(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!DR[s.type]:a==="textarea"}function cv(s,a,u,y){Ul(y),a=yc(a,"onChange"),0<a.length&&(u=new Yf("onChange","change",null,u,y),s.push({event:u,listeners:a}))}var la=null,ca=null;function jR(s){Tv(s,0)}function pc(s){var a=_s(s);if(ye(a))return s}function OR(s,a){if(s==="change")return a}var uv=!1;if(c){var ep;if(c){var tp="oninput"in document;if(!tp){var dv=document.createElement("div");dv.setAttribute("oninput","return;"),tp=typeof dv.oninput=="function"}ep=tp}else ep=!1;uv=ep&&(!document.documentMode||9<document.documentMode)}function fv(){la&&(la.detachEvent("onpropertychange",pv),ca=la=null)}function pv(s){if(s.propertyName==="value"&&pc(ca)){var a=[];cv(a,ca,s,Wi(s)),Xl(jR,a)}}function $R(s,a,u){s==="focusin"?(fv(),la=a,ca=u,la.attachEvent("onpropertychange",pv)):s==="focusout"&&fv()}function LR(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pc(ca)}function FR(s,a){if(s==="click")return pc(a)}function zR(s,a){if(s==="input"||s==="change")return pc(a)}function VR(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var bn=typeof Object.is=="function"?Object.is:VR;function ua(s,a){if(bn(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),y=Object.keys(a);if(u.length!==y.length)return!1;for(y=0;y<u.length;y++){var C=u[y];if(!d.call(a,C)||!bn(s[C],a[C]))return!1}return!0}function hv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function gv(s,a){var u=hv(s);s=0;for(var y;u;){if(u.nodeType===3){if(y=s+u.textContent.length,s<=a&&y>=a)return{node:u,offset:a-s};s=y}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=hv(u)}}function mv(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?mv(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function yv(){for(var s=window,a=me();a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=me(s.document)}return a}function np(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}function HR(s){var a=yv(),u=s.focusedElem,y=s.selectionRange;if(a!==u&&u&&u.ownerDocument&&mv(u.ownerDocument.documentElement,u)){if(y!==null&&np(u)){if(a=y.start,s=y.end,s===void 0&&(s=a),"selectionStart"in u)u.selectionStart=a,u.selectionEnd=Math.min(s,u.value.length);else if(s=(a=u.ownerDocument||document)&&a.defaultView||window,s.getSelection){s=s.getSelection();var C=u.textContent.length,T=Math.min(y.start,C);y=y.end===void 0?T:Math.min(y.end,C),!s.extend&&T>y&&(C=y,y=T,T=C),C=gv(u,T);var D=gv(u,y);C&&D&&(s.rangeCount!==1||s.anchorNode!==C.node||s.anchorOffset!==C.offset||s.focusNode!==D.node||s.focusOffset!==D.offset)&&(a=a.createRange(),a.setStart(C.node,C.offset),s.removeAllRanges(),T>y?(s.addRange(a),s.extend(D.node,D.offset)):(a.setEnd(D.node,D.offset),s.addRange(a)))}}for(a=[],s=u;s=s.parentNode;)s.nodeType===1&&a.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<a.length;u++)s=a[u],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var BR=c&&"documentMode"in document&&11>=document.documentMode,Ts=null,rp=null,da=null,op=!1;function vv(s,a,u){var y=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;op||Ts==null||Ts!==me(y)||(y=Ts,"selectionStart"in y&&np(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),da&&ua(da,y)||(da=y,y=yc(rp,"onSelect"),0<y.length&&(a=new Yf("onSelect","select",null,a,u),s.push({event:a,listeners:y}),a.target=Ts)))}function hc(s,a){var u={};return u[s.toLowerCase()]=a.toLowerCase(),u["Webkit"+s]="webkit"+a,u["Moz"+s]="moz"+a,u}var Ps={animationend:hc("Animation","AnimationEnd"),animationiteration:hc("Animation","AnimationIteration"),animationstart:hc("Animation","AnimationStart"),transitionend:hc("Transition","TransitionEnd")},sp={},xv={};c&&(xv=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function gc(s){if(sp[s])return sp[s];if(!Ps[s])return s;var a=Ps[s],u;for(u in a)if(a.hasOwnProperty(u)&&u in xv)return sp[s]=a[u];return s}var wv=gc("animationend"),bv=gc("animationiteration"),Sv=gc("animationstart"),Cv=gc("transitionend"),Ev=new Map,Nv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Fr(s,a){Ev.set(s,a),i(a,[s])}for(var ip=0;ip<Nv.length;ip++){var ap=Nv[ip],WR=ap.toLowerCase(),UR=ap[0].toUpperCase()+ap.slice(1);Fr(WR,"on"+UR)}Fr(wv,"onAnimationEnd"),Fr(bv,"onAnimationIteration"),Fr(Sv,"onAnimationStart"),Fr("dblclick","onDoubleClick"),Fr("focusin","onFocus"),Fr("focusout","onBlur"),Fr(Cv,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),KR=new Set("cancel close invalid load scroll toggle".split(" ").concat(fa));function kv(s,a,u){var y=s.type||"unknown-event";s.currentTarget=u,Af(y,a,void 0,s),s.currentTarget=null}function Tv(s,a){a=(a&4)!==0;for(var u=0;u<s.length;u++){var y=s[u],C=y.event;y=y.listeners;e:{var T=void 0;if(a)for(var D=y.length-1;0<=D;D--){var Y=y[D],J=Y.instance,ie=Y.currentTarget;if(Y=Y.listener,J!==T&&C.isPropagationStopped())break e;kv(C,Y,ie),T=J}else for(D=0;D<y.length;D++){if(Y=y[D],J=Y.instance,ie=Y.currentTarget,Y=Y.listener,J!==T&&C.isPropagationStopped())break e;kv(C,Y,ie),T=J}}}if(vs)throw s=Yi,vs=!1,Yi=null,s}function tt(s,a){var u=a[gp];u===void 0&&(u=a[gp]=new Set);var y=s+"__bubble";u.has(y)||(Pv(a,s,2,!1),u.add(y))}function lp(s,a,u){var y=0;a&&(y|=4),Pv(u,s,y,a)}var mc="_reactListening"+Math.random().toString(36).slice(2);function pa(s){if(!s[mc]){s[mc]=!0,r.forEach(function(u){u!=="selectionchange"&&(KR.has(u)||lp(u,!1,s),lp(u,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[mc]||(a[mc]=!0,lp("selectionchange",!1,a))}}function Pv(s,a,u,y){switch(Zy(a)){case 1:var C=iR;break;case 4:C=aR;break;default:C=Uf}u=C.bind(null,a,u,s),C=void 0,!Gi||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(C=!0),y?C!==void 0?s.addEventListener(a,u,{capture:!0,passive:C}):s.addEventListener(a,u,!0):C!==void 0?s.addEventListener(a,u,{passive:C}):s.addEventListener(a,u,!1)}function cp(s,a,u,y,C){var T=y;if((a&1)===0&&(a&2)===0&&y!==null)e:for(;;){if(y===null)return;var D=y.tag;if(D===3||D===4){var Y=y.stateNode.containerInfo;if(Y===C||Y.nodeType===8&&Y.parentNode===C)break;if(D===4)for(D=y.return;D!==null;){var J=D.tag;if((J===3||J===4)&&(J=D.stateNode.containerInfo,J===C||J.nodeType===8&&J.parentNode===C))return;D=D.return}for(;Y!==null;){if(D=Io(Y),D===null)return;if(J=D.tag,J===5||J===6){y=T=D;continue e}Y=Y.parentNode}}y=y.return}Xl(function(){var ie=T,fe=Wi(u),pe=[];e:{var de=Ev.get(s);if(de!==void 0){var we=Yf,Te=s;switch(s){case"keypress":if(uc(u)===0)break e;case"keydown":case"keyup":we=SR;break;case"focusin":Te="focus",we=Zf;break;case"focusout":Te="blur",we=Zf;break;case"beforeblur":case"afterblur":we=Zf;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=uR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=NR;break;case wv:case bv:case Sv:we=pR;break;case Cv:we=TR;break;case"scroll":we=lR;break;case"wheel":we=RR;break;case"copy":case"cut":case"paste":we=gR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=nv}var Pe=(a&4)!==0,ft=!Pe&&s==="scroll",re=Pe?de!==null?de+"Capture":null:de;Pe=[];for(var te=ie,se;te!==null;){se=te;var he=se.stateNode;if(se.tag===5&&he!==null&&(se=he,re!==null&&(he=No(te,re),he!=null&&Pe.push(ha(te,he,se)))),ft)break;te=te.return}0<Pe.length&&(de=new we(de,Te,null,u,fe),pe.push({event:de,listeners:Pe}))}}if((a&7)===0){e:{if(de=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",de&&u!==Bi&&(Te=u.relatedTarget||u.fromElement)&&(Io(Te)||Te[sr]))break e;if((we||de)&&(de=fe.window===fe?fe:(de=fe.ownerDocument)?de.defaultView||de.parentWindow:window,we?(Te=u.relatedTarget||u.toElement,we=ie,Te=Te?Io(Te):null,Te!==null&&(ft=Fn(Te),Te!==ft||Te.tag!==5&&Te.tag!==6)&&(Te=null)):(we=null,Te=ie),we!==Te)){if(Pe=ev,he="onMouseLeave",re="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(Pe=nv,he="onPointerLeave",re="onPointerEnter",te="pointer"),ft=we==null?de:_s(we),se=Te==null?de:_s(Te),de=new Pe(he,te+"leave",we,u,fe),de.target=ft,de.relatedTarget=se,he=null,Io(fe)===ie&&(Pe=new Pe(re,te+"enter",Te,u,fe),Pe.target=se,Pe.relatedTarget=ft,he=Pe),ft=he,we&&Te)t:{for(Pe=we,re=Te,te=0,se=Pe;se;se=Rs(se))te++;for(se=0,he=re;he;he=Rs(he))se++;for(;0<te-se;)Pe=Rs(Pe),te--;for(;0<se-te;)re=Rs(re),se--;for(;te--;){if(Pe===re||re!==null&&Pe===re.alternate)break t;Pe=Rs(Pe),re=Rs(re)}Pe=null}else Pe=null;we!==null&&Rv(pe,de,we,Pe,!1),Te!==null&&ft!==null&&Rv(pe,ft,Te,Pe,!0)}}e:{if(de=ie?_s(ie):window,we=de.nodeName&&de.nodeName.toLowerCase(),we==="select"||we==="input"&&de.type==="file")var Re=OR;else if(lv(de))if(uv)Re=zR;else{Re=LR;var Ie=$R}else(we=de.nodeName)&&we.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Re=FR);if(Re&&(Re=Re(s,ie))){cv(pe,Re,u,fe);break e}Ie&&Ie(s,de,ie),s==="focusout"&&(Ie=de._wrapperState)&&Ie.controlled&&de.type==="number"&&Se(de,"number",de.value)}switch(Ie=ie?_s(ie):window,s){case"focusin":(lv(Ie)||Ie.contentEditable==="true")&&(Ts=Ie,rp=ie,da=null);break;case"focusout":da=rp=Ts=null;break;case"mousedown":op=!0;break;case"contextmenu":case"mouseup":case"dragend":op=!1,vv(pe,u,fe);break;case"selectionchange":if(BR)break;case"keydown":case"keyup":vv(pe,u,fe)}var _e;if(Jf)e:{switch(s){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else ks?iv(s,u)&&(Ae="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Ae="onCompositionStart");Ae&&(rv&&u.locale!=="ko"&&(ks||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&ks&&(_e=Qy()):(Lr=fe,Gf="value"in Lr?Lr.value:Lr.textContent,ks=!0)),Ie=yc(ie,Ae),0<Ie.length&&(Ae=new tv(Ae,s,null,u,fe),pe.push({event:Ae,listeners:Ie}),_e?Ae.data=_e:(_e=av(u),_e!==null&&(Ae.data=_e)))),(_e=_R?AR(s,u):MR(s,u))&&(ie=yc(ie,"onBeforeInput"),0<ie.length&&(fe=new tv("onBeforeInput","beforeinput",null,u,fe),pe.push({event:fe,listeners:ie}),fe.data=_e))}Tv(pe,a)})}function ha(s,a,u){return{instance:s,listener:a,currentTarget:u}}function yc(s,a){for(var u=a+"Capture",y=[];s!==null;){var C=s,T=C.stateNode;C.tag===5&&T!==null&&(C=T,T=No(s,u),T!=null&&y.unshift(ha(s,T,C)),T=No(s,a),T!=null&&y.push(ha(s,T,C))),s=s.return}return y}function Rs(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Rv(s,a,u,y,C){for(var T=a._reactName,D=[];u!==null&&u!==y;){var Y=u,J=Y.alternate,ie=Y.stateNode;if(J!==null&&J===y)break;Y.tag===5&&ie!==null&&(Y=ie,C?(J=No(u,T),J!=null&&D.unshift(ha(u,J,Y))):C||(J=No(u,T),J!=null&&D.push(ha(u,J,Y)))),u=u.return}D.length!==0&&s.push({event:a,listeners:D})}var GR=/\r\n?/g,YR=/\u0000|\uFFFD/g;function Iv(s){return(typeof s=="string"?s:""+s).replace(GR,`
6
+ `).replace(YR,"")}function vc(s,a,u){if(a=Iv(a),Iv(s)!==a&&u)throw Error(n(425))}function xc(){}var up=null,dp=null;function fp(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var pp=typeof setTimeout=="function"?setTimeout:void 0,XR=typeof clearTimeout=="function"?clearTimeout:void 0,_v=typeof Promise=="function"?Promise:void 0,qR=typeof queueMicrotask=="function"?queueMicrotask:typeof _v<"u"?function(s){return _v.resolve(null).then(s).catch(ZR)}:pp;function ZR(s){setTimeout(function(){throw s})}function hp(s,a){var u=a,y=0;do{var C=u.nextSibling;if(s.removeChild(u),C&&C.nodeType===8)if(u=C.data,u==="/$"){if(y===0){s.removeChild(C),oa(a);return}y--}else u!=="$"&&u!=="$?"&&u!=="$!"||y++;u=C}while(u);oa(a)}function zr(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return s}function Av(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"){if(a===0)return s;a--}else u==="/$"&&a++}s=s.previousSibling}return null}var Is=Math.random().toString(36).slice(2),zn="__reactFiber$"+Is,ga="__reactProps$"+Is,sr="__reactContainer$"+Is,gp="__reactEvents$"+Is,QR="__reactListeners$"+Is,JR="__reactHandles$"+Is;function Io(s){var a=s[zn];if(a)return a;for(var u=s.parentNode;u;){if(a=u[sr]||u[zn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=Av(s);s!==null;){if(u=s[zn])return u;s=Av(s)}return a}s=u,u=s.parentNode}return null}function ma(s){return s=s[zn]||s[sr],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function _s(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function wc(s){return s[ga]||null}var mp=[],As=-1;function Vr(s){return{current:s}}function nt(s){0>As||(s.current=mp[As],mp[As]=null,As--)}function Je(s,a){As++,mp[As]=s.current,s.current=a}var Hr={},Rt=Vr(Hr),Vt=Vr(!1),_o=Hr;function Ms(s,a){var u=s.type.contextTypes;if(!u)return Hr;var y=s.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===a)return y.__reactInternalMemoizedMaskedChildContext;var C={},T;for(T in u)C[T]=a[T];return y&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=C),C}function Ht(s){return s=s.childContextTypes,s!=null}function bc(){nt(Vt),nt(Rt)}function Mv(s,a,u){if(Rt.current!==Hr)throw Error(n(168));Je(Rt,a),Je(Vt,u)}function Dv(s,a,u){var y=s.stateNode;if(a=a.childContextTypes,typeof y.getChildContext!="function")return u;y=y.getChildContext();for(var C in y)if(!(C in a))throw Error(n(108,K(s)||"Unknown",C));return Z({},u,y)}function Sc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Hr,_o=Rt.current,Je(Rt,s),Je(Vt,Vt.current),!0}function jv(s,a,u){var y=s.stateNode;if(!y)throw Error(n(169));u?(s=Dv(s,a,_o),y.__reactInternalMemoizedMergedChildContext=s,nt(Vt),nt(Rt),Je(Rt,s)):nt(Vt),Je(Vt,u)}var ir=null,Cc=!1,yp=!1;function Ov(s){ir===null?ir=[s]:ir.push(s)}function eI(s){Cc=!0,Ov(s)}function Br(){if(!yp&&ir!==null){yp=!0;var s=0,a=Ge;try{var u=ir;for(Ge=1;s<u.length;s++){var y=u[s];do y=y(!0);while(y!==null)}ir=null,Cc=!1}catch(C){throw ir!==null&&(ir=ir.slice(s+1)),Ql(Zi,Br),C}finally{Ge=a,yp=!1}}return null}var Ds=[],js=0,Ec=null,Nc=0,fn=[],pn=0,Ao=null,ar=1,lr="";function Mo(s,a){Ds[js++]=Nc,Ds[js++]=Ec,Ec=s,Nc=a}function $v(s,a,u){fn[pn++]=ar,fn[pn++]=lr,fn[pn++]=Ao,Ao=s;var y=ar;s=lr;var C=32-Zt(y)-1;y&=~(1<<C),u+=1;var T=32-Zt(a)+C;if(30<T){var D=C-C%5;T=(y&(1<<D)-1).toString(32),y>>=D,C-=D,ar=1<<32-Zt(a)+C|u<<C|y,lr=T+s}else ar=1<<T|u<<C|y,lr=s}function vp(s){s.return!==null&&(Mo(s,1),$v(s,1,0))}function xp(s){for(;s===Ec;)Ec=Ds[--js],Ds[js]=null,Nc=Ds[--js],Ds[js]=null;for(;s===Ao;)Ao=fn[--pn],fn[pn]=null,lr=fn[--pn],fn[pn]=null,ar=fn[--pn],fn[pn]=null}var Jt=null,en=null,st=!1,Sn=null;function Lv(s,a){var u=yn(5,null,null,0);u.elementType="DELETED",u.stateNode=a,u.return=s,a=s.deletions,a===null?(s.deletions=[u],s.flags|=16):a.push(u)}function Fv(s,a){switch(s.tag){case 5:var u=s.type;return a=a.nodeType!==1||u.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(s.stateNode=a,Jt=s,en=zr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Jt=s,en=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=Ao!==null?{id:ar,overflow:lr}:null,s.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=yn(18,null,null,0),u.stateNode=a,u.return=s,s.child=u,Jt=s,en=null,!0):!1;default:return!1}}function wp(s){return(s.mode&1)!==0&&(s.flags&128)===0}function bp(s){if(st){var a=en;if(a){var u=a;if(!Fv(s,a)){if(wp(s))throw Error(n(418));a=zr(u.nextSibling);var y=Jt;a&&Fv(s,a)?Lv(y,u):(s.flags=s.flags&-4097|2,st=!1,Jt=s)}}else{if(wp(s))throw Error(n(418));s.flags=s.flags&-4097|2,st=!1,Jt=s}}}function zv(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Jt=s}function kc(s){if(s!==Jt)return!1;if(!st)return zv(s),st=!0,!1;var a;if((a=s.tag!==3)&&!(a=s.tag!==5)&&(a=s.type,a=a!=="head"&&a!=="body"&&!fp(s.type,s.memoizedProps)),a&&(a=en)){if(wp(s))throw Vv(),Error(n(418));for(;a;)Lv(s,a),a=zr(a.nextSibling)}if(zv(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"){if(a===0){en=zr(s.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}s=s.nextSibling}en=null}}else en=Jt?zr(s.stateNode.nextSibling):null;return!0}function Vv(){for(var s=en;s;)s=zr(s.nextSibling)}function Os(){en=Jt=null,st=!1}function Sp(s){Sn===null?Sn=[s]:Sn.push(s)}var tI=P.ReactCurrentBatchConfig;function ya(s,a,u){if(s=u.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var y=u.stateNode}if(!y)throw Error(n(147,s));var C=y,T=""+s;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===T?a.ref:(a=function(D){var Y=C.refs;D===null?delete Y[T]:Y[T]=D},a._stringRef=T,a)}if(typeof s!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,s))}return s}function Tc(s,a){throw s=Object.prototype.toString.call(a),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s))}function Hv(s){var a=s._init;return a(s._payload)}function Bv(s){function a(re,te){if(s){var se=re.deletions;se===null?(re.deletions=[te],re.flags|=16):se.push(te)}}function u(re,te){if(!s)return null;for(;te!==null;)a(re,te),te=te.sibling;return null}function y(re,te){for(re=new Map;te!==null;)te.key!==null?re.set(te.key,te):re.set(te.index,te),te=te.sibling;return re}function C(re,te){return re=Zr(re,te),re.index=0,re.sibling=null,re}function T(re,te,se){return re.index=se,s?(se=re.alternate,se!==null?(se=se.index,se<te?(re.flags|=2,te):se):(re.flags|=2,te)):(re.flags|=1048576,te)}function D(re){return s&&re.alternate===null&&(re.flags|=2),re}function Y(re,te,se,he){return te===null||te.tag!==6?(te=ph(se,re.mode,he),te.return=re,te):(te=C(te,se),te.return=re,te)}function J(re,te,se,he){var Re=se.type;return Re===R?fe(re,te,se.props.children,he,se.key):te!==null&&(te.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===M&&Hv(Re)===te.type)?(he=C(te,se.props),he.ref=ya(re,te,se),he.return=re,he):(he=Zc(se.type,se.key,se.props,null,re.mode,he),he.ref=ya(re,te,se),he.return=re,he)}function ie(re,te,se,he){return te===null||te.tag!==4||te.stateNode.containerInfo!==se.containerInfo||te.stateNode.implementation!==se.implementation?(te=hh(se,re.mode,he),te.return=re,te):(te=C(te,se.children||[]),te.return=re,te)}function fe(re,te,se,he,Re){return te===null||te.tag!==7?(te=Vo(se,re.mode,he,Re),te.return=re,te):(te=C(te,se),te.return=re,te)}function pe(re,te,se){if(typeof te=="string"&&te!==""||typeof te=="number")return te=ph(""+te,re.mode,se),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case A:return se=Zc(te.type,te.key,te.props,null,re.mode,se),se.ref=ya(re,null,te),se.return=re,se;case I:return te=hh(te,re.mode,se),te.return=re,te;case M:var he=te._init;return pe(re,he(te._payload),se)}if(Oe(te)||W(te))return te=Vo(te,re.mode,se,null),te.return=re,te;Tc(re,te)}return null}function de(re,te,se,he){var Re=te!==null?te.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Re!==null?null:Y(re,te,""+se,he);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case A:return se.key===Re?J(re,te,se,he):null;case I:return se.key===Re?ie(re,te,se,he):null;case M:return Re=se._init,de(re,te,Re(se._payload),he)}if(Oe(se)||W(se))return Re!==null?null:fe(re,te,se,he,null);Tc(re,se)}return null}function we(re,te,se,he,Re){if(typeof he=="string"&&he!==""||typeof he=="number")return re=re.get(se)||null,Y(te,re,""+he,Re);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case A:return re=re.get(he.key===null?se:he.key)||null,J(te,re,he,Re);case I:return re=re.get(he.key===null?se:he.key)||null,ie(te,re,he,Re);case M:var Ie=he._init;return we(re,te,se,Ie(he._payload),Re)}if(Oe(he)||W(he))return re=re.get(se)||null,fe(te,re,he,Re,null);Tc(te,he)}return null}function Te(re,te,se,he){for(var Re=null,Ie=null,_e=te,Ae=te=0,Ct=null;_e!==null&&Ae<se.length;Ae++){_e.index>Ae?(Ct=_e,_e=null):Ct=_e.sibling;var Ue=de(re,_e,se[Ae],he);if(Ue===null){_e===null&&(_e=Ct);break}s&&_e&&Ue.alternate===null&&a(re,_e),te=T(Ue,te,Ae),Ie===null?Re=Ue:Ie.sibling=Ue,Ie=Ue,_e=Ct}if(Ae===se.length)return u(re,_e),st&&Mo(re,Ae),Re;if(_e===null){for(;Ae<se.length;Ae++)_e=pe(re,se[Ae],he),_e!==null&&(te=T(_e,te,Ae),Ie===null?Re=_e:Ie.sibling=_e,Ie=_e);return st&&Mo(re,Ae),Re}for(_e=y(re,_e);Ae<se.length;Ae++)Ct=we(_e,re,Ae,se[Ae],he),Ct!==null&&(s&&Ct.alternate!==null&&_e.delete(Ct.key===null?Ae:Ct.key),te=T(Ct,te,Ae),Ie===null?Re=Ct:Ie.sibling=Ct,Ie=Ct);return s&&_e.forEach(function(Qr){return a(re,Qr)}),st&&Mo(re,Ae),Re}function Pe(re,te,se,he){var Re=W(se);if(typeof Re!="function")throw Error(n(150));if(se=Re.call(se),se==null)throw Error(n(151));for(var Ie=Re=null,_e=te,Ae=te=0,Ct=null,Ue=se.next();_e!==null&&!Ue.done;Ae++,Ue=se.next()){_e.index>Ae?(Ct=_e,_e=null):Ct=_e.sibling;var Qr=de(re,_e,Ue.value,he);if(Qr===null){_e===null&&(_e=Ct);break}s&&_e&&Qr.alternate===null&&a(re,_e),te=T(Qr,te,Ae),Ie===null?Re=Qr:Ie.sibling=Qr,Ie=Qr,_e=Ct}if(Ue.done)return u(re,_e),st&&Mo(re,Ae),Re;if(_e===null){for(;!Ue.done;Ae++,Ue=se.next())Ue=pe(re,Ue.value,he),Ue!==null&&(te=T(Ue,te,Ae),Ie===null?Re=Ue:Ie.sibling=Ue,Ie=Ue);return st&&Mo(re,Ae),Re}for(_e=y(re,_e);!Ue.done;Ae++,Ue=se.next())Ue=we(_e,re,Ae,Ue.value,he),Ue!==null&&(s&&Ue.alternate!==null&&_e.delete(Ue.key===null?Ae:Ue.key),te=T(Ue,te,Ae),Ie===null?Re=Ue:Ie.sibling=Ue,Ie=Ue);return s&&_e.forEach(function(DI){return a(re,DI)}),st&&Mo(re,Ae),Re}function ft(re,te,se,he){if(typeof se=="object"&&se!==null&&se.type===R&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case A:e:{for(var Re=se.key,Ie=te;Ie!==null;){if(Ie.key===Re){if(Re=se.type,Re===R){if(Ie.tag===7){u(re,Ie.sibling),te=C(Ie,se.props.children),te.return=re,re=te;break e}}else if(Ie.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===M&&Hv(Re)===Ie.type){u(re,Ie.sibling),te=C(Ie,se.props),te.ref=ya(re,Ie,se),te.return=re,re=te;break e}u(re,Ie);break}else a(re,Ie);Ie=Ie.sibling}se.type===R?(te=Vo(se.props.children,re.mode,he,se.key),te.return=re,re=te):(he=Zc(se.type,se.key,se.props,null,re.mode,he),he.ref=ya(re,te,se),he.return=re,re=he)}return D(re);case I:e:{for(Ie=se.key;te!==null;){if(te.key===Ie)if(te.tag===4&&te.stateNode.containerInfo===se.containerInfo&&te.stateNode.implementation===se.implementation){u(re,te.sibling),te=C(te,se.children||[]),te.return=re,re=te;break e}else{u(re,te);break}else a(re,te);te=te.sibling}te=hh(se,re.mode,he),te.return=re,re=te}return D(re);case M:return Ie=se._init,ft(re,te,Ie(se._payload),he)}if(Oe(se))return Te(re,te,se,he);if(W(se))return Pe(re,te,se,he);Tc(re,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,te!==null&&te.tag===6?(u(re,te.sibling),te=C(te,se),te.return=re,re=te):(u(re,te),te=ph(se,re.mode,he),te.return=re,re=te),D(re)):u(re,te)}return ft}var $s=Bv(!0),Wv=Bv(!1),Pc=Vr(null),Rc=null,Ls=null,Cp=null;function Ep(){Cp=Ls=Rc=null}function Np(s){var a=Pc.current;nt(Pc),s._currentValue=a}function kp(s,a,u){for(;s!==null;){var y=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,y!==null&&(y.childLanes|=a)):y!==null&&(y.childLanes&a)!==a&&(y.childLanes|=a),s===u)break;s=s.return}}function Fs(s,a){Rc=s,Cp=Ls=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&a)!==0&&(Bt=!0),s.firstContext=null)}function hn(s){var a=s._currentValue;if(Cp!==s)if(s={context:s,memoizedValue:a,next:null},Ls===null){if(Rc===null)throw Error(n(308));Ls=s,Rc.dependencies={lanes:0,firstContext:s}}else Ls=Ls.next=s;return a}var Do=null;function Tp(s){Do===null?Do=[s]:Do.push(s)}function Uv(s,a,u,y){var C=a.interleaved;return C===null?(u.next=u,Tp(a)):(u.next=C.next,C.next=u),a.interleaved=u,cr(s,y)}function cr(s,a){s.lanes|=a;var u=s.alternate;for(u!==null&&(u.lanes|=a),u=s,s=s.return;s!==null;)s.childLanes|=a,u=s.alternate,u!==null&&(u.childLanes|=a),u=s,s=s.return;return u.tag===3?u.stateNode:null}var Wr=!1;function Pp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kv(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function ur(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Ur(s,a,u){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(Be&2)!==0){var C=y.pending;return C===null?a.next=a:(a.next=C.next,C.next=a),y.pending=a,cr(s,u)}return C=y.interleaved,C===null?(a.next=a,Tp(y)):(a.next=C.next,C.next=a),y.interleaved=a,cr(s,u)}function Ic(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194240)!==0)){var y=a.lanes;y&=s.pendingLanes,u|=y,a.lanes=u,Hf(s,u)}}function Gv(s,a){var u=s.updateQueue,y=s.alternate;if(y!==null&&(y=y.updateQueue,u===y)){var C=null,T=null;if(u=u.firstBaseUpdate,u!==null){do{var D={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};T===null?C=T=D:T=T.next=D,u=u.next}while(u!==null);T===null?C=T=a:T=T.next=a}else C=T=a;u={baseState:y.baseState,firstBaseUpdate:C,lastBaseUpdate:T,shared:y.shared,effects:y.effects},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}function _c(s,a,u,y){var C=s.updateQueue;Wr=!1;var T=C.firstBaseUpdate,D=C.lastBaseUpdate,Y=C.shared.pending;if(Y!==null){C.shared.pending=null;var J=Y,ie=J.next;J.next=null,D===null?T=ie:D.next=ie,D=J;var fe=s.alternate;fe!==null&&(fe=fe.updateQueue,Y=fe.lastBaseUpdate,Y!==D&&(Y===null?fe.firstBaseUpdate=ie:Y.next=ie,fe.lastBaseUpdate=J))}if(T!==null){var pe=C.baseState;D=0,fe=ie=J=null,Y=T;do{var de=Y.lane,we=Y.eventTime;if((y&de)===de){fe!==null&&(fe=fe.next={eventTime:we,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var Te=s,Pe=Y;switch(de=a,we=u,Pe.tag){case 1:if(Te=Pe.payload,typeof Te=="function"){pe=Te.call(we,pe,de);break e}pe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Pe.payload,de=typeof Te=="function"?Te.call(we,pe,de):Te,de==null)break e;pe=Z({},pe,de);break e;case 2:Wr=!0}}Y.callback!==null&&Y.lane!==0&&(s.flags|=64,de=C.effects,de===null?C.effects=[Y]:de.push(Y))}else we={eventTime:we,lane:de,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},fe===null?(ie=fe=we,J=pe):fe=fe.next=we,D|=de;if(Y=Y.next,Y===null){if(Y=C.shared.pending,Y===null)break;de=Y,Y=de.next,de.next=null,C.lastBaseUpdate=de,C.shared.pending=null}}while(!0);if(fe===null&&(J=pe),C.baseState=J,C.firstBaseUpdate=ie,C.lastBaseUpdate=fe,a=C.shared.interleaved,a!==null){C=a;do D|=C.lane,C=C.next;while(C!==a)}else T===null&&(C.shared.lanes=0);$o|=D,s.lanes=D,s.memoizedState=pe}}function Yv(s,a,u){if(s=a.effects,a.effects=null,s!==null)for(a=0;a<s.length;a++){var y=s[a],C=y.callback;if(C!==null){if(y.callback=null,y=u,typeof C!="function")throw Error(n(191,C));C.call(y)}}}var va={},Vn=Vr(va),xa=Vr(va),wa=Vr(va);function jo(s){if(s===va)throw Error(n(174));return s}function Rp(s,a){switch(Je(wa,a),Je(xa,s),Je(Vn,va),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:rr(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=rr(a,s)}nt(Vn),Je(Vn,a)}function zs(){nt(Vn),nt(xa),nt(wa)}function Xv(s){jo(wa.current);var a=jo(Vn.current),u=rr(a,s.type);a!==u&&(Je(xa,s),Je(Vn,u))}function Ip(s){xa.current===s&&(nt(Vn),nt(xa))}var lt=Vr(0);function Ac(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var _p=[];function Ap(){for(var s=0;s<_p.length;s++)_p[s]._workInProgressVersionPrimary=null;_p.length=0}var Mc=P.ReactCurrentDispatcher,Mp=P.ReactCurrentBatchConfig,Oo=0,ct=null,vt=null,bt=null,Dc=!1,ba=!1,Sa=0,nI=0;function It(){throw Error(n(321))}function Dp(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!bn(s[u],a[u]))return!1;return!0}function jp(s,a,u,y,C,T){if(Oo=T,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Mc.current=s===null||s.memoizedState===null?iI:aI,s=u(y,C),ba){T=0;do{if(ba=!1,Sa=0,25<=T)throw Error(n(301));T+=1,bt=vt=null,a.updateQueue=null,Mc.current=lI,s=u(y,C)}while(ba)}if(Mc.current=$c,a=vt!==null&&vt.next!==null,Oo=0,bt=vt=ct=null,Dc=!1,a)throw Error(n(300));return s}function Op(){var s=Sa!==0;return Sa=0,s}function Hn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?ct.memoizedState=bt=s:bt=bt.next=s,bt}function gn(){if(vt===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=vt.next;var a=bt===null?ct.memoizedState:bt.next;if(a!==null)bt=a,vt=s;else{if(s===null)throw Error(n(310));vt=s,s={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},bt===null?ct.memoizedState=bt=s:bt=bt.next=s}return bt}function Ca(s,a){return typeof a=="function"?a(s):a}function $p(s){var a=gn(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var y=vt,C=y.baseQueue,T=u.pending;if(T!==null){if(C!==null){var D=C.next;C.next=T.next,T.next=D}y.baseQueue=C=T,u.pending=null}if(C!==null){T=C.next,y=y.baseState;var Y=D=null,J=null,ie=T;do{var fe=ie.lane;if((Oo&fe)===fe)J!==null&&(J=J.next={lane:0,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),y=ie.hasEagerState?ie.eagerState:s(y,ie.action);else{var pe={lane:fe,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};J===null?(Y=J=pe,D=y):J=J.next=pe,ct.lanes|=fe,$o|=fe}ie=ie.next}while(ie!==null&&ie!==T);J===null?D=y:J.next=Y,bn(y,a.memoizedState)||(Bt=!0),a.memoizedState=y,a.baseState=D,a.baseQueue=J,u.lastRenderedState=y}if(s=u.interleaved,s!==null){C=s;do T=C.lane,ct.lanes|=T,$o|=T,C=C.next;while(C!==s)}else C===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function Lp(s){var a=gn(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var y=u.dispatch,C=u.pending,T=a.memoizedState;if(C!==null){u.pending=null;var D=C=C.next;do T=s(T,D.action),D=D.next;while(D!==C);bn(T,a.memoizedState)||(Bt=!0),a.memoizedState=T,a.baseQueue===null&&(a.baseState=T),u.lastRenderedState=T}return[T,y]}function qv(){}function Zv(s,a){var u=ct,y=gn(),C=a(),T=!bn(y.memoizedState,C);if(T&&(y.memoizedState=C,Bt=!0),y=y.queue,Fp(ex.bind(null,u,y,s),[s]),y.getSnapshot!==a||T||bt!==null&&bt.memoizedState.tag&1){if(u.flags|=2048,Ea(9,Jv.bind(null,u,y,C,a),void 0,null),St===null)throw Error(n(349));(Oo&30)!==0||Qv(u,a,C)}return C}function Qv(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=ct.updateQueue,a===null?(a={lastEffect:null,stores:null},ct.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function Jv(s,a,u,y){a.value=u,a.getSnapshot=y,tx(a)&&nx(s)}function ex(s,a,u){return u(function(){tx(a)&&nx(s)})}function tx(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!bn(s,u)}catch{return!0}}function nx(s){var a=cr(s,1);a!==null&&kn(a,s,1,-1)}function rx(s){var a=Hn();return typeof s=="function"&&(s=s()),a.memoizedState=a.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:s},a.queue=s,s=s.dispatch=sI.bind(null,ct,s),[a.memoizedState,s]}function Ea(s,a,u,y){return s={tag:s,create:a,destroy:u,deps:y,next:null},a=ct.updateQueue,a===null?(a={lastEffect:null,stores:null},ct.updateQueue=a,a.lastEffect=s.next=s):(u=a.lastEffect,u===null?a.lastEffect=s.next=s:(y=u.next,u.next=s,s.next=y,a.lastEffect=s)),s}function ox(){return gn().memoizedState}function jc(s,a,u,y){var C=Hn();ct.flags|=s,C.memoizedState=Ea(1|a,u,void 0,y===void 0?null:y)}function Oc(s,a,u,y){var C=gn();y=y===void 0?null:y;var T=void 0;if(vt!==null){var D=vt.memoizedState;if(T=D.destroy,y!==null&&Dp(y,D.deps)){C.memoizedState=Ea(a,u,T,y);return}}ct.flags|=s,C.memoizedState=Ea(1|a,u,T,y)}function sx(s,a){return jc(8390656,8,s,a)}function Fp(s,a){return Oc(2048,8,s,a)}function ix(s,a){return Oc(4,2,s,a)}function ax(s,a){return Oc(4,4,s,a)}function lx(s,a){if(typeof a=="function")return s=s(),a(s),function(){a(null)};if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function cx(s,a,u){return u=u!=null?u.concat([s]):null,Oc(4,4,lx.bind(null,a,s),u)}function zp(){}function ux(s,a){var u=gn();a=a===void 0?null:a;var y=u.memoizedState;return y!==null&&a!==null&&Dp(a,y[1])?y[0]:(u.memoizedState=[s,a],s)}function dx(s,a){var u=gn();a=a===void 0?null:a;var y=u.memoizedState;return y!==null&&a!==null&&Dp(a,y[1])?y[0]:(s=s(),u.memoizedState=[s,a],s)}function fx(s,a,u){return(Oo&21)===0?(s.baseState&&(s.baseState=!1,Bt=!0),s.memoizedState=u):(bn(u,a)||(u=Cs(),ct.lanes|=u,$o|=u,s.baseState=!0),a)}function rI(s,a){var u=Ge;Ge=u!==0&&4>u?u:4,s(!0);var y=Mp.transition;Mp.transition={};try{s(!1),a()}finally{Ge=u,Mp.transition=y}}function px(){return gn().memoizedState}function oI(s,a,u){var y=Xr(s);if(u={lane:y,action:u,hasEagerState:!1,eagerState:null,next:null},hx(s))gx(a,u);else if(u=Uv(s,a,u,y),u!==null){var C=Ot();kn(u,s,y,C),mx(u,a,y)}}function sI(s,a,u){var y=Xr(s),C={lane:y,action:u,hasEagerState:!1,eagerState:null,next:null};if(hx(s))gx(a,C);else{var T=s.alternate;if(s.lanes===0&&(T===null||T.lanes===0)&&(T=a.lastRenderedReducer,T!==null))try{var D=a.lastRenderedState,Y=T(D,u);if(C.hasEagerState=!0,C.eagerState=Y,bn(Y,D)){var J=a.interleaved;J===null?(C.next=C,Tp(a)):(C.next=J.next,J.next=C),a.interleaved=C;return}}catch{}u=Uv(s,a,C,y),u!==null&&(C=Ot(),kn(u,s,y,C),mx(u,a,y))}}function hx(s){var a=s.alternate;return s===ct||a!==null&&a===ct}function gx(s,a){ba=Dc=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function mx(s,a,u){if((u&4194240)!==0){var y=a.lanes;y&=s.pendingLanes,u|=y,a.lanes=u,Hf(s,u)}}var $c={readContext:hn,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useInsertionEffect:It,useLayoutEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useMutableSource:It,useSyncExternalStore:It,useId:It,unstable_isNewReconciler:!1},iI={readContext:hn,useCallback:function(s,a){return Hn().memoizedState=[s,a===void 0?null:a],s},useContext:hn,useEffect:sx,useImperativeHandle:function(s,a,u){return u=u!=null?u.concat([s]):null,jc(4194308,4,lx.bind(null,a,s),u)},useLayoutEffect:function(s,a){return jc(4194308,4,s,a)},useInsertionEffect:function(s,a){return jc(4,2,s,a)},useMemo:function(s,a){var u=Hn();return a=a===void 0?null:a,s=s(),u.memoizedState=[s,a],s},useReducer:function(s,a,u){var y=Hn();return a=u!==void 0?u(a):a,y.memoizedState=y.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},y.queue=s,s=s.dispatch=oI.bind(null,ct,s),[y.memoizedState,s]},useRef:function(s){var a=Hn();return s={current:s},a.memoizedState=s},useState:rx,useDebugValue:zp,useDeferredValue:function(s){return Hn().memoizedState=s},useTransition:function(){var s=rx(!1),a=s[0];return s=rI.bind(null,s[1]),Hn().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,u){var y=ct,C=Hn();if(st){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),St===null)throw Error(n(349));(Oo&30)!==0||Qv(y,a,u)}C.memoizedState=u;var T={value:u,getSnapshot:a};return C.queue=T,sx(ex.bind(null,y,T,s),[s]),y.flags|=2048,Ea(9,Jv.bind(null,y,T,u,a),void 0,null),u},useId:function(){var s=Hn(),a=St.identifierPrefix;if(st){var u=lr,y=ar;u=(y&~(1<<32-Zt(y)-1)).toString(32)+u,a=":"+a+"R"+u,u=Sa++,0<u&&(a+="H"+u.toString(32)),a+=":"}else u=nI++,a=":"+a+"r"+u.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},aI={readContext:hn,useCallback:ux,useContext:hn,useEffect:Fp,useImperativeHandle:cx,useInsertionEffect:ix,useLayoutEffect:ax,useMemo:dx,useReducer:$p,useRef:ox,useState:function(){return $p(Ca)},useDebugValue:zp,useDeferredValue:function(s){var a=gn();return fx(a,vt.memoizedState,s)},useTransition:function(){var s=$p(Ca)[0],a=gn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1},lI={readContext:hn,useCallback:ux,useContext:hn,useEffect:Fp,useImperativeHandle:cx,useInsertionEffect:ix,useLayoutEffect:ax,useMemo:dx,useReducer:Lp,useRef:ox,useState:function(){return Lp(Ca)},useDebugValue:zp,useDeferredValue:function(s){var a=gn();return vt===null?a.memoizedState=s:fx(a,vt.memoizedState,s)},useTransition:function(){var s=Lp(Ca)[0],a=gn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1};function Cn(s,a){if(s&&s.defaultProps){a=Z({},a),s=s.defaultProps;for(var u in s)a[u]===void 0&&(a[u]=s[u]);return a}return a}function Vp(s,a,u,y){a=s.memoizedState,u=u(y,a),u=u==null?a:Z({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Lc={isMounted:function(s){return(s=s._reactInternals)?Fn(s)===s:!1},enqueueSetState:function(s,a,u){s=s._reactInternals;var y=Ot(),C=Xr(s),T=ur(y,C);T.payload=a,u!=null&&(T.callback=u),a=Ur(s,T,C),a!==null&&(kn(a,s,C,y),Ic(a,s,C))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var y=Ot(),C=Xr(s),T=ur(y,C);T.tag=1,T.payload=a,u!=null&&(T.callback=u),a=Ur(s,T,C),a!==null&&(kn(a,s,C,y),Ic(a,s,C))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=Ot(),y=Xr(s),C=ur(u,y);C.tag=2,a!=null&&(C.callback=a),a=Ur(s,C,y),a!==null&&(kn(a,s,y,u),Ic(a,s,y))}};function yx(s,a,u,y,C,T,D){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,T,D):a.prototype&&a.prototype.isPureReactComponent?!ua(u,y)||!ua(C,T):!0}function vx(s,a,u){var y=!1,C=Hr,T=a.contextType;return typeof T=="object"&&T!==null?T=hn(T):(C=Ht(a)?_o:Rt.current,y=a.contextTypes,T=(y=y!=null)?Ms(s,C):Hr),a=new a(u,T),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Lc,s.stateNode=a,a._reactInternals=s,y&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=C,s.__reactInternalMemoizedMaskedChildContext=T),a}function xx(s,a,u,y){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,y),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,y),a.state!==s&&Lc.enqueueReplaceState(a,a.state,null)}function Hp(s,a,u,y){var C=s.stateNode;C.props=u,C.state=s.memoizedState,C.refs={},Pp(s);var T=a.contextType;typeof T=="object"&&T!==null?C.context=hn(T):(T=Ht(a)?_o:Rt.current,C.context=Ms(s,T)),C.state=s.memoizedState,T=a.getDerivedStateFromProps,typeof T=="function"&&(Vp(s,a,T,u),C.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(a=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),a!==C.state&&Lc.enqueueReplaceState(C,C.state,null),_c(s,u,C,y),C.state=s.memoizedState),typeof C.componentDidMount=="function"&&(s.flags|=4194308)}function Vs(s,a){try{var u="",y=a;do u+=ee(y),y=y.return;while(y);var C=u}catch(T){C=`
7
+ Error generating stack: `+T.message+`
8
+ `+T.stack}return{value:s,source:a,stack:C,digest:null}}function Bp(s,a,u){return{value:s,source:null,stack:u??null,digest:a??null}}function Wp(s,a){try{console.error(a.value)}catch(u){setTimeout(function(){throw u})}}var cI=typeof WeakMap=="function"?WeakMap:Map;function wx(s,a,u){u=ur(-1,u),u.tag=3,u.payload={element:null};var y=a.value;return u.callback=function(){Uc||(Uc=!0,sh=y),Wp(s,a)},u}function bx(s,a,u){u=ur(-1,u),u.tag=3;var y=s.type.getDerivedStateFromError;if(typeof y=="function"){var C=a.value;u.payload=function(){return y(C)},u.callback=function(){Wp(s,a)}}var T=s.stateNode;return T!==null&&typeof T.componentDidCatch=="function"&&(u.callback=function(){Wp(s,a),typeof y!="function"&&(Gr===null?Gr=new Set([this]):Gr.add(this));var D=a.stack;this.componentDidCatch(a.value,{componentStack:D!==null?D:""})}),u}function Sx(s,a,u){var y=s.pingCache;if(y===null){y=s.pingCache=new cI;var C=new Set;y.set(a,C)}else C=y.get(a),C===void 0&&(C=new Set,y.set(a,C));C.has(u)||(C.add(u),s=CI.bind(null,s,a,u),a.then(s,s))}function Cx(s){do{var a;if((a=s.tag===13)&&(a=s.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return s;s=s.return}while(s!==null);return null}function Ex(s,a,u,y,C){return(s.mode&1)===0?(s===a?s.flags|=65536:(s.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(a=ur(-1,1),a.tag=2,Ur(u,a,1))),u.lanes|=1),s):(s.flags|=65536,s.lanes=C,s)}var uI=P.ReactCurrentOwner,Bt=!1;function jt(s,a,u,y){a.child=s===null?Wv(a,null,u,y):$s(a,s.child,u,y)}function Nx(s,a,u,y,C){u=u.render;var T=a.ref;return Fs(a,C),y=jp(s,a,u,y,T,C),u=Op(),s!==null&&!Bt?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~C,dr(s,a,C)):(st&&u&&vp(a),a.flags|=1,jt(s,a,y,C),a.child)}function kx(s,a,u,y,C){if(s===null){var T=u.type;return typeof T=="function"&&!fh(T)&&T.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(a.tag=15,a.type=T,Tx(s,a,T,y,C)):(s=Zc(u.type,null,y,a,a.mode,C),s.ref=a.ref,s.return=a,a.child=s)}if(T=s.child,(s.lanes&C)===0){var D=T.memoizedProps;if(u=u.compare,u=u!==null?u:ua,u(D,y)&&s.ref===a.ref)return dr(s,a,C)}return a.flags|=1,s=Zr(T,y),s.ref=a.ref,s.return=a,a.child=s}function Tx(s,a,u,y,C){if(s!==null){var T=s.memoizedProps;if(ua(T,y)&&s.ref===a.ref)if(Bt=!1,a.pendingProps=y=T,(s.lanes&C)!==0)(s.flags&131072)!==0&&(Bt=!0);else return a.lanes=s.lanes,dr(s,a,C)}return Up(s,a,u,y,C)}function Px(s,a,u){var y=a.pendingProps,C=y.children,T=s!==null?s.memoizedState:null;if(y.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Je(Bs,tn),tn|=u;else{if((u&1073741824)===0)return s=T!==null?T.baseLanes|u:u,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:s,cachePool:null,transitions:null},a.updateQueue=null,Je(Bs,tn),tn|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=T!==null?T.baseLanes:u,Je(Bs,tn),tn|=y}else T!==null?(y=T.baseLanes|u,a.memoizedState=null):y=u,Je(Bs,tn),tn|=y;return jt(s,a,C,u),a.child}function Rx(s,a){var u=a.ref;(s===null&&u!==null||s!==null&&s.ref!==u)&&(a.flags|=512,a.flags|=2097152)}function Up(s,a,u,y,C){var T=Ht(u)?_o:Rt.current;return T=Ms(a,T),Fs(a,C),u=jp(s,a,u,y,T,C),y=Op(),s!==null&&!Bt?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~C,dr(s,a,C)):(st&&y&&vp(a),a.flags|=1,jt(s,a,u,C),a.child)}function Ix(s,a,u,y,C){if(Ht(u)){var T=!0;Sc(a)}else T=!1;if(Fs(a,C),a.stateNode===null)zc(s,a),vx(a,u,y),Hp(a,u,y,C),y=!0;else if(s===null){var D=a.stateNode,Y=a.memoizedProps;D.props=Y;var J=D.context,ie=u.contextType;typeof ie=="object"&&ie!==null?ie=hn(ie):(ie=Ht(u)?_o:Rt.current,ie=Ms(a,ie));var fe=u.getDerivedStateFromProps,pe=typeof fe=="function"||typeof D.getSnapshotBeforeUpdate=="function";pe||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(Y!==y||J!==ie)&&xx(a,D,y,ie),Wr=!1;var de=a.memoizedState;D.state=de,_c(a,y,D,C),J=a.memoizedState,Y!==y||de!==J||Vt.current||Wr?(typeof fe=="function"&&(Vp(a,u,fe,y),J=a.memoizedState),(Y=Wr||yx(a,u,Y,y,de,J,ie))?(pe||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(a.flags|=4194308)):(typeof D.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=y,a.memoizedState=J),D.props=y,D.state=J,D.context=ie,y=Y):(typeof D.componentDidMount=="function"&&(a.flags|=4194308),y=!1)}else{D=a.stateNode,Kv(s,a),Y=a.memoizedProps,ie=a.type===a.elementType?Y:Cn(a.type,Y),D.props=ie,pe=a.pendingProps,de=D.context,J=u.contextType,typeof J=="object"&&J!==null?J=hn(J):(J=Ht(u)?_o:Rt.current,J=Ms(a,J));var we=u.getDerivedStateFromProps;(fe=typeof we=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(Y!==pe||de!==J)&&xx(a,D,y,J),Wr=!1,de=a.memoizedState,D.state=de,_c(a,y,D,C);var Te=a.memoizedState;Y!==pe||de!==Te||Vt.current||Wr?(typeof we=="function"&&(Vp(a,u,we,y),Te=a.memoizedState),(ie=Wr||yx(a,u,ie,y,de,Te,J)||!1)?(fe||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(y,Te,J),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(y,Te,J)),typeof D.componentDidUpdate=="function"&&(a.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof D.componentDidUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=1024),a.memoizedProps=y,a.memoizedState=Te),D.props=y,D.state=Te,D.context=J,y=ie):(typeof D.componentDidUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=1024),y=!1)}return Kp(s,a,u,y,T,C)}function Kp(s,a,u,y,C,T){Rx(s,a);var D=(a.flags&128)!==0;if(!y&&!D)return C&&jv(a,u,!1),dr(s,a,T);y=a.stateNode,uI.current=a;var Y=D&&typeof u.getDerivedStateFromError!="function"?null:y.render();return a.flags|=1,s!==null&&D?(a.child=$s(a,s.child,null,T),a.child=$s(a,null,Y,T)):jt(s,a,Y,T),a.memoizedState=y.state,C&&jv(a,u,!0),a.child}function _x(s){var a=s.stateNode;a.pendingContext?Mv(s,a.pendingContext,a.pendingContext!==a.context):a.context&&Mv(s,a.context,!1),Rp(s,a.containerInfo)}function Ax(s,a,u,y,C){return Os(),Sp(C),a.flags|=256,jt(s,a,u,y),a.child}var Gp={dehydrated:null,treeContext:null,retryLane:0};function Yp(s){return{baseLanes:s,cachePool:null,transitions:null}}function Mx(s,a,u){var y=a.pendingProps,C=lt.current,T=!1,D=(a.flags&128)!==0,Y;if((Y=D)||(Y=s!==null&&s.memoizedState===null?!1:(C&2)!==0),Y?(T=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(C|=1),Je(lt,C&1),s===null)return bp(a),s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((a.mode&1)===0?a.lanes=1:s.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(D=y.children,s=y.fallback,T?(y=a.mode,T=a.child,D={mode:"hidden",children:D},(y&1)===0&&T!==null?(T.childLanes=0,T.pendingProps=D):T=Qc(D,y,0,null),s=Vo(s,y,u,null),T.return=a,s.return=a,T.sibling=s,a.child=T,a.child.memoizedState=Yp(u),a.memoizedState=Gp,s):Xp(a,D));if(C=s.memoizedState,C!==null&&(Y=C.dehydrated,Y!==null))return dI(s,a,D,y,Y,C,u);if(T){T=y.fallback,D=a.mode,C=s.child,Y=C.sibling;var J={mode:"hidden",children:y.children};return(D&1)===0&&a.child!==C?(y=a.child,y.childLanes=0,y.pendingProps=J,a.deletions=null):(y=Zr(C,J),y.subtreeFlags=C.subtreeFlags&14680064),Y!==null?T=Zr(Y,T):(T=Vo(T,D,u,null),T.flags|=2),T.return=a,y.return=a,y.sibling=T,a.child=y,y=T,T=a.child,D=s.child.memoizedState,D=D===null?Yp(u):{baseLanes:D.baseLanes|u,cachePool:null,transitions:D.transitions},T.memoizedState=D,T.childLanes=s.childLanes&~u,a.memoizedState=Gp,y}return T=s.child,s=T.sibling,y=Zr(T,{mode:"visible",children:y.children}),(a.mode&1)===0&&(y.lanes=u),y.return=a,y.sibling=null,s!==null&&(u=a.deletions,u===null?(a.deletions=[s],a.flags|=16):u.push(s)),a.child=y,a.memoizedState=null,y}function Xp(s,a){return a=Qc({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function Fc(s,a,u,y){return y!==null&&Sp(y),$s(a,s.child,null,u),s=Xp(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function dI(s,a,u,y,C,T,D){if(u)return a.flags&256?(a.flags&=-257,y=Bp(Error(n(422))),Fc(s,a,D,y)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(T=y.fallback,C=a.mode,y=Qc({mode:"visible",children:y.children},C,0,null),T=Vo(T,C,D,null),T.flags|=2,y.return=a,T.return=a,y.sibling=T,a.child=y,(a.mode&1)!==0&&$s(a,s.child,null,D),a.child.memoizedState=Yp(D),a.memoizedState=Gp,T);if((a.mode&1)===0)return Fc(s,a,D,null);if(C.data==="$!"){if(y=C.nextSibling&&C.nextSibling.dataset,y)var Y=y.dgst;return y=Y,T=Error(n(419)),y=Bp(T,y,void 0),Fc(s,a,D,y)}if(Y=(D&s.childLanes)!==0,Bt||Y){if(y=St,y!==null){switch(D&-D){case 4:C=2;break;case 16:C=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:C=32;break;case 536870912:C=268435456;break;default:C=0}C=(C&(y.suspendedLanes|D))!==0?0:C,C!==0&&C!==T.retryLane&&(T.retryLane=C,cr(s,C),kn(y,s,C,-1))}return dh(),y=Bp(Error(n(421))),Fc(s,a,D,y)}return C.data==="$?"?(a.flags|=128,a.child=s.child,a=EI.bind(null,s),C._reactRetry=a,null):(s=T.treeContext,en=zr(C.nextSibling),Jt=a,st=!0,Sn=null,s!==null&&(fn[pn++]=ar,fn[pn++]=lr,fn[pn++]=Ao,ar=s.id,lr=s.overflow,Ao=a),a=Xp(a,y.children),a.flags|=4096,a)}function Dx(s,a,u){s.lanes|=a;var y=s.alternate;y!==null&&(y.lanes|=a),kp(s.return,a,u)}function qp(s,a,u,y,C){var T=s.memoizedState;T===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:y,tail:u,tailMode:C}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=y,T.tail=u,T.tailMode=C)}function jx(s,a,u){var y=a.pendingProps,C=y.revealOrder,T=y.tail;if(jt(s,a,y.children,u),y=lt.current,(y&2)!==0)y=y&1|2,a.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Dx(s,u,a);else if(s.tag===19)Dx(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}y&=1}if(Je(lt,y),(a.mode&1)===0)a.memoizedState=null;else switch(C){case"forwards":for(u=a.child,C=null;u!==null;)s=u.alternate,s!==null&&Ac(s)===null&&(C=u),u=u.sibling;u=C,u===null?(C=a.child,a.child=null):(C=u.sibling,u.sibling=null),qp(a,!1,C,u,T);break;case"backwards":for(u=null,C=a.child,a.child=null;C!==null;){if(s=C.alternate,s!==null&&Ac(s)===null){a.child=C;break}s=C.sibling,C.sibling=u,u=C,C=s}qp(a,!0,u,null,T);break;case"together":qp(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function zc(s,a){(a.mode&1)===0&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function dr(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),$o|=a.lanes,(u&a.childLanes)===0)return null;if(s!==null&&a.child!==s.child)throw Error(n(153));if(a.child!==null){for(s=a.child,u=Zr(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Zr(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function fI(s,a,u){switch(a.tag){case 3:_x(a),Os();break;case 5:Xv(a);break;case 1:Ht(a.type)&&Sc(a);break;case 4:Rp(a,a.stateNode.containerInfo);break;case 10:var y=a.type._context,C=a.memoizedProps.value;Je(Pc,y._currentValue),y._currentValue=C;break;case 13:if(y=a.memoizedState,y!==null)return y.dehydrated!==null?(Je(lt,lt.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Mx(s,a,u):(Je(lt,lt.current&1),s=dr(s,a,u),s!==null?s.sibling:null);Je(lt,lt.current&1);break;case 19:if(y=(u&a.childLanes)!==0,(s.flags&128)!==0){if(y)return jx(s,a,u);a.flags|=128}if(C=a.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),Je(lt,lt.current),y)break;return null;case 22:case 23:return a.lanes=0,Px(s,a,u)}return dr(s,a,u)}var Ox,Zp,$x,Lx;Ox=function(s,a){for(var u=a.child;u!==null;){if(u.tag===5||u.tag===6)s.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Zp=function(){},$x=function(s,a,u,y){var C=s.memoizedProps;if(C!==y){s=a.stateNode,jo(Vn.current);var T=null;switch(u){case"input":C=Ee(s,C),y=Ee(s,y),T=[];break;case"select":C=Z({},C,{value:void 0}),y=Z({},y,{value:void 0}),T=[];break;case"textarea":C=yt(s,C),y=yt(s,y),T=[];break;default:typeof C.onClick!="function"&&typeof y.onClick=="function"&&(s.onclick=xc)}Vi(u,y);var D;u=null;for(ie in C)if(!y.hasOwnProperty(ie)&&C.hasOwnProperty(ie)&&C[ie]!=null)if(ie==="style"){var Y=C[ie];for(D in Y)Y.hasOwnProperty(D)&&(u||(u={}),u[D]="")}else ie!=="dangerouslySetInnerHTML"&&ie!=="children"&&ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&ie!=="autoFocus"&&(o.hasOwnProperty(ie)?T||(T=[]):(T=T||[]).push(ie,null));for(ie in y){var J=y[ie];if(Y=C?.[ie],y.hasOwnProperty(ie)&&J!==Y&&(J!=null||Y!=null))if(ie==="style")if(Y){for(D in Y)!Y.hasOwnProperty(D)||J&&J.hasOwnProperty(D)||(u||(u={}),u[D]="");for(D in J)J.hasOwnProperty(D)&&Y[D]!==J[D]&&(u||(u={}),u[D]=J[D])}else u||(T||(T=[]),T.push(ie,u)),u=J;else ie==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,Y=Y?Y.__html:void 0,J!=null&&Y!==J&&(T=T||[]).push(ie,J)):ie==="children"?typeof J!="string"&&typeof J!="number"||(T=T||[]).push(ie,""+J):ie!=="suppressContentEditableWarning"&&ie!=="suppressHydrationWarning"&&(o.hasOwnProperty(ie)?(J!=null&&ie==="onScroll"&&tt("scroll",s),T||Y===J||(T=[])):(T=T||[]).push(ie,J))}u&&(T=T||[]).push("style",u);var ie=T;(a.updateQueue=ie)&&(a.flags|=4)}},Lx=function(s,a,u,y){u!==y&&(a.flags|=4)};function Na(s,a){if(!st)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var y=null;u!==null;)u.alternate!==null&&(y=u),u=u.sibling;y===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:y.sibling=null}}function _t(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,y=0;if(a)for(var C=s.child;C!==null;)u|=C.lanes|C.childLanes,y|=C.subtreeFlags&14680064,y|=C.flags&14680064,C.return=s,C=C.sibling;else for(C=s.child;C!==null;)u|=C.lanes|C.childLanes,y|=C.subtreeFlags,y|=C.flags,C.return=s,C=C.sibling;return s.subtreeFlags|=y,s.childLanes=u,a}function pI(s,a,u){var y=a.pendingProps;switch(xp(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return Ht(a.type)&&bc(),_t(a),null;case 3:return y=a.stateNode,zs(),nt(Vt),nt(Rt),Ap(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(s===null||s.child===null)&&(kc(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Sn!==null&&(lh(Sn),Sn=null))),Zp(s,a),_t(a),null;case 5:Ip(a);var C=jo(wa.current);if(u=a.type,s!==null&&a.stateNode!=null)$x(s,a,u,y,C),s.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!y){if(a.stateNode===null)throw Error(n(166));return _t(a),null}if(s=jo(Vn.current),kc(a)){y=a.stateNode,u=a.type;var T=a.memoizedProps;switch(y[zn]=a,y[ga]=T,s=(a.mode&1)!==0,u){case"dialog":tt("cancel",y),tt("close",y);break;case"iframe":case"object":case"embed":tt("load",y);break;case"video":case"audio":for(C=0;C<fa.length;C++)tt(fa[C],y);break;case"source":tt("error",y);break;case"img":case"image":case"link":tt("error",y),tt("load",y);break;case"details":tt("toggle",y);break;case"input":Le(y,T),tt("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!T.multiple},tt("invalid",y);break;case"textarea":Dt(y,T),tt("invalid",y)}Vi(u,T),C=null;for(var D in T)if(T.hasOwnProperty(D)){var Y=T[D];D==="children"?typeof Y=="string"?y.textContent!==Y&&(T.suppressHydrationWarning!==!0&&vc(y.textContent,Y,s),C=["children",Y]):typeof Y=="number"&&y.textContent!==""+Y&&(T.suppressHydrationWarning!==!0&&vc(y.textContent,Y,s),C=["children",""+Y]):o.hasOwnProperty(D)&&Y!=null&&D==="onScroll"&&tt("scroll",y)}switch(u){case"input":ge(y),le(y,T,!0);break;case"textarea":ge(y),So(y);break;case"select":case"option":break;default:typeof T.onClick=="function"&&(y.onclick=xc)}y=C,a.updateQueue=y,y!==null&&(a.flags|=4)}else{D=C.nodeType===9?C:C.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=nr(u)),s==="http://www.w3.org/1999/xhtml"?u==="script"?(s=D.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof y.is=="string"?s=D.createElement(u,{is:y.is}):(s=D.createElement(u),u==="select"&&(D=s,y.multiple?D.multiple=!0:y.size&&(D.size=y.size))):s=D.createElementNS(s,u),s[zn]=a,s[ga]=y,Ox(s,a,!1,!1),a.stateNode=s;e:{switch(D=Hi(u,y),u){case"dialog":tt("cancel",s),tt("close",s),C=y;break;case"iframe":case"object":case"embed":tt("load",s),C=y;break;case"video":case"audio":for(C=0;C<fa.length;C++)tt(fa[C],s);C=y;break;case"source":tt("error",s),C=y;break;case"img":case"image":case"link":tt("error",s),tt("load",s),C=y;break;case"details":tt("toggle",s),C=y;break;case"input":Le(s,y),C=Ee(s,y),tt("invalid",s);break;case"option":C=y;break;case"select":s._wrapperState={wasMultiple:!!y.multiple},C=Z({},y,{value:void 0}),tt("invalid",s);break;case"textarea":Dt(s,y),C=yt(s,y),tt("invalid",s);break;default:C=y}Vi(u,C),Y=C;for(T in Y)if(Y.hasOwnProperty(T)){var J=Y[T];T==="style"?Bl(s,J):T==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&Vl(s,J)):T==="children"?typeof J=="string"?(u!=="textarea"||J!=="")&&or(s,J):typeof J=="number"&&or(s,""+J):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(o.hasOwnProperty(T)?J!=null&&T==="onScroll"&&tt("scroll",s):J!=null&&k(s,T,J,D))}switch(u){case"input":ge(s),le(s,y,!1);break;case"textarea":ge(s),So(s);break;case"option":y.value!=null&&s.setAttribute("value",""+q(y.value));break;case"select":s.multiple=!!y.multiple,T=y.value,T!=null?qe(s,!!y.multiple,T,!1):y.defaultValue!=null&&qe(s,!!y.multiple,y.defaultValue,!0);break;default:typeof C.onClick=="function"&&(s.onclick=xc)}switch(u){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}}y&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return _t(a),null;case 6:if(s&&a.stateNode!=null)Lx(s,a,s.memoizedProps,y);else{if(typeof y!="string"&&a.stateNode===null)throw Error(n(166));if(u=jo(wa.current),jo(Vn.current),kc(a)){if(y=a.stateNode,u=a.memoizedProps,y[zn]=a,(T=y.nodeValue!==u)&&(s=Jt,s!==null))switch(s.tag){case 3:vc(y.nodeValue,u,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&vc(y.nodeValue,u,(s.mode&1)!==0)}T&&(a.flags|=4)}else y=(u.nodeType===9?u:u.ownerDocument).createTextNode(y),y[zn]=a,a.stateNode=y}return _t(a),null;case 13:if(nt(lt),y=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(st&&en!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Vv(),Os(),a.flags|=98560,T=!1;else if(T=kc(a),y!==null&&y.dehydrated!==null){if(s===null){if(!T)throw Error(n(318));if(T=a.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(n(317));T[zn]=a}else Os(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),T=!1}else Sn!==null&&(lh(Sn),Sn=null),T=!0;if(!T)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=u,a):(y=y!==null,y!==(s!==null&&s.memoizedState!==null)&&y&&(a.child.flags|=8192,(a.mode&1)!==0&&(s===null||(lt.current&1)!==0?xt===0&&(xt=3):dh())),a.updateQueue!==null&&(a.flags|=4),_t(a),null);case 4:return zs(),Zp(s,a),s===null&&pa(a.stateNode.containerInfo),_t(a),null;case 10:return Np(a.type._context),_t(a),null;case 17:return Ht(a.type)&&bc(),_t(a),null;case 19:if(nt(lt),T=a.memoizedState,T===null)return _t(a),null;if(y=(a.flags&128)!==0,D=T.rendering,D===null)if(y)Na(T,!1);else{if(xt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(D=Ac(s),D!==null){for(a.flags|=128,Na(T,!1),y=D.updateQueue,y!==null&&(a.updateQueue=y,a.flags|=4),a.subtreeFlags=0,y=u,u=a.child;u!==null;)T=u,s=y,T.flags&=14680066,D=T.alternate,D===null?(T.childLanes=0,T.lanes=s,T.child=null,T.subtreeFlags=0,T.memoizedProps=null,T.memoizedState=null,T.updateQueue=null,T.dependencies=null,T.stateNode=null):(T.childLanes=D.childLanes,T.lanes=D.lanes,T.child=D.child,T.subtreeFlags=0,T.deletions=null,T.memoizedProps=D.memoizedProps,T.memoizedState=D.memoizedState,T.updateQueue=D.updateQueue,T.type=D.type,s=D.dependencies,T.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),u=u.sibling;return Je(lt,lt.current&1|2),a.child}s=s.sibling}T.tail!==null&&at()>Ws&&(a.flags|=128,y=!0,Na(T,!1),a.lanes=4194304)}else{if(!y)if(s=Ac(D),s!==null){if(a.flags|=128,y=!0,u=s.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),Na(T,!0),T.tail===null&&T.tailMode==="hidden"&&!D.alternate&&!st)return _t(a),null}else 2*at()-T.renderingStartTime>Ws&&u!==1073741824&&(a.flags|=128,y=!0,Na(T,!1),a.lanes=4194304);T.isBackwards?(D.sibling=a.child,a.child=D):(u=T.last,u!==null?u.sibling=D:a.child=D,T.last=D)}return T.tail!==null?(a=T.tail,T.rendering=a,T.tail=a.sibling,T.renderingStartTime=at(),a.sibling=null,u=lt.current,Je(lt,y?u&1|2:u&1),a):(_t(a),null);case 22:case 23:return uh(),y=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==y&&(a.flags|=8192),y&&(a.mode&1)!==0?(tn&1073741824)!==0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function hI(s,a){switch(xp(a),a.tag){case 1:return Ht(a.type)&&bc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return zs(),nt(Vt),nt(Rt),Ap(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 5:return Ip(a),null;case 13:if(nt(lt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Os()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return nt(lt),null;case 4:return zs(),null;case 10:return Np(a.type._context),null;case 22:case 23:return uh(),null;case 24:return null;default:return null}}var Vc=!1,At=!1,gI=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function Hs(s,a){var u=s.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(y){ut(s,a,y)}else u.current=null}function Qp(s,a,u){try{u()}catch(y){ut(s,a,y)}}var Fx=!1;function mI(s,a){if(up=ac,s=yv(),np(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var y=u.getSelection&&u.getSelection();if(y&&y.rangeCount!==0){u=y.anchorNode;var C=y.anchorOffset,T=y.focusNode;y=y.focusOffset;try{u.nodeType,T.nodeType}catch{u=null;break e}var D=0,Y=-1,J=-1,ie=0,fe=0,pe=s,de=null;t:for(;;){for(var we;pe!==u||C!==0&&pe.nodeType!==3||(Y=D+C),pe!==T||y!==0&&pe.nodeType!==3||(J=D+y),pe.nodeType===3&&(D+=pe.nodeValue.length),(we=pe.firstChild)!==null;)de=pe,pe=we;for(;;){if(pe===s)break t;if(de===u&&++ie===C&&(Y=D),de===T&&++fe===y&&(J=D),(we=pe.nextSibling)!==null)break;pe=de,de=pe.parentNode}pe=we}u=Y===-1||J===-1?null:{start:Y,end:J}}else u=null}u=u||{start:0,end:0}}else u=null;for(dp={focusedElem:s,selectionRange:u},ac=!1,Ne=a;Ne!==null;)if(a=Ne,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Ne=s;else for(;Ne!==null;){a=Ne;try{var Te=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Te!==null){var Pe=Te.memoizedProps,ft=Te.memoizedState,re=a.stateNode,te=re.getSnapshotBeforeUpdate(a.elementType===a.type?Pe:Cn(a.type,Pe),ft);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var se=a.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(he){ut(a,a.return,he)}if(s=a.sibling,s!==null){s.return=a.return,Ne=s;break}Ne=a.return}return Te=Fx,Fx=!1,Te}function ka(s,a,u){var y=a.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var C=y=y.next;do{if((C.tag&s)===s){var T=C.destroy;C.destroy=void 0,T!==void 0&&Qp(a,u,T)}C=C.next}while(C!==y)}}function Hc(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&s)===s){var y=u.create;u.destroy=y()}u=u.next}while(u!==a)}}function Jp(s){var a=s.ref;if(a!==null){var u=s.stateNode;s.tag,s=u,typeof a=="function"?a(s):a.current=s}}function zx(s){var a=s.alternate;a!==null&&(s.alternate=null,zx(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[zn],delete a[ga],delete a[gp],delete a[QR],delete a[JR])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Vx(s){return s.tag===5||s.tag===3||s.tag===4}function Hx(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Vx(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function eh(s,a,u){var y=s.tag;if(y===5||y===6)s=s.stateNode,a?u.nodeType===8?u.parentNode.insertBefore(s,a):u.insertBefore(s,a):(u.nodeType===8?(a=u.parentNode,a.insertBefore(s,u)):(a=u,a.appendChild(s)),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=xc));else if(y!==4&&(s=s.child,s!==null))for(eh(s,a,u),s=s.sibling;s!==null;)eh(s,a,u),s=s.sibling}function th(s,a,u){var y=s.tag;if(y===5||y===6)s=s.stateNode,a?u.insertBefore(s,a):u.appendChild(s);else if(y!==4&&(s=s.child,s!==null))for(th(s,a,u),s=s.sibling;s!==null;)th(s,a,u),s=s.sibling}var Et=null,En=!1;function Kr(s,a,u){for(u=u.child;u!==null;)Bx(s,a,u),u=u.sibling}function Bx(s,a,u){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(Po,u)}catch{}switch(u.tag){case 5:At||Hs(u,a);case 6:var y=Et,C=En;Et=null,Kr(s,a,u),Et=y,En=C,Et!==null&&(En?(s=Et,u=u.stateNode,s.nodeType===8?s.parentNode.removeChild(u):s.removeChild(u)):Et.removeChild(u.stateNode));break;case 18:Et!==null&&(En?(s=Et,u=u.stateNode,s.nodeType===8?hp(s.parentNode,u):s.nodeType===1&&hp(s,u),oa(s)):hp(Et,u.stateNode));break;case 4:y=Et,C=En,Et=u.stateNode.containerInfo,En=!0,Kr(s,a,u),Et=y,En=C;break;case 0:case 11:case 14:case 15:if(!At&&(y=u.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){C=y=y.next;do{var T=C,D=T.destroy;T=T.tag,D!==void 0&&((T&2)!==0||(T&4)!==0)&&Qp(u,a,D),C=C.next}while(C!==y)}Kr(s,a,u);break;case 1:if(!At&&(Hs(u,a),y=u.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=u.memoizedProps,y.state=u.memoizedState,y.componentWillUnmount()}catch(Y){ut(u,a,Y)}Kr(s,a,u);break;case 21:Kr(s,a,u);break;case 22:u.mode&1?(At=(y=At)||u.memoizedState!==null,Kr(s,a,u),At=y):Kr(s,a,u);break;default:Kr(s,a,u)}}function Wx(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var u=s.stateNode;u===null&&(u=s.stateNode=new gI),a.forEach(function(y){var C=NI.bind(null,s,y);u.has(y)||(u.add(y),y.then(C,C))})}}function Nn(s,a){var u=a.deletions;if(u!==null)for(var y=0;y<u.length;y++){var C=u[y];try{var T=s,D=a,Y=D;e:for(;Y!==null;){switch(Y.tag){case 5:Et=Y.stateNode,En=!1;break e;case 3:Et=Y.stateNode.containerInfo,En=!0;break e;case 4:Et=Y.stateNode.containerInfo,En=!0;break e}Y=Y.return}if(Et===null)throw Error(n(160));Bx(T,D,C),Et=null,En=!1;var J=C.alternate;J!==null&&(J.return=null),C.return=null}catch(ie){ut(C,a,ie)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Ux(a,s),a=a.sibling}function Ux(s,a){var u=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(Nn(a,s),Bn(s),y&4){try{ka(3,s,s.return),Hc(3,s)}catch(Pe){ut(s,s.return,Pe)}try{ka(5,s,s.return)}catch(Pe){ut(s,s.return,Pe)}}break;case 1:Nn(a,s),Bn(s),y&512&&u!==null&&Hs(u,u.return);break;case 5:if(Nn(a,s),Bn(s),y&512&&u!==null&&Hs(u,u.return),s.flags&32){var C=s.stateNode;try{or(C,"")}catch(Pe){ut(s,s.return,Pe)}}if(y&4&&(C=s.stateNode,C!=null)){var T=s.memoizedProps,D=u!==null?u.memoizedProps:T,Y=s.type,J=s.updateQueue;if(s.updateQueue=null,J!==null)try{Y==="input"&&T.type==="radio"&&T.name!=null&&Fe(C,T),Hi(Y,D);var ie=Hi(Y,T);for(D=0;D<J.length;D+=2){var fe=J[D],pe=J[D+1];fe==="style"?Bl(C,pe):fe==="dangerouslySetInnerHTML"?Vl(C,pe):fe==="children"?or(C,pe):k(C,fe,pe,ie)}switch(Y){case"input":Ke(C,T);break;case"textarea":Qe(C,T);break;case"select":var de=C._wrapperState.wasMultiple;C._wrapperState.wasMultiple=!!T.multiple;var we=T.value;we!=null?qe(C,!!T.multiple,we,!1):de!==!!T.multiple&&(T.defaultValue!=null?qe(C,!!T.multiple,T.defaultValue,!0):qe(C,!!T.multiple,T.multiple?[]:"",!1))}C[ga]=T}catch(Pe){ut(s,s.return,Pe)}}break;case 6:if(Nn(a,s),Bn(s),y&4){if(s.stateNode===null)throw Error(n(162));C=s.stateNode,T=s.memoizedProps;try{C.nodeValue=T}catch(Pe){ut(s,s.return,Pe)}}break;case 3:if(Nn(a,s),Bn(s),y&4&&u!==null&&u.memoizedState.isDehydrated)try{oa(a.containerInfo)}catch(Pe){ut(s,s.return,Pe)}break;case 4:Nn(a,s),Bn(s);break;case 13:Nn(a,s),Bn(s),C=s.child,C.flags&8192&&(T=C.memoizedState!==null,C.stateNode.isHidden=T,!T||C.alternate!==null&&C.alternate.memoizedState!==null||(oh=at())),y&4&&Wx(s);break;case 22:if(fe=u!==null&&u.memoizedState!==null,s.mode&1?(At=(ie=At)||fe,Nn(a,s),At=ie):Nn(a,s),Bn(s),y&8192){if(ie=s.memoizedState!==null,(s.stateNode.isHidden=ie)&&!fe&&(s.mode&1)!==0)for(Ne=s,fe=s.child;fe!==null;){for(pe=Ne=fe;Ne!==null;){switch(de=Ne,we=de.child,de.tag){case 0:case 11:case 14:case 15:ka(4,de,de.return);break;case 1:Hs(de,de.return);var Te=de.stateNode;if(typeof Te.componentWillUnmount=="function"){y=de,u=de.return;try{a=y,Te.props=a.memoizedProps,Te.state=a.memoizedState,Te.componentWillUnmount()}catch(Pe){ut(y,u,Pe)}}break;case 5:Hs(de,de.return);break;case 22:if(de.memoizedState!==null){Yx(pe);continue}}we!==null?(we.return=de,Ne=we):Yx(pe)}fe=fe.sibling}e:for(fe=null,pe=s;;){if(pe.tag===5){if(fe===null){fe=pe;try{C=pe.stateNode,ie?(T=C.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none"):(Y=pe.stateNode,J=pe.memoizedProps.style,D=J!=null&&J.hasOwnProperty("display")?J.display:null,Y.style.display=Hl("display",D))}catch(Pe){ut(s,s.return,Pe)}}}else if(pe.tag===6){if(fe===null)try{pe.stateNode.nodeValue=ie?"":pe.memoizedProps}catch(Pe){ut(s,s.return,Pe)}}else if((pe.tag!==22&&pe.tag!==23||pe.memoizedState===null||pe===s)&&pe.child!==null){pe.child.return=pe,pe=pe.child;continue}if(pe===s)break e;for(;pe.sibling===null;){if(pe.return===null||pe.return===s)break e;fe===pe&&(fe=null),pe=pe.return}fe===pe&&(fe=null),pe.sibling.return=pe.return,pe=pe.sibling}}break;case 19:Nn(a,s),Bn(s),y&4&&Wx(s);break;case 21:break;default:Nn(a,s),Bn(s)}}function Bn(s){var a=s.flags;if(a&2){try{e:{for(var u=s.return;u!==null;){if(Vx(u)){var y=u;break e}u=u.return}throw Error(n(160))}switch(y.tag){case 5:var C=y.stateNode;y.flags&32&&(or(C,""),y.flags&=-33);var T=Hx(s);th(s,T,C);break;case 3:case 4:var D=y.stateNode.containerInfo,Y=Hx(s);eh(s,Y,D);break;default:throw Error(n(161))}}catch(J){ut(s,s.return,J)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function yI(s,a,u){Ne=s,Kx(s)}function Kx(s,a,u){for(var y=(s.mode&1)!==0;Ne!==null;){var C=Ne,T=C.child;if(C.tag===22&&y){var D=C.memoizedState!==null||Vc;if(!D){var Y=C.alternate,J=Y!==null&&Y.memoizedState!==null||At;Y=Vc;var ie=At;if(Vc=D,(At=J)&&!ie)for(Ne=C;Ne!==null;)D=Ne,J=D.child,D.tag===22&&D.memoizedState!==null?Xx(C):J!==null?(J.return=D,Ne=J):Xx(C);for(;T!==null;)Ne=T,Kx(T),T=T.sibling;Ne=C,Vc=Y,At=ie}Gx(s)}else(C.subtreeFlags&8772)!==0&&T!==null?(T.return=C,Ne=T):Gx(s)}}function Gx(s){for(;Ne!==null;){var a=Ne;if((a.flags&8772)!==0){var u=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:At||Hc(5,a);break;case 1:var y=a.stateNode;if(a.flags&4&&!At)if(u===null)y.componentDidMount();else{var C=a.elementType===a.type?u.memoizedProps:Cn(a.type,u.memoizedProps);y.componentDidUpdate(C,u.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var T=a.updateQueue;T!==null&&Yv(a,T,y);break;case 3:var D=a.updateQueue;if(D!==null){if(u=null,a.child!==null)switch(a.child.tag){case 5:u=a.child.stateNode;break;case 1:u=a.child.stateNode}Yv(a,D,u)}break;case 5:var Y=a.stateNode;if(u===null&&a.flags&4){u=Y;var J=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":J.autoFocus&&u.focus();break;case"img":J.src&&(u.src=J.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ie=a.alternate;if(ie!==null){var fe=ie.memoizedState;if(fe!==null){var pe=fe.dehydrated;pe!==null&&oa(pe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}At||a.flags&512&&Jp(a)}catch(de){ut(a,a.return,de)}}if(a===s){Ne=null;break}if(u=a.sibling,u!==null){u.return=a.return,Ne=u;break}Ne=a.return}}function Yx(s){for(;Ne!==null;){var a=Ne;if(a===s){Ne=null;break}var u=a.sibling;if(u!==null){u.return=a.return,Ne=u;break}Ne=a.return}}function Xx(s){for(;Ne!==null;){var a=Ne;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Hc(4,a)}catch(J){ut(a,u,J)}break;case 1:var y=a.stateNode;if(typeof y.componentDidMount=="function"){var C=a.return;try{y.componentDidMount()}catch(J){ut(a,C,J)}}var T=a.return;try{Jp(a)}catch(J){ut(a,T,J)}break;case 5:var D=a.return;try{Jp(a)}catch(J){ut(a,D,J)}}}catch(J){ut(a,a.return,J)}if(a===s){Ne=null;break}var Y=a.sibling;if(Y!==null){Y.return=a.return,Ne=Y;break}Ne=a.return}}var vI=Math.ceil,Bc=P.ReactCurrentDispatcher,nh=P.ReactCurrentOwner,mn=P.ReactCurrentBatchConfig,Be=0,St=null,ht=null,Nt=0,tn=0,Bs=Vr(0),xt=0,Ta=null,$o=0,Wc=0,rh=0,Pa=null,Wt=null,oh=0,Ws=1/0,fr=null,Uc=!1,sh=null,Gr=null,Kc=!1,Yr=null,Gc=0,Ra=0,ih=null,Yc=-1,Xc=0;function Ot(){return(Be&6)!==0?at():Yc!==-1?Yc:Yc=at()}function Xr(s){return(s.mode&1)===0?1:(Be&2)!==0&&Nt!==0?Nt&-Nt:tI.transition!==null?(Xc===0&&(Xc=Cs()),Xc):(s=Ge,s!==0||(s=window.event,s=s===void 0?16:Zy(s.type)),s)}function kn(s,a,u,y){if(50<Ra)throw Ra=0,ih=null,Error(n(185));Ro(s,u,y),((Be&2)===0||s!==St)&&(s===St&&((Be&2)===0&&(Wc|=u),xt===4&&qr(s,Nt)),Ut(s,y),u===1&&Be===0&&(a.mode&1)===0&&(Ws=at()+500,Cc&&Br()))}function Ut(s,a){var u=s.callbackNode;Vf(s,a);var y=Ss(s,s===St?Nt:0);if(y===0)u!==null&&Jl(u),s.callbackNode=null,s.callbackPriority=0;else if(a=y&-y,s.callbackPriority!==a){if(u!=null&&Jl(u),a===1)s.tag===0?eI(Zx.bind(null,s)):Ov(Zx.bind(null,s)),qR(function(){(Be&6)===0&&Br()}),u=null;else{switch(By(y)){case 1:u=Zi;break;case 4:u=tc;break;case 16:u=xs;break;case 536870912:u=nc;break;default:u=xs}u=s0(u,qx.bind(null,s))}s.callbackPriority=a,s.callbackNode=u}}function qx(s,a){if(Yc=-1,Xc=0,(Be&6)!==0)throw Error(n(327));var u=s.callbackNode;if(Us()&&s.callbackNode!==u)return null;var y=Ss(s,s===St?Nt:0);if(y===0)return null;if((y&30)!==0||(y&s.expiredLanes)!==0||a)a=qc(s,y);else{a=y;var C=Be;Be|=2;var T=Jx();(St!==s||Nt!==a)&&(fr=null,Ws=at()+500,Fo(s,a));do try{bI();break}catch(Y){Qx(s,Y)}while(!0);Ep(),Bc.current=T,Be=C,ht!==null?a=0:(St=null,Nt=0,a=xt)}if(a!==0){if(a===2&&(C=Qi(s),C!==0&&(y=C,a=ah(s,C))),a===1)throw u=Ta,Fo(s,0),qr(s,y),Ut(s,at()),u;if(a===6)qr(s,y);else{if(C=s.current.alternate,(y&30)===0&&!xI(C)&&(a=qc(s,y),a===2&&(T=Qi(s),T!==0&&(y=T,a=ah(s,T))),a===1))throw u=Ta,Fo(s,0),qr(s,y),Ut(s,at()),u;switch(s.finishedWork=C,s.finishedLanes=y,a){case 0:case 1:throw Error(n(345));case 2:zo(s,Wt,fr);break;case 3:if(qr(s,y),(y&130023424)===y&&(a=oh+500-at(),10<a)){if(Ss(s,0)!==0)break;if(C=s.suspendedLanes,(C&y)!==y){Ot(),s.pingedLanes|=s.suspendedLanes&C;break}s.timeoutHandle=pp(zo.bind(null,s,Wt,fr),a);break}zo(s,Wt,fr);break;case 4:if(qr(s,y),(y&4194240)===y)break;for(a=s.eventTimes,C=-1;0<y;){var D=31-Zt(y);T=1<<D,D=a[D],D>C&&(C=D),y&=~T}if(y=C,y=at()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*vI(y/1960))-y,10<y){s.timeoutHandle=pp(zo.bind(null,s,Wt,fr),y);break}zo(s,Wt,fr);break;case 5:zo(s,Wt,fr);break;default:throw Error(n(329))}}}return Ut(s,at()),s.callbackNode===u?qx.bind(null,s):null}function ah(s,a){var u=Pa;return s.current.memoizedState.isDehydrated&&(Fo(s,a).flags|=256),s=qc(s,a),s!==2&&(a=Wt,Wt=u,a!==null&&lh(a)),s}function lh(s){Wt===null?Wt=s:Wt.push.apply(Wt,s)}function xI(s){for(var a=s;;){if(a.flags&16384){var u=a.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var y=0;y<u.length;y++){var C=u[y],T=C.getSnapshot;C=C.value;try{if(!bn(T(),C))return!1}catch{return!1}}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function qr(s,a){for(a&=~rh,a&=~Wc,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var u=31-Zt(a),y=1<<u;s[u]=-1,a&=~y}}function Zx(s){if((Be&6)!==0)throw Error(n(327));Us();var a=Ss(s,0);if((a&1)===0)return Ut(s,at()),null;var u=qc(s,a);if(s.tag!==0&&u===2){var y=Qi(s);y!==0&&(a=y,u=ah(s,y))}if(u===1)throw u=Ta,Fo(s,0),qr(s,a),Ut(s,at()),u;if(u===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,zo(s,Wt,fr),Ut(s,at()),null}function ch(s,a){var u=Be;Be|=1;try{return s(a)}finally{Be=u,Be===0&&(Ws=at()+500,Cc&&Br())}}function Lo(s){Yr!==null&&Yr.tag===0&&(Be&6)===0&&Us();var a=Be;Be|=1;var u=mn.transition,y=Ge;try{if(mn.transition=null,Ge=1,s)return s()}finally{Ge=y,mn.transition=u,Be=a,(Be&6)===0&&Br()}}function uh(){tn=Bs.current,nt(Bs)}function Fo(s,a){s.finishedWork=null,s.finishedLanes=0;var u=s.timeoutHandle;if(u!==-1&&(s.timeoutHandle=-1,XR(u)),ht!==null)for(u=ht.return;u!==null;){var y=u;switch(xp(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&bc();break;case 3:zs(),nt(Vt),nt(Rt),Ap();break;case 5:Ip(y);break;case 4:zs();break;case 13:nt(lt);break;case 19:nt(lt);break;case 10:Np(y.type._context);break;case 22:case 23:uh()}u=u.return}if(St=s,ht=s=Zr(s.current,null),Nt=tn=a,xt=0,Ta=null,rh=Wc=$o=0,Wt=Pa=null,Do!==null){for(a=0;a<Do.length;a++)if(u=Do[a],y=u.interleaved,y!==null){u.interleaved=null;var C=y.next,T=u.pending;if(T!==null){var D=T.next;T.next=C,y.next=D}u.pending=y}Do=null}return s}function Qx(s,a){do{var u=ht;try{if(Ep(),Mc.current=$c,Dc){for(var y=ct.memoizedState;y!==null;){var C=y.queue;C!==null&&(C.pending=null),y=y.next}Dc=!1}if(Oo=0,bt=vt=ct=null,ba=!1,Sa=0,nh.current=null,u===null||u.return===null){xt=1,Ta=a,ht=null;break}e:{var T=s,D=u.return,Y=u,J=a;if(a=Nt,Y.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var ie=J,fe=Y,pe=fe.tag;if((fe.mode&1)===0&&(pe===0||pe===11||pe===15)){var de=fe.alternate;de?(fe.updateQueue=de.updateQueue,fe.memoizedState=de.memoizedState,fe.lanes=de.lanes):(fe.updateQueue=null,fe.memoizedState=null)}var we=Cx(D);if(we!==null){we.flags&=-257,Ex(we,D,Y,T,a),we.mode&1&&Sx(T,ie,a),a=we,J=ie;var Te=a.updateQueue;if(Te===null){var Pe=new Set;Pe.add(J),a.updateQueue=Pe}else Te.add(J);break e}else{if((a&1)===0){Sx(T,ie,a),dh();break e}J=Error(n(426))}}else if(st&&Y.mode&1){var ft=Cx(D);if(ft!==null){(ft.flags&65536)===0&&(ft.flags|=256),Ex(ft,D,Y,T,a),Sp(Vs(J,Y));break e}}T=J=Vs(J,Y),xt!==4&&(xt=2),Pa===null?Pa=[T]:Pa.push(T),T=D;do{switch(T.tag){case 3:T.flags|=65536,a&=-a,T.lanes|=a;var re=wx(T,J,a);Gv(T,re);break e;case 1:Y=J;var te=T.type,se=T.stateNode;if((T.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Gr===null||!Gr.has(se)))){T.flags|=65536,a&=-a,T.lanes|=a;var he=bx(T,Y,a);Gv(T,he);break e}}T=T.return}while(T!==null)}t0(u)}catch(Re){a=Re,ht===u&&u!==null&&(ht=u=u.return);continue}break}while(!0)}function Jx(){var s=Bc.current;return Bc.current=$c,s===null?$c:s}function dh(){(xt===0||xt===3||xt===2)&&(xt=4),St===null||($o&268435455)===0&&(Wc&268435455)===0||qr(St,Nt)}function qc(s,a){var u=Be;Be|=2;var y=Jx();(St!==s||Nt!==a)&&(fr=null,Fo(s,a));do try{wI();break}catch(C){Qx(s,C)}while(!0);if(Ep(),Be=u,Bc.current=y,ht!==null)throw Error(n(261));return St=null,Nt=0,xt}function wI(){for(;ht!==null;)e0(ht)}function bI(){for(;ht!==null&&!Df();)e0(ht)}function e0(s){var a=o0(s.alternate,s,tn);s.memoizedProps=s.pendingProps,a===null?t0(s):ht=a,nh.current=null}function t0(s){var a=s;do{var u=a.alternate;if(s=a.return,(a.flags&32768)===0){if(u=pI(u,a,tn),u!==null){ht=u;return}}else{if(u=hI(u,a),u!==null){u.flags&=32767,ht=u;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{xt=6,ht=null;return}}if(a=a.sibling,a!==null){ht=a;return}ht=a=s}while(a!==null);xt===0&&(xt=5)}function zo(s,a,u){var y=Ge,C=mn.transition;try{mn.transition=null,Ge=1,SI(s,a,u,y)}finally{mn.transition=C,Ge=y}return null}function SI(s,a,u,y){do Us();while(Yr!==null);if((Be&6)!==0)throw Error(n(327));u=s.finishedWork;var C=s.finishedLanes;if(u===null)return null;if(s.finishedWork=null,s.finishedLanes=0,u===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var T=u.lanes|u.childLanes;if(oc(s,T),s===St&&(ht=St=null,Nt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Kc||(Kc=!0,s0(xs,function(){return Us(),null})),T=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||T){T=mn.transition,mn.transition=null;var D=Ge;Ge=1;var Y=Be;Be|=4,nh.current=null,mI(s,u),Ux(u,s),HR(dp),ac=!!up,dp=up=null,s.current=u,yI(u),ec(),Be=Y,Ge=D,mn.transition=T}else s.current=u;if(Kc&&(Kc=!1,Yr=s,Gc=C),T=s.pendingLanes,T===0&&(Gr=null),$f(u.stateNode),Ut(s,at()),a!==null)for(y=s.onRecoverableError,u=0;u<a.length;u++)C=a[u],y(C.value,{componentStack:C.stack,digest:C.digest});if(Uc)throw Uc=!1,s=sh,sh=null,s;return(Gc&1)!==0&&s.tag!==0&&Us(),T=s.pendingLanes,(T&1)!==0?s===ih?Ra++:(Ra=0,ih=s):Ra=0,Br(),null}function Us(){if(Yr!==null){var s=By(Gc),a=mn.transition,u=Ge;try{if(mn.transition=null,Ge=16>s?16:s,Yr===null)var y=!1;else{if(s=Yr,Yr=null,Gc=0,(Be&6)!==0)throw Error(n(331));var C=Be;for(Be|=4,Ne=s.current;Ne!==null;){var T=Ne,D=T.child;if((Ne.flags&16)!==0){var Y=T.deletions;if(Y!==null){for(var J=0;J<Y.length;J++){var ie=Y[J];for(Ne=ie;Ne!==null;){var fe=Ne;switch(fe.tag){case 0:case 11:case 15:ka(8,fe,T)}var pe=fe.child;if(pe!==null)pe.return=fe,Ne=pe;else for(;Ne!==null;){fe=Ne;var de=fe.sibling,we=fe.return;if(zx(fe),fe===ie){Ne=null;break}if(de!==null){de.return=we,Ne=de;break}Ne=we}}}var Te=T.alternate;if(Te!==null){var Pe=Te.child;if(Pe!==null){Te.child=null;do{var ft=Pe.sibling;Pe.sibling=null,Pe=ft}while(Pe!==null)}}Ne=T}}if((T.subtreeFlags&2064)!==0&&D!==null)D.return=T,Ne=D;else e:for(;Ne!==null;){if(T=Ne,(T.flags&2048)!==0)switch(T.tag){case 0:case 11:case 15:ka(9,T,T.return)}var re=T.sibling;if(re!==null){re.return=T.return,Ne=re;break e}Ne=T.return}}var te=s.current;for(Ne=te;Ne!==null;){D=Ne;var se=D.child;if((D.subtreeFlags&2064)!==0&&se!==null)se.return=D,Ne=se;else e:for(D=te;Ne!==null;){if(Y=Ne,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Hc(9,Y)}}catch(Re){ut(Y,Y.return,Re)}if(Y===D){Ne=null;break e}var he=Y.sibling;if(he!==null){he.return=Y.return,Ne=he;break e}Ne=Y.return}}if(Be=C,Br(),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(Po,s)}catch{}y=!0}return y}finally{Ge=u,mn.transition=a}}return!1}function n0(s,a,u){a=Vs(u,a),a=wx(s,a,1),s=Ur(s,a,1),a=Ot(),s!==null&&(Ro(s,1,a),Ut(s,a))}function ut(s,a,u){if(s.tag===3)n0(s,s,u);else for(;a!==null;){if(a.tag===3){n0(a,s,u);break}else if(a.tag===1){var y=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Gr===null||!Gr.has(y))){s=Vs(u,s),s=bx(a,s,1),a=Ur(a,s,1),s=Ot(),a!==null&&(Ro(a,1,s),Ut(a,s));break}}a=a.return}}function CI(s,a,u){var y=s.pingCache;y!==null&&y.delete(a),a=Ot(),s.pingedLanes|=s.suspendedLanes&u,St===s&&(Nt&u)===u&&(xt===4||xt===3&&(Nt&130023424)===Nt&&500>at()-oh?Fo(s,0):rh|=u),Ut(s,a)}function r0(s,a){a===0&&((s.mode&1)===0?a=1:(a=bs,bs<<=1,(bs&130023424)===0&&(bs=4194304)));var u=Ot();s=cr(s,a),s!==null&&(Ro(s,a,u),Ut(s,u))}function EI(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),r0(s,u)}function NI(s,a){var u=0;switch(s.tag){case 13:var y=s.stateNode,C=s.memoizedState;C!==null&&(u=C.retryLane);break;case 19:y=s.stateNode;break;default:throw Error(n(314))}y!==null&&y.delete(a),r0(s,u)}var o0;o0=function(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps||Vt.current)Bt=!0;else{if((s.lanes&u)===0&&(a.flags&128)===0)return Bt=!1,fI(s,a,u);Bt=(s.flags&131072)!==0}else Bt=!1,st&&(a.flags&1048576)!==0&&$v(a,Nc,a.index);switch(a.lanes=0,a.tag){case 2:var y=a.type;zc(s,a),s=a.pendingProps;var C=Ms(a,Rt.current);Fs(a,u),C=jp(null,a,y,s,C,u);var T=Op();return a.flags|=1,typeof C=="object"&&C!==null&&typeof C.render=="function"&&C.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Ht(y)?(T=!0,Sc(a)):T=!1,a.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,Pp(a),C.updater=Lc,a.stateNode=C,C._reactInternals=a,Hp(a,y,s,u),a=Kp(null,a,y,!0,T,u)):(a.tag=0,st&&T&&vp(a),jt(null,a,C,u),a=a.child),a;case 16:y=a.elementType;e:{switch(zc(s,a),s=a.pendingProps,C=y._init,y=C(y._payload),a.type=y,C=a.tag=TI(y),s=Cn(y,s),C){case 0:a=Up(null,a,y,s,u);break e;case 1:a=Ix(null,a,y,s,u);break e;case 11:a=Nx(null,a,y,s,u);break e;case 14:a=kx(null,a,y,Cn(y.type,s),u);break e}throw Error(n(306,y,""))}return a;case 0:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Cn(y,C),Up(s,a,y,C,u);case 1:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Cn(y,C),Ix(s,a,y,C,u);case 3:e:{if(_x(a),s===null)throw Error(n(387));y=a.pendingProps,T=a.memoizedState,C=T.element,Kv(s,a),_c(a,y,null,u);var D=a.memoizedState;if(y=D.element,T.isDehydrated)if(T={element:y,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},a.updateQueue.baseState=T,a.memoizedState=T,a.flags&256){C=Vs(Error(n(423)),a),a=Ax(s,a,y,u,C);break e}else if(y!==C){C=Vs(Error(n(424)),a),a=Ax(s,a,y,u,C);break e}else for(en=zr(a.stateNode.containerInfo.firstChild),Jt=a,st=!0,Sn=null,u=Wv(a,null,y,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Os(),y===C){a=dr(s,a,u);break e}jt(s,a,y,u)}a=a.child}return a;case 5:return Xv(a),s===null&&bp(a),y=a.type,C=a.pendingProps,T=s!==null?s.memoizedProps:null,D=C.children,fp(y,C)?D=null:T!==null&&fp(y,T)&&(a.flags|=32),Rx(s,a),jt(s,a,D,u),a.child;case 6:return s===null&&bp(a),null;case 13:return Mx(s,a,u);case 4:return Rp(a,a.stateNode.containerInfo),y=a.pendingProps,s===null?a.child=$s(a,null,y,u):jt(s,a,y,u),a.child;case 11:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Cn(y,C),Nx(s,a,y,C,u);case 7:return jt(s,a,a.pendingProps,u),a.child;case 8:return jt(s,a,a.pendingProps.children,u),a.child;case 12:return jt(s,a,a.pendingProps.children,u),a.child;case 10:e:{if(y=a.type._context,C=a.pendingProps,T=a.memoizedProps,D=C.value,Je(Pc,y._currentValue),y._currentValue=D,T!==null)if(bn(T.value,D)){if(T.children===C.children&&!Vt.current){a=dr(s,a,u);break e}}else for(T=a.child,T!==null&&(T.return=a);T!==null;){var Y=T.dependencies;if(Y!==null){D=T.child;for(var J=Y.firstContext;J!==null;){if(J.context===y){if(T.tag===1){J=ur(-1,u&-u),J.tag=2;var ie=T.updateQueue;if(ie!==null){ie=ie.shared;var fe=ie.pending;fe===null?J.next=J:(J.next=fe.next,fe.next=J),ie.pending=J}}T.lanes|=u,J=T.alternate,J!==null&&(J.lanes|=u),kp(T.return,u,a),Y.lanes|=u;break}J=J.next}}else if(T.tag===10)D=T.type===a.type?null:T.child;else if(T.tag===18){if(D=T.return,D===null)throw Error(n(341));D.lanes|=u,Y=D.alternate,Y!==null&&(Y.lanes|=u),kp(D,u,a),D=T.sibling}else D=T.child;if(D!==null)D.return=T;else for(D=T;D!==null;){if(D===a){D=null;break}if(T=D.sibling,T!==null){T.return=D.return,D=T;break}D=D.return}T=D}jt(s,a,C.children,u),a=a.child}return a;case 9:return C=a.type,y=a.pendingProps.children,Fs(a,u),C=hn(C),y=y(C),a.flags|=1,jt(s,a,y,u),a.child;case 14:return y=a.type,C=Cn(y,a.pendingProps),C=Cn(y.type,C),kx(s,a,y,C,u);case 15:return Tx(s,a,a.type,a.pendingProps,u);case 17:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Cn(y,C),zc(s,a),a.tag=1,Ht(y)?(s=!0,Sc(a)):s=!1,Fs(a,u),vx(a,y,C),Hp(a,y,C,u),Kp(null,a,y,!0,s,u);case 19:return jx(s,a,u);case 22:return Px(s,a,u)}throw Error(n(156,a.tag))};function s0(s,a){return Ql(s,a)}function kI(s,a,u,y){this.tag=s,this.key=u,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=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(s,a,u,y){return new kI(s,a,u,y)}function fh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function TI(s){if(typeof s=="function")return fh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===B)return 11;if(s===O)return 14}return 2}function Zr(s,a){var u=s.alternate;return u===null?(u=yn(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&14680064,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u}function Zc(s,a,u,y,C,T){var D=2;if(y=s,typeof s=="function")fh(s)&&(D=1);else if(typeof s=="string")D=5;else e:switch(s){case R:return Vo(u.children,C,T,a);case j:D=8,C|=8;break;case L:return s=yn(12,u,a,C|2),s.elementType=L,s.lanes=T,s;case G:return s=yn(13,u,a,C),s.elementType=G,s.lanes=T,s;case _:return s=yn(19,u,a,C),s.elementType=_,s.lanes=T,s;case z:return Qc(u,C,T,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case U:D=10;break e;case $:D=9;break e;case B:D=11;break e;case O:D=14;break e;case M:D=16,y=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return a=yn(D,u,a,C),a.elementType=s,a.type=y,a.lanes=T,a}function Vo(s,a,u,y){return s=yn(7,s,y,a),s.lanes=u,s}function Qc(s,a,u,y){return s=yn(22,s,y,a),s.elementType=z,s.lanes=u,s.stateNode={isHidden:!1},s}function ph(s,a,u){return s=yn(6,s,null,a),s.lanes=u,s}function hh(s,a,u){return a=yn(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function PI(s,a,u,y,C){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ji(0),this.expirationTimes=Ji(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ji(0),this.identifierPrefix=y,this.onRecoverableError=C,this.mutableSourceEagerHydrationData=null}function gh(s,a,u,y,C,T,D,Y,J){return s=new PI(s,a,u,Y,J),a===1?(a=1,T===!0&&(a|=8)):a=0,T=yn(3,null,null,a),s.current=T,T.stateNode=s,T.memoizedState={element:y,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pp(T),s}function RI(s,a,u){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:y==null?null:""+y,children:s,containerInfo:a,implementation:u}}function i0(s){if(!s)return Hr;s=s._reactInternals;e:{if(Fn(s)!==s||s.tag!==1)throw Error(n(170));var a=s;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Ht(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(s.tag===1){var u=s.type;if(Ht(u))return Dv(s,u,a)}return a}function a0(s,a,u,y,C,T,D,Y,J){return s=gh(u,y,!0,s,C,T,D,Y,J),s.context=i0(null),u=s.current,y=Ot(),C=Xr(u),T=ur(y,C),T.callback=a??null,Ur(u,T,C),s.current.lanes=C,Ro(s,C,y),Ut(s,y),s}function Jc(s,a,u,y){var C=a.current,T=Ot(),D=Xr(C);return u=i0(u),a.context===null?a.context=u:a.pendingContext=u,a=ur(T,D),a.payload={element:s},y=y===void 0?null:y,y!==null&&(a.callback=y),s=Ur(C,a,D),s!==null&&(kn(s,C,D,T),Ic(s,C,D)),D}function eu(s){return s=s.current,s.child?(s.child.tag===5,s.child.stateNode):null}function l0(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function mh(s,a){l0(s,a),(s=s.alternate)&&l0(s,a)}function II(){return null}var c0=typeof reportError=="function"?reportError:function(s){console.error(s)};function yh(s){this._internalRoot=s}tu.prototype.render=yh.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(n(409));Jc(s,a,null,null)},tu.prototype.unmount=yh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Lo(function(){Jc(null,s,null,null)}),a[sr]=null}};function tu(s){this._internalRoot=s}tu.prototype.unstable_scheduleHydration=function(s){if(s){var a=Ky();s={blockedOn:null,target:s,priority:a};for(var u=0;u<$r.length&&a!==0&&a<$r[u].priority;u++);$r.splice(u,0,s),u===0&&Xy(s)}};function vh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function nu(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function u0(){}function _I(s,a,u,y,C){if(C){if(typeof y=="function"){var T=y;y=function(){var ie=eu(D);T.call(ie)}}var D=a0(a,y,s,0,null,!1,!1,"",u0);return s._reactRootContainer=D,s[sr]=D.current,pa(s.nodeType===8?s.parentNode:s),Lo(),D}for(;C=s.lastChild;)s.removeChild(C);if(typeof y=="function"){var Y=y;y=function(){var ie=eu(J);Y.call(ie)}}var J=gh(s,0,!1,null,null,!1,!1,"",u0);return s._reactRootContainer=J,s[sr]=J.current,pa(s.nodeType===8?s.parentNode:s),Lo(function(){Jc(a,J,u,y)}),J}function ru(s,a,u,y,C){var T=u._reactRootContainer;if(T){var D=T;if(typeof C=="function"){var Y=C;C=function(){var J=eu(D);Y.call(J)}}Jc(a,D,s,C)}else D=_I(u,a,s,C,y);return eu(D)}Wy=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var u=Mr(a.pendingLanes);u!==0&&(Hf(a,u|1),Ut(a,at()),(Be&6)===0&&(Ws=at()+500,Br()))}break;case 13:Lo(function(){var y=cr(s,1);if(y!==null){var C=Ot();kn(y,s,1,C)}}),mh(s,1)}},Bf=function(s){if(s.tag===13){var a=cr(s,134217728);if(a!==null){var u=Ot();kn(a,s,134217728,u)}mh(s,134217728)}},Uy=function(s){if(s.tag===13){var a=Xr(s),u=cr(s,a);if(u!==null){var y=Ot();kn(u,s,a,y)}mh(s,a)}},Ky=function(){return Ge},Gy=function(s,a){var u=Ge;try{return Ge=s,a()}finally{Ge=u}},Ui=function(s,a,u){switch(a){case"input":if(Ke(s,u),a=u.name,u.type==="radio"&&a!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<u.length;a++){var y=u[a];if(y!==s&&y.form===s.form){var C=wc(y);if(!C)throw Error(n(90));ye(y),Ke(y,C)}}}break;case"textarea":Qe(s,u);break;case"select":a=u.value,a!=null&&qe(s,!!u.multiple,a,!1)}},Gl=ch,Yl=Lo;var AI={usingClientEntryPoint:!1,Events:[ma,_s,wc,Ul,Kl,ch]},Ia={findFiberByHostInstance:Io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},MI={bundleType:Ia.bundleType,version:Ia.version,rendererPackageName:Ia.rendererPackageName,rendererConfig:Ia.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=ql(s),s===null?null:s.stateNode},findFiberByHostInstance:Ia.findFiberByHostInstance||II,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Po=ou.inject(MI),dn=ou}catch{}}return Kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AI,Kt.createPortal=function(s,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vh(a))throw Error(n(200));return RI(s,a,null,u)},Kt.createRoot=function(s,a){if(!vh(s))throw Error(n(299));var u=!1,y="",C=c0;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(y=a.identifierPrefix),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=gh(s,1,!1,null,null,u,!1,y,C),s[sr]=a.current,pa(s.nodeType===8?s.parentNode:s),new yh(a)},Kt.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=ql(a),s=s===null?null:s.stateNode,s},Kt.flushSync=function(s){return Lo(s)},Kt.hydrate=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!0,u)},Kt.hydrateRoot=function(s,a,u){if(!vh(s))throw Error(n(405));var y=u!=null&&u.hydratedSources||null,C=!1,T="",D=c0;if(u!=null&&(u.unstable_strictMode===!0&&(C=!0),u.identifierPrefix!==void 0&&(T=u.identifierPrefix),u.onRecoverableError!==void 0&&(D=u.onRecoverableError)),a=a0(a,null,s,1,u??null,C,!1,T,D),s[sr]=a.current,pa(s),y)for(s=0;s<y.length;s++)u=y[s],C=u._getVersion,C=C(u._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[u,C]:a.mutableSourceEagerHydrationData.push(u,C);return new tu(a)},Kt.render=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!1,u)},Kt.unmountComponentAtNode=function(s){if(!nu(s))throw Error(n(40));return s._reactRootContainer?(Lo(function(){ru(null,null,s,!1,function(){s._reactRootContainer=null,s[sr]=null})}),!0):!1},Kt.unstable_batchedUpdates=ch,Kt.unstable_renderSubtreeIntoContainer=function(s,a,u,y){if(!nu(u))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return ru(s,a,u,!1,y)},Kt.version="18.3.1-next-f1338f8080-20240426",Kt}var v0;function r1(){if(v0)return bh.exports;v0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bh.exports=VI(),bh.exports}var x0;function HI(){if(x0)return su;x0=1;var e=r1();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var BI=HI(),Eh={};const Me=e=>typeof e=="string",Aa=()=>{let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},w0=e=>e==null?"":""+e,WI=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},UI=/###/g,b0=e=>e&&e.indexOf("###")>-1?e.replace(UI,"."):e,S0=e=>!e||Me(e),Ga=(e,t,n)=>{const r=Me(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(S0(e))return{};const i=b0(r[o]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++o}return S0(e)?{}:{obj:e,k:b0(r[o])}},C0=(e,t,n)=>{const{obj:r,k:o}=Ga(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let i=t[t.length-1],l=t.slice(0,t.length-1),c=Ga(e,l,Object);for(;c.obj===void 0&&l.length;)i=`${l[l.length-1]}.${i}`,l=l.slice(0,l.length-1),c=Ga(e,l,Object),c?.obj&&typeof c.obj[`${c.k}.${i}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${i}`]=n},KI=(e,t,n,r)=>{const{obj:o,k:i}=Ga(e,t,Object);o[i]=o[i]||[],o[i].push(n)},Vu=(e,t)=>{const{obj:n,k:r}=Ga(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},GI=(e,t,n)=>{const r=Vu(e,n);return r!==void 0?r:Vu(t,n)},o1=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?Me(e[r])||e[r]instanceof String||Me(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):o1(e[r],t[r],n):e[r]=t[r]);return e},Ho=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var YI={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const XI=e=>Me(e)?e.replace(/[&<>"'\/]/g,t=>YI[t]):e;class qI{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const ZI=[" ",",","?","!",";"],QI=new qI(20),JI=(e,t,n)=>{t=t||"",n=n||"";const r=ZI.filter(l=>t.indexOf(l)<0&&n.indexOf(l)<0);if(r.length===0)return!0;const o=QI.getRegExp(`(${r.map(l=>l==="?"?"\\?":l).join("|")})`);let i=!o.test(e);if(!i){const l=e.indexOf(n);l>0&&!o.test(e.substring(0,l))&&(i=!0)}return i},gg=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let o=e;for(let i=0;i<r.length;){if(!o||typeof o!="object")return;let l,c="";for(let d=i;d<r.length;++d)if(d!==i&&(c+=n),c+=r[d],l=o[c],l!==void 0){if(["string","number","boolean"].indexOf(typeof l)>-1&&d<r.length-1)continue;i+=d-i+1;break}o=l}return o},Ja=e=>e?.replace(/_/g,"-"),e_={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Hu{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||e_,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,o){return o&&!this.debug?null:(Me(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Hu(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Hu(this.logger,t)}}var Kn=new Hu;class bd{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,i])=>{for(let l=0;l<i;l++)o(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,i])=>{for(let l=0;l<i;l++)o.apply(o,[t,...n])})}}class E0 extends bd{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,o={}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,l=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;t.indexOf(".")>-1?c=t.split("."):(c=[t,n],r&&(Array.isArray(r)?c.push(...r):Me(r)&&i?c.push(...r.split(i)):c.push(r)));const d=Vu(this.data,c);return!d&&!n&&!r&&t.indexOf(".")>-1&&(t=c[0],n=c[1],r=c.slice(2).join(".")),d||!l||!Me(r)?d:gg(this.data?.[t]?.[n],r,i)}addResource(t,n,r,o,i={silent:!1}){const l=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let c=[t,n];r&&(c=c.concat(l?r.split(l):r)),t.indexOf(".")>-1&&(c=t.split("."),o=n,n=c[1]),this.addNamespaces(n),C0(this.data,c,o),i.silent||this.emit("added",t,n,r,o)}addResources(t,n,r,o={silent:!1}){for(const i in r)(Me(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,i,l={silent:!1,skipCopy:!1}){let c=[t,n];t.indexOf(".")>-1&&(c=t.split("."),o=r,r=n,n=c[1]),this.addNamespaces(n);let d=Vu(this.data,c)||{};l.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?o1(d,r,i):d={...d,...r},C0(this.data,c,d),l.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var s1={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(i=>{t=this.processors[i]?.process(t,n,r,o)??t}),t}};const i1=Symbol("i18next/PATH_KEY");function t_(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>(n?.revoke?.(),o===i1?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function si(e,t){const{[i1]:n}=e(t_()),r=t?.keySeparator??".",o=t?.nsSeparator??":";if(n.length>1&&o){const i=t?.ns,l=Array.isArray(i)?i:null;if(l&&l.length>1&&l.slice(1).includes(n[0]))return`${n[0]}${o}${n.slice(1).join(r)}`}return n.join(r)}const N0={},Nh=e=>!Me(e)&&typeof e!="boolean"&&typeof e!="number";class Bu extends bd{constructor(t,n={}){super(),WI(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Kn.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const o=this.resolve(t,r);if(o?.res===void 0)return!1;const i=Nh(o.res);return!(r.returnObjects===!1&&i)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const l=r&&t.indexOf(r)>-1,c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!JI(t,r,o);if(l&&!c){const d=t.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:t,namespaces:Me(i)?[i]:i};const f=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(f[0])>-1)&&(i=f.shift()),t=f.join(o)}return{key:t,namespaces:Me(i)?[i]:i}}translate(t,n,r){let o=typeof n=="object"?{...n}:n;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),t==null)return"";typeof t=="function"&&(t=si(t,{...this.options,...o})),Array.isArray(t)||(t=[String(t)]),t=t.map(G=>typeof G=="function"?si(G,{...this.options,...o}):String(G));const i=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,l=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:c,namespaces:d}=this.extractFromKey(t[t.length-1],o),f=d[d.length-1];let g=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;g===void 0&&(g=":");const h=o.lng||this.language,v=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return v?i?{res:`${f}${g}${c}`,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(o)}:`${f}${g}${c}`:i?{res:c,usedKey:c,exactUsedKey:c,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(o)}:c;const x=this.resolve(t,o);let S=x?.res;const w=x?.usedKey||c,E=x?.exactUsedKey||c,b=["[object Number]","[object Function]","[object RegExp]"],N=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,P=o.count!==void 0&&!Me(o.count),A=Bu.hasDefaultValue(o),I=P?this.pluralResolver.getSuffix(h,o.count,o):"",R=o.ordinal&&P?this.pluralResolver.getSuffix(h,o.count,{ordinal:!1}):"",j=P&&!o.ordinal&&o.count===0,L=j&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${I}`]||o[`defaultValue${R}`]||o.defaultValue;let U=S;k&&!S&&A&&(U=L);const $=Nh(U),B=Object.prototype.toString.apply(U);if(k&&U&&$&&b.indexOf(B)<0&&!(Me(N)&&Array.isArray(U))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,U,{...o,ns:d}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(x.res=G,x.usedParams=this.getUsedParamsDetails(o),x):G}if(l){const G=Array.isArray(U),_=G?[]:{},O=G?E:w;for(const M in U)if(Object.prototype.hasOwnProperty.call(U,M)){const z=`${O}${l}${M}`;A&&!S?_[M]=this.translate(z,{...o,defaultValue:Nh(L)?L[M]:void 0,joinArrays:!1,ns:d}):_[M]=this.translate(z,{...o,joinArrays:!1,ns:d}),_[M]===z&&(_[M]=U[M])}S=_}}else if(k&&Me(N)&&Array.isArray(S))S=S.join(N),S&&(S=this.extendTranslation(S,t,o,r));else{let G=!1,_=!1;!this.isValidLookup(S)&&A&&(G=!0,S=L),this.isValidLookup(S)||(_=!0,S=c);const M=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&_?void 0:S,z=A&&L!==S&&this.options.updateMissing;if(_||G||z){if(this.logger.log(z?"updateKey":"missingKey",h,f,c,z?L:S),l){const F=this.resolve(c,{...o,keySeparator:!1});F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let H=[];const W=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&W&&W[0])for(let F=0;F<W.length;F++)H.push(W[F]);else this.options.saveMissingTo==="all"?H=this.languageUtils.toResolveHierarchy(o.lng||this.language):H.push(o.lng||this.language);const Z=(F,V,X)=>{const Q=A&&X!==S?X:M;this.options.missingKeyHandler?this.options.missingKeyHandler(F,f,V,Q,z,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(F,f,V,Q,z,o),this.emit("missingKey",F,f,V,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?H.forEach(F=>{const V=this.pluralResolver.getSuffixes(F,o);j&&o[`defaultValue${this.options.pluralSeparator}zero`]&&V.indexOf(`${this.options.pluralSeparator}zero`)<0&&V.push(`${this.options.pluralSeparator}zero`),V.forEach(X=>{Z([F],c+X,o[`defaultValue${X}`]||L)})}):Z(H,c,L))}S=this.extendTranslation(S,t,o,x,r),_&&S===c&&this.options.appendNamespaceToMissingKey&&(S=`${f}${g}${c}`),(_||G)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${g}${c}`:c,G?S:void 0,o))}return i?(x.res=S,x.usedParams=this.getUsedParamsDetails(o),x):S}extendTranslation(t,n,r,o,i){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=Me(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(d){const h=t.match(this.interpolator.nestingRegexp);f=h&&h.length}let g=r.replace&&!Me(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),t=this.interpolator.interpolate(t,g,r.lng||this.language||o.usedLng,r),d){const h=t.match(this.interpolator.nestingRegexp),v=h&&h.length;f<v&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...h)=>i?.[0]===h[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=Me(l)?[l]:l;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=s1.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,o,i,l,c;return Me(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(d=>typeof d=="function"?si(d,{...this.options,...n}):d)),t.forEach(d=>{if(this.isValidLookup(r))return;const f=this.extractFromKey(d,n),g=f.key;o=g;let h=f.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const v=n.count!==void 0&&!Me(n.count),x=v&&!n.ordinal&&n.count===0,S=n.context!==void 0&&(Me(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(E=>{this.isValidLookup(r)||(c=E,!N0[`${w[0]}-${E}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(N0[`${w[0]}-${E}`]=!0,this.logger.warn(`key "${o}" for languages "${w.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(b=>{if(this.isValidLookup(r))return;l=b;const N=[g];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(N,g,b,E,n);else{let P;v&&(P=this.pluralResolver.getSuffix(b,n.count,n));const A=`${this.options.pluralSeparator}zero`,I=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(n.ordinal&&P.indexOf(I)===0&&N.push(g+P.replace(I,this.options.pluralSeparator)),N.push(g+P),x&&N.push(g+A)),S){const R=`${g}${this.options.contextSeparator||"_"}${n.context}`;N.push(R),v&&(n.ordinal&&P.indexOf(I)===0&&N.push(R+P.replace(I,this.options.pluralSeparator)),N.push(R+P),x&&N.push(R+A))}}let k;for(;k=N.pop();)this.isValidLookup(r)||(i=k,r=this.getResource(b,E,k,n))}))})}),{res:r,usedKey:o,exactUsedKey:i,usedLng:l,usedNS:c}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!Me(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const i of n)delete o[i]}return o}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class k0{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Kn.create("languageUtils")}getScriptPartFromCode(t){if(t=Ja(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Ja(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(Me(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return n=o;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(l=>{if(l===i)return l;if(!(l.indexOf("-")<0&&i.indexOf("-")<0)&&(l.indexOf("-")>0&&i.indexOf("-")<0&&l.substring(0,l.indexOf("-"))===i||l.indexOf(i)===0&&i.length>1))return l})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),Me(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),o=[],i=l=>{l&&(this.isSupportedCode(l)?o.push(l):this.logger.warn(`rejecting language code not found in supportedLngs: ${l}`))};return Me(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):Me(t)&&i(this.formatLanguageCode(t)),r.forEach(l=>{o.indexOf(l)<0&&i(this.formatLanguageCode(l))}),o}}const T0={zero:0,one:1,two:2,few:3,many:4,other:5},P0={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class n_{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Kn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=Ja(t==="dev"?"en":t),o=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:o});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let l;try{l=new Intl.PluralRules(r,{type:o})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),P0;if(!t.match(/-|_/))return P0;const d=this.languageUtils.getLanguagePartFromCode(t);l=this.getRule(d,n)}return this.pluralRulesCache[i]=l,l}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(o=>`${n}${o}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((o,i)=>T0[o]-T0[i]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,n,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const R0=(e,t,n,r=".",o=!0)=>{let i=GI(e,t,n);return!i&&o&&Me(n)&&(i=gg(e,n,r),i===void 0&&(i=gg(t,n,r))),i},kh=e=>e.replace(/\$/g,"$$$$");class I0{constructor(t={}){this.logger=Kn.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(n=>n),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:o,prefix:i,prefixEscaped:l,suffix:c,suffixEscaped:d,formatSeparator:f,unescapeSuffix:g,unescapePrefix:h,nestingPrefix:v,nestingPrefixEscaped:x,nestingSuffix:S,nestingSuffixEscaped:w,nestingOptionsSeparator:E,maxReplaces:b,alwaysFormat:N}=t.interpolation;this.escape=n!==void 0?n:XI,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=i?Ho(i):l||"{{",this.suffix=c?Ho(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=g?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":g||"",this.nestingPrefix=v?Ho(v):x||Ho("$t("),this.nestingSuffix=S?Ho(S):w||Ho(")"),this.nestingOptionsSeparator=E||",",this.maxReplaces=b||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,o){let i,l,c;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=x=>{if(x.indexOf(this.formatSeparator)<0){const b=R0(n,d,x,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...o,...n,interpolationkey:x}):b}const S=x.split(this.formatSeparator),w=S.shift().trim(),E=S.join(this.formatSeparator).trim();return this.format(R0(n,d,w,this.options.keySeparator,this.options.ignoreJSONStructure),E,r,{...o,...n,interpolationkey:w})};this.resetRegExp();const g=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:x=>kh(x)},{regex:this.regexp,safeValue:x=>this.escapeValue?kh(this.escape(x)):kh(x)}].forEach(x=>{for(c=0;i=x.regex.exec(t);){const S=i[1].trim();if(l=f(S),l===void 0)if(typeof g=="function"){const E=g(t,i,o);l=Me(E)?E:""}else if(o&&Object.prototype.hasOwnProperty.call(o,S))l="";else if(h){l=i[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${t}`),l="";else!Me(l)&&!this.useRawValueToEscape&&(l=w0(l));const w=x.safeValue(l);if(t=t.replace(i[0],w),h?(x.regex.lastIndex+=l.length,x.regex.lastIndex-=i[0].length):x.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),t}nest(t,n,r={}){let o,i,l;const c=(d,f)=>{const g=this.nestingOptionsSeparator;if(d.indexOf(g)<0)return d;const h=d.split(new RegExp(`${Ho(g)}[ ]*{`));let v=`{${h[1]}`;d=h[0],v=this.interpolate(v,l);const x=v.match(/'/g),S=v.match(/"/g);((x?.length??0)%2===0&&!S||(S?.length??0)%2!==0)&&(v=v.replace(/'/g,'"'));try{l=JSON.parse(v),f&&(l={...f,...l})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,w),`${d}${g}${v}`}return l.defaultValue&&l.defaultValue.indexOf(this.prefix)>-1&&delete l.defaultValue,d};for(;o=this.nestingRegexp.exec(t);){let d=[];l={...r},l=l.replace&&!Me(l.replace)?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;const f=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(f!==-1&&(d=o[1].slice(f).split(this.formatSeparator).map(g=>g.trim()).filter(Boolean),o[1]=o[1].slice(0,f)),i=n(c.call(this,o[1].trim(),l),l),i&&o[0]===t&&!Me(i))return i;Me(i)||(i=w0(i)),i||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),i=""),d.length&&(i=d.reduce((g,h)=>this.format(g,h,r.lng,{...r,interpolationkey:o[1].trim()}),i.trim())),t=t.replace(o[0],i),this.regexp.lastIndex=0}return t}}const r_=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(l=>{if(l){const[c,...d]=l.split(":"),f=d.join(":").trim().replace(/^'+|'+$/g,""),g=c.trim();n[g]||(n[g]=f),f==="false"&&(n[g]=!1),f==="true"&&(n[g]=!0),isNaN(f)||(n[g]=parseInt(f,10))}})}return{formatName:t,formatOptions:n}},_0=e=>{const t={};return(n,r,o)=>{let i=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(i={...i,[o.interpolationkey]:void 0});const l=r+JSON.stringify(i);let c=t[l];return c||(c=e(Ja(r),o),t[l]=c),c(n)}},o_=e=>(t,n,r)=>e(Ja(n),r)(t);class s_{constructor(t={}){this.logger=Kn.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?_0:o_;this.formats={number:r((o,i)=>{const l=new Intl.NumberFormat(o,{...i});return c=>l.format(c)}),currency:r((o,i)=>{const l=new Intl.NumberFormat(o,{...i,style:"currency"});return c=>l.format(c)}),datetime:r((o,i)=>{const l=new Intl.DateTimeFormat(o,{...i});return c=>l.format(c)}),relativetime:r((o,i)=>{const l=new Intl.RelativeTimeFormat(o,{...i});return c=>l.format(c,i.range||"day")}),list:r((o,i)=>{const l=new Intl.ListFormat(o,{...i});return c=>l.format(c)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=_0(n)}format(t,n,r,o={}){const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(c=>c.indexOf(")")>-1)){const c=i.findIndex(d=>d.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,c)].join(this.formatSeparator)}return i.reduce((c,d)=>{const{formatName:f,formatOptions:g}=r_(d);if(this.formats[f]){let h=c;try{const v=o?.formatParams?.[o.interpolationkey]||{},x=v.locale||v.lng||o.locale||o.lng||r;h=this.formats[f](c,x,{...g,...o,...v})}catch(v){this.logger.warn(v)}return h}else this.logger.warn(`there was no format function for ${f}`);return c},t)}}const i_=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class a_ extends bd{constructor(t,n,r,o={}){super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Kn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,n,r,o){const i={},l={},c={},d={};return t.forEach(f=>{let g=!0;n.forEach(h=>{const v=`${f}|${h}`;!r.reload&&this.store.hasResourceBundle(f,h)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?l[v]===void 0&&(l[v]=!0):(this.state[v]=1,g=!1,l[v]===void 0&&(l[v]=!0),i[v]===void 0&&(i[v]=!0),d[h]===void 0&&(d[h]=!0)))}),g||(c[f]=!0)}),(Object.keys(i).length||Object.keys(l).length)&&this.queue.push({pending:l,pendingCount:Object.keys(l).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(l),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(d)}}loaded(t,n,r){const o=t.split("|"),i=o[0],l=o[1];n&&this.emit("failedLoading",i,l,n),!n&&r&&this.store.addResourceBundle(i,l,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const c={};this.queue.forEach(d=>{KI(d.loaded,[i],l),i_(d,t),n&&d.errors.push(n),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(f=>{c[f]||(c[f]={});const g=d.loaded[f];g.length&&g.forEach(h=>{c[f][h]===void 0&&(c[f][h]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(d=>!d.done)}read(t,n,r,o=0,i=this.retryTimeout,l){if(!t.length)return l(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:i,callback:l});return}this.readingCalls++;const c=(f,g)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(f&&g&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,i*2,l)},i);return}l(f,g)},d=this.backend[r].bind(this.backend);if(d.length===2){try{const f=d(t,n);f&&typeof f.then=="function"?f.then(g=>c(null,g)).catch(c):c(null,f)}catch(f){c(f)}return}return d(t,n,c)}prepareLoading(t,n,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();Me(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Me(n)&&(n=[n]);const i=this.queueLoad(t,n,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach(l=>{this.loadOne(l)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(l,c)=>{l&&this.logger.warn(`${n}loading namespace ${i} for language ${o} failed`,l),!l&&c&&this.logger.log(`${n}loaded namespace ${i} for language ${o}`,c),this.loaded(t,l,c)})}saveMissing(t,n,r,o,i,l={},c=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const d={...l,isUpdate:i},f=this.backend.create.bind(this.backend);if(f.length<6)try{let g;f.length===5?g=f(t,n,r,o,d):g=f(t,n,r,o),g&&typeof g.then=="function"?g.then(h=>c(null,h)).catch(c):c(null,g)}catch(g){c(g)}else f(t,n,r,o,c,d)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}const Th=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Me(e[1])&&(t.defaultValue=e[1]),Me(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),A0=e=>(Me(e.ns)&&(e.ns=[e.ns]),Me(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Me(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),iu=()=>{},l_=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})},a1="__i18next_supportNoticeShown",c_=()=>!!(typeof globalThis<"u"&&globalThis[a1]||typeof process<"u"&&Eh&&Eh.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Eh),u_=()=>{typeof globalThis<"u"&&(globalThis[a1]=!0)},d_=e=>!!(e?.modules?.backend?.name?.indexOf("Locize")>0||e?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||e?.options?.backend?.backends&&e.options.backend.backends.some(t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0)||e?.options?.backend?.projectId||e?.options?.backend?.backendOptions&&e.options.backend.backendOptions.some(t=>t?.projectId));class Ya extends bd{constructor(t={},n){if(super(),this.options=A0(t),this.services={},this.logger=Kn,this.modules={external:[]},l_(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(Me(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Th();this.options={...r,...this.options,...A0(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!d_(this)&&!c_()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),u_());const o=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?Kn.init(o(this.modules.logger),this.options):Kn.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=s_;const g=new k0(this.options);this.store=new E0(this.options.resources,this.options);const h=this.services;h.logger=Kn,h.resourceStore=this.store,h.languageUtils=g,h.pluralResolver=new n_(g,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),f&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(h.formatter=o(f),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new I0(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new a_(o(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(x,...S)=>{this.emit(x,...S)}),this.modules.languageDetector&&(h.languageDetector=o(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=o(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Bu(this.services,this.options),this.translator.on("*",(x,...S)=>{this.emit(x,...S)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,n||(n=iu),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=(...g)=>this.store[f](...g)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=(...g)=>(this.store[f](...g),this)});const c=Aa(),d=()=>{const f=(g,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(h),n(g,h)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),c}loadResources(t,n=iu){let r=n;const o=Me(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],l=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(f=>{f!=="cimode"&&i.indexOf(f)<0&&i.push(f)})};o?l(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(d=>l(d)),this.options.preload?.forEach?.(c=>l(c)),this.services.backendConnector.load(i,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(c)})}else r(null)}reloadResources(t,n,r){const o=Aa();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=iu),this.services.backendConnector.reload(t,n,i=>{o.resolve(),r(i)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&s1.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=Aa();this.emit("languageChanging",t);const o=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},i=(c,d)=>{d?this.isLanguageChangingTo===t&&(o(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,r.resolve((...f)=>this.t(...f)),n&&n(c,(...f)=>this.t(...f))},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=Me(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(Me(c)?[c]:c);f&&(this.language||o(f),this.translator.language||this.translator.changeLanguage(f),this.services.languageDetector?.cacheUserLanguage?.(f)),this.loadResources(f,g=>{i(g,f)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),r}getFixedT(t,n,r){const o=(i,l,...c)=>{let d;typeof l!="object"?d=this.options.overloadTranslationOptionHandler([i,l].concat(c)):d={...l},d.lng=d.lng||o.lng,d.lngs=d.lngs||o.lngs,d.ns=d.ns||o.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||r||o.keyPrefix);const f={...this.options,...d};typeof d.keyPrefix=="function"&&(d.keyPrefix=si(d.keyPrefix,f));const g=this.options.keySeparator||".";let h;return d.keyPrefix&&Array.isArray(i)?h=i.map(v=>(typeof v=="function"&&(v=si(v,f)),`${d.keyPrefix}${g}${v}`)):(typeof i=="function"&&(i=si(i,f)),h=d.keyPrefix?`${d.keyPrefix}${g}${i}`:i),this.t(h,d)};return Me(t)?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const l=(c,d)=>{const f=this.services.backendConnector.state[`${c}|${d}`];return f===-1||f===0||f===2};if(n.precheck){const c=n.precheck(this,l);if(c!==void 0)return c}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||l(r,t)&&(!o||l(i,t)))}loadNamespaces(t,n){const r=Aa();return this.options.ns?(Me(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Aa();Me(t)&&(t=[t]);const o=this.options.preload||[],i=t.filter(l=>o.indexOf(l)<0&&this.services.languageUtils.isSupportedCode(l));return i.length?(this.options.preload=o.concat(i),this.loadResources(l=>{r.resolve(),n&&n(l)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const i=o.getTextInfo();if(i&&i.direction)return i.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new k0(Th());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new Ya(t,n);return r.createInstance=Ya.createInstance,r}cloneInstance(t={},n=iu){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},i=new Ya(o);if((t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(c=>{i[c]=this[c]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r){const c=Object.keys(this.store.data).reduce((d,f)=>(d[f]={...this.store.data[f]},d[f]=Object.keys(d[f]).reduce((g,h)=>(g[h]={...d[f][h]},g),d[f]),d),{});i.store=new E0(c,o),i.services.resourceStore=i.store}if(t.interpolation){const d={...Th().interpolation,...this.options.interpolation,...t.interpolation},f={...o,interpolation:d};i.services.interpolator=new I0(f)}return i.translator=new Bu(i.services,o),i.translator.on("*",(c,...d)=>{i.emit(c,...d)}),i.init(o,n),i.translator.options=o,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Tt=Ya.createInstance();Tt.createInstance;Tt.dir;Tt.init;Tt.loadResources;Tt.reloadResources;Tt.use;Tt.changeLanguage;Tt.getFixedT;Tt.t;Tt.exists;Tt.setDefaultNamespace;Tt.hasLoadedNamespace;Tt.loadNamespaces;Tt.loadLanguages;const f_=(e,t,n,r)=>{const o=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Xo(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},M0={},mg=(e,t,n,r)=>{Xo(n)&&M0[n]||(Xo(n)&&(M0[n]=new Date),f_(e,t,n,r))},l1=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},yg=(e,t,n)=>{e.loadNamespaces(t,l1(e,n))},D0=(e,t,n,r)=>{if(Xo(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return yg(e,n,r);n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,l1(e,r))},p_=(e,t,n={})=>!t.languages||!t.languages.length?(mg(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Xo=e=>typeof e=="string",h_=e=>typeof e=="object"&&e!==null,g_=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,m_={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},y_=e=>m_[e],v_=e=>e.replace(g_,y_);let vg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:v_};const x_=(e={})=>{vg={...vg,...e}},w_=()=>vg;let c1;const b_=e=>{c1=e},S_=()=>c1,C_={type:"3rdParty",init(e){x_(e.options.react),b_(e)}},u1=m.createContext();class E_{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const N_=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current},d1=(e,t,n,r)=>e.getFixedT(t,n,r),k_=(e,t,n,r)=>m.useCallback(d1(e,t,n,r),[e,t,n,r]),Xe=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:o}=m.useContext(u1)||{},i=n||r||S_();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new E_),!i){mg(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const P=(I,R)=>Xo(R)?R:h_(R)&&Xo(R.defaultValue)?R.defaultValue:Array.isArray(I)?I[I.length-1]:I,A=[P,{},!1];return A.t=P,A.i18n={},A.ready=!1,A}i.options.react?.wait&&mg(i,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...w_(),...i.options.react,...t},{useSuspense:c,keyPrefix:d}=l;let f=o||i.options?.defaultNS;f=Xo(f)?[f]:f||["translation"],i.reportNamespaces.addUsedNamespaces?.(f);const g=(i.isInitialized||i.initializedStoreOnce)&&f.every(P=>p_(P,i,l)),h=k_(i,t.lng||null,l.nsMode==="fallback"?f:f[0],d),v=()=>h,x=()=>d1(i,t.lng||null,l.nsMode==="fallback"?f:f[0],d),[S,w]=m.useState(v);let E=f.join();t.lng&&(E=`${t.lng}${E}`);const b=N_(E),N=m.useRef(!0);m.useEffect(()=>{const{bindI18n:P,bindI18nStore:A}=l;N.current=!0,!g&&!c&&(t.lng?D0(i,t.lng,f,()=>{N.current&&w(x)}):yg(i,f,()=>{N.current&&w(x)})),g&&b&&b!==E&&N.current&&w(x);const I=()=>{N.current&&w(x)};return P&&i?.on(P,I),A&&i?.store.on(A,I),()=>{N.current=!1,i&&P&&P?.split(" ").forEach(R=>i.off(R,I)),A&&i&&A.split(" ").forEach(R=>i.store.off(R,I))}},[i,E]),m.useEffect(()=>{N.current&&g&&w(v)},[i,d,g]);const k=[S,i,g];if(k.t=S,k.i18n=i,k.ready=g,g||!g&&!c)return k;throw new Promise(P=>{t.lng?D0(i,t.lng,f,()=>P()):yg(i,f,()=>P())})};function T_({i18n:e,defaultNS:t,children:n}){const r=m.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return m.createElement(u1.Provider,{value:r},n)}const P_={new:"Neu",open:"Öffnen…",save:"Speichern",undo:"Rückgängig",redo:"Wiederholen",validate:"Validieren"},R_={toggleTheme:"Design wechseln",changeLanguage:"Sprache ändern"},I_={discard:"Nicht gespeicherte Änderungen verwerfen?"},__={saveFailed:"Speichern fehlgeschlagen",loadFailed:"Laden fehlgeschlagen",error:"Etwas ist schiefgelaufen"},A_={invalidJson:"Ungültiges JSON"},M_={toolbar:P_,a11y:R_,confirm:I_,toast:__,error:A_},D_={new:"New",open:"Open…",save:"Save",undo:"Undo",redo:"Redo",validate:"Validate"},j_={toggleTheme:"Toggle theme",changeLanguage:"Change language"},O_={discard:"Discard unsaved changes?"},$_={saveFailed:"Save failed",loadFailed:"Load failed",error:"Something went wrong"},L_={invalidJson:"Invalid JSON"},F_={toolbar:D_,a11y:j_,confirm:O_,toast:$_,error:L_},xg="fh-lang";function z_(){return localStorage.getItem(xg)==="de"?"de":"en"}Tt.use(C_).init({resources:{en:{translation:F_},de:{translation:M_}},lng:z_(),fallbackLng:"en",interpolation:{escapeValue:!1}});var xe=(e=>(e.Input="Input",e.Output="Output",e.Logic="Logic",e.Data="Data",e.Trigger="Trigger",e.Tool="Tool",e.AI="AI",e.Function="Function",e))(xe||{}),kr=(e=>(e.Network="Network",e.Pin="Pin",e.Serial="Serial",e))(kr||{});const V_={type:"ReadPin",label:"Read Pin",category:xe.Input,tags:[kr.Pin],description:"Read data from a pin",outputs:[{id:"output",label:"Pin Value",type:"static",dataType:e=>e.signalType==="digital"?"bool":"int"}],parameters:[{id:"pinReference",label:"Pin",description:"IO pin to read from",type:"channelSelect",channelType:e=>e.signalType==="digital"?["GPIOIN"]:["ADC"]},{id:"signalType",label:"Signal Type",description:"Type of signal",type:"selection",default:"digital",options:[{value:"digital",label:"Digital"},{value:"analog",label:"Analog"}]},{id:"toolDescription",label:"Tool Description",description:"Description shown to the agent when this node is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}]},H_={type:"Retriever",label:"Retriever",category:xe.Input,description:"Retrieves relevant documents from a knowledge base",outputs:[{id:"output",label:"Retrieved Documents",type:"static",dataType:"string"}],parameters:[{id:"memoryReference",label:"Vector Database",description:"The vector database to search",type:"memorySelect",memoryType:["VectorDatabase"]},{id:"topK",label:"Top K",description:"Number of results to retrieve",type:"int",default:5},{id:"query",label:"Query",description:"Search query expression",type:"expression",expressionType:"string",default:{expression:"",references:[],dataType:"string"}},{id:"toolDescription",label:"Tool Description",description:"Description shown to the agent when this node is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}]},B_={type:"WebFetch",label:"Web Fetch",category:xe.Input,description:"Fetches a URL and returns extracted text",outputs:[{id:"output",label:"Fetched Text",type:"static",dataType:"string"}],parameters:[{id:"url",label:"URL",description:"URL to fetch (http or https)",type:"expression",expressionType:"string",default:{expression:"",references:[],dataType:"string"}},{id:"maxChars",label:"Max Characters",description:"Maximum characters of extracted text to return",type:"int",optional:!0}]},W_={type:"SerialRead",label:"Serial Read",category:xe.Input,tags:[kr.Serial],description:"Read string from serial port",outputs:[{id:"output",label:"Serial Data",type:"static",dataType:"string"}],parameters:[{id:"portReference",label:"Port",description:"Serial port to read from",type:"channelSelect",channelType:["UART"]},{id:"prompt",label:"Input prompt",description:"Prompt for the serial read operation",type:"string",optional:!0}]},U_={type:"Agent",label:"LLM Agent",category:xe.AI,description:"AI-powered agent for intelligent processing",canBranch:!0,outputs:[{id:"answer",label:"Answer",type:"static",dataType:"string"},{id:"outputDeclarations",label:"Structured Output",type:"list"}],parameters:[{id:"name",label:"Name",description:"Name of the agent",optional:!0,type:"string"},{id:"model",label:"Model",description:"AI model to use for the agent",type:"modelSelect",modelType:["LLMModel"],capabilities:["chat"]},{id:"instructions",label:"Instructions",description:"Instructions for the cloud agent that act as system prompt",type:"string",multiline:!0,optional:!0},{id:"maxTurns",label:"Max Turns",description:"Maximum number of agent runner turns",type:"int",optional:!0},{id:"memoryRefs",label:"Memory Files",description:"Project memory files this agent can access, with per-file read or read+write mode",type:"memory-refs",default:[]},{id:"toolDescription",label:"Tool Description",description:"Description shown to the calling agent when this agent is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}]},K_={type:"OnFunctionCall",label:"On Function Call",category:xe.Trigger,description:"Fires when this function is invoked by a Function Call node",parameters:[],isUnremovable:!0,isSingleton:!0},G_={type:"Delay",label:"Delay",category:xe.Trigger,description:"Pauses execution for a specified duration and triggers once the delay is complete. During this pause other node chains may run.",parameters:[{id:"delayMs",label:"Delay (ms)",description:"Time in milliseconds to pause execution",type:"int",default:1e3}]},Y_={type:"Ticker",label:"Ticker",category:xe.Trigger,description:"Fires repeatedly at a specified interval",parameters:[{id:"intervalValue",label:"Interval",description:"How many units between ticks",type:"int",default:1},{id:"intervalUnit",label:"Unit",description:"Time unit for the interval",type:"selection",options:[{value:"milliseconds",label:"Milliseconds"},{value:"seconds",label:"Seconds"},{value:"minutes",label:"Minutes"},{value:"hours",label:"Hours"}],default:"seconds"}]},X_={type:"Alarm",label:"Alarm",category:xe.Trigger,description:"Fires at a scheduled time on selected days of the week",parameters:[{id:"time",label:"Time",description:"Time of day to fire (24h format)",type:"time",default:"12:00"},{id:"days",label:"Days",description:"Days of the week to fire on (empty = every day)",type:"weekdays",default:[]}]},q_={type:"OnStartup",label:"On Startup",category:xe.Trigger,description:"Fires once when the device powers on",parameters:[],isSingleton:!0},Z_={type:"OnPinEdge",label:"On Pin Edge",category:xe.Trigger,tags:[kr.Pin],description:"Fires when a digital pin transitions",parameters:[{id:"pinReference",label:"Pin",description:"Digital pin to watch",type:"channelSelect",channelType:["GPIOIN"]},{id:"edge",label:"Edge",description:"Edge transition that fires the trigger",type:"selection",options:[{value:"rising",label:"Rising"},{value:"falling",label:"Falling"},{value:"both",label:"Both"}],default:"both"}]},Q_={type:"OnSerialReceive",label:"On Serial Receive",category:xe.Trigger,tags:[kr.Serial],description:"Fires when serial data arrives",outputs:[{id:"output",label:"Serial Data",type:"static",dataType:"string"}],parameters:[{id:"portReference",label:"Port",description:"Serial port to listen on",type:"channelSelect",channelType:["UART"]}]},J_={type:"OnThreshold",label:"On Threshold",category:xe.Trigger,description:"Fires when a numeric variable crosses a threshold",outputs:[{id:"output",label:"Triggering Value",type:"static",dataType:"float"}],parameters:[{id:"variable",label:"Variable",description:"Numeric variable to watch for threshold crossings",type:"variableSelect"},{id:"threshold",label:"Threshold",description:"Value the variable crosses to fire the trigger",type:"float",default:0},{id:"direction",label:"Direction",description:"Crossing direction to fire on",type:"selection",options:[{value:"rising",label:"Rising"},{value:"falling",label:"Falling"},{value:"both",label:"Both"}],default:"both"},{id:"deadband",label:"Deadband",description:"Hysteresis band width around threshold (0 disables)",type:"float",default:0,optional:!0}]},eA={type:"WebSearchTool",label:"Web Search",category:xe.Tool,description:"Provides web search capability to connected agents",parameters:[{id:"maxResults",label:"Max Results",description:"Maximum number of search results to return per call (capped at 20)",type:"int",optional:!0}]},tA={type:"WritePin",label:"Write Pin",category:xe.Output,tags:[kr.Pin],description:"Write data to a pin",parameters:[{id:"pinReference",label:"Pin",description:"IO pin to write to",type:"channelSelect",channelType:e=>e.signalType==="digital"?["GPIOOUT"]:["PWM","DAC"]},{id:"signalType",label:"Signal Type",description:"Type of signal",type:"selection",default:"digital",options:[{value:"digital",label:"Digital"},{value:"analog",label:"Analog"}]},{id:"value",label:"Value",description:"What value to write to the pin",type:"expression",expressionType:e=>e.signalType==="digital"?"bool":"int",default:{expression:"",references:[],dataType:"bool"}}]},nA={type:"SerialWrite",label:"Serial Write",category:xe.Output,tags:[kr.Serial],description:"Write string to serial port",parameters:[{id:"portReference",label:"Port",description:"Serial port to write to",type:"channelSelect",channelType:["UART"]},{id:"value",label:"Value",description:"Expression for the value to write",type:"expression",expressionType:"string",default:{expression:"",references:[],dataType:"string"}}]},rA={type:"If",label:"If Condition Node",category:xe.Logic,description:"Conditional branching based on boolean expression",parameters:[{id:"condition",label:"Condition",description:"Boolean expression (e.g., ${Input_1.value} > 50)",type:"expression",expressionType:"bool",default:{expression:"",references:[],dataType:"bool"}}]},oA={type:"SetVariable",label:"Set Variable",category:xe.Data,description:"Assign a new value to an existing variable",parameters:[{id:"variable",label:"Variable",description:"The variable to update",type:"variableSelect"},{id:"value",label:"Value",description:"Expression to assign",type:"expression",expressionType:"int",fromReference:"variable",default:{expression:"",references:[],dataType:"int"}}]},sA={type:"MqttPublish",label:"MQTT Publish",category:xe.Output,tags:[kr.Network],description:"Publish a value to an MQTT topic",parameters:[{id:"channelReference",label:"Channel",description:"MQTT channel to publish through",type:"channelSelect",channelType:["MQTT"]},{id:"dataType",label:"Data Type",description:"Data type of the value to publish",type:"selection",options:[{value:"int",label:"Integer"},{value:"float",label:"Float"},{value:"bool",label:"Boolean"},{value:"string",label:"String"}],default:"string"},{id:"value",label:"Value",description:"Value to publish",type:"expression",expressionType:e=>e.dataType,default:{expression:"",references:[],dataType:"string"}},{id:"qos",label:"QoS",description:"Quality of Service level",type:"selection",options:[{value:"0",label:"0 - At most once"},{value:"1",label:"1 - At least once"},{value:"2",label:"2 - Exactly once"}],default:"0"},{id:"retain",label:"Retain",description:"Whether the broker should retain the message",type:"bool",default:!1}]},iA={type:"OnMqttMessage",label:"On MQTT Message",category:xe.Trigger,tags:[kr.Network],description:"Fires when a message is received on a subscribed MQTT topic",outputs:[{id:"output",label:"Message Value",type:"static",dataType:e=>e.dataType}],parameters:[{id:"channelReference",label:"Channel",description:"MQTT channel to subscribe through",type:"channelSelect",channelType:["MQTT"]},{id:"dataType",label:"Data Type",description:"Expected data type of the received message value",type:"selection",options:[{value:"int",label:"Integer"},{value:"float",label:"Float"},{value:"bool",label:"Boolean"},{value:"string",label:"String"}],default:"string"}]};class aA{nodes=new Map;initialized=!1;initialize(){this.initialized||(this.register(V_),this.register(W_),this.register(tA),this.register(nA),this.register(U_),this.register(rA),this.register(oA),this.register(K_),this.register(G_),this.register(Y_),this.register(X_),this.register(q_),this.register(Z_),this.register(Q_),this.register(J_),this.register(eA),this.register(H_),this.register(B_),this.register(sA),this.register(iA),this.initialized=!0)}register(t){this.nodes.set(t.type,t)}getAll(){return Array.from(this.nodes.values())}getAllCategories(){const t=new Set(this.getAll().map(n=>n.category));return Array.from(t).sort()}getByType(t){return this.nodes.get(t)}getByCategory(t){return this.getAll().filter(n=>n.category===t)}}const Lt=new aA;Lt.initialize();const lA={agentTask:{label:"Task",description:"Assigns a task to an agent with a prompt",parameters:[{id:"prompt",label:"Prompt",description:"",type:"expression",expressionType:"string",default:{expression:"",references:[],dataType:"string"}}]},agentChoice:{label:"Choice",description:"A path the agent can choose based on its description",parameters:[{id:"description",label:"Description",description:"",type:"string",default:"When should the agent take this path?"}]},agentDelegate:{label:"Delegation",description:"Lets an agent hand off control to another agent",parameters:[{id:"description",label:"Description",description:"",type:"string",default:"When should the agent take this path?"},{id:"prompt",label:"Prompt",description:"",type:"expression",expressionType:"string",default:{expression:"",references:[],dataType:"string"}}]},control:{label:"Control",description:"Sequential control flow between nodes",parameters:[]},tool:{label:"Tool",description:"Tool connection between nodes",parameters:[]}};function f1(e){return lA[e]}function cm(e){return e==="control"||e==="agentTask"||e==="agentChoice"||e==="agentDelegate"}function p1(e){return e==="tool"}function j0(e){const t=e.sourceHandle||"",n=e.targetHandle||"",r=e.type,o={nodeId:e.source,port:t},i={nodeId:e.target,port:n};switch(r){case"agentTask":return{id:e.id,type:"agentTask",from:o,to:i,prompt:e.data?.prompt??{expression:"",references:[],dataType:"string"}};case"agentChoice":return{id:e.id,type:"agentChoice",from:o,to:i,...e.data?.description?{description:e.data.description}:{}};case"agentDelegate":return{id:e.id,type:"agentDelegate",from:o,to:i,...e.data?.prompt?{prompt:e.data.prompt}:{},...e.data?.description?{description:e.data.description}:{}};case"control":return{id:e.id,type:"control",from:o,to:i};case"tool":return{id:e.id,type:"tool",from:o,to:i};default:return{id:e.id,type:t.startsWith("ctrl")||n.startsWith("ctrl")?"control":"tool",from:o,to:i}}}function O0(e){let t;return(e.type==="agentTask"||e.type==="agentDelegate")&&e.prompt&&(t={...t,prompt:e.prompt}),(e.type==="agentChoice"||e.type==="agentDelegate")&&e.description&&(t={...t,description:e.description}),{id:e.id,type:e.type,source:e.from.nodeId,sourceHandle:e.from.port,target:e.to.nodeId,targetHandle:e.to.port,...t?{data:t}:{}}}function ln(){return crypto.randomUUID()}function so(e){switch(e.kind){case"node":return`${e.nodeId}:${e.outputId}`;case"declared":return`declared:${e.uid}`;case"fnarg":return`fnarg:${e.uid}`}}function Pi(e){return`declared:${e}`}function um(e){return`fnarg:${e}`}function el(e,t){return`${e}:${t}`}function vr(e){switch(e.srcId){case"declared":return Pi(e.varId);case"fnarg":return um(e.varId);default:return el(e.srcId,e.varId)}}function h1(e){return"uid"in e&&e.uid?e:{uid:ln(),name:e.name,dataType:e.dataType}}function $0(e){return e.map(h1)}function Jo(e){return e.uid}function dm(e,t){const n=[],r={},o=new Set;for(const i of t)p1(i.type)&&o.add(i.target);for(const[i,l]of Object.entries(e))l.kind==="node"&&o.has(l.nodeId)||(n.push(l),r[i]=l);return{list:n,lookup:r}}function Ri(e,t){return typeof e=="function"?e(t):e}function Tr(e,t,n){return e.activationRules?.length?e.activationRules.every(r=>{switch(r.type){case"isControlFlow":return!n;case"isToolInput":return n;case"parameterIn":return r.values.includes(t[r.parameterId])}}):!0}function bl(e){return e==null||e===""}function g1(e,t,n=!1){for(const r of t)(r.activationRules?.length&&!Tr(r,e,n)||bl(e[r.id]))&&delete e[r.id]}function m1(e,t,n){if(e.fromReference){const r=t[e.fromReference];if(r?.varId){const o=n[vr(r)];if(o)return o.dataType}}return Ri(e.expressionType,t)}function cA(e,t){return e.capabilities===void 0?void 0:Ri(e.capabilities,t)}function y1(e,t){return Ri(e.channelType,t)}function v1(e,t){return Ri(e.memoryType,t)}function x1(e,t){return Ri(e.modelType,t)}function w1(e,t){return Ri(e.dataType,t)}function Wu(e,t){return e[t]}function b1(e,t){const n=e.arguments;if(e.type==="FunctionCall")return Wu(n,t);const r=Lt.getByType(e.type);if(r?.outputs)for(const o of r.outputs)if(o.type==="static"){if(o.id===t)return Wu(n,o.id)}else{const l=n[o.id]?.find(c=>c.mode==="emit"&&c.uid===t);if(l&&l.mode==="emit")return{active:!0,mode:"emit",name:l.name}}}function Dn(e){switch(e.type){case"ReadPin":return{input:[{id:"ctrl",type:"control"},{id:"tool",type:"tool",label:"As Tool"}],output:[{id:"ctrl",type:"control"}]};case"SerialRead":case"WritePin":case"SerialWrite":case"MqttPublish":return{input:[{id:"ctrl",type:"control"}],output:[{id:"ctrl",type:"control"}]};case"FunctionCall":return{input:[{id:"ctrl",type:"control"},{id:"tool",type:"tool",label:"As Tool"}],output:[{id:"ctrl",type:"control"}]};case"Agent":return{input:[{id:"ctrl",type:"control"},{id:"tool",type:"tool",label:"As Tool"}],output:[{id:"ctrl",type:"control"},{id:"tools",type:"tool"}]};case"SetVariable":return{input:[{id:"ctrl",type:"control"}],output:[{id:"ctrl",type:"control"}]};case"If":return{input:[{id:"ctrl",type:"control"}],output:[{id:"true",type:"control",label:"True"},{id:"false",type:"control",label:"False"}]};case"Delay":return{input:[{id:"ctrl",type:"control"}],output:[{id:"ctrl",type:"control"}]};case"OnFunctionCall":case"Ticker":case"Alarm":case"OnStartup":case"OnPinEdge":case"OnSerialReceive":case"OnThreshold":case"OnMqttMessage":return{input:[],output:[{id:"ctrl",type:"control"}]};case"Retriever":return{input:[{id:"ctrl",type:"control"},{id:"tool",type:"tool",label:"As Tool"}],output:[{id:"ctrl",type:"control"}]};case"WebFetch":return{input:[{id:"ctrl",type:"control"}],output:[{id:"ctrl",type:"control"}]};case"WebSearchTool":return{input:[{id:"tool",type:"tool",label:"As Tool"}],output:[]}}}function Sd(e){return e.arguments}function S1(e){const t={};if(e.type==="FunctionCall"){for(const o of e.functionInfo.returns)t[o.uid]={name:o.name,dataType:o.dataType};return t}const n=Lt.getByType(e.type);if(!n?.outputs)return t;const r=e.arguments;for(const o of n.outputs)if(o.type==="static")t[o.id]={name:o.id,dataType:w1(o,e.arguments)};else{const i=r[o.id]??[];for(const l of i)l.mode==="emit"&&(t[l.uid]={name:l.name,dataType:l.dataType})}return t}function Uu(e){const t={},n=e.arguments,r=(i,l,c,d)=>{if(!d){t[i]={name:l,dataType:c};return}d.active&&d.mode==="emit"&&(t[i]={name:d.name,dataType:c})};if(e.type==="FunctionCall"){for(const i of e.functionInfo.returns)r(i.uid,i.name,i.dataType,Wu(n,i.uid));return t}const o=Lt.getByType(e.type);if(!o?.outputs)return t;for(const i of o.outputs)if(i.type==="static")r(i.id,i.id,w1(i,e.arguments),Wu(n,i.id));else{const l=n[i.id]??[];for(const c of l)c.mode==="emit"&&(t[c.uid]={name:c.name,dataType:c.dataType})}return t}function uA(e){switch(e.type){case"ReadPin":return[{kind:"gpio",pinReference:e.arguments.pinReference,dataType:e.arguments.signalType==="digital"?"bool":"int"}];case"SerialRead":return[{kind:"serial"}];case"OnPinEdge":return[{kind:"gpio",pinReference:e.arguments.pinReference,dataType:"bool"}];case"OnSerialReceive":return[{kind:"serial"}];default:return[]}}function tl(e,t,n){const o=Dn(t).input.filter(i=>i.type==="tool");return o.length===0?!1:n.some(i=>i.target===e&&o.some(l=>l.id===i.targetHandle))}function wg(e,t=n=>n){return{type:"FunctionCall",functionInfo:e,label:e.name,category:xe.Function,description:t("builder.functionCallDesc",{name:e.name}),parameters:[...e.arguments.map(n=>({id:Jo(n),label:n.name,description:t("builder.functionParamDesc",{name:n.name}),type:"expression",expressionType:n.dataType,default:{expression:"",references:[],dataType:n.dataType},activationRules:[{type:"isControlFlow"}]})),{id:"toolDescription",label:"Tool Description",description:"Description shown to the agent when this function is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}],outputs:e.returns.map(n=>({id:Jo(n),label:n.name,type:"static",dataType:n.dataType}))}}function L0(e,t){const n=dA(e,e.position,t);if(e.label&&(n.label=e.label),"arguments"in n&&n.arguments){const r=e.type!=="FunctionCall"?Lt.getByType(e.type):void 0;r&&g1(n.arguments,r.parameters,t)}return n}function dA(e,t,n){switch(e.type){case"ReadPin":return{id:e.id,type:e.type,position:t,arguments:{pinReference:e.arguments.pinReference,signalType:e.arguments.signalType,output:e.arguments.output,toolDescription:e.arguments.toolDescription}};case"SerialRead":return{id:e.id,type:e.type,position:t,arguments:{portReference:e.arguments.portReference,...e.arguments.prompt!==void 0?{prompt:e.arguments.prompt}:{},output:e.arguments.output}};case"WritePin":return{id:e.id,type:e.type,position:t,arguments:{pinReference:e.arguments.pinReference,signalType:e.arguments.signalType,value:e.arguments.value}};case"SerialWrite":return{id:e.id,type:e.type,position:t,arguments:{portReference:e.arguments.portReference,value:e.arguments.value}};case"Agent":return{id:e.id,type:e.type,position:t,arguments:{name:e.arguments.name,model:e.arguments.model,instructions:e.arguments.instructions,maxTurns:e.arguments.maxTurns,outputDeclarations:e.arguments.outputDeclarations,memoryRefs:e.arguments.memoryRefs??[],answer:e.arguments.answer,toolDescription:e.arguments.toolDescription}};case"If":return{id:e.id,type:e.type,position:t,arguments:{condition:e.arguments.condition}};case"OnFunctionCall":return{id:e.id,type:e.type,position:t};case"OnStartup":return{id:e.id,type:e.type,position:t};case"OnPinEdge":return{id:e.id,type:e.type,position:t,arguments:{pinReference:e.arguments.pinReference,edge:e.arguments.edge}};case"OnSerialReceive":return{id:e.id,type:e.type,position:t,arguments:{portReference:e.arguments.portReference,output:e.arguments.output}};case"OnThreshold":return{id:e.id,type:e.type,position:t,arguments:{variable:e.arguments.variable,threshold:e.arguments.threshold,direction:e.arguments.direction,deadband:e.arguments.deadband,output:e.arguments.output}};case"Delay":return{id:e.id,type:e.type,position:t,arguments:{delayMs:e.arguments.delayMs}};case"Ticker":return{id:e.id,type:e.type,position:t,arguments:{intervalValue:e.arguments.intervalValue,intervalUnit:e.arguments.intervalUnit}};case"Alarm":return{id:e.id,type:e.type,position:t,arguments:{time:e.arguments.time,days:e.arguments.days}};case"WebSearchTool":return{id:e.id,type:e.type,position:t,arguments:{maxResults:e.arguments.maxResults}};case"Retriever":return{id:e.id,type:e.type,position:t,arguments:{memoryReference:e.arguments.memoryReference,topK:e.arguments.topK,query:e.arguments.query,output:e.arguments.output,toolDescription:e.arguments.toolDescription}};case"WebFetch":return{id:e.id,type:e.type,position:t,arguments:{url:e.arguments.url,maxChars:e.arguments.maxChars,output:e.arguments.output}};case"FunctionCall":{const r={},o={},i=e.arguments;for(const c of e.functionInfo.arguments){const d=c.uid??c.name,f=i[d];f!==void 0&&(r[d]=f)}for(const c of e.functionInfo.returns){const d=c.uid??c.name,f=i[d];f!==void 0&&(o[d]=f)}const l=i.toolDescription;return{id:e.id,type:e.type,functionId:e.functionInfo.id,position:t,arguments:{inputBindings:r,outputBindings:o,...n&&l!==void 0?{toolDescription:l}:{}}}}case"SetVariable":return{id:e.id,type:e.type,position:t,arguments:{variable:e.arguments.variable,value:e.arguments.value}};case"MqttPublish":return{id:e.id,type:e.type,position:t,arguments:{channelReference:e.arguments.channelReference??"",dataType:e.arguments.dataType,value:e.arguments.value,qos:Number(e.arguments.qos),retain:e.arguments.retain}};case"OnMqttMessage":return{id:e.id,type:e.type,position:t,arguments:{channelReference:e.arguments.channelReference??"",dataType:e.arguments.dataType,output:e.arguments.output}}}}function F0(e,t){return{...fA(e,t),position:e.position}}function fA(e,t){switch(e.type){case"ReadPin":return{id:e.id,type:e.type,label:e.label,arguments:{pinReference:e.arguments.pinReference??"",signalType:e.arguments.signalType,output:e.arguments.output,toolDescription:e.arguments.toolDescription}};case"SerialRead":return{id:e.id,type:e.type,label:e.label,arguments:{portReference:e.arguments.portReference??"",prompt:e.arguments.prompt??"",output:e.arguments.output}};case"Retriever":return{id:e.id,type:e.type,label:e.label,arguments:{memoryReference:e.arguments.memoryReference??"",topK:e.arguments.topK??0,query:e.arguments.query,output:e.arguments.output,toolDescription:e.arguments.toolDescription}};case"WritePin":return{id:e.id,type:e.type,label:e.label,arguments:{pinReference:e.arguments.pinReference??"",signalType:e.arguments.signalType,value:e.arguments.value}};case"SerialWrite":return{id:e.id,type:e.type,label:e.label,arguments:{portReference:e.arguments.portReference??"",value:e.arguments.value}};case"Agent":return{id:e.id,type:e.type,label:e.label,arguments:{name:e.arguments.name??"",model:e.arguments.model??"",instructions:e.arguments.instructions??"",maxTurns:e.arguments.maxTurns,outputDeclarations:e.arguments.outputDeclarations,memoryRefs:e.arguments.memoryRefs??[],answer:e.arguments.answer,toolDescription:e.arguments.toolDescription}};case"If":return{id:e.id,type:e.type,label:e.label,arguments:{condition:e.arguments.condition}};case"OnFunctionCall":return{id:e.id,type:e.type,label:e.label,arguments:{}};case"OnStartup":return{id:e.id,type:e.type,label:e.label,arguments:{}};case"OnPinEdge":return{id:e.id,type:e.type,label:e.label,arguments:{pinReference:e.arguments.pinReference??"",edge:e.arguments.edge}};case"OnSerialReceive":return{id:e.id,type:e.type,label:e.label,arguments:{portReference:e.arguments.portReference??"",output:e.arguments.output}};case"OnThreshold":return{id:e.id,type:e.type,label:e.label,arguments:{variable:e.arguments.variable,threshold:e.arguments.threshold,direction:e.arguments.direction,deadband:e.arguments.deadband,output:e.arguments.output}};case"Delay":return{id:e.id,type:e.type,label:e.label,arguments:{delayMs:e.arguments.delayMs??0}};case"Ticker":return{id:e.id,type:e.type,label:e.label,arguments:{intervalValue:e.arguments.intervalValue??0,intervalUnit:e.arguments.intervalUnit}};case"Alarm":return{id:e.id,type:e.type,label:e.label,arguments:{time:e.arguments.time??"",days:e.arguments.days}};case"WebSearchTool":return{id:e.id,type:e.type,label:e.label,arguments:{maxResults:e.arguments.maxResults}};case"WebFetch":return{id:e.id,type:e.type,label:e.label,arguments:{url:e.arguments.url,maxChars:e.arguments.maxChars,output:e.arguments.output}};case"SetVariable":return{id:e.id,type:e.type,label:e.label,arguments:{variable:e.arguments.variable,value:e.arguments.value}};case"FunctionCall":{const n={...e.arguments.inputBindings??{},...e.arguments.outputBindings??{}};e.arguments.toolDescription!==void 0&&(n.toolDescription=e.arguments.toolDescription);const r=t?.(e.functionId)??{id:e.functionId,version:0,name:"",arguments:[],returns:[]};return{id:e.id,type:e.type,label:e.label,functionInfo:r,arguments:n}}case"MqttPublish":return{id:e.id,type:e.type,label:e.label,arguments:{channelReference:e.arguments.channelReference??"",dataType:e.arguments.dataType,value:e.arguments.value,qos:String(e.arguments.qos),retain:e.arguments.retain}};case"OnMqttMessage":return{id:e.id,type:e.type,label:e.label,arguments:{channelReference:e.arguments.channelReference??"",dataType:e.arguments.dataType,output:e.arguments.output}}}}function Sl(e,t){return{expression:e.expression,expectedType:e.dataType,variables:e.references.map(n=>{if(!n.varId)return null;const r=vr(n),o=t[r];return o?{name:o.name,dataType:o.dataType}:null})}}function es(e){return typeof e=="object"&&e!==null&&"expression"in e&&"references"in e}class pA{add(t,n,r){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][r?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}}class hA{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class ae{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+ae.version}static addUnaryOp(t){return ae.max_unop_len=Math.max(t.length,ae.max_unop_len),ae.unary_ops[t]=1,ae}static addBinaryOp(t,n,r){return ae.max_binop_len=Math.max(t.length,ae.max_binop_len),ae.binary_ops[t]=n,r?ae.right_associative.add(t):ae.right_associative.delete(t),ae}static addIdentifierChar(t){return ae.additional_identifier_chars.add(t),ae}static addLiteral(t,n){return ae.literals[t]=n,ae}static removeUnaryOp(t){return delete ae.unary_ops[t],t.length===ae.max_unop_len&&(ae.max_unop_len=ae.getMaxKeyLen(ae.unary_ops)),ae}static removeAllUnaryOps(){return ae.unary_ops={},ae.max_unop_len=0,ae}static removeIdentifierChar(t){return ae.additional_identifier_chars.delete(t),ae}static removeBinaryOp(t){return delete ae.binary_ops[t],t.length===ae.max_binop_len&&(ae.max_binop_len=ae.getMaxKeyLen(ae.binary_ops)),ae.right_associative.delete(t),ae}static removeAllBinaryOps(){return ae.binary_ops={},ae.max_binop_len=0,ae}static removeLiteral(t){return delete ae.literals[t],ae}static removeAllLiterals(){return ae.literals={},ae}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new ae(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return ae.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!ae.binary_ops[String.fromCharCode(t)]||ae.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return ae.isIdentifierStart(t)||ae.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(ae.hooks[t]){const r={context:this,node:n};return ae.hooks.run(t,r),r.node}return n}searchHook(t){if(ae.hooks[t]){const n={context:this};return ae.hooks[t].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===ae.SPACE_CODE||t===ae.TAB_CODE||t===ae.LF_CODE||t===ae.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:ae.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],r,o;for(;this.index<this.expr.length;)if(r=this.code,r===ae.SEMCOL_CODE||r===ae.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())n.push(o);else if(this.index<this.expr.length){if(r===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,ae.max_binop_len),n=t.length;for(;n>0;){if(ae.binary_ops.hasOwnProperty(t)&&(!ae.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!ae.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,r,o,i,l,c,d,f;if(l=this.gobbleToken(),!l||(n=this.gobbleBinaryOp(),!n))return l;for(i={value:n,prec:ae.binaryPrecedence(n),right_a:ae.right_associative.has(n)},c=this.gobbleToken(),c||this.throwError("Expected expression after "+n),o=[l,i,c];n=this.gobbleBinaryOp();){if(r=ae.binaryPrecedence(n),r===0){this.index-=n.length;break}i={value:n,prec:r,right_a:ae.right_associative.has(n)},f=n;const g=h=>i.right_a&&h.right_a?r>h.prec:r<=h.prec;for(;o.length>2&&g(o[o.length-2]);)c=o.pop(),n=o.pop().value,l=o.pop(),t={type:ae.BINARY_EXP,operator:n,left:l,right:c},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+f),o.push(i,t)}for(d=o.length-1,t=o[d];d>1;)t={type:ae.BINARY_EXP,operator:o[d-1].value,left:o[d-2],right:t},d-=2;return t}gobbleToken(){let t,n,r,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,ae.isDecimalDigit(t)||t===ae.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===ae.SQUOTE_CODE||t===ae.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===ae.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,ae.max_unop_len),r=n.length;r>0;){if(ae.unary_ops.hasOwnProperty(n)&&(!ae.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!ae.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=r;const i=this.gobbleToken();return i||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:ae.UNARY_EXP,operator:n,argument:i,prefix:!0})}n=n.substr(0,--r)}ae.isIdentifierStart(t)?(o=this.gobbleIdentifier(),ae.literals.hasOwnProperty(o.name)?o={type:ae.LITERAL,value:ae.literals[o.name],raw:o.name}:o.name===ae.this_str&&(o={type:ae.THIS_EXP})):t===ae.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===ae.PERIOD_CODE||n===ae.OBRACK_CODE||n===ae.OPAREN_CODE||n===ae.QUMARK_CODE;){let r;if(n===ae.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==ae.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===ae.OBRACK_CODE?(t={type:ae.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),n=this.code,n!==ae.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===ae.OPAREN_CODE?t={type:ae.CALL_EXP,arguments:this.gobbleArguments(ae.CPAREN_CODE),callee:t}:(n===ae.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),t={type:ae.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),r&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,r;for(;ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===ae.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));ae.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);ae.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return r=this.code,ae.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(r===ae.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===ae.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:ae.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const n=this.index,r=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let i=this.expr.charAt(this.index++);if(i===r){o=!0;break}else if(i==="\\")switch(i=this.expr.charAt(this.index++),i){case"n":t+=`
9
+ `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=i}else t+=i}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:ae.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(ae.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,ae.isIdentifierPart(t));)this.index++;return{type:ae.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){const n=[];let r=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===t){r=!0,this.index++,t===ae.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(i===ae.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===ae.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===ae.CBRACK_CODE)for(let l=n.length;l<o;l++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{const l=this.gobbleExpression();(!l||l.type===ae.COMPOUND)&&this.throwError("Expected comma"),n.push(l)}}return r||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(ae.CPAREN_CODE);if(this.code===ae.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:ae.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:ae.ARRAY_EXP,elements:this.gobbleArguments(ae.CBRACK_CODE)}}}const gA=new pA;Object.assign(ae,{hooks:gA,plugins:new hA(ae),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});ae.max_unop_len=ae.getMaxKeyLen(ae.unary_ops);ae.max_binop_len=ae.getMaxKeyLen(ae.binary_ops);const nl=e=>new ae(e).parse(),mA=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(ae).filter(e=>!mA.includes(e)&&nl[e]===void 0).forEach(e=>{nl[e]=ae[e]});nl.Jsep=ae;const yA="ConditionalExpression";var vA={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const r=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),n.node={type:yA,test:r,consequent:o,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let l=r;for(;l.right.operator&&e.binary_ops[l.right.operator]<=.9;)l=l.right;n.node.test=l.right,l.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};nl.plugins.register(vA);function Cd(e){if(!e.expression.trim())return{isValid:!1,inferredType:null,errors:["Expression is empty"]};if(e.variables.some(c=>c===null))return{isValid:!1,inferredType:null,errors:["Expression contains stale variable references"]};const t=[],n=new Map;let r=e.expression;const o=(e.expression.match(/\$\{\}/g)||[]).length;if(o!==e.variables.length)return t.push(`Placeholder count (${o}) doesn't match reference count (${e.variables.length})`),{isValid:!1,inferredType:null,errors:t};if(e.variables.forEach((c,d)=>{const f=`__var${d}__`;r=r.replace("${}",f),c?n.set(f,c.dataType):t.push(`Referenced variable at position ${d+1} not found`)}),t.length>0)return{isValid:!1,inferredType:null,errors:t};e.expectedType==="string"&&(r=NA(r));let i;try{i=nl(r)}catch(c){return{isValid:!1,inferredType:null,errors:[`Parse error: ${c instanceof Error?c.message:String(c)}`]}}const l=co(i,n,t);return l&&e.expectedType!==l&&(EA(l,e.expectedType)||t.push(`Type mismatch: expression evaluates to '${l}', expected '${e.expectedType}'`)),{isValid:t.length===0&&l!==null,inferredType:l,errors:t}}function co(e,t,n){switch(e.type){case"Literal":return xA(e);case"Identifier":{const r=e.name,o=t.get(r);return o||(r.startsWith("__var")&&r.endsWith("__")?n.push("Missing type for variable reference"):n.push(`Unknown identifier: '${r}'`)),o??null}case"BinaryExpression":return wA(e,t,n);case"UnaryExpression":return bA(e,t,n);case"ConditionalExpression":{const r=e;co(r.test,t,n)!=="bool"&&n.push("Ternary condition must be boolean");const i=co(r.consequent,t,n),l=co(r.alternate,t,n);if(i&&l&&i!==l){if(Rn(i)&&Rn(l))return"float";n.push(`Ternary branches must have same type (got '${i}' and '${l}')`)}return i}case"MemberExpression":return n.push("Member expressions (e.g., obj.property) are not supported"),null;case"CallExpression":return CA(e,t,n);default:return n.push(`Unsupported expression type: ${e.type}`),null}}function xA(e){const t=e.value;return typeof t=="boolean"?"bool":typeof t=="number"?Number.isInteger(t)?"int":"float":typeof t=="string"?"string":"int"}function wA(e,t,n){const r=co(e.left,t,n),o=co(e.right,t,n),i=e.operator;return!r||!o?null:i==="+"&&(r==="string"||o==="string")?"string":["+","-","*","/"].includes(i)?!Rn(r)||!Rn(o)?(n.push(`Operator '${i}' requires numeric operands (got '${r}' and '${o}')`),null):r==="float"||o==="float"?"float":"int":i==="%"?r!=="int"||o!=="int"?(n.push(`Operator '%' requires integer operands (got '${r}' and '${o}')`),null):"int":["<",">","<=",">="].includes(i)?((!Rn(r)||!Rn(o))&&n.push(`Operator '${i}' requires numeric operands (got '${r}' and '${o}')`),"bool"):["==","!="].includes(i)?(r!==o&&!(Rn(r)&&Rn(o))&&n.push(`Comparing incompatible types: '${r}' and '${o}'`),"bool"):["&&","||"].includes(i)?((r!=="bool"||o!=="bool")&&n.push(`Operator '${i}' requires boolean operands (got '${r}' and '${o}')`),"bool"):["&","|","^","<<",">>"].includes(i)?r!=="int"||o!=="int"?(n.push(`Bitwise operator '${i}' requires integer operands (got '${r}' and '${o}')`),null):"int":(n.push(`Unknown operator: '${i}'`),null)}function bA(e,t,n){const r=co(e.argument,t,n);return r?e.operator==="!"?(r!=="bool"&&n.push(`Logical NOT '!' requires boolean operand (got '${r}')`),"bool"):e.operator==="-"||e.operator==="+"?(Rn(r)||n.push(`Unary '${e.operator}' requires numeric operand (got '${r}')`),r):e.operator==="~"?(r!=="int"&&n.push(`Bitwise NOT '~' requires integer operand (got '${r}')`),"int"):(n.push(`Unknown unary operator: '${e.operator}'`),r):null}const SA={int:"int",float:"float",bool:"bool",str:"string"};function CA(e,t,n){const r=e.callee;if(r.type!=="Identifier")return n.push("Only cast functions are supported (int, float, bool, str)"),null;const o=r.name,i=SA[o];return i?e.arguments.length!==1?(n.push(`${o}() expects exactly 1 argument, got ${e.arguments.length}`),null):(co(e.arguments[0],t,n),i):(n.push(`Unknown function '${o}'. Available cast functions: int(), float(), bool(), str()`),null)}function Rn(e){return e==="int"||e==="float"}function EA(e,t){return!!(e===t||Rn(e)&&Rn(t)||t==="string")}function NA(e){const t=e.split(/(__var\d+__)/),n=[];for(const r of t)if(/^__var\d+__$/.test(r))n.push(r);else if(r!==""){const o=r.replace(/\\/g,"\\\\").replace(/"/g,'\\"');n.push(`"${o}"`)}return n.join(" + ")}const C1=["GPIOIN","GPIOOUT","ADC","PWM","DAC","UART","MQTT"],Ed={parameters:[{id:"type",label:"Type",description:"Channel type",type:"selection",default:"GPIOIN",options:C1.map(e=>({value:e,label:e}))},{id:"bias",label:"Bias",description:"Pin bias configuration",type:"selection",default:"none",options:[{value:"none",label:"None"},{value:"pullup",label:"Pull-up"},{value:"pulldown",label:"Pull-down"}],activationRules:[{type:"parameterIn",parameterId:"type",values:["GPIOIN"]}]},{id:"debounceMs",label:"Debounce (ms)",description:"Debounce window in milliseconds",type:"int",default:50,activationRules:[{type:"parameterIn",parameterId:"type",values:["GPIOIN"]}]},{id:"frequency",label:"Frequency (Hz)",description:"PWM frequency in Hz",type:"int",default:1e3,activationRules:[{type:"parameterIn",parameterId:"type",values:["PWM"]}]},{id:"topic",label:"Topic",description:"MQTT topic this channel publishes to / subscribes on (e.g. sensors/temperature)",type:"string",activationRules:[{type:"parameterIn",parameterId:"type",values:["MQTT"]}]}]};function kA(e){const{id:t,label:n,type:r}=e,o={...e.arguments,type:r};switch(g1(o,Ed.parameters),r){case"GPIOIN":return{type:r,id:t,label:n,bias:o.bias,debounceMs:o.debounceMs};case"GPIOOUT":return{type:r,id:t,label:n};case"ADC":return{type:r,id:t,label:n};case"PWM":return{type:r,id:t,label:n,frequency:o.frequency};case"DAC":return{type:r,id:t,label:n};case"UART":return{type:r,id:t,label:n};case"MQTT":return{type:r,id:t,label:n,topic:o.topic}}}function TA(e){const{id:t,label:n,type:r}=e,o={};switch(r){case"GPIOIN":o.bias=e.bias,o.debounceMs=e.debounceMs;break;case"PWM":o.frequency=e.frequency;break;case"MQTT":o.topic=e.topic;break}return{id:t,label:n,type:r,arguments:o}}const PA={type:"MemoryFile",label:"Memory File",description:"Durable text storage an agent can read and write",parameters:[{id:"description",label:"Description",description:"What this memory file is for (shown to the LLM as tool description)",type:"string",multiline:!0,optional:!0},{id:"content",label:"Initial Content",description:"Seed content written on fresh deploy; existing rows keep their content on redeploy",type:"string",multiline:!0,optional:!0},{id:"maxSizeBytes",label:"Max Size (bytes)",description:"Byte cap on writes; leave empty for unlimited",type:"int",optional:!0}]},RA={type:"VectorDatabase",label:"Vector Database",description:"RAG knowledge base that Retriever nodes can query",parameters:[{id:"description",label:"Description",description:"What this knowledge base contains",type:"string",multiline:!0,optional:!0}]};class IA{memories=new Map;initialized=!1;initialize(){this.initialized||(this.register(PA),this.register(RA),this.initialized=!0)}register(t){this.memories.set(t.type,t)}getAll(){return Array.from(this.memories.values())}getByType(t){return this.memories.get(t)}}const Nd=new IA;Nd.initialize();function _A(e){const{id:t,label:n,type:r,arguments:o}=e;switch(r){case"MemoryFile":return{type:r,id:t,label:n,description:o.description??"",content:o.content??"",...o.maxSizeBytes!=null?{maxSizeBytes:o.maxSizeBytes}:{}};case"VectorDatabase":return{type:r,id:t,label:n,...o.description!=null?{description:o.description}:{}}}}function AA(e){const{id:t,label:n,type:r}=e,o={};switch(r){case"MemoryFile":o.description=e.description??"",o.content=e.content??"",e.maxSizeBytes!=null&&(o.maxSizeBytes=e.maxSizeBytes);break;case"VectorDatabase":e.description!=null&&(o.description=e.description);break}return{id:t,label:n,type:r,arguments:o}}const MA={type:"LLMModel",label:"Custom LLM Model",description:"A self-hosted or custom LLM the llmproxy doesn't ship by default",parameters:[]};class DA{models=new Map;initialized=!1;initialize(){this.initialized||(this.register(MA),this.initialized=!0)}register(t){this.models.set(t.type,t)}getAll(){return Array.from(this.models.values())}getByType(t){return this.models.get(t)}}const kd=new DA;kd.initialize();function jA(e){const{id:t,label:n,type:r,arguments:o}=e;if(r==="LLMModel")return{type:r,id:t,label:n,capabilities:o.capabilities??["chat"]}}function OA(e){const{id:t,label:n,type:r}=e,o={};return r==="LLMModel"&&(o.capabilities=e.capabilities),{id:t,label:n,type:r,arguments:o}}function Td(e){return{id:e.id,version:e.version,name:e.name,arguments:e.arguments,returns:e.outputs.map(({uid:t,name:n,dataType:r})=>({uid:t,name:n,dataType:r}))}}function $A(e){const t={};for(const n of e.outputs)t[n.uid]=n.expression;return{functionInfo:Td(e),outputAssignments:t}}function LA(e,t){return{id:e.id,version:e.version,name:e.name,arguments:e.arguments,outputs:e.returns.map(n=>({uid:n.uid,name:n.name,dataType:n.dataType,expression:t[n.uid]??{expression:"",references:[],dataType:n.dataType}}))}}const We="main";function E1(e){const{canvasId:t,nodeId:n,nodeData:r,nodeDefinition:o,availableVariables:i,channels:l,memory:c,models:d,availableModelIds:f,edges:g,isStale:h=!1,isDeleted:v=!1}=e,x=[];if(v?x.push({severity:"error",category:"function-deleted",canvasId:t,nodeId:n,message:"Function has been deleted. Remove this node."}):h&&x.push({severity:"warning",category:"function-stale",canvasId:t,nodeId:n,message:"Function definition has changed. Please update this node."}),!o)return x;const S=Dn(r),w=Sd(r),E=tl(n,r,g);for(const I of o.parameters){if(!Tr(I,w,E))continue;const R=w[I.id];if(es(R)&&R.expression){const j=Sl(R,i);I.type==="expression"&&(j.expectedType=m1(I,w,i));const L=Cd(j);L.isValid||x.push({severity:"error",category:"invalid-expression",canvasId:t,nodeId:n,paramId:I.id,message:`Invalid expression for "${I.label}": ${L.errors.join(", ")}`})}if(!I.optional){const j=es(R)&&!R.expression,L=I.type==="variableSelect"&&(!R||typeof R=="object"&&R!==null&&!R.varId);(bl(R)||j||L)&&x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,paramId:I.id,message:`Missing required parameter "${I.label}"`})}if(I.type==="variableSelect"&&R){const j=R;if(j.varId){const L=vr(j);i[L]||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references a deleted variable`})}}if(I.type==="channelSelect"&&R){const j=R,L=Object.values(l).find(U=>U.id===j);L?y1(I,w).includes(L.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references "${L.label}" (${L.type}), which is not a compatible channel type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references a deleted channel`})}if(I.type==="memory-refs"&&Array.isArray(R)&&c){const j=R,L=new Set(Object.values(c).filter($=>$.type==="MemoryFile").map($=>$.id)),U=j.filter($=>!$.id||!L.has($.id));U.length>0&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references ${U.length} deleted memory file${U.length===1?"":"s"}`})}if(I.type==="memorySelect"&&R&&c){const j=R,L=Object.values(c).find(U=>U.id===j);L?v1(I,w).includes(L.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references "${L.label}" (${L.type}), which is not a compatible memory type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references a deleted memory`})}if(I.type==="modelSelect"&&R&&d){const j=R,L=Object.values(d).find(U=>U.id===j);L?x1(I,w).includes(L.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references "${L.label}" (${L.type}), which is not a compatible model type`}):f&&!f.has(j)&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:I.id,message:`"${I.label}" references a deleted model`})}}if(!E){const I=S1(r);for(const j of Object.keys(I)){const L=b1(r,j);if(!L||!L.active||L.mode!=="assign")continue;const U=I[j];if(!L.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:j,message:`Output "${U?.name??j}" has no variable selected`});continue}const $=vr(L.target),B=i[$];B?U&&B.dataType!==U.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:j,message:`Output "${U.name}" (${U.dataType}) cannot assign to "${B.name}" (${B.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:j,message:`Output "${U?.name??j}" assigns to a deleted variable`})}const R=(o.outputs??[]).filter(j=>j.type==="list");for(const j of R){const L=r.arguments[j.id]??[],U=new Map;L.forEach(($,B)=>{const G=U.get($.name);G?G.push(B):U.set($.name,[B])}),L.forEach(($,B)=>{const G=`${j.id}[${B}]`;if(!$.name||$.name.trim()===""?x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,outputId:G,message:`${j.label} entry #${B+1} has no name`}):(U.get($.name)??[]).length>1&&x.push({severity:"error",category:"duplicate-output-name",canvasId:t,nodeId:n,outputId:G,message:`${j.label} entry #${B+1} has duplicate name "${$.name}"`}),$.mode!=="assign")return;if(!$.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${j.label} entry #${B+1} has no variable selected`});return}const _=vr($.target),O=i[_];O?O.dataType!==$.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${j.label} entry #${B+1} (${$.dataType}) cannot assign to "${O.name}" (${O.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${j.label} entry #${B+1} assigns to a deleted variable`})})}}const b=S.input.filter(I=>I.type==="control"),N=S.input.filter(I=>I.type==="tool"),k=S.output.filter(I=>I.type==="control"),P=new Set(g.filter(I=>I.target===n).map(I=>I.targetHandle)),A=new Set(g.filter(I=>I.source===n).map(I=>I.sourceHandle));if(b.length>0)if(E)for(const I of N)P.has(I.id)||x.push({severity:"warning",category:"unconnected-input",canvasId:t,nodeId:n,message:"Node is not connected and will never run"});else for(const I of b)P.has(I.id)||x.push({severity:"warning",category:"unconnected-input",canvasId:t,nodeId:n,message:"Node is not connected and will never run"});else N.length>0&&(N.some(R=>P.has(R.id))||x.push({severity:"warning",category:"tool-not-connected",canvasId:t,nodeId:n,message:`"${o.label}" is not connected to an agent`}));if(k.length>0&&o.category===xe.Trigger)for(const I of k)A.has(I.id)||x.push({severity:"warning",category:"unconnected-output",canvasId:t,nodeId:n,message:`"${o.label}" has no outgoing connection — nothing will run after it`});return x}function N1(e){const{canvasId:t,edgeId:n,edgeType:r,edgeData:o,availableVariables:i,sourceControlEdgeCount:l}=e,c=[],d=f1(r);if(d.parameters.length===0)return c;const f=l>1;for(const g of d.parameters){if(g.id==="description"&&!f&&(r==="agentChoice"||r==="agentDelegate"))continue;const h=o?.[g.id];if(g.type==="expression"){const v=h;if(!v?.expression){c.push({severity:"error",category:"missing-required-param",canvasId:t,edgeId:n,paramId:g.id,message:`Missing required parameter "${g.label}" on edge`});continue}if(es(v)){const x=Sl(v,i),S=Cd(x);S.isValid||c.push({severity:"error",category:"invalid-expression",canvasId:t,edgeId:n,paramId:g.id,message:`Invalid expression for "${g.label}": ${S.errors.join(", ")}`})}}else h||c.push({severity:"error",category:"missing-required-param",canvasId:t,edgeId:n,paramId:g.id,message:`Missing required parameter "${g.label}" on edge`})}return c}function k1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",channelId:e.id,message:"Channel has no label"});const n={...e.arguments,type:e.type};for(const r of Ed.parameters){if(r.id==="type"||!Tr(r,n,!1)||r.optional)continue;const o=e.arguments[r.id];bl(o)&&t.push({severity:"error",category:"missing-required-param",channelId:e.id,paramId:r.id,message:`Missing required parameter "${r.label}" on channel "${e.label}"`})}return t}function T1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",memoryId:e.id,message:"Memory has no label"});const n=Nd.getByType(e.type);for(const r of n?.parameters??[]){if(!Tr(r,e.arguments,!1)||r.optional)continue;const o=e.arguments[r.id];bl(o)&&t.push({severity:"error",category:"missing-required-param",memoryId:e.id,paramId:r.id,message:`Missing required parameter "${r.label}" on memory "${e.label}"`})}return t}function P1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",modelId:e.id,message:"Model has no label"});const n=kd.getByType(e.type);for(const r of n?.parameters??[]){if(!Tr(r,e.arguments,!1)||r.optional)continue;const o=e.arguments[r.id];bl(o)&&t.push({severity:"error",category:"missing-required-param",modelId:e.id,paramId:r.id,message:`Missing required parameter "${r.label}" on model "${e.label}"`})}return t}function R1(e,t){const n=[];for(const r of e){const o=r.expression?.expression;if(!o||o.trim()==="")n.push({severity:"error",category:"missing-output-assignment",outputId:r.uid,message:`Missing return value assignment for "${r.name}"`});else if(t){const i=Cd(Sl(r.expression,t));i.isValid||n.push({severity:"error",category:"invalid-expression",outputId:r.uid,message:`Invalid expression for "${r.name}": ${i.errors.join(", ")}`})}}return n}function FA(e,t){const n=[];(!e.name||e.name.trim()==="")&&n.push({severity:"error",category:"missing-required-param",functionId:e.id,message:"Function has no name"});for(const r of R1(e.outputs,t))n.push({...r,functionId:e.id});return n}function zA(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Td(r);return t}function VA(e){const t=e.canvases??{},n=e.functions??{},r=zA(n),o=e.channels??{},i=e.memory??{},l=e.models??{},c=[];let d=0,f=0;for(const[x,S]of Object.entries(t)){const{nodes:w,edges:E}=S,{lookup:b}=dm(S.variables,E),N=[];for(const A of w){const I=A;let R,j=!1,L=!1;if(I.type==="FunctionCall"){const $=I,B=r[$.functionInfo.id];L=!B,j=B?$.functionInfo.version!==B.version:!1,B?R=wg(B):R=wg($.functionInfo)}else R=Lt.getByType(I.type);const U=E1({canvasId:x,nodeId:A.id,nodeData:I,nodeDefinition:R,availableVariables:b,channels:o,memory:i,models:l,edges:E,isStale:j,isDeleted:L});N.push(...U)}const k=new Map;for(const A of E)cm(A.type)&&k.set(A.source,(k.get(A.source)??0)+1);for(const A of E){const I=A.type??"control",R=N1({canvasId:x,edgeId:A.id,edgeType:I,edgeData:A.data,availableVariables:b,sourceControlEdgeCount:k.get(A.source)??0});N.push(...R)}const P=n[x];if(P)for(const A of R1(P.outputs,b))N.push({...A,canvasId:x});if(N.length>0){const A=N.filter(j=>j.severity==="error").length,I=N.filter(j=>j.severity==="warning").length,R=x===We?"Main":n[x]?.name??x;c.push({canvasId:x,canvasLabel:R,diagnostics:N,errorCount:A,warningCount:I}),d+=A,f+=I}}const g=[];for(const x of Object.values(o))g.push(...k1(x));for(const x of g)x.severity==="error"?d++:f++;const h=[];for(const x of Object.values(i))h.push(...T1(x));for(const x of h)x.severity==="error"?d++:f++;const v=[];for(const x of Object.values(l))v.push(...P1(x));for(const x of v)x.severity==="error"?d++:f++;return{canvases:c,channelDiagnostics:g,memoryDiagnostics:h,modelDiagnostics:v,totalErrors:d,totalWarnings:f}}const HA="Node-Bibliothek",BA="Node-Bibliothek",WA="Diagnose",UA="Funktionsdefinition",KA="Öffnen",GA="Schließen",YA="Speichern",XA="Als JSON exportieren",qA="Versionsverlauf",ZA="Testen",QA="Ausführen",JA="Stoppen",eM="Bereitstellen",tM="Konfigurieren",nM="Node hinzufügen",rM="Node löschen",oM="Node duplizieren",sM="Nodes verbinden",iM="Nodes trennen",aM="Vergrößern",lM="Verkleinern",cM="An Ansicht anpassen",uM="Auto-Layout",dM="Raster",fM="Raster anzeigen",pM="Am Raster ausrichten",hM="Rückgängig",gM="Wiederholen",mM="Ausschneiden",yM="Kopieren",vM="Einfügen",xM="Alle auswählen",wM="Auswahl aufheben",bM="Canvas",SM="Parameter",CM="Verbindungen",EM="Validierung",NM="Fehler",kM="Warnungen",TM="Keine Fehler gefunden",PM="Unbekannter Nodetyp: {{type}}",RM="Node löschen",IM="Auf neueste Definition aktualisieren",_M="Funktionsaufruf-Nodes aktualisiert",AM="{{count}} Node(s) wurden auf die neueste Funktionsdefinition migriert.",MM="Variablen",DM="KI-Modelle",jM="Agenten",OM="Konversationen",$M="Keine Variablen verfügbar",LM="Fügen Sie Nodes hinzu, um deren Ausgabevariablen zu sehen",FM="AI-Agenten für Ihren Workflow verwalten und konfigurieren",zM="Noch keine Agenten konfiguriert",VM="Agent hinzufügen",HM="Verfügbare Agenten",BM="Demnächst...",WM="Konversationsabläufe anzeigen und verwalten",UM="Noch keine Konversationen",KM="Neue Konversation",GM="Vorlagen",YM="Neuer Workflow",XM="Nodes durchsuchen...",qM="Keine Parameter",ZM="+{{count}} weitere",QM="Parameter:",JM="Erforderlich",eD="Optional",tD="Typ:",nD="Standard:",rD="Optionen:",oD="{{count}} Parameter",sD="Text",iD="Zahl",aD="Boolean",lD="Auswahl",cD="Expr",uD="Derzeit sind keine LLM-Modelle verfügbar. Bitte kontaktieren Sie den Support.",dD="Generierte Konfiguration",fD="Projekt importieren",pD="JSON-Konfiguration",hD="JSON-Konfiguration hier einfügen...",gD="Oder Datei hochladen",mD="Workflow speichern",yD="Projekt erstellen",vD="Erstellen",xD="Ungespeicherter Entwurf",wD="Sie haben ungespeicherte Änderungen, die verloren gehen. Trotzdem verlassen?",bD="Das Projekt konnte nicht erstellt werden. Laden Sie Ihre Arbeit als JSON herunter, um sie nicht zu verlieren.",SD="Als JSON herunterladen",CD="Workflow Name eingeben...",ED="Beschreibung (optional)",ND="Kurze Beschreibung des Workflows...",kD="Speichere...",TD="Agenten-Node testen",PD="Sende einen Prompt an den Agenten und streame die Antwort. Die Kosten werden mit deinem Guthaben verrechnet.",RD="Prompt",ID="Beschreibe die Aufgabe für den Agenten",_D="Wird getestet…",AD="Test starten",MD="Stopp",DD="Agent testen",jD="Max. Durchläufe",OD="Tool-Aufruf: {{name}}",$D="Tool-Ergebnis: {{name}}",LD="Endergebnis ({{turns}} Durchläufe)",FD="Strukturierte Ausgabe",zD="Strukturierte Ausgabe konnte nicht als JSON geparst werden",VD="Roh-JSON",HD="Name",BD="Typ",WD="Wert",UD="Kein Node gewählt",KD="Bitte wähle einen Ziel-Node im Canvas.",GD="Import Fehler",YD="Ungültiges JSON-Format",XD="Export erfolgreich",qD="Konfiguration wurde heruntergeladen",ZD="Kopiert",QD="Konfiguration wurde in die Zwischenablage kopiert",JD="Automatischer Checkpoint",e2="Auto",t2="Version umbenennen",n2="Visuelle Vorschau kommt bald",r2="Lade Versionen...",o2="Keine Versionen vorhanden.",s2="Versionen sind schreibgeschützt und können nicht verändert werden.",i2="Dialoge laden…",a2="Versionen laden…",l2="Testdialog lädt…",c2="Aktuell",u2="Neue Funktion",d2="Ausdruck eingeben...",f2="{{type}}-Ausdruck eingeben...",p2="von {{node}}",h2="Funktion hinzufügen",g2="Wiederverwendbare Funktion erstellen",m2="Nodes hinzufügen, um deren Ausgabevariablen zu sehen",y2="Variable hinzufügen",v2="Mit Warnungen fortfahren",x2="Funktion erstellen",w2="Definierte Variablen",b2="Funktion löschen",S2="Funktion löschen?",C2="Fertig",E2="Funktion bearbeiten",N2="Ausdruck für",k2="Arg",T2="Funktionsargumente",P2="Funktionsnamen, Eingaben und Ausgaben konfigurieren.",R2="Argumente, die beim Aufruf der Funktion übergeben werden",I2="Werte, die die Funktion zurückgibt; jeder ist ein Ausdruck über ihre Eingaben und ihren Rumpf",_2="Funktionsname",A2="Funktionsname eingeben...",M2="Funktionen",D2="Funktion öffnen",j2="Globale Variable",O2="Anfangswert",$2="Eingaben",L2="Node-Ausgabevariablen",F2="Keine Kantenparameter",z2="Keine Funktionsinformationen verfügbar",V2="Noch keine Funktionen",H2="Keine Eingaben",B2="Keine Probleme gefunden",W2="Keine Ausgaben",U2="Ausgaben",K2="Rückgabewert-Zuweisungen",G2="Ausdrücke den Funktions-Rückgabewerten zuweisen",Y2="Verbindung löschen",X2="Projekt umbenennen",q2='Die Funktion "{{name}}" aufrufen',Z2="Wert für {{name}} eingeben",Q2="Name der Ausgabevariable für {{name}} eingeben",J2="Diese Funktion und alle zugehörigen Knoten werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",ej="Knoten",tj="Keine Fehler oder Warnungen in Workflow",nj="Validierungsprobleme",rj="{{errorCount}} Fehler und {{warningCount}} Warnung(en) gefunden. Fehler müssen vor dem Export behoben werden.",oj="{{warningCount}} Warnung(en) gefunden. Sie können trotzdem fortfahren.",sj="Version gespeichert",ij="Version konnte nicht gespeichert werden",aj="Version wiederhergestellt",lj="Version konnte nicht wiederhergestellt werden",cj="Version umbenannt",uj="Version konnte nicht umbenannt werden",dj="Die Embedded-Firmware wurde erfolgreich generiert und heruntergeladen.",fj="C-Code generiert",pj="C-Code Generierung fehlgeschlagen",hj="Der C-Code konnte nicht generiert werden.",gj="Visueller Builder für Ihre Projekte.",mj="Projekt nicht gefunden",yj="Das ausgewählte Projekt existiert nicht.",vj="Deployment nicht gefunden",xj={title:"Workflow bereitstellen",description:"Diesen Workflow auf einem Gerät bereitstellen.",redeployTab:"Agent aktualisieren",newAgentTab:"Neuer Agent",selectAgent:"Agent auswählen",redeploy:"Erneut bereitstellen",selectDevice:"Gerät auswählen",agentName:"Agent-Name",agentNamePlaceholder:"z. B. Gewächshaus-Controller",confirm:"Bereitstellen",platform:"Plattform",platformPlaceholder:"Plattform auswählen",submitPush:"An Engine pushen",submitBundle:"Bundle herunterladen",submitCreateAndBundle:"Agent anlegen & herunterladen",method:{sectionTitle:"Deploy-Methode",push:"An Engine pushen",pushHint:"Den Workflow direkt über das lokale Netzwerk an die laufende Engine senden.",bundle:"Bundle herunterladen",bundleHint:"Deploy-Bundle herunterladen und manuell auf dem Gerät anwenden.",includeImage:"Auch Engine-Image (.tar) herunterladen",offlineHint:"Engine ist offline — zuletzt gesehen {{time}}. Bitte das Bundle herunterladen und auf dem Gerät anwenden.",pendingHint:"Engine startet nach dem letzten Deployment. Sie können das Bundle herunterladen, um es manuell anzuwenden.",bootErrorHint:"Engine meldet einen Boot-Fehler. Bitte das Bundle herunterladen und erneut auf dem Gerät anwenden.",newAgentHint:"Ein neuer Agent hat noch keine laufende Engine. Beim Bestätigen wird der Agent angelegt und das Deploy-Bundle für die manuelle Installation heruntergeladen."},redeployHeader:"{{workflow}} auf {{agent}} erneut bereitstellen",success:{push:"Workflow an Engine gepusht",bundle:"Deploy-Bundle heruntergeladen",bundleWithImage:"Bundle und Engine-Image heruntergeladen"},warn:{imageFailed:"Engine-Image-Download fehlgeschlagen",imageFailedDescription:"Bundle wurde erfolgreich heruntergeladen. Sie können den Image-Download von der Agent-Detailseite erneut starten."},error:{save:"Speichern des Workflows fehlgeschlagen",push:"Push an Engine fehlgeschlagen",pushUnreachable:"Engine ist nicht erreichbar — versuchen Sie es mit dem Bundle-Download",pushForbidden:"Engine hat die Anfrage abgelehnt — bitte Agent-Zugangsdaten prüfen",bundle:"Bundle-Download fehlgeschlagen"},releaseInfo:"Release {{number}}",newRelease:"Neues Release wird erstellt",savingChanges:"Änderungen werden gespeichert...",deploying:"Wird bereitgestellt...",deploySuccess:"Erfolgreich bereitgestellt",deploySuccessDesc:"Auf {{device}} bereitgestellt",draftError:"Speichern Sie Ihr Projekt vor der Bereitstellung"},wj={input:"Eingang",output:"Ausgang",logic:"Logik",math:"Mathematik",ai:"KI",control:"Steuerung",sensor:"Sensor",actuator:"Aktor",communication:"Kommunikation",storage:"Speicher",custom:"Benutzerdefiniert"},bj="Hinzufügen",Sj="Abbrechen",Cj={ReadPin:{description:"Daten von einem Pin lesen",params:{pinNumber:{description:"Nummer des zu lesenden Pins"},signalType:{description:"Art des Signals"},outputName:{description:"Name für die erzeugte Ausgabevariable"}}},SerialRead:{description:"Zeichenkette von serieller Schnittstelle lesen",params:{prompt:{description:"Aufforderung für den seriellen Lesevorgang"},outputName:{description:"Name der Variable für den gelesenen Wert"}}},Retriever:{description:"Ruft relevante Dokumente aus einer Wissensdatenbank ab",params:{memoryReference:{description:"Die zu durchsuchende Vektordatenbank"},topK:{description:"Anzahl der abzurufenden Ergebnisse"},outputName:{description:"Variablenname für die abgerufenen Ergebnisse"}}},WritePin:{description:"Daten an einen Pin schreiben",params:{pinNumber:{description:"Nummer des zu beschreibenden Pins"},signalType:{description:"Art des Signals"},value:{description:"Welcher Wert an den Pin geschrieben werden soll"}}},SerialWrite:{description:"Zeichenkette an serielle Schnittstelle schreiben",params:{value:{description:"Ausdruck für den zu schreibenden Wert"}}},OnFunctionCall:{description:"Wird ausgelöst, wenn diese Funktion von einem Funktionsaufruf-Knoten aufgerufen wird"},Delay:{description:"Pausiert die Ausführung für eine bestimmte Dauer und löst aus, wenn die Verzögerung abgeschlossen ist. Während dieser Pause können andere Knotenketten ausgeführt werden.",params:{delayMs:{description:"Zeit in Millisekunden für die Pause"}}},Ticker:{description:"Wird wiederholt in einem festgelegten Intervall ausgelöst",params:{intervalValue:{description:"Anzahl der Einheiten zwischen Takten"},intervalUnit:{description:"Zeiteinheit für das Intervall"}}},Alarm:{description:"Wird zu einer geplanten Zeit an ausgewählten Wochentagen ausgelöst",params:{time:{description:"Tageszeit für die Auslösung (24-Stunden-Format)"},days:{description:"Wochentage für die Auslösung (leer = jeden Tag)"}}},OnStartup:{description:"Wird einmal ausgelöst, wenn das Gerät eingeschaltet wird"},OnPinChange:{description:"Wird ausgelöst, wenn sich ein Pin-Wert ändert",params:{pinNumber:{description:"Zu überwachende Pin-Nummer"},outputName:{description:"Name der Variable, die den Pin-Wert enthält, wenn der Trigger ausgelöst wird"},mode:{description:"Ob der Pin als digital oder analog gelesen werden soll"},edge:{description:"Welcher Flankenübergang das Ereignis auslöst"},threshold:{description:"Analoger Schwellenwert (0-1023)"},direction:{description:"Richtung der Schwellenwertüberschreitung, die das Ereignis auslöst"}}},OnSerialReceive:{description:"Wird ausgelöst, wenn serielle Daten eintreffen"},OnThreshold:{description:"Wird ausgelöst, wenn ein Ausdruckswert einen Schwellenwert überschreitet",params:{value:{description:"Zu überwachender Ausdruck"},threshold:{description:"Schwellenwert"},direction:{description:"Richtung der Schwellenwertüberschreitung, die das Ereignis auslöst"}}},Agent:{description:"KI-gesteuerter Agent für intelligente Verarbeitung",params:{name:{description:"Name des Agenten"},model:{description:"KI-Modell für den Cloud-Agenten"},instructions:{description:"Anweisungen für den Cloud-Agenten als Systemaufforderung"}}},If:{description:"Bedingte Verzweigung basierend auf booleschem Ausdruck",params:{condition:{description:"Boolescher Ausdruck (z.B. ${Input_1.value} > 50)"}}},SetVariable:{description:"Einer bestehenden Variable einen neuen Wert zuweisen",params:{variable:{description:"Die zu aktualisierende Variable"},value:{description:"Zuzuweisender Ausdruck"}}},WebSearchTool:{description:"Stellt Websuchfunktionalität für verbundene Agenten bereit",params:{maxResults:{description:"Maximale Anzahl der zurückzugebenden Suchergebnisse"},searchDomain:{description:"Optionale Domäne zur Einschränkung der Suche"}}}},Ej={agentTask:{description:"Weist einem Agenten eine Aufgabe mit einem Prompt zu"},agentChoice:{description:"Ein Pfad, den der Agent basierend auf seiner Beschreibung wählen kann"},agentDelegate:{description:"Ermöglicht einem Agenten, die Kontrolle an einen anderen Agenten zu übergeben"},control:{description:"Sequenzieller Steuerungsfluss zwischen Knoten"},tool:{description:"Werkzeugverbindung zwischen Knoten"}},Nj={nodeLibrary:HA,blockLibrary:BA,diagnostics:WA,functionDefinition:UA,open:KA,close:GA,save:YA,exportAsJSON:XA,versionHistory:qA,test:ZA,run:QA,stop:JA,deploy:eM,configure:tM,addBlock:nM,deleteBlock:rM,duplicateBlock:oM,connectBlocks:sM,disconnectBlocks:iM,zoomIn:aM,zoomOut:lM,fitView:cM,autoLayout:uM,grid:dM,showGrid:fM,snapToGrid:pM,undo:hM,redo:gM,cut:mM,copy:yM,paste:vM,selectAll:xM,deselectAll:wM,delete:"Löschen",canvas:bM,parameters:SM,connections:CM,validation:EM,errors:NM,warnings:kM,noErrors:TM,unknownNodeType:PM,deleteNode:RM,updateToLatestDefinition:IM,functionCallNodesMigrated:_M,functionCallNodesMigratedDesc:AM,variables:MM,models:DM,agents:jM,conversations:OM,noVariables:$M,addBlocksForVariables:LM,agentsDescription:FM,noAgentsConfigured:zM,addAgent:VM,availableAgents:HM,comingSoon:BM,conversationsDescription:WM,noConversations:UM,newConversation:KM,conversationTemplates:GM,newWorkflow:YM,searchBlocks:XM,noParameters:qM,moreCount:ZM,parametersLabel:QM,required:JM,optional:eD,typeLabel:tD,defaultLabel:nD,optionsLabel:rD,parameterCount:oD,paramTypeText:sD,paramTypeNumber:iD,paramTypeBoolean:aD,paramTypeSelection:lD,paramTypeExpression:cD,noModelsAvailable:uD,generatedConfig:dD,importProject:fD,jsonConfig:pD,jsonConfigPlaceholder:hD,orUploadFile:gD,import:"Importieren",saveWorkflow:mD,createProject:yD,create:vD,unsavedDraft:xD,unsavedDraftWarning:wD,saveFailedMessage:bD,downloadAsJSON:SD,namePlaceholder:CD,descriptionOptional:ED,descriptionPlaceholder:ND,saving:kD,testAgentNode:TD,testAgentDescription:PD,prompt:RD,promptPlaceholder:ID,testing:_D,startTest:AD,stopTest:MD,testAgent:DD,maxTurns:jD,toolCall:OD,toolResult:$D,finalOutput:LD,structuredOutput:FD,structuredOutputParseError:zD,rawJson:VD,outputName:HD,outputType:BD,outputValue:WD,noNodeSelected:UD,selectNodeMessage:KD,importError:GD,invalidJson:YD,exportSuccess:XD,configDownloaded:qD,copied:ZD,configCopied:QD,autoVersionMessage:JD,autoVersionLabel:e2,"saveStatus.saved":"Gespeichert","saveStatus.saving":"Speichern...","saveStatus.unsaved":"Ungespeicherte Änderungen",versionRenameTooltip:t2,versionPreviewPlaceholder:n2,"preview.viewingVersion":"Version #{{number}} vom {{date}}","preview.restore":"Wiederherstellen","preview.cancel":"Zurück zum aktuellen Stand","preview.viewButton":"Ansehen","preview.viewOnly":"Nur Ansicht","preview.noPreview":"Version auswählen für Vorschau","preview.selectVersion":"Version auswählen zum Ansehen","preview.template":"Template: {{name}}","preview.useAsProject":"Als Projekt verwenden","preview.emptyCanvas":"Keine Nodes in dieser Version","preview.setAsCurrent":"Als aktuell setzen","preview.returnToCurrent":"Zurück zur aktuellen","debug.session":"Debug-Sitzung","debug.start":"Debug","debug.stop":"Stopp","debug.step":"Schritt","debug.building":"Kompiliert","debug.idle":"Bereit","debug.paused":"Pausiert","debug.stepping":"Ausführung","debug.error":"Fehler","debug.console":"Konsole","debug.clearConsole":"Konsole leeren","debug.consoleEmpty":"Konsolenausgaben erscheinen hier während der Ausführung.","debug.context":"Kontext","debug.externalIO":"Externe E/A","debug.noVariables":"Keine Workflow-Variablen definiert.","debug.noInputsNeeded":"Keine externen Eingaben für diesen Node erforderlich.","debug.selectNode":"Wähle einen Node zum Debuggen.","debug.triggerNotSteppable":"Trigger-Nodes können nicht einzeln ausgeführt werden. Wähle einen nachfolgenden Node.","debug.gpioPin":"GPIO Pin {{pin}}","debug.serialInput":"Serielle Eingabe","debug.serialPlaceholder":"Serielle Daten eingeben...",versionsLoading:r2,noVersions:o2,versionsReadOnly:s2,loadingDialogs:i2,loadingVersions:a2,loadingTest:l2,current:c2,newFunction:u2,enterExpression:d2,enterTypeExpression:f2,fromNode:p2,addFunction:h2,addFunctionHint:g2,addNodesForVariables:m2,addVariable:y2,continueWithWarnings:v2,createFunction:x2,definedVariables:w2,deleteFunction:b2,deleteFunctionTitle:S2,done:C2,editFunction:E2,expressionFor:N2,fnarg:k2,functionArguments:T2,functionDialogDesc:P2,functionInputsDesc:R2,functionOutputsDesc:I2,functionName:_2,functionNamePlaceholder:A2,functions:M2,openFunction:D2,globalVariable:j2,initialValue:O2,inputs:$2,nodeOutputVariables:L2,noEdgeParams:F2,noFunctionInfo:z2,noFunctions:V2,noInputs:H2,noIssuesFound:B2,noOutputs:W2,outputs:U2,returnValueAssignments:K2,returnValueAssignmentsDesc:G2,deleteEdge:Y2,renameProject:X2,functionCallDesc:q2,functionParamDesc:Z2,functionOutputDesc:Q2,deleteFunctionDesc:J2,nodeLabel:ej,validationPassed:tj,validationIssues:nj,validationErrorsDesc:rj,validationWarningsDesc:oj,versionSaved:sj,versionSaveError:ij,versionRestored:aj,versionRestoreError:lj,versionRenamed:cj,versionRenameError:uj,codeGenSuccess:dj,codeGenTitle:fj,codeGenError:pj,codeGenErrorDesc:hj,seoDescription:gj,projectNotFound:mj,projectNotFoundDesc:yj,deploymentNotFound:vj,deployDialog:xj,blocks:wj,add:bj,cancel:Sj,nodes:Cj,edges:Ej},kj="Export as JSON",Tj="Node Library",Pj="Node Library",Rj="Diagnostics",Ij="Function Definition",_j="Open",Aj="Close",Mj="Save",Dj="Version History",jj="Test",Oj="Run",$j="Stop",Lj="Deploy",Fj="Configure",zj="Add Node",Vj="Delete Node",Hj="Duplicate Node",Bj="Connect Nodes",Wj="Disconnect Nodes",Uj="Zoom In",Kj="Zoom Out",Gj="Fit to View",Yj="Auto Layout",Xj="Grid",qj="Show Grid",Zj="Snap to Grid",Qj="Undo",Jj="Redo",eO="Cut",tO="Copy",nO="Paste",rO="Select All",oO="Deselect All",sO="Canvas",iO="Parameters",aO="Connections",lO="Validation",cO="Errors",uO="Warnings",dO="No errors found",fO="Unknown node type: {{type}}",pO="Delete Node",hO="Update to latest definition",gO="Function call nodes updated",mO="{{count}} node(s) were migrated to the latest function definition.",yO="Variables",vO="Agents",xO="Conversations",wO="No variables available",bO="Add nodes to see their output variables",SO="Manage and configure AI agents for your workflow",CO="No agents configured yet",EO="Add Agent",NO="Available Agents",kO="Coming soon...",TO="View and manage conversation flows",PO="No conversations yet",RO="New Conversation",IO="Templates",_O="New Workflow",AO="Search nodes...",MO="No parameters",DO="+{{count}} more",jO="Parameters:",OO="Required",$O="Optional",LO="Type:",FO="Default:",zO="Options:",VO="{{count}} parameter",HO="Text",BO="Number",WO="Boolean",UO="Selection",KO="Expr",GO="No LLM models are currently available. Please contact support.",YO="Generated Configuration",XO="Import Project",qO="JSON Configuration",ZO="Paste JSON configuration here...",QO="Or upload file",JO="Save Workflow",e$="Create Project",t$="Create",n$="Unsaved draft",r$="You have unsaved changes that will be lost. Leave anyway?",o$="Could not create the project. Download your work as JSON to avoid losing it.",s$="Download as JSON",i$="Enter workflow name...",a$="Description (optional)",l$="Short description of the workflow...",c$="Saving...",u$="Test Agent Node",d$="Send a prompt to the agent and stream the response. Costs are charged to your balance.",f$="Prompt",p$="Describe the task for the agent",h$="Testing...",g$="Start Test",m$="Stop",y$="Test Agent",v$="Max Turns",x$="Tool Call: {{name}}",w$="Tool Result: {{name}}",b$="Final Output ({{turns}} turns)",S$="Structured Output",C$="Could not parse structured output as JSON",E$="Raw JSON",N$="Name",k$="Type",T$="Value",P$="No node selected",R$="Please select a target node on the canvas.",I$="Import Error",_$="Invalid JSON format",A$="Export successful",M$="Configuration was downloaded",D$="Copied",j$="Configuration was copied to clipboard",O$="Automatic checkpoint",$$="Auto",L$="Rename version",F$="Visual preview coming soon",z$="Loading versions...",V$="No versions available.",H$="Versions are read-only and cannot be modified.",B$="Loading dialogs...",W$="Loading versions...",U$="Loading test dialog...",K$="Current",G$="New Function",Y$="Enter expression...",X$="Enter {{type}} expression...",q$="from {{node}}",Z$="Add Function",Q$="Create a reusable function",J$="Add nodes to see their output variables",eL="Add Variable",tL="Continue with Warnings",nL="Create Function",rL="Defined Variables",oL="Delete Function",sL="Delete Function?",iL="Done",aL="Edit Function",lL="Expression for",cL="Arg",uL="Function Arguments",dL="Configure the function name, inputs and outputs.",fL="Arguments passed in when the function is called",pL="Values the function returns; each is an expression over its inputs and body",hL="Function Name",gL="Enter function name...",mL="Functions",yL="Open function",vL="Global Variable",xL="Data type",wL="Delete variable",bL="Variable name",SL="Name is required",CL="A declared variable you can read and write across this canvas",EL="Initial Value",NL="Inputs",kL="Node Output Variables",TL="No edge parameters",PL="No function information available",RL="No functions yet",IL="No inputs",_L="No channels defined yet",AL="Add channels to declare the hardware interfaces your workflow needs",ML="Channels",DL="Label",jL="Add Channel",OL="Select a channel...",$L="No memory files yet",LL="Declare durable storage your agents can read or write",FL="Memory",zL="Add Memory File",VL="Delete memory file",HL="Memory file name",BL="Agent-scoped durable storage",WL="Name is required",UL="Name must be unique per agent",KL="No memory files declared yet. Add one from the Memory tab in the sidebar.",GL="Select memory file...",YL="Deleted memory file",XL="Add memory ref",qL="Remove memory ref",ZL="Read",QL="Read + Write",JL="No memory declared yet",eF="Declare memory files for agents and vector databases for RAG",tF="Add Vector Database",nF="Select memory...",rF="Memory label",oF="Label is required",sF="Label must be unique per agent",iF="Delete memory",aF="AI Models",lF="No custom models yet",cF="Built-in models are always available. Declare custom or self-hosted models here.",uF="Add Custom Model",dF="LLM",fF="Select model...",pF="Model label",hF="Label is required",gF="Custom model mapped to a provider at deploy",mF="Delete model",yF="Create new pin...",vF="Capabilities",xF="Protocol",wF="No issues found",bF="No outputs",SF="Outputs",CF="Return Value Assignments",EF="Assign expressions to function return values",NF="Delete Edge",kF="Rename project",TF='Invoke the "{{name}}" function',PF="Enter value for {{name}}",RF="Enter name of output variable for {{name}}",IF="This will permanently delete this function and all its nodes. This action cannot be undone.",_F="Node",AF="No errors or warnings in workflow",MF="Validation Issues",DF="{{errorCount}} error(s) and {{warningCount}} warning(s) found. Fix errors before exporting.",jF="{{warningCount}} warning(s) found. You can still proceed.",OF="Version saved",$F="Version could not be saved",LF="Version restored",FF="Version could not be restored",zF="Version renamed",VF="Version could not be renamed",HF="Embedded firmware was successfully generated and downloaded.",BF="C code generated",WF="C code generation failed",UF="C code could not be generated.",KF="Visual builder for your projects.",GF="Project not found",YF="The selected project does not exist.",XF="Deployment not found",qF={title:"Deploy Workflow",description:"Deploy this workflow to a device.",redeployTab:"Update Agent",newAgentTab:"New Agent",selectAgent:"Select an agent",redeploy:"Redeploy",selectDevice:"Select a device",agentName:"Agent name",agentNamePlaceholder:"e.g. Greenhouse Controller",confirm:"Deploy",platform:"Platform",platformPlaceholder:"Select a platform",submitPush:"Push to engine",submitBundle:"Download bundle",submitCreateAndBundle:"Create agent & download",method:{sectionTitle:"Deploy method",push:"Push to engine",pushHint:"Send the workflow directly to the running engine over the local network.",bundle:"Download bundle",bundleHint:"Download the deploy bundle and apply it on the device manually.",includeImage:"Also download engine image (.tar)",offlineHint:"Engine is offline — last seen {{time}}. Download the bundle and apply it on the device.",pendingHint:"Engine is still booting after the latest deployment. Download the bundle if you want to re-apply manually.",bootErrorHint:"Engine reported a boot error. Download the bundle and re-apply on the device.",newAgentHint:"A new agent has no running engine yet. Submit creates the agent and downloads the deploy bundle for manual install."},redeployHeader:"Redeploy {{workflow}} to {{agent}}",success:{push:"Workflow pushed to engine",bundle:"Deploy bundle downloaded",bundleWithImage:"Bundle and engine image downloaded"},warn:{imageFailed:"Engine image download failed",imageFailedDescription:"Bundle was downloaded successfully. You can retry the engine image download from the agent details page."},error:{save:"Saving the workflow failed",push:"Push to engine failed",pushUnreachable:"Engine is unreachable — try downloading the bundle instead",pushForbidden:"Engine rejected the request — check agent credentials",bundle:"Bundle download failed"},releaseInfo:"Release {{number}}",newRelease:"New release will be created",existingRelease:"Deploying existing release",savingChanges:"Saving changes...",deploying:"Deploying...",deploySuccess:"Deployed successfully",deploySuccessDesc:"Deployed to {{device}}",draftError:"Save your project before deploying"},ZF={title:"Map Pins to Board",description:"Drag each IO pin onto a compatible board pin",unassignedPins:"Unassigned Pins",allMapped:"All pins mapped",confirm:"Generate Code",clickToUnassign:"Click to unassign"},QF={input:"Input",output:"Output",logic:"Logic",math:"Math",ai:"AI",control:"Control",sensor:"Sensor",actuator:"Actuator",communication:"Communication",storage:"Storage",custom:"Custom"},JF="Add",ez="Cancel",tz={ReadPin:{description:"Read data from a pin",params:{pinNumber:{description:"Number of the pin to read"},signalType:{description:"Type of signal"},outputName:{description:"Name for the generated output variable"}}},SerialRead:{description:"Read a string from serial interface",params:{prompt:{description:"Prompt for the serial read operation"},outputName:{description:"Variable name for the read value"}}},Retriever:{description:"Retrieves relevant documents from a knowledge base",params:{memoryReference:{description:"The vector database to search"},topK:{description:"Number of results to retrieve"},outputName:{description:"Variable name for the retrieved results"}}},WritePin:{description:"Write data to a pin",params:{pinNumber:{description:"Number of the pin to write to"},signalType:{description:"Type of signal"},value:{description:"Value to write to the pin"}}},SerialWrite:{description:"Write a string to serial interface",params:{value:{description:"Expression for the value to write"}}},OnFunctionCall:{description:"Triggers when this function is called by a function call node"},Delay:{description:"Pauses execution for a specified duration and triggers when the delay completes. Other node chains can execute during this pause.",params:{delayMs:{description:"Time in milliseconds to pause"}}},Ticker:{description:"Triggers repeatedly at a fixed interval",params:{intervalValue:{description:"Number of units between ticks"},intervalUnit:{description:"Time unit for the interval"}}},Alarm:{description:"Triggers at a scheduled time on selected weekdays",params:{time:{description:"Time of day to trigger (24-hour format)"},days:{description:"Weekdays to trigger on (empty = every day)"}}},OnStartup:{description:"Triggers once when the device powers on"},OnPinChange:{description:"Triggers when a pin value changes",params:{pinNumber:{description:"Pin number to monitor"},outputName:{description:"Variable name that holds the pin value when the trigger fires"},mode:{description:"Whether to read the pin as digital or analog"},edge:{description:"Which edge transition triggers the event"},threshold:{description:"Analog threshold value (0-1023)"},direction:{description:"Direction of threshold crossing that triggers the event"}}},OnSerialReceive:{description:"Triggers when serial data arrives"},OnThreshold:{description:"Triggers when an expression value crosses a threshold",params:{value:{description:"Expression to monitor"},threshold:{description:"Threshold value"},direction:{description:"Direction of threshold crossing that triggers the event"}}},Agent:{description:"AI-powered agent for intelligent processing",params:{name:{description:"Name of the agent"},model:{description:"AI model for the cloud agent"},instructions:{description:"Instructions for the cloud agent as system prompt"}}},If:{description:"Conditional branching based on boolean expression",params:{condition:{description:"Boolean expression (e.g. ${Input_1.value} > 50)"}}},SetVariable:{description:"Assign a new value to an existing variable",params:{variable:{description:"The variable to update"},value:{description:"Expression to assign"}}},WebSearchTool:{description:"Provides web search functionality for connected agents",params:{maxResults:{description:"Maximum number of search results to return"},searchDomain:{description:"Optional domain to restrict the search"}}}},nz={agentTask:{description:"Assigns a task with a prompt to an agent"},agentChoice:{description:"A path the agent can choose based on its description"},agentDelegate:{description:"Allows an agent to hand off control to another agent"},control:{description:"Sequential control flow between nodes"},tool:{description:"Tool connection between nodes"}},rz={exportAsJSON:kj,nodeLibrary:Tj,blockLibrary:Pj,diagnostics:Rj,functionDefinition:Ij,open:_j,close:Aj,save:Mj,versionHistory:Dj,test:jj,run:Oj,stop:$j,deploy:Lj,configure:Fj,addBlock:zj,deleteBlock:Vj,duplicateBlock:Hj,connectBlocks:Bj,disconnectBlocks:Wj,zoomIn:Uj,zoomOut:Kj,fitView:Gj,autoLayout:Yj,grid:Xj,showGrid:qj,snapToGrid:Zj,undo:Qj,redo:Jj,cut:eO,copy:tO,paste:nO,selectAll:rO,deselectAll:oO,delete:"Delete",canvas:sO,parameters:iO,connections:aO,validation:lO,errors:cO,warnings:uO,noErrors:dO,unknownNodeType:fO,deleteNode:pO,updateToLatestDefinition:hO,functionCallNodesMigrated:gO,functionCallNodesMigratedDesc:mO,variables:yO,agents:vO,conversations:xO,noVariables:wO,addBlocksForVariables:bO,agentsDescription:SO,noAgentsConfigured:CO,addAgent:EO,availableAgents:NO,comingSoon:kO,conversationsDescription:TO,noConversations:PO,newConversation:RO,conversationTemplates:IO,newWorkflow:_O,searchBlocks:AO,noParameters:MO,moreCount:DO,parametersLabel:jO,required:OO,optional:$O,typeLabel:LO,defaultLabel:FO,optionsLabel:zO,parameterCount:VO,paramTypeText:HO,paramTypeNumber:BO,paramTypeBoolean:WO,paramTypeSelection:UO,paramTypeExpression:KO,noModelsAvailable:GO,generatedConfig:YO,importProject:XO,jsonConfig:qO,jsonConfigPlaceholder:ZO,orUploadFile:QO,import:"Import",saveWorkflow:JO,createProject:e$,create:t$,unsavedDraft:n$,unsavedDraftWarning:r$,saveFailedMessage:o$,downloadAsJSON:s$,namePlaceholder:i$,descriptionOptional:a$,descriptionPlaceholder:l$,saving:c$,testAgentNode:u$,testAgentDescription:d$,prompt:f$,promptPlaceholder:p$,testing:h$,startTest:g$,stopTest:m$,testAgent:y$,maxTurns:v$,toolCall:x$,toolResult:w$,finalOutput:b$,structuredOutput:S$,structuredOutputParseError:C$,rawJson:E$,outputName:N$,outputType:k$,outputValue:T$,noNodeSelected:P$,selectNodeMessage:R$,importError:I$,invalidJson:_$,exportSuccess:A$,configDownloaded:M$,copied:D$,configCopied:j$,autoVersionMessage:O$,autoVersionLabel:$$,"saveStatus.saved":"Saved","saveStatus.saving":"Saving...","saveStatus.unsaved":"Unsaved changes",versionRenameTooltip:L$,versionPreviewPlaceholder:F$,"preview.viewingVersion":"Version #{{number}} from {{date}}","preview.restore":"Restore","preview.cancel":"Back to current","preview.viewButton":"Inspect","preview.viewOnly":"View only","preview.noPreview":"Select a version to preview","preview.selectVersion":"Select a version to inspect","preview.template":"Template: {{name}}","preview.useAsProject":"Use as Project","preview.emptyCanvas":"No nodes in this version","preview.setAsCurrent":"Set as current","preview.returnToCurrent":"Return to current","debug.session":"Debug Session","debug.start":"Debug","debug.stop":"Stop","debug.step":"Step","debug.building":"Building","debug.idle":"Idle","debug.paused":"Paused","debug.stepping":"Stepping","debug.error":"Error","debug.console":"Console","debug.clearConsole":"Clear console","debug.consoleEmpty":"Console output will appear here during execution.","debug.context":"Context","debug.externalIO":"External I/O","debug.noVariables":"No workflow variables defined.","debug.noInputsNeeded":"No external inputs needed for this node.","debug.selectNode":"Select a node to debug.","debug.triggerNotSteppable":"Trigger nodes cannot be stepped. Select a downstream node to begin debugging.","debug.gpioPin":"GPIO Pin {{pin}}","debug.serialInput":"Serial Input","debug.serialPlaceholder":"Enter serial data...",versionsLoading:z$,noVersions:V$,versionsReadOnly:H$,loadingDialogs:B$,loadingVersions:W$,loadingTest:U$,current:K$,newFunction:G$,enterExpression:Y$,enterTypeExpression:X$,fromNode:q$,addFunction:Z$,addFunctionHint:Q$,addNodesForVariables:J$,addVariable:eL,continueWithWarnings:tL,createFunction:nL,definedVariables:rL,deleteFunction:oL,deleteFunctionTitle:sL,done:iL,editFunction:aL,expressionFor:lL,fnarg:cL,functionArguments:uL,functionDialogDesc:dL,functionInputsDesc:fL,functionOutputsDesc:pL,functionName:hL,functionNamePlaceholder:gL,functions:mL,openFunction:yL,globalVariable:vL,dataType:xL,deleteVariable:wL,variableName:bL,variableNameRequired:SL,variableDescription:CL,initialValue:EL,inputs:NL,nodeOutputVariables:kL,noEdgeParams:TL,noFunctionInfo:PL,noFunctions:RL,noInputs:IL,noChannels:_L,noChannelsHint:AL,channels:ML,channelLabelHeading:DL,addChannel:jL,selectChannel:OL,noMemoryFiles:$L,noMemoryFilesHint:LL,memoryFiles:FL,addMemoryFile:zL,deleteMemoryFile:VL,memoryFileName:HL,memoryFileDescription:BL,memoryFileNameRequired:WL,memoryFileNameDuplicate:UL,noMemoryFilesForAgent:KL,selectMemoryFile:GL,memoryRefStale:YL,addMemoryRef:XL,removeMemoryRef:qL,memoryModeRead:ZL,memoryModeReadWrite:QL,noMemory:JL,noMemoryHint:eF,addVectorDatabase:tF,selectMemory:nF,memoryLabel:rF,memoryLabelRequired:oF,memoryLabelDuplicate:sF,deleteMemory:iF,models:aF,noModels:lF,noModelsHint:cF,addCustomModel:uF,modelLLMBadge:dF,selectModel:fF,modelLabel:pF,modelLabelRequired:hF,modelCustomDescription:gF,deleteModel:mF,createNewPin:yF,capabilities:vF,protocol:xF,noIssuesFound:wF,noOutputs:bF,outputs:SF,returnValueAssignments:CF,returnValueAssignmentsDesc:EF,deleteEdge:NF,renameProject:kF,functionCallDesc:TF,functionParamDesc:PF,functionOutputDesc:RF,deleteFunctionDesc:IF,nodeLabel:_F,validationPassed:AF,validationIssues:MF,validationErrorsDesc:DF,validationWarningsDesc:jF,versionSaved:OF,versionSaveError:$F,versionRestored:LF,versionRestoreError:FF,versionRenamed:zF,versionRenameError:VF,codeGenSuccess:HF,codeGenTitle:BF,codeGenError:WF,codeGenErrorDesc:UF,seoDescription:KF,projectNotFound:GF,projectNotFoundDesc:YF,deploymentNotFound:XF,deployDialog:qF,pinMapping:ZF,blocks:QF,add:JF,cancel:ez,nodes:tz,edges:nz},oz={de:{translation:Nj},en:{translation:rz}},mr=Tt.createInstance();mr.init({resources:oz,fallbackLng:"en",lng:"en",interpolation:{escapeValue:!1},defaultNS:"translation",react:{useSuspense:!1,bindI18n:"languageChanged"}});const sz=1,iz=1e6;let Ph=0;function az(){return Ph=(Ph+1)%Number.MAX_SAFE_INTEGER,Ph.toString()}const Rh=new Map;function z0(e){if(Rh.has(e))return;const t=setTimeout(()=>{Rh.delete(e),Xa({type:"REMOVE_TOAST",toastId:e})},iz);Rh.set(e,t)}const lz=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,sz)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?z0(n):e.toasts.forEach(r=>z0(r.id)),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Iu=[];let _u={toasts:[]};function Xa(e){_u=lz(_u,e),Iu.forEach(t=>t(_u))}function Gt({...e}){const t=az(),n=o=>Xa({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Xa({type:"DISMISS_TOAST",toastId:t});return Xa({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function cz(){const[e,t]=m.useState(_u);return m.useEffect(()=>(Iu.push(t),()=>{const n=Iu.indexOf(t);n>-1&&Iu.splice(n,1)}),[]),{...e,toast:Gt,dismiss:n=>Xa({type:"DISMISS_TOAST",toastId:n})}}const uz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I1=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var dz={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const fz=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:l,...c},d)=>m.createElement("svg",{ref:d,...dz,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:I1("lucide",o),...c},[...l.map(([f,g])=>m.createElement(f,g)),...Array.isArray(i)?i:[i]]));const je=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(fz,{ref:i,iconNode:t,className:I1(`lucide-${uz(e)}`,r),...o}));return n.displayName=`${e}`,n};const V0=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const pz=je("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);const hz=je("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const gz=je("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const mz=je("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const _1=je("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);const yz=je("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const vz=je("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);const A1=je("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Ii=je("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Cl=je("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const xz=je("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Pd=je("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const M1=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const D1=je("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const bg=je("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const j1=je("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const wz=je("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const bz=je("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const Sz=je("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const Cz=je("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const Ez=je("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);const Nz=je("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const kz=je("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Tz=je("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const ts=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Pz=je("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);const Rz=je("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const Iz=je("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const O1=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const _z=je("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const $1=je("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);const Az=je("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const Mz=je("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);const El=je("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const mo=je("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const H0=je("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);const Dz=je("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);const Ku=je("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);const jz=je("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);const Oz=je("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const Rd=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const $z=je("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function L1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=L1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function F1(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=L1(e))&&(r&&(r+=" "),r+=t);return r}const B0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,W0=F1,yo=(e,t)=>n=>{var r;if(t?.variants==null)return W0(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,l=Object.keys(o).map(f=>{const g=n?.[f],h=i?.[f];if(g===null)return null;const v=B0(g)||B0(h);return o[f][v]}),c=n&&Object.entries(n).reduce((f,g)=>{let[h,v]=g;return v===void 0||(f[h]=v),f},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,g)=>{let{class:h,className:v,...x}=g;return Object.entries(x).every(S=>{let[w,E]=S;return Array.isArray(E)?E.includes({...i,...c}[w]):{...i,...c}[w]===E})?[...f,h,v]:f},[]);return W0(e,l,d,n?.class,n?.className)},fm="-",Lz=e=>{const t=zz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const c=l.split(fm);return c[0]===""&&c.length!==1&&c.shift(),z1(c,t)||Fz(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&r[l]?[...d,...r[l]]:d}}},z1=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?z1(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(fm);return t.validators.find(({validator:l})=>l(i))?.classGroupId},U0=/^\[(.+)\]$/,Fz=e=>{if(U0.test(e)){const t=U0.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zz=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Hz(Object.entries(e.classGroups),n).forEach(([i,l])=>{Sg(l,r,i,t)}),r},Sg=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:K0(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Vz(o)){Sg(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{Sg(l,K0(t,i),n,r)})})},K0=(e,t)=>{let n=e;return t.split(fm).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Vz=e=>e.isThemeGetter,Hz=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,c])=>[t+l,c])):i);return[n,o]}):e,Bz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},V1="!",Wz=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,l=c=>{const d=[];let f=0,g=0,h;for(let E=0;E<c.length;E++){let b=c[E];if(f===0){if(b===o&&(r||c.slice(E,E+i)===t)){d.push(c.slice(g,E)),g=E+i;continue}if(b==="/"){h=E;continue}}b==="["?f++:b==="]"&&f--}const v=d.length===0?c:c.substring(g),x=v.startsWith(V1),S=x?v.substring(1):v,w=h&&h>g?h-g:void 0;return{modifiers:d,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:w}};return n?c=>n({className:c,parseClassName:l}):l},Uz=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Kz=e=>({cache:Bz(e.cacheSize),parseClassName:Wz(e),...Lz(e)}),Gz=/\s+/,Yz=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(Gz);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{modifiers:g,hasImportantModifier:h,baseClassName:v,maybePostfixModifierPosition:x}=n(f);let S=!!x,w=r(S?v.substring(0,x):v);if(!w){if(!S){c=f+(c.length>0?" "+c:c);continue}if(w=r(v),!w){c=f+(c.length>0?" "+c:c);continue}S=!1}const E=Uz(g).join(":"),b=h?E+V1:E,N=b+w;if(i.includes(N))continue;i.push(N);const k=o(w,S);for(let P=0;P<k.length;++P){const A=k[P];i.push(b+A)}c=f+(c.length>0?" "+c:c)}return c};function Xz(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=H1(t))&&(r&&(r+=" "),r+=n);return r}const H1=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=H1(e[r]))&&(n&&(n+=" "),n+=t);return n};function qz(e,...t){let n,r,o,i=l;function l(d){const f=t.reduce((g,h)=>h(g),e());return n=Kz(f),r=n.cache.get,o=n.cache.set,i=c,c(d)}function c(d){const f=r(d);if(f)return f;const g=Yz(d,n);return o(d,g),g}return function(){return i(Xz.apply(null,arguments))}}const rt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},B1=/^\[(?:([a-z-]+):)?(.+)\]$/i,Zz=/^\d+\/\d+$/,Qz=new Set(["px","full","screen"]),Jz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,t3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pr=e=>ii(e)||Qz.has(e)||Zz.test(e),Jr=e=>_i(e,"length",d3),ii=e=>!!e&&!Number.isNaN(Number(e)),Ih=e=>_i(e,"number",ii),Ma=e=>!!e&&Number.isInteger(Number(e)),o3=e=>e.endsWith("%")&&ii(e.slice(0,-1)),$e=e=>B1.test(e),eo=e=>Jz.test(e),s3=new Set(["length","size","percentage"]),i3=e=>_i(e,s3,W1),a3=e=>_i(e,"position",W1),l3=new Set(["image","url"]),c3=e=>_i(e,l3,p3),u3=e=>_i(e,"",f3),Da=()=>!0,_i=(e,t,n)=>{const r=B1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},d3=e=>e3.test(e)&&!t3.test(e),W1=()=>!1,f3=e=>n3.test(e),p3=e=>r3.test(e),h3=()=>{const e=rt("colors"),t=rt("spacing"),n=rt("blur"),r=rt("brightness"),o=rt("borderColor"),i=rt("borderRadius"),l=rt("borderSpacing"),c=rt("borderWidth"),d=rt("contrast"),f=rt("grayscale"),g=rt("hueRotate"),h=rt("invert"),v=rt("gap"),x=rt("gradientColorStops"),S=rt("gradientColorStopPositions"),w=rt("inset"),E=rt("margin"),b=rt("opacity"),N=rt("padding"),k=rt("saturate"),P=rt("scale"),A=rt("sepia"),I=rt("skew"),R=rt("space"),j=rt("translate"),L=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",$e,t],B=()=>[$e,t],G=()=>["",pr,Jr],_=()=>["auto",ii,$e],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",$e],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>[ii,$e];return{cacheSize:500,separator:":",theme:{colors:[Da],spacing:[pr,Jr],blur:["none","",eo,$e],brightness:F(),borderColor:[e],borderRadius:["none","","full",eo,$e],borderSpacing:B(),borderWidth:G(),contrast:F(),grayscale:W(),hueRotate:F(),invert:W(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[o3,Jr],inset:$(),margin:$(),opacity:F(),padding:B(),saturate:F(),scale:F(),sepia:W(),skew:F(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[eo]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...O(),$e]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ma,$e]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$e]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Ma,$e]}],"grid-cols":[{"grid-cols":[Da]}],"col-start-end":[{col:["auto",{span:["full",Ma,$e]},$e]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[Da]}],"row-start-end":[{row:["auto",{span:[Ma,$e]},$e]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$e]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$e,t]}],"min-w":[{"min-w":[$e,t,"min","max","fit"]}],"max-w":[{"max-w":[$e,t,"none","full","min","max","fit","prose",{screen:[eo]},eo]}],h:[{h:[$e,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$e,t,"auto","min","max","fit"]}],"font-size":[{text:["base",eo,Jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ih]}],"font-family":[{font:[Da]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",$e]}],"line-clamp":[{"line-clamp":["none",ii,Ih]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",pr,$e]}],"list-image":[{"list-image":["none",$e]}],"list-style-type":[{list:["none","disc","decimal",$e]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",pr,Jr]}],"underline-offset":[{"underline-offset":["auto",pr,$e]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),a3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",i3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:M()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[pr,$e]}],"outline-w":[{outline:[pr,Jr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[pr,Jr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",eo,u3]}],"shadow-color":[{shadow:[Da]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",eo,$e]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[h]}],saturate:[{saturate:[k]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$e]}],duration:[{duration:F()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:F()}],animate:[{animate:["none","spin","ping","pulse","bounce",$e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[Ma,$e]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$e]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$e]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$e]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[pr,Jr,Ih]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},g3=qz(h3);function Ce(...e){return g3(F1(e))}const m3=yo("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function fo({className:e,variant:t,...n}){return p.jsx("div",{className:Ce(m3({variant:t}),e),...n})}function G0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Xt(...e){return t=>{let n=!1;const r=e.map(o=>{const i=G0(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():G0(e[o],null)}}}}function De(...e){return m.useCallback(Xt(...e),e)}var y3=Symbol.for("react.lazy"),Gu=wd[" use ".trim().toString()];function v3(e){return typeof e=="object"&&e!==null&&"then"in e}function U1(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===y3&&"_payload"in e&&v3(e._payload)}function pm(e){const t=w3(e),n=m.forwardRef((r,o)=>{let{children:i,...l}=r;U1(i)&&typeof Gu=="function"&&(i=Gu(i._payload));const c=m.Children.toArray(i),d=c.find(S3);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var x3=pm("Slot");function w3(e){const t=m.forwardRef((n,r)=>{let{children:o,...i}=n;if(U1(o)&&typeof Gu=="function"&&(o=Gu(o._payload)),m.isValidElement(o)){const l=E3(o),c=C3(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var b3=Symbol("radix.slottable");function S3(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===b3}function C3(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function E3(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const hm=yo("inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"glass-forest-button-primary hover:scale-[1.02]",destructive:"glass-forest-button bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"glass-forest-button hover:bg-primary/10 hover:text-primary",secondary:"glass-forest-button bg-secondary/50 text-secondary-foreground hover:bg-secondary/70",ghost:"hover:glass-forest-button hover:bg-primary/10",link:"text-primary underline-offset-4 hover:underline",glass:"glass-forest-button text-foreground","glass-primary":"glass-forest-button-primary","glass-cyan":"glass-forest-button bg-primary text-primary-foreground hover:scale-[1.02]",success:"glass-forest-button bg-success text-success-foreground hover:bg-success/90",warning:"glass-forest-button bg-warning text-warning-foreground hover:bg-warning/90"},size:{default:"h-10 px-6 py-2 text-sm rounded-full",sm:"h-9 px-4 text-sm rounded-full",lg:"h-11 px-8 text-base rounded-full",xl:"h-12 px-10 text-base rounded-full",icon:"h-10 w-10 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),gt=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,loading:o,children:i,disabled:l,...c},d)=>{const f=r?x3:"button";return p.jsxs(f,{className:Ce(hm({variant:t,size:n,className:e})),ref:d,disabled:l||o,...c,children:[o&&p.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[p.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),p.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i]})});gt.displayName="Button";function ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function N3(e,t){const n=m.createContext(t),r=i=>{const{children:l,...c}=i,d=m.useMemo(()=>c,Object.values(c));return p.jsx(n.Provider,{value:d,children:l})};r.displayName=e+"Provider";function o(i){const l=m.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Ft(e,t=[]){let n=[];function r(i,l){const c=m.createContext(l),d=n.length;n=[...n,l];const f=h=>{const{scope:v,children:x,...S}=h,w=v?.[e]?.[d]||c,E=m.useMemo(()=>S,Object.values(S));return p.jsx(w.Provider,{value:E,children:x})};f.displayName=i+"Provider";function g(h,v){const x=v?.[e]?.[d]||c,S=m.useContext(x);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[f,g]}const o=()=>{const i=n.map(l=>m.createContext(l));return function(c){const d=c?.[e]||i;return m.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[r,k3(o,...t)]}function k3(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const l=r.reduce((c,{useScope:d,scopeName:f})=>{const h=d(i)[`__scope${f}`];return{...c,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var wt=globalThis?.document?m.useLayoutEffect:()=>{},T3=wd[" useId ".trim().toString()]||(()=>{}),P3=0;function kt(e){const[t,n]=m.useState(T3());return wt(()=>{n(r=>r??String(P3++))},[e]),t?`radix-${t}`:""}var R3=wd[" useInsertionEffect ".trim().toString()]||wt;function cn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,l]=I3({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:o;{const g=m.useRef(e!==void 0);m.useEffect(()=>{const h=g.current;h!==c&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,r])}const f=m.useCallback(g=>{if(c){const h=_3(g)?g(e):g;h!==e&&l.current?.(h)}else i(g)},[c,e,i,l]);return[d,f]}function I3({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return R3(()=>{i.current=t},[t]),m.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function _3(e){return typeof e=="function"}var hs=r1();const A3=lm(hs);function M3(e){const t=D3(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(O3);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function D3(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=L3(o),c=$3(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var j3=Symbol("radix.slottable");function O3(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===j3}function $3(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function L3(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var F3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=F3.reduce((e,t)=>{const n=M3(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function gm(e,t){e&&hs.flushSync(()=>e.dispatchEvent(t))}function pt(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function z3(e,t=globalThis?.document){const n=pt(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var V3="DismissableLayer",Cg="dismissableLayer.update",H3="dismissableLayer.pointerDownOutside",B3="dismissableLayer.focusOutside",Y0,K1=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ai=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...d}=e,f=m.useContext(K1),[g,h]=m.useState(null),v=g?.ownerDocument??globalThis?.document,[,x]=m.useState({}),S=De(t,R=>h(R)),w=Array.from(f.layers),[E]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=w.indexOf(E),N=g?w.indexOf(g):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,P=N>=b,A=U3(R=>{const j=R.target,L=[...f.branches].some(U=>U.contains(j));!P||L||(o?.(R),l?.(R),R.defaultPrevented||c?.())},v),I=K3(R=>{const j=R.target;[...f.branches].some(U=>U.contains(j))||(i?.(R),l?.(R),R.defaultPrevented||c?.())},v);return z3(R=>{N===f.layers.size-1&&(r?.(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},v),m.useEffect(()=>{if(g)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Y0=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(g)),f.layers.add(g),X0(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=Y0)}},[g,v,n,f]),m.useEffect(()=>()=>{g&&(f.layers.delete(g),f.layersWithOutsidePointerEventsDisabled.delete(g),X0())},[g,f]),m.useEffect(()=>{const R=()=>x({});return document.addEventListener(Cg,R),()=>document.removeEventListener(Cg,R)},[]),p.jsx(ke.div,{...d,ref:S,style:{pointerEvents:k?P?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,I.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,A.onPointerDownCapture)})});Ai.displayName=V3;var W3="DismissableLayerBranch",G1=m.forwardRef((e,t)=>{const n=m.useContext(K1),r=m.useRef(null),o=De(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(ke.div,{...e,ref:o})});G1.displayName=W3;function U3(e,t=globalThis?.document){const n=pt(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let d=function(){Y1(H3,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function K3(e,t=globalThis?.document){const n=pt(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&Y1(B3,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function X0(){const e=new CustomEvent(Cg);document.dispatchEvent(e)}function Y1(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?gm(o,i):o.dispatchEvent(i)}var G3=Ai,Y3=G1,_h="focusScope.autoFocusOnMount",Ah="focusScope.autoFocusOnUnmount",q0={bubbles:!1,cancelable:!0},X3="FocusScope",Id=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=e,[c,d]=m.useState(null),f=pt(o),g=pt(i),h=m.useRef(null),v=De(t,w=>d(w)),x=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let w=function(k){if(x.paused||!c)return;const P=k.target;c.contains(P)?h.current=P:oo(h.current,{select:!0})},E=function(k){if(x.paused||!c)return;const P=k.relatedTarget;P!==null&&(c.contains(P)||oo(h.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const A of k)A.removedNodes.length>0&&oo(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",E);const N=new MutationObserver(b);return c&&N.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",E),N.disconnect()}}},[r,c,x.paused]),m.useEffect(()=>{if(c){Q0.add(x);const w=document.activeElement;if(!c.contains(w)){const b=new CustomEvent(_h,q0);c.addEventListener(_h,f),c.dispatchEvent(b),b.defaultPrevented||(q3(t5(X1(c)),{select:!0}),document.activeElement===w&&oo(c))}return()=>{c.removeEventListener(_h,f),setTimeout(()=>{const b=new CustomEvent(Ah,q0);c.addEventListener(Ah,g),c.dispatchEvent(b),b.defaultPrevented||oo(w??document.body,{select:!0}),c.removeEventListener(Ah,g),Q0.remove(x)},0)}}},[c,f,g,x]);const S=m.useCallback(w=>{if(!n&&!r||x.paused)return;const E=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,b=document.activeElement;if(E&&b){const N=w.currentTarget,[k,P]=Z3(N);k&&P?!w.shiftKey&&b===P?(w.preventDefault(),n&&oo(k,{select:!0})):w.shiftKey&&b===k&&(w.preventDefault(),n&&oo(P,{select:!0})):b===N&&w.preventDefault()}},[n,r,x.paused]);return p.jsx(ke.div,{tabIndex:-1,...l,ref:v,onKeyDown:S})});Id.displayName=X3;function q3(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(oo(r,{select:t}),document.activeElement!==n)return}function Z3(e){const t=X1(e),n=Z0(t,e),r=Z0(t.reverse(),e);return[n,r]}function X1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Z0(e,t){for(const n of e)if(!Q3(n,{upTo:t}))return n}function Q3(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function J3(e){return e instanceof HTMLInputElement&&"select"in e}function oo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&J3(e)&&t&&e.select()}}var Q0=e5();function e5(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=J0(e,t),e.unshift(t)},remove(t){e=J0(e,t),e[0]?.resume()}}}function J0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function t5(e){return e.filter(t=>t.tagName!=="A")}var n5="Portal",Mi=m.forwardRef((e,t)=>{const{container:n,...r}=e,[o,i]=m.useState(!1);wt(()=>i(!0),[]);const l=n||o&&globalThis?.document?.body;return l?A3.createPortal(p.jsx(ke.div,{...r,ref:t}),l):null});Mi.displayName=n5;function r5(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Pt=e=>{const{present:t,children:n}=e,r=o5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=De(r.ref,s5(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Pt.displayName="Presence";function o5(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),l=e?"mounted":"unmounted",[c,d]=r5(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=au(r.current);i.current=c==="mounted"?f:"none"},[c]),wt(()=>{const f=r.current,g=o.current;if(g!==e){const v=i.current,x=au(f);e?d("MOUNT"):x==="none"||f?.display==="none"?d("UNMOUNT"):d(g&&v!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),wt(()=>{if(t){let f;const g=t.ownerDocument.defaultView??window,h=x=>{const w=au(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&w&&(d("ANIMATION_END"),!o.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",f=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},v=x=>{x.target===t&&(i.current=au(r.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{g.clearTimeout(f),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function au(e){return e?.animationName||"none"}function s5(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mh=0;function mm(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ew()),document.body.insertAdjacentElement("beforeend",e[1]??ew()),Mh++,()=>{Mh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Mh--}},[])}function ew(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Un=function(){return Un=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Un.apply(this,arguments)};function q1(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function i5(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Au="right-scroll-bar-position",Mu="width-before-scroll-bar",a5="with-scroll-bars-hidden",l5="--removed-body-scroll-bar-size";function Dh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function c5(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var u5=typeof window<"u"?m.useLayoutEffect:m.useEffect,tw=new WeakMap;function d5(e,t){var n=c5(null,function(r){return e.forEach(function(o){return Dh(o,r)})});return u5(function(){var r=tw.get(n);if(r){var o=new Set(r),i=new Set(e),l=n.current;o.forEach(function(c){i.has(c)||Dh(c,null)}),i.forEach(function(c){o.has(c)||Dh(c,l)})}tw.set(n,e)},[e]),n}function f5(e){return e}function p5(e,t){t===void 0&&(t=f5);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(i){for(r=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(c){return i(c)},filter:function(){return n}}},assignMedium:function(i){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(i),l=n}var d=function(){var g=l;l=[],g.forEach(i)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(g){l.push(g),f()},filter:function(g){return l=l.filter(g),n}}}};return o}function h5(e){e===void 0&&(e={});var t=p5(null);return t.options=Un({async:!0,ssr:!1},e),t}var Z1=function(e){var t=e.sideCar,n=q1(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Un({},n))};Z1.isSideCarExport=!0;function g5(e,t){return e.useMedium(t),Z1}var Q1=h5(),jh=function(){},_d=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:jh,onWheelCapture:jh,onTouchMoveCapture:jh}),o=r[0],i=r[1],l=e.forwardProps,c=e.children,d=e.className,f=e.removeScrollBar,g=e.enabled,h=e.shards,v=e.sideCar,x=e.noRelative,S=e.noIsolation,w=e.inert,E=e.allowPinchZoom,b=e.as,N=b===void 0?"div":b,k=e.gapMode,P=q1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=v,I=d5([n,t]),R=Un(Un({},P),o);return m.createElement(m.Fragment,null,g&&m.createElement(A,{sideCar:Q1,removeScrollBar:f,shards:h,noRelative:x,noIsolation:S,inert:w,setCallbacks:i,allowPinchZoom:!!E,lockRef:n,gapMode:k}),l?m.cloneElement(m.Children.only(c),Un(Un({},R),{ref:I})):m.createElement(N,Un({},R,{className:d,ref:I}),c))});_d.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_d.classNames={fullWidth:Mu,zeroRight:Au};var m5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function y5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=m5();return t&&e.setAttribute("nonce",t),e}function v5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function x5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var w5=function(){var e=0,t=null;return{add:function(n){e==0&&(t=y5())&&(v5(t,n),x5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},b5=function(){var e=w5();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},J1=function(){var e=b5(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},S5={left:0,top:0,right:0,gap:0},Oh=function(e){return parseInt(e||"",10)||0},C5=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Oh(n),Oh(r),Oh(o)]},E5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return S5;var t=C5(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},N5=J1(),ai="data-scroll-locked",k5=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
10
+ .`.concat(a5,` {
11
+ overflow: hidden `).concat(r,`;
12
+ padding-right: `).concat(c,"px ").concat(r,`;
13
+ }
14
+ body[`).concat(ai,`] {
15
+ overflow: hidden `).concat(r,`;
16
+ overscroll-behavior: contain;
17
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
18
+ padding-left: `.concat(o,`px;
19
+ padding-top: `).concat(i,`px;
20
+ padding-right: `).concat(l,`px;
21
+ margin-left:0;
22
+ margin-top:0;
23
+ margin-right: `).concat(c,"px ").concat(r,`;
24
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
25
+ }
26
+
27
+ .`).concat(Au,` {
28
+ right: `).concat(c,"px ").concat(r,`;
29
+ }
30
+
31
+ .`).concat(Mu,` {
32
+ margin-right: `).concat(c,"px ").concat(r,`;
33
+ }
34
+
35
+ .`).concat(Au," .").concat(Au,` {
36
+ right: 0 `).concat(r,`;
37
+ }
38
+
39
+ .`).concat(Mu," .").concat(Mu,` {
40
+ margin-right: 0 `).concat(r,`;
41
+ }
42
+
43
+ body[`).concat(ai,`] {
44
+ `).concat(l5,": ").concat(c,`px;
45
+ }
46
+ `)},nw=function(){var e=parseInt(document.body.getAttribute(ai)||"0",10);return isFinite(e)?e:0},T5=function(){m.useEffect(function(){return document.body.setAttribute(ai,(nw()+1).toString()),function(){var e=nw()-1;e<=0?document.body.removeAttribute(ai):document.body.setAttribute(ai,e.toString())}},[])},P5=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;T5();var i=m.useMemo(function(){return E5(o)},[o]);return m.createElement(N5,{styles:k5(i,!t,o,n?"":"!important")})},Eg=!1;if(typeof window<"u")try{var lu=Object.defineProperty({},"passive",{get:function(){return Eg=!0,!0}});window.addEventListener("test",lu,lu),window.removeEventListener("test",lu,lu)}catch{Eg=!1}var Ks=Eg?{passive:!1}:!1,R5=function(e){return e.tagName==="TEXTAREA"},eS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!R5(e)&&n[t]==="visible")},I5=function(e){return eS(e,"overflowY")},_5=function(e){return eS(e,"overflowX")},rw=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=tS(e,r);if(o){var i=nS(e,r),l=i[1],c=i[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},A5=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},M5=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},tS=function(e,t){return e==="v"?I5(t):_5(t)},nS=function(e,t){return e==="v"?A5(t):M5(t)},D5=function(e,t){return e==="h"&&t==="rtl"?-1:1},j5=function(e,t,n,r,o){var i=D5(e,window.getComputedStyle(t).direction),l=i*r,c=n.target,d=t.contains(c),f=!1,g=l>0,h=0,v=0;do{if(!c)break;var x=nS(e,c),S=x[0],w=x[1],E=x[2],b=w-E-i*S;(S||b)&&tS(e,c)&&(h+=b,v+=S);var N=c.parentNode;c=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(g&&Math.abs(h)<1||!g&&Math.abs(v)<1)&&(f=!0),f},cu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ow=function(e){return[e.deltaX,e.deltaY]},sw=function(e){return e&&"current"in e?e.current:e},O5=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$5=function(e){return`
47
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
48
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
49
+ `)},L5=0,Gs=[];function F5(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(L5++)[0],i=m.useState(J1)[0],l=m.useRef(e);m.useEffect(function(){l.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=i5([e.lockRef.current],(e.shards||[]).map(sw),!0).filter(Boolean);return w.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=m.useCallback(function(w,E){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!l.current.allowPinchZoom;var b=cu(w),N=n.current,k="deltaX"in w?w.deltaX:N[0]-b[0],P="deltaY"in w?w.deltaY:N[1]-b[1],A,I=w.target,R=Math.abs(k)>Math.abs(P)?"h":"v";if("touches"in w&&R==="h"&&I.type==="range")return!1;var j=window.getSelection(),L=j&&j.anchorNode,U=L?L===I||L.contains(I):!1;if(U)return!1;var $=rw(R,I);if(!$)return!0;if($?A=R:(A=R==="v"?"h":"v",$=rw(R,I)),!$)return!1;if(!r.current&&"changedTouches"in w&&(k||P)&&(r.current=A),!A)return!0;var B=r.current||A;return j5(B,E,w,B==="h"?k:P)},[]),d=m.useCallback(function(w){var E=w;if(!(!Gs.length||Gs[Gs.length-1]!==i)){var b="deltaY"in E?ow(E):cu(E),N=t.current.filter(function(A){return A.name===E.type&&(A.target===E.target||E.target===A.shadowParent)&&O5(A.delta,b)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(l.current.shards||[]).map(sw).filter(Boolean).filter(function(A){return A.contains(E.target)}),P=k.length>0?c(E,k[0]):!l.current.noIsolation;P&&E.cancelable&&E.preventDefault()}}},[]),f=m.useCallback(function(w,E,b,N){var k={name:w,delta:E,target:b,should:N,shadowParent:z5(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(P){return P!==k})},1)},[]),g=m.useCallback(function(w){n.current=cu(w),r.current=void 0},[]),h=m.useCallback(function(w){f(w.type,ow(w),w.target,c(w,e.lockRef.current))},[]),v=m.useCallback(function(w){f(w.type,cu(w),w.target,c(w,e.lockRef.current))},[]);m.useEffect(function(){return Gs.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:v}),document.addEventListener("wheel",d,Ks),document.addEventListener("touchmove",d,Ks),document.addEventListener("touchstart",g,Ks),function(){Gs=Gs.filter(function(w){return w!==i}),document.removeEventListener("wheel",d,Ks),document.removeEventListener("touchmove",d,Ks),document.removeEventListener("touchstart",g,Ks)}},[]);var x=e.removeScrollBar,S=e.inert;return m.createElement(m.Fragment,null,S?m.createElement(i,{styles:$5(o)}):null,x?m.createElement(P5,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function z5(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const V5=g5(Q1,F5);var Ad=m.forwardRef(function(e,t){return m.createElement(_d,Un({},e,{ref:t,sideCar:V5}))});Ad.classNames=_d.classNames;var H5=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ys=new WeakMap,uu=new WeakMap,du={},$h=0,rS=function(e){return e&&(e.host||rS(e.parentNode))},B5=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rS(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},W5=function(e,t,n,r){var o=B5(t,Array.isArray(e)?e:[e]);du[n]||(du[n]=new WeakMap);var i=du[n],l=[],c=new Set,d=new Set(o),f=function(h){!h||c.has(h)||(c.add(h),f(h.parentNode))};o.forEach(f);var g=function(h){!h||d.has(h)||Array.prototype.forEach.call(h.children,function(v){if(c.has(v))g(v);else try{var x=v.getAttribute(r),S=x!==null&&x!=="false",w=(Ys.get(v)||0)+1,E=(i.get(v)||0)+1;Ys.set(v,w),i.set(v,E),l.push(v),w===1&&S&&uu.set(v,!0),E===1&&v.setAttribute(n,"true"),S||v.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",v,b)}})};return g(t),c.clear(),$h++,function(){l.forEach(function(h){var v=Ys.get(h)-1,x=i.get(h)-1;Ys.set(h,v),i.set(h,x),v||(uu.has(h)||h.removeAttribute(r),uu.delete(h)),x||h.removeAttribute(n)}),$h--,$h||(Ys=new WeakMap,Ys=new WeakMap,uu=new WeakMap,du={})}},ym=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=H5(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),W5(r,o,n,"aria-hidden")):function(){return null}};function U5(e){const t=K5(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(Y5);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function K5(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=q5(o),c=X5(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var G5=Symbol("radix.slottable");function Y5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===G5}function X5(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function q5(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Md="Dialog",[oS,sS]=Ft(Md),[Z5,$n]=oS(Md),iS=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=m.useRef(null),d=m.useRef(null),[f,g]=cn({prop:r,defaultProp:o??!1,onChange:i,caller:Md});return p.jsx(Z5,{scope:t,triggerRef:c,contentRef:d,contentId:kt(),titleId:kt(),descriptionId:kt(),open:f,onOpenChange:g,onOpenToggle:m.useCallback(()=>g(h=>!h),[g]),modal:l,children:n})};iS.displayName=Md;var aS="DialogTrigger",lS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$n(aS,n),i=De(t,o.triggerRef);return p.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":wm(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)})});lS.displayName=aS;var vm="DialogPortal",[Q5,cS]=oS(vm,{forceMount:void 0}),uS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=$n(vm,t);return p.jsx(Q5,{scope:t,forceMount:n,children:m.Children.map(r,l=>p.jsx(Pt,{present:n||i.open,children:p.jsx(Mi,{asChild:!0,container:o,children:l})}))})};uS.displayName=vm;var Yu="DialogOverlay",dS=m.forwardRef((e,t)=>{const n=cS(Yu,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=$n(Yu,e.__scopeDialog);return i.modal?p.jsx(Pt,{present:r||i.open,children:p.jsx(e4,{...o,ref:t})}):null});dS.displayName=Yu;var J5=U5("DialogOverlay.RemoveScroll"),e4=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$n(Yu,n);return p.jsx(Ad,{as:J5,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(ke.div,{"data-state":wm(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ns="DialogContent",fS=m.forwardRef((e,t)=>{const n=cS(ns,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=$n(ns,e.__scopeDialog);return p.jsx(Pt,{present:r||i.open,children:i.modal?p.jsx(t4,{...o,ref:t}):p.jsx(n4,{...o,ref:t})})});fS.displayName=ns;var t4=m.forwardRef((e,t)=>{const n=$n(ns,e.__scopeDialog),r=m.useRef(null),o=De(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return ym(i)},[]),p.jsx(pS,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&i.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault())})}),n4=m.forwardRef((e,t)=>{const n=$n(ns,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return p.jsx(pS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;n.triggerRef.current?.contains(l)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),pS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=e,c=$n(ns,n),d=m.useRef(null),f=De(t,d);return mm(),p.jsxs(p.Fragment,{children:[p.jsx(Id,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:p.jsx(Ai,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":wm(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(o4,{titleId:c.titleId}),p.jsx(i4,{contentRef:d,descriptionId:c.descriptionId})]})]})}),xm="DialogTitle",hS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$n(xm,n);return p.jsx(ke.h2,{id:o.titleId,...r,ref:t})});hS.displayName=xm;var gS="DialogDescription",mS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$n(gS,n);return p.jsx(ke.p,{id:o.descriptionId,...r,ref:t})});mS.displayName=gS;var yS="DialogClose",vS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$n(yS,n);return p.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});vS.displayName=yS;function wm(e){return e?"open":"closed"}var xS="DialogTitleWarning",[r4,wS]=N3(xS,{contentName:ns,titleName:xm,docsSlug:"dialog"}),o4=({titleId:e})=>{const t=wS(xS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
50
+
51
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
52
+
53
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},s4="DialogDescriptionWarning",i4=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wS(s4).contentName}}.`;return m.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bm=iS,a4=lS,Sm=uS,Dd=dS,jd=fS,Cm=hS,Em=mS,Nm=vS;const bS=bm,l4=Sm,SS=m.forwardRef(({className:e,...t},n)=>p.jsx(Dd,{ref:n,className:Ce("fixed inset-0 z-50 bg-[hsl(var(--overlay))] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));SS.displayName=Dd.displayName;const km=m.forwardRef(({className:e,children:t,variant:n="surface",...r},o)=>p.jsxs(l4,{children:[p.jsx(SS,{}),p.jsxs(jd,{ref:o,className:Ce("fh-builder-portal font-sans fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n==="glass"&&"bg-background/80 backdrop-blur-md",n==="inset"&&"border-border/60",e),...r,children:[t,p.jsxs(Nm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(Rd,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));km.displayName=jd.displayName;const CS=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});CS.displayName="DialogHeader";const ES=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ES.displayName="DialogFooter";const NS=m.forwardRef(({className:e,...t},n)=>p.jsx(Cm,{ref:n,className:Ce("font-heading text-lg font-semibold leading-none tracking-tight",e),...t}));NS.displayName=Cm.displayName;const kS=m.forwardRef(({className:e,...t},n)=>p.jsx(Em,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));kS.displayName=Em.displayName;function c4({open:e,onOpenChange:t,validation:n,onContinue:r,onSelectDiagnostic:o}){const{t:i}=Xe(),l=n.totalErrors>0;return p.jsx(bS,{open:e,onOpenChange:t,children:p.jsxs(km,{className:"max-w-lg max-h-[80vh] flex flex-col",children:[p.jsxs(CS,{children:[p.jsxs(NS,{className:"flex items-center gap-2",children:[l?p.jsx(mo,{className:"w-5 h-5 text-destructive"}):p.jsx(Pd,{className:"w-5 h-5 text-warning"}),i("validationIssues")]}),p.jsx(kS,{children:l?i("validationErrorsDesc",{errorCount:n.totalErrors,warningCount:n.totalWarnings}):i("validationWarningsDesc",{warningCount:n.totalWarnings})})]}),p.jsx("div",{className:"flex-1 overflow-y-auto -mx-6 px-6",children:p.jsxs("div",{className:"flex flex-col gap-2",children:[n.canvases.map(c=>p.jsx(fu,{label:c.canvasLabel,diagnostics:c.diagnostics,onSelectDiagnostic:o},c.canvasId)),n.channelDiagnostics.length>0&&p.jsx(fu,{label:i("channels"),diagnostics:n.channelDiagnostics,onSelectDiagnostic:o}),n.memoryDiagnostics.length>0&&p.jsx(fu,{label:i("memoryFiles"),diagnostics:n.memoryDiagnostics,onSelectDiagnostic:o}),n.modelDiagnostics.length>0&&p.jsx(fu,{label:i("models"),diagnostics:n.modelDiagnostics,onSelectDiagnostic:o})]})}),p.jsx(ES,{children:l||!r?p.jsx(gt,{variant:"outline",onClick:()=>t(!1),children:i("close")}):p.jsxs(p.Fragment,{children:[p.jsx(gt,{variant:"outline",onClick:()=>t(!1),children:i("cancel")}),p.jsx(gt,{onClick:r,children:i("continueWithWarnings")})]})})]})})}function fu({label:e,diagnostics:t,onSelectDiagnostic:n}){const[r,o]=m.useState(!0),i=t.filter(c=>c.severity==="error").length,l=t.length-i;return p.jsxs("div",{className:"rounded-md border border-border/60",children:[p.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex items-center gap-2 w-full px-3 py-2 text-left text-sm hover:bg-accent/50 rounded-t-md",children:[p.jsx(Ii,{className:Ce("w-3.5 h-3.5 shrink-0 transition-transform",!r&&"-rotate-90")}),p.jsx("span",{className:"truncate flex-1 font-medium",children:e}),p.jsxs("div",{className:"flex items-center gap-1",children:[i>0&&p.jsx(fo,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 leading-4 border-destructive/40 text-destructive bg-card",children:i}),l>0&&p.jsx(fo,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 leading-4 border-warning/40 text-warning bg-card",children:l})]})]}),r&&p.jsx("div",{className:"border-t border-border/40 px-3 py-1.5 flex flex-col gap-0.5",children:t.map((c,d)=>p.jsxs("button",{type:"button",onClick:()=>n?.(c),disabled:!n,className:"flex items-start gap-1.5 px-1 py-1 text-xs text-left rounded transition-colors enabled:hover:bg-accent/50 enabled:cursor-pointer disabled:cursor-default",children:[c.severity==="error"?p.jsx(mo,{className:"w-3.5 h-3.5 text-destructive shrink-0 mt-0.5"}):p.jsx(Pd,{className:"w-3.5 h-3.5 text-warning shrink-0 mt-0.5"}),p.jsx("span",{className:"text-muted-foreground",children:c.message})]},d))})]})}const Od=m.createContext(null);Od.displayName="PanelGroupContext";const dt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Tm=10,qo=m.useLayoutEffect,iw=wd.useId,u4=typeof iw=="function"?iw:()=>null;let d4=0;function Pm(e=null){const t=u4(),n=m.useRef(e||t||null);return n.current===null&&(n.current=""+d4++),e??n.current}function TS({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:l,maxSize:c,minSize:d,onCollapse:f,onExpand:g,onResize:h,order:v,style:x,tagName:S="div",...w}){const E=m.useContext(Od);if(E===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:N,getPanelSize:k,getPanelStyle:P,groupId:A,isPanelCollapsed:I,reevaluatePanelConstraints:R,registerPanel:j,resizePanel:L,unregisterPanel:U}=E,$=Pm(l),B=m.useRef({callbacks:{onCollapse:f,onExpand:g,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:c,minSize:d},id:$,idIsFromProps:l!==void 0,order:v});m.useRef({didLogMissingDefaultSizeWarning:!1}),qo(()=>{const{callbacks:_,constraints:O}=B.current,M={...O};B.current.id=$,B.current.idIsFromProps=l!==void 0,B.current.order=v,_.onCollapse=f,_.onExpand=g,_.onResize=h,O.collapsedSize=n,O.collapsible=r,O.defaultSize=o,O.maxSize=c,O.minSize=d,(M.collapsedSize!==O.collapsedSize||M.collapsible!==O.collapsible||M.maxSize!==O.maxSize||M.minSize!==O.minSize)&&R(B.current,M)}),qo(()=>{const _=B.current;return j(_),()=>{U(_)}},[v,$,j,U]),m.useImperativeHandle(i,()=>({collapse:()=>{b(B.current)},expand:_=>{N(B.current,_)},getId(){return $},getSize(){return k(B.current)},isCollapsed(){return I(B.current)},isExpanded(){return!I(B.current)},resize:_=>{L(B.current,_)}}),[b,N,k,I,$,L]);const G=P(B.current,o);return m.createElement(S,{...w,children:e,className:t,id:$,style:{...G,...x},[dt.groupId]:A,[dt.panel]:"",[dt.panelCollapsible]:r||void 0,[dt.panelId]:$,[dt.panelSize]:parseFloat(""+G.flexGrow).toFixed(1)})}const PS=m.forwardRef((e,t)=>m.createElement(TS,{...e,forwardedRef:t}));TS.displayName="Panel";PS.displayName="forwardRef(Panel)";let Ng=null,Du=-1,io=null;function f4(e,t){if(t){const n=(t&MS)!==0,r=(t&DS)!==0,o=(t&jS)!==0,i=(t&OS)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function p4(){io!==null&&(document.head.removeChild(io),Ng=null,io=null,Du=-1)}function Lh(e,t){var n,r;const o=f4(e,t);if(Ng!==o){if(Ng=o,io===null&&(io=document.createElement("style"),document.head.appendChild(io)),Du>=0){var i;(i=io.sheet)===null||i===void 0||i.removeRule(Du)}Du=(n=(r=io.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function RS(e){return e.type==="keydown"}function IS(e){return e.type.startsWith("pointer")}function _S(e){return e.type.startsWith("mouse")}function $d(e){if(IS(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(_S(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function h4(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function g4(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function m4(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:cw(e),b:cw(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;ze(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:lw(aw(n.a)),b:lw(aw(n.b))};if(o.a===o.b){const i=r.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let c=i.length;for(;c--;){const d=i[c];if(d===l.a)return 1;if(d===l.b)return-1}}return Math.sign(o.a-o.b)}const y4=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function v4(e){var t;const n=getComputedStyle((t=AS(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function x4(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||v4(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||y4.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function aw(e){let t=e.length;for(;t--;){const n=e[t];if(ze(n,"Missing node"),x4(n))return n}return null}function lw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cw(e){const t=[];for(;e;)t.push(e),e=AS(e);return t}function AS(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const MS=1,DS=2,jS=4,OS=8,w4=h4()==="coarse";let Mn=[],li=!1,Ko=new Map,Ld=new Map;const rl=new Set;function b4(e,t,n,r,o){var i;const{ownerDocument:l}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},d=(i=Ko.get(l))!==null&&i!==void 0?i:0;return Ko.set(l,d+1),rl.add(c),Xu(),function(){var g;Ld.delete(e),rl.delete(c);const h=(g=Ko.get(l))!==null&&g!==void 0?g:1;if(Ko.set(l,h-1),Xu(),h===1&&Ko.delete(l),Mn.includes(c)){const v=Mn.indexOf(c);v>=0&&Mn.splice(v,1),Im(),o("up",!0,null)}}}function S4(e){const{target:t}=e,{x:n,y:r}=$d(e);li=!0,Rm({target:t,x:n,y:r}),Xu(),Mn.length>0&&(qu("down",e),e.preventDefault(),$S(t)||e.stopImmediatePropagation())}function Fh(e){const{x:t,y:n}=$d(e);if(li&&e.buttons===0&&(li=!1,qu("up",e)),!li){const{target:r}=e;Rm({target:r,x:t,y:n})}qu("move",e),Im(),Mn.length>0&&e.preventDefault()}function zh(e){const{target:t}=e,{x:n,y:r}=$d(e);Ld.clear(),li=!1,Mn.length>0&&(e.preventDefault(),$S(t)||e.stopImmediatePropagation()),qu("up",e),Rm({target:t,x:n,y:r}),Im(),Xu()}function $S(e){let t=e;for(;t;){if(t.hasAttribute(dt.resizeHandle))return!0;t=t.parentElement}return!1}function Rm({target:e,x:t,y:n}){Mn.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),rl.forEach(o=>{const{element:i,hitAreaMargins:l}=o,c=i.getBoundingClientRect(),{bottom:d,left:f,right:g,top:h}=c,v=w4?l.coarse:l.fine;if(t>=f-v&&t<=g+v&&n>=h-v&&n<=d+v){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&m4(r,i)>0){let S=r,w=!1;for(;S&&!S.contains(i);){if(g4(S.getBoundingClientRect(),c)){w=!0;break}S=S.parentElement}if(w)return}Mn.push(o)}})}function Vh(e,t){Ld.set(e,t)}function Im(){let e=!1,t=!1;Mn.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Ld.forEach(r=>{n|=r}),e&&t?Lh("intersection",n):e?Lh("horizontal",n):t?Lh("vertical",n):p4()}let Hh=new AbortController;function Xu(){Hh.abort(),Hh=new AbortController;const e={capture:!0,signal:Hh.signal};rl.size&&(li?(Mn.length>0&&Ko.forEach((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",zh,e),r.addEventListener("pointerleave",Fh,e),r.addEventListener("pointermove",Fh,e))}),window.addEventListener("pointerup",zh,e),window.addEventListener("pointercancel",zh,e)):Ko.forEach((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",S4,e),r.addEventListener("pointermove",Fh,e))}))}function qu(e,t){rl.forEach(n=>{const{setResizeHandlerState:r}=n,o=Mn.includes(n);r(e,o,t)})}function C4(){const[e,t]=m.useState(0);return m.useCallback(()=>t(n=>n+1),[])}function ze(e,t){if(!e)throw console.error(t),Error(t)}function rs(e,t,n=Tm){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function gr(e,t,n=Tm){return rs(e,t,n)===0}function nn(e,t,n){return rs(e,t,n)===0}function E4(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!nn(o,i,n))return!1}return!0}function ni({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];ze(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:l=100,minSize:c=0}=r;if(rs(n,c)<0)if(i){const d=(o+c)/2;rs(n,d)<0?n=o:n=c}else n=c;return n=Math.min(l,n),n=parseFloat(n.toFixed(Tm)),n}function za({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(nn(e,0))return t;const l=[...t],[c,d]=r;ze(c!=null,"Invalid first pivot index"),ze(d!=null,"Invalid second pivot index");let f=0;if(i==="keyboard"){{const h=e<0?d:c,v=n[h];ze(v,`Panel constraints not found for index ${h}`);const{collapsedSize:x=0,collapsible:S,minSize:w=0}=v;if(S){const E=t[h];if(ze(E!=null,`Previous layout not found for panel index ${h}`),nn(E,x)){const b=w-E;rs(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const h=e<0?c:d,v=n[h];ze(v,`No panel constraints found for index ${h}`);const{collapsedSize:x=0,collapsible:S,minSize:w=0}=v;if(S){const E=t[h];if(ze(E!=null,`Previous layout not found for panel index ${h}`),nn(E,w)){const b=E-x;rs(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const h=e<0?1:-1;let v=e<0?d:c,x=0;for(;;){const w=t[v];ze(w!=null,`Previous layout not found for panel index ${v}`);const b=ni({panelConstraints:n,panelIndex:v,size:100})-w;if(x+=b,v+=h,v<0||v>=n.length)break}const S=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-S:S}{let v=e<0?c:d;for(;v>=0&&v<n.length;){const x=Math.abs(e)-Math.abs(f),S=t[v];ze(S!=null,`Previous layout not found for panel index ${v}`);const w=S-x,E=ni({panelConstraints:n,panelIndex:v,size:w});if(!nn(S,E)&&(f+=S-E,l[v]=E,f.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if(E4(o,l))return o;{const h=e<0?d:c,v=t[h];ze(v!=null,`Previous layout not found for panel index ${h}`);const x=v+f,S=ni({panelConstraints:n,panelIndex:h,size:x});if(l[h]=S,!nn(S,x)){let w=x-S,b=e<0?d:c;for(;b>=0&&b<n.length;){const N=l[b];ze(N!=null,`Previous layout not found for panel index ${b}`);const k=N+w,P=ni({panelConstraints:n,panelIndex:b,size:k});if(nn(N,P)||(w-=P-N,l[b]=P),nn(w,0))break;e>0?b--:b++}}}const g=l.reduce((h,v)=>v+h,0);return nn(g,100)?l:o}function N4({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,l=0;const c=n[0];ze(c!=null,"No pivot index found"),t.forEach((h,v)=>{const{constraints:x}=h,{maxSize:S=100,minSize:w=0}=x;v===c?(r=w,o=S):(i+=w,l+=S)});const d=Math.min(o,100-i),f=Math.max(r,100-l),g=e[c];return{valueMax:d,valueMin:f,valueNow:g}}function ol(e,t=document){return Array.from(t.querySelectorAll(`[${dt.resizeHandleId}][data-panel-group-id="${e}"]`))}function LS(e,t,n=document){const o=ol(e,n).findIndex(i=>i.getAttribute(dt.resizeHandleId)===t);return o??null}function FS(e,t,n){const r=LS(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function zS(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function Fd(e,t=document){const n=t.querySelector(`[${dt.resizeHandleId}="${e}"]`);return n||null}function k4(e,t,n,r=document){var o,i,l,c;const d=Fd(t,r),f=ol(e,r),g=d?f.indexOf(d):-1,h=(o=(i=n[g])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,v=(l=(c=n[g+1])===null||c===void 0?void 0:c.id)!==null&&l!==void 0?l:null;return[h,v]}function T4({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:l}){m.useRef({didWarnAboutMissingResizeHandle:!1}),qo(()=>{if(!i)return;const c=ol(n,i);for(let d=0;d<o.length-1;d++){const{valueMax:f,valueMin:g,valueNow:h}=N4({layout:r,panelsArray:o,pivotIndices:[d,d+1]}),v=c[d];if(v!=null){const x=o[d];ze(x,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",x.id),v.setAttribute("aria-valuemax",""+Math.round(f)),v.setAttribute("aria-valuemin",""+Math.round(g)),v.setAttribute("aria-valuenow",h!=null?""+Math.round(h):"")}}return()=>{c.forEach((d,f)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[n,r,o,i]),m.useEffect(()=>{if(!i)return;const c=t.current;ze(c,"Eager values not found");const{panelDataArray:d}=c,f=zS(n,i);ze(f!=null,`No group found for id "${n}"`);const g=ol(n,i);ze(g,`No resize handles found for group id "${n}"`);const h=g.map(v=>{const x=v.getAttribute(dt.resizeHandleId);ze(x,"Resize handle element has no handle id attribute");const[S,w]=k4(n,x,d,i);if(S==null||w==null)return()=>{};const E=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const N=d.findIndex(k=>k.id===S);if(N>=0){const k=d[N];ze(k,`No panel data found for index ${N}`);const P=r[N],{collapsedSize:A=0,collapsible:I,minSize:R=0}=k.constraints;if(P!=null&&I){const j=za({delta:nn(P,A)?R-A:A-P,initialLayout:r,panelConstraints:d.map(L=>L.constraints),pivotIndices:FS(n,x,i),prevLayout:r,trigger:"keyboard"});r!==j&&l(j)}}break}}};return v.addEventListener("keydown",E),()=>{v.removeEventListener("keydown",E)}});return()=>{h.forEach(v=>v())}},[i,e,t,n,r,o,l])}function uw(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function VS(e,t){const n=e==="horizontal",{x:r,y:o}=$d(t);return n?r:o}function P4(e,t,n,r,o){const i=n==="horizontal",l=Fd(t,o);ze(l,`No resize handle element found for id "${t}"`);const c=l.getAttribute(dt.groupId);ze(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=r;const f=VS(n,e),g=zS(c,o);ze(g,`No group element found for id "${c}"`);const h=g.getBoundingClientRect(),v=i?h.width:h.height;return(f-d)/v*100}function R4(e,t,n,r,o,i){if(RS(e)){const l=n==="horizontal";let c=0;e.shiftKey?c=100:o!=null?c=o:c=10;let d=0;switch(e.key){case"ArrowDown":d=l?0:c;break;case"ArrowLeft":d=l?-c:0;break;case"ArrowRight":d=l?c:0;break;case"ArrowUp":d=l?0:-c;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return r==null?0:P4(e,t,n,r,i)}function I4({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const l=n[i];ze(l,`Panel constraints not found for index ${i}`);const{defaultSize:c}=l;c!=null&&(r++,t[i]=c,o-=c)}for(let i=0;i<e.length;i++){const l=n[i];ze(l,`Panel constraints not found for index ${i}`);const{defaultSize:c}=l;if(c!=null)continue;const d=e.length-r,f=o/d;r++,t[i]=f,o-=f}return t}function Xs(e,t,n){t.forEach((r,o)=>{const i=e[o];ze(i,`Panel data not found for index ${o}`);const{callbacks:l,constraints:c,id:d}=i,{collapsedSize:f=0,collapsible:g}=c,h=n[d];if(h==null||r!==h){n[d]=r;const{onCollapse:v,onExpand:x,onResize:S}=l;S&&S(r,h),g&&(v||x)&&(x&&(h==null||gr(h,f))&&!gr(r,f)&&x(),v&&(h==null||!gr(h,f))&&gr(r,f)&&v())}})}function pu(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function _4({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const l=n[o];let c;return l==null?c=e!=null?e.toPrecision(i):"1":r.length===1?c="1":c=l.toPrecision(i),{flexBasis:0,flexGrow:c,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function A4(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function dw(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function HS(e){return`react-resizable-panels:${e}`}function BS(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function WS(e,t){try{const n=HS(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function M4(e,t,n){var r,o;const i=(r=WS(e,n))!==null&&r!==void 0?r:{},l=BS(t);return(o=i[l])!==null&&o!==void 0?o:null}function D4(e,t,n,r,o){var i;const l=HS(e),c=BS(t),d=(i=WS(e,o))!==null&&i!==void 0?i:{};d[c]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(l,JSON.stringify(d))}catch(f){console.error(f)}}function fw({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,l)=>i+l,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!nn(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const l=n[i];ze(l!=null,`No layout data found for index ${i}`);const c=100/r*l;n[i]=c}let o=0;for(let i=0;i<t.length;i++){const l=n[i];ze(l!=null,`No layout data found for index ${i}`);const c=ni({panelConstraints:t,panelIndex:i,size:l});l!=c&&(o+=l-c,n[i]=c)}if(!nn(o,0))for(let i=0;i<t.length;i++){const l=n[i];ze(l!=null,`No layout data found for index ${i}`);const c=l+o,d=ni({panelConstraints:t,panelIndex:i,size:c});if(l!==d&&(o-=d-l,n[i]=d,nn(o,0)))break}return n}const j4=100,Va={getItem:e=>(dw(Va),Va.getItem(e)),setItem:(e,t)=>{dw(Va),Va.setItem(e,t)}},pw={};function US({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:l=null,keyboardResizeBy:c=null,storage:d=Va,style:f,tagName:g="div",...h}){const v=Pm(i),x=m.useRef(null),[S,w]=m.useState(null),[E,b]=m.useState([]),N=C4(),k=m.useRef({}),P=m.useRef(new Map),A=m.useRef(0),I=m.useRef({autoSaveId:e,direction:r,dragState:S,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),R=m.useRef({layout:E,panelDataArray:[],panelDataArrayChanged:!1});m.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),m.useImperativeHandle(o,()=>({getId:()=>I.current.id,getLayout:()=>{const{layout:X}=R.current;return X},setLayout:X=>{const{onLayout:Q}=I.current,{layout:ee,panelDataArray:ne}=R.current,K=fw({layout:X,panelConstraints:ne.map(q=>q.constraints)});uw(ee,K)||(b(K),R.current.layout=K,Q&&Q(K),Xs(ne,K,k.current))}}),[]),qo(()=>{I.current.autoSaveId=e,I.current.direction=r,I.current.dragState=S,I.current.id=v,I.current.onLayout=l,I.current.storage=d}),T4({committedValuesRef:I,eagerValuesRef:R,groupId:v,layout:E,panelDataArray:R.current.panelDataArray,setLayout:b,panelGroupElement:x.current}),m.useEffect(()=>{const{panelDataArray:X}=R.current;if(e){if(E.length===0||E.length!==X.length)return;let Q=pw[e];Q==null&&(Q=A4(D4,j4),pw[e]=Q);const ee=[...X],ne=new Map(P.current);Q(e,ee,ne,E,d)}},[e,E,d]),m.useEffect(()=>{});const j=m.useCallback(X=>{const{onLayout:Q}=I.current,{layout:ee,panelDataArray:ne}=R.current;if(X.constraints.collapsible){const K=ne.map(ge=>ge.constraints),{collapsedSize:q=0,panelSize:oe,pivotIndices:ce}=Bo(ne,X,ee);if(ze(oe!=null,`Panel size not found for panel "${X.id}"`),!gr(oe,q)){P.current.set(X.id,oe);const ye=Js(ne,X)===ne.length-1?oe-q:q-oe,me=za({delta:ye,initialLayout:ee,panelConstraints:K,pivotIndices:ce,prevLayout:ee,trigger:"imperative-api"});pu(ee,me)||(b(me),R.current.layout=me,Q&&Q(me),Xs(ne,me,k.current))}}},[]),L=m.useCallback((X,Q)=>{const{onLayout:ee}=I.current,{layout:ne,panelDataArray:K}=R.current;if(X.constraints.collapsible){const q=K.map(Ee=>Ee.constraints),{collapsedSize:oe=0,panelSize:ce=0,minSize:ge=0,pivotIndices:ye}=Bo(K,X,ne),me=Q??ge;if(gr(ce,oe)){const Ee=P.current.get(X.id),Le=Ee!=null&&Ee>=me?Ee:me,Ke=Js(K,X)===K.length-1?ce-Le:Le-ce,le=za({delta:Ke,initialLayout:ne,panelConstraints:q,pivotIndices:ye,prevLayout:ne,trigger:"imperative-api"});pu(ne,le)||(b(le),R.current.layout=le,ee&&ee(le),Xs(K,le,k.current))}}},[]),U=m.useCallback(X=>{const{layout:Q,panelDataArray:ee}=R.current,{panelSize:ne}=Bo(ee,X,Q);return ze(ne!=null,`Panel size not found for panel "${X.id}"`),ne},[]),$=m.useCallback((X,Q)=>{const{panelDataArray:ee}=R.current,ne=Js(ee,X);return _4({defaultSize:Q,dragState:S,layout:E,panelData:ee,panelIndex:ne})},[S,E]),B=m.useCallback(X=>{const{layout:Q,panelDataArray:ee}=R.current,{collapsedSize:ne=0,collapsible:K,panelSize:q}=Bo(ee,X,Q);return ze(q!=null,`Panel size not found for panel "${X.id}"`),K===!0&&gr(q,ne)},[]),G=m.useCallback(X=>{const{layout:Q,panelDataArray:ee}=R.current,{collapsedSize:ne=0,collapsible:K,panelSize:q}=Bo(ee,X,Q);return ze(q!=null,`Panel size not found for panel "${X.id}"`),!K||rs(q,ne)>0},[]),_=m.useCallback(X=>{const{panelDataArray:Q}=R.current;Q.push(X),Q.sort((ee,ne)=>{const K=ee.order,q=ne.order;return K==null&&q==null?0:K==null?-1:q==null?1:K-q}),R.current.panelDataArrayChanged=!0,N()},[N]);qo(()=>{if(R.current.panelDataArrayChanged){R.current.panelDataArrayChanged=!1;const{autoSaveId:X,onLayout:Q,storage:ee}=I.current,{layout:ne,panelDataArray:K}=R.current;let q=null;if(X){const ce=M4(X,K,ee);ce&&(P.current=new Map(Object.entries(ce.expandToSizes)),q=ce.layout)}q==null&&(q=I4({panelDataArray:K}));const oe=fw({layout:q,panelConstraints:K.map(ce=>ce.constraints)});uw(ne,oe)||(b(oe),R.current.layout=oe,Q&&Q(oe),Xs(K,oe,k.current))}}),qo(()=>{const X=R.current;return()=>{X.layout=[]}},[]);const O=m.useCallback(X=>{let Q=!1;const ee=x.current;return ee&&window.getComputedStyle(ee,null).getPropertyValue("direction")==="rtl"&&(Q=!0),function(K){K.preventDefault();const q=x.current;if(!q)return()=>null;const{direction:oe,dragState:ce,id:ge,keyboardResizeBy:ye,onLayout:me}=I.current,{layout:Ee,panelDataArray:Le}=R.current,{initialLayout:Fe}=ce??{},Ke=FS(ge,X,q);let le=R4(K,X,oe,ce,ye,q);const Se=oe==="horizontal";Se&&Q&&(le=-le);const Oe=Le.map(Dt=>Dt.constraints),qe=za({delta:le,initialLayout:Fe??Ee,panelConstraints:Oe,pivotIndices:Ke,prevLayout:Ee,trigger:RS(K)?"keyboard":"mouse-or-touch"}),yt=!pu(Ee,qe);(IS(K)||_S(K))&&A.current!=le&&(A.current=le,!yt&&le!==0?Se?Vh(X,le<0?MS:DS):Vh(X,le<0?jS:OS):Vh(X,0)),yt&&(b(qe),R.current.layout=qe,me&&me(qe),Xs(Le,qe,k.current))}},[]),M=m.useCallback((X,Q)=>{const{onLayout:ee}=I.current,{layout:ne,panelDataArray:K}=R.current,q=K.map(Ee=>Ee.constraints),{panelSize:oe,pivotIndices:ce}=Bo(K,X,ne);ze(oe!=null,`Panel size not found for panel "${X.id}"`);const ye=Js(K,X)===K.length-1?oe-Q:Q-oe,me=za({delta:ye,initialLayout:ne,panelConstraints:q,pivotIndices:ce,prevLayout:ne,trigger:"imperative-api"});pu(ne,me)||(b(me),R.current.layout=me,ee&&ee(me),Xs(K,me,k.current))},[]),z=m.useCallback((X,Q)=>{const{layout:ee,panelDataArray:ne}=R.current,{collapsedSize:K=0,collapsible:q}=Q,{collapsedSize:oe=0,collapsible:ce,maxSize:ge=100,minSize:ye=0}=X.constraints,{panelSize:me}=Bo(ne,X,ee);me!=null&&(q&&ce&&gr(me,K)?gr(K,oe)||M(X,oe):me<ye?M(X,ye):me>ge&&M(X,ge))},[M]),H=m.useCallback((X,Q)=>{const{direction:ee}=I.current,{layout:ne}=R.current;if(!x.current)return;const K=Fd(X,x.current);ze(K,`Drag handle element not found for id "${X}"`);const q=VS(ee,Q);w({dragHandleId:X,dragHandleRect:K.getBoundingClientRect(),initialCursorPosition:q,initialLayout:ne})},[]),W=m.useCallback(()=>{w(null)},[]),Z=m.useCallback(X=>{const{panelDataArray:Q}=R.current,ee=Js(Q,X);ee>=0&&(Q.splice(ee,1),delete k.current[X.id],R.current.panelDataArrayChanged=!0,N())},[N]),F=m.useMemo(()=>({collapsePanel:j,direction:r,dragState:S,expandPanel:L,getPanelSize:U,getPanelStyle:$,groupId:v,isPanelCollapsed:B,isPanelExpanded:G,reevaluatePanelConstraints:z,registerPanel:_,registerResizeHandle:O,resizePanel:M,startDragging:H,stopDragging:W,unregisterPanel:Z,panelGroupElement:x.current}),[j,S,r,L,U,$,v,B,G,z,_,O,M,H,W,Z]),V={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return m.createElement(Od.Provider,{value:F},m.createElement(g,{...h,children:t,className:n,id:i,ref:x,style:{...V,...f},[dt.group]:"",[dt.groupDirection]:r,[dt.groupId]:v}))}const KS=m.forwardRef((e,t)=>m.createElement(US,{...e,forwardedRef:t}));US.displayName="PanelGroup";KS.displayName="forwardRef(PanelGroup)";function Js(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Bo(e,t,n){const r=Js(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],l=n[r];return{...t.constraints,panelSize:l,pivotIndices:i}}function O4({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){m.useEffect(()=>{if(e||n==null||r==null)return;const o=Fd(t,r);if(o==null)return;const i=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),n(l);break}case"F6":{l.preventDefault();const c=o.getAttribute(dt.groupId);ze(c,`No group element found for id "${c}"`);const d=ol(c,r),f=LS(c,t,r);ze(f!==null,`No resize element found for id "${t}"`);const g=l.shiftKey?f>0?f-1:d.length-1:f+1<d.length?f+1:0;d[g].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function GS({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onClick:l,onDragging:c,onFocus:d,onPointerDown:f,onPointerUp:g,style:h={},tabIndex:v=0,tagName:x="div",...S}){var w,E;const b=m.useRef(null),N=m.useRef({onClick:l,onDragging:c,onPointerDown:f,onPointerUp:g});m.useEffect(()=>{N.current.onClick=l,N.current.onDragging=c,N.current.onPointerDown=f,N.current.onPointerUp=g});const k=m.useContext(Od);if(k===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:P,groupId:A,registerResizeHandle:I,startDragging:R,stopDragging:j,panelGroupElement:L}=k,U=Pm(o),[$,B]=m.useState("inactive"),[G,_]=m.useState(!1),[O,M]=m.useState(null),z=m.useRef({state:$});qo(()=>{z.current.state=$}),m.useEffect(()=>{if(n)M(null);else{const F=I(U);M(()=>F)}},[n,U,I]);const H=(w=r?.coarse)!==null&&w!==void 0?w:15,W=(E=r?.fine)!==null&&E!==void 0?E:5;m.useEffect(()=>{if(n||O==null)return;const F=b.current;ze(F,"Element ref not attached");let V=!1;return b4(U,F,P,{coarse:H,fine:W},(Q,ee,ne)=>{if(!ee){B("inactive");return}switch(Q){case"down":{B("drag"),V=!1,ze(ne,'Expected event to be defined for "down" action'),R(U,ne);const{onDragging:K,onPointerDown:q}=N.current;K?.(!0),q?.();break}case"move":{const{state:K}=z.current;V=!0,K!=="drag"&&B("hover"),ze(ne,'Expected event to be defined for "move" action'),O(ne);break}case"up":{B("hover"),j();const{onClick:K,onDragging:q,onPointerUp:oe}=N.current;q?.(!1),oe?.(),V||K?.();break}}})},[H,P,n,W,I,U,O,R,j]),O4({disabled:n,handleId:U,resizeHandler:O,panelGroupElement:L});const Z={touchAction:"none",userSelect:"none"};return m.createElement(x,{...S,children:e,className:t,id:o,onBlur:()=>{_(!1),i?.()},onFocus:()=>{_(!0),d?.()},ref:b,role:"separator",style:{...Z,...h},tabIndex:v,[dt.groupDirection]:P,[dt.groupId]:A,[dt.resizeHandle]:"",[dt.resizeHandleActive]:$==="drag"?"pointer":G?"keyboard":void 0,[dt.resizeHandleEnabled]:!n,[dt.resizeHandleId]:U,[dt.resizeHandleState]:$})}GS.displayName="PanelResizeHandle";const $4=({className:e,...t})=>p.jsx(KS,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),hw=PS,L4=({withHandle:e,className:t,...n})=>p.jsx(GS,{className:Ce("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&p.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:p.jsx(Sz,{className:"h-2.5 w-2.5"})})});var F4=m.createContext(void 0);function Nl(e){const t=m.useContext(F4);return e||t||"ltr"}function kg(e,[t,n]){return Math.min(n,Math.max(t,e))}function z4(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var _m="ScrollArea",[YS]=Ft(_m),[V4,xn]=YS(_m),XS=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...l}=e,[c,d]=m.useState(null),[f,g]=m.useState(null),[h,v]=m.useState(null),[x,S]=m.useState(null),[w,E]=m.useState(null),[b,N]=m.useState(0),[k,P]=m.useState(0),[A,I]=m.useState(!1),[R,j]=m.useState(!1),L=De(t,$=>d($)),U=Nl(o);return p.jsx(V4,{scope:n,type:r,dir:U,scrollHideDelay:i,scrollArea:c,viewport:f,onViewportChange:g,content:h,onContentChange:v,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:A,onScrollbarXEnabledChange:I,scrollbarY:w,onScrollbarYChange:E,scrollbarYEnabled:R,onScrollbarYEnabledChange:j,onCornerWidthChange:N,onCornerHeightChange:P,children:p.jsx(ke.div,{dir:U,...l,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});XS.displayName=_m;var qS="ScrollAreaViewport",ZS=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,l=xn(qS,n),c=m.useRef(null),d=De(t,c,l.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(ke.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:p.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});ZS.displayName=qS;var Jn="ScrollAreaScrollbar",Am=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=xn(Jn,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,c=e.orientation==="horizontal";return m.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),o.type==="hover"?p.jsx(H4,{...r,ref:t,forceMount:n}):o.type==="scroll"?p.jsx(B4,{...r,ref:t,forceMount:n}):o.type==="auto"?p.jsx(QS,{...r,ref:t,forceMount:n}):o.type==="always"?p.jsx(Mm,{...r,ref:t}):null});Am.displayName=Jn;var H4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=xn(Jn,e.__scopeScrollArea),[i,l]=m.useState(!1);return m.useEffect(()=>{const c=o.scrollArea;let d=0;if(c){const f=()=>{window.clearTimeout(d),l(!0)},g=()=>{d=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return c.addEventListener("pointerenter",f),c.addEventListener("pointerleave",g),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",f),c.removeEventListener("pointerleave",g)}}},[o.scrollArea,o.scrollHideDelay]),p.jsx(Pt,{present:n||i,children:p.jsx(QS,{"data-state":i?"visible":"hidden",...r,ref:t})})}),B4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=xn(Jn,e.__scopeScrollArea),i=e.orientation==="horizontal",l=Vd(()=>d("SCROLL_END"),100),[c,d]=z4("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(c==="idle"){const f=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(f)}},[c,o.scrollHideDelay,d]),m.useEffect(()=>{const f=o.viewport,g=i?"scrollLeft":"scrollTop";if(f){let h=f[g];const v=()=>{const x=f[g];h!==x&&(d("SCROLL"),l()),h=x};return f.addEventListener("scroll",v),()=>f.removeEventListener("scroll",v)}},[o.viewport,i,d,l]),p.jsx(Pt,{present:n||c!=="hidden",children:p.jsx(Mm,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ve(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:ve(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),QS=m.forwardRef((e,t)=>{const n=xn(Jn,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,l]=m.useState(!1),c=e.orientation==="horizontal",d=Vd(()=>{if(n.viewport){const f=n.viewport.offsetWidth<n.viewport.scrollWidth,g=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?f:g)}},10);return pi(n.viewport,d),pi(n.content,d),p.jsx(Pt,{present:r||i,children:p.jsx(Mm,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Mm=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=xn(Jn,e.__scopeScrollArea),i=m.useRef(null),l=m.useRef(0),[c,d]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=rC(c.viewport,c.content),g={...r,sizes:c,onSizesChange:d,hasThumb:f>0&&f<1,onThumbChange:v=>i.current=v,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:v=>l.current=v};function h(v,x){return X4(v,l.current,c,x)}return n==="horizontal"?p.jsx(W4,{...g,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const v=o.viewport.scrollLeft,x=gw(v,c,o.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollLeft=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollLeft=h(v,o.dir))}}):n==="vertical"?p.jsx(U4,{...g,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const v=o.viewport.scrollTop,x=gw(v,c);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:v=>{o.viewport&&(o.viewport.scrollTop=v)},onDragScroll:v=>{o.viewport&&(o.viewport.scrollTop=h(v))}}):null}),W4=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=xn(Jn,e.__scopeScrollArea),[l,c]=m.useState(),d=m.useRef(null),f=De(t,d,i.onScrollbarXChange);return m.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),p.jsx(eC,{"data-orientation":"horizontal",...o,ref:f,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":zd(n)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,h)=>{if(i.viewport){const v=i.viewport.scrollLeft+g.deltaX;e.onWheelScroll(v),sC(v,h)&&g.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Qu(l.paddingLeft),paddingEnd:Qu(l.paddingRight)}})}})}),U4=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=xn(Jn,e.__scopeScrollArea),[l,c]=m.useState(),d=m.useRef(null),f=De(t,d,i.onScrollbarYChange);return m.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),p.jsx(eC,{"data-orientation":"vertical",...o,ref:f,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":zd(n)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,h)=>{if(i.viewport){const v=i.viewport.scrollTop+g.deltaY;e.onWheelScroll(v),sC(v,h)&&g.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Qu(l.paddingTop),paddingEnd:Qu(l.paddingBottom)}})}})}),[K4,JS]=YS(Jn),eC=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:g,onResize:h,...v}=e,x=xn(Jn,n),[S,w]=m.useState(null),E=De(t,L=>w(L)),b=m.useRef(null),N=m.useRef(""),k=x.viewport,P=r.content-r.viewport,A=pt(g),I=pt(d),R=Vd(h,10);function j(L){if(b.current){const U=L.clientX-b.current.left,$=L.clientY-b.current.top;f({x:U,y:$})}}return m.useEffect(()=>{const L=U=>{const $=U.target;S?.contains($)&&A(U,P)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[k,S,P,A]),m.useEffect(I,[r,I]),pi(S,R),pi(x.content,R),p.jsx(K4,{scope:n,scrollbar:S,hasThumb:o,onThumbChange:pt(i),onThumbPointerUp:pt(l),onThumbPositionChange:I,onThumbPointerDown:pt(c),children:p.jsx(ke.div,{...v,ref:E,style:{position:"absolute",...v.style},onPointerDown:ve(e.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),b.current=S.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),j(L))}),onPointerMove:ve(e.onPointerMove,j),onPointerUp:ve(e.onPointerUp,L=>{const U=L.target;U.hasPointerCapture(L.pointerId)&&U.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),Zu="ScrollAreaThumb",tC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=JS(Zu,e.__scopeScrollArea);return p.jsx(Pt,{present:n||o.hasThumb,children:p.jsx(G4,{ref:t,...r})})}),G4=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=xn(Zu,n),l=JS(Zu,n),{onThumbPositionChange:c}=l,d=De(t,h=>l.onThumbChange(h)),f=m.useRef(void 0),g=Vd(()=>{f.current&&(f.current(),f.current=void 0)},100);return m.useEffect(()=>{const h=i.viewport;if(h){const v=()=>{if(g(),!f.current){const x=q4(h,c);f.current=x,c()}};return c(),h.addEventListener("scroll",v),()=>h.removeEventListener("scroll",v)}},[i.viewport,g,c]),p.jsx(ke.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ve(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),S=h.clientX-x.left,w=h.clientY-x.top;l.onThumbPointerDown({x:S,y:w})}),onPointerUp:ve(e.onPointerUp,l.onThumbPointerUp)})});tC.displayName=Zu;var Dm="ScrollAreaCorner",nC=m.forwardRef((e,t)=>{const n=xn(Dm,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(Y4,{...e,ref:t}):null});nC.displayName=Dm;var Y4=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=xn(Dm,n),[i,l]=m.useState(0),[c,d]=m.useState(0),f=!!(i&&c);return pi(o.scrollbarX,()=>{const g=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(g),d(g)}),pi(o.scrollbarY,()=>{const g=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(g),l(g)}),f?p.jsx(ke.div,{...r,ref:t,style:{width:i,height:c,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Qu(e){return e?parseInt(e,10):0}function rC(e,t){const n=e/t;return isNaN(n)?0:n}function zd(e){const t=rC(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function X4(e,t,n,r="ltr"){const o=zd(n),i=o/2,l=t||i,c=o-l,d=n.scrollbar.paddingStart+l,f=n.scrollbar.size-n.scrollbar.paddingEnd-c,g=n.content-n.viewport,h=r==="ltr"?[0,g]:[g*-1,0];return oC([d,f],h)(e)}function gw(e,t,n="ltr"){const r=zd(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,l=t.content-t.viewport,c=i-r,d=n==="ltr"?[0,l]:[l*-1,0],f=kg(e,d);return oC([0,l],[0,c])(f)}function oC(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function sC(e,t){return e>0&&e<t}var q4=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},l=n.left!==i.left,c=n.top!==i.top;(l||c)&&t(),n=i,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Vd(e,t){const n=pt(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function pi(e,t){const n=pt(t);wt(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var iC=XS,Z4=ZS,Q4=nC;const Di=m.forwardRef(({className:e,children:t,viewportRef:n,viewportClassName:r,type:o="hover",...i},l)=>p.jsxs(iC,{ref:l,type:o,className:Ce("relative overflow-hidden",e),...i,children:[p.jsx(Z4,{ref:n,className:Ce("h-full w-full rounded-[inherit]",r),children:t}),p.jsx(Tg,{}),p.jsx(Tg,{orientation:"horizontal"}),p.jsx(Q4,{className:"bg-transparent"})]}));Di.displayName=iC.displayName;const Tg=m.forwardRef(({className:e,orientation:t="vertical",...n},r)=>p.jsx(Am,{ref:r,forceMount:!0,orientation:t,className:Ce("flex touch-none select-none transition-opacity duration-200","data-[state=hidden]:opacity-0 data-[state=visible]:opacity-100","data-[state=hidden]:pointer-events-none",t==="vertical"&&"h-full w-1.5",t==="horizontal"&&"h-1.5 flex-col w-full",e),...n,children:p.jsx(tC,{className:Ce("relative flex-1 rounded-full bg-muted-foreground/30 transition-colors","hover:bg-muted-foreground/55")})}));Tg.displayName=Am.displayName;const J4=["top","right","bottom","left"],po=Math.min,rn=Math.max,Ju=Math.round,hu=Math.floor,Yn=e=>({x:e,y:e}),eV={left:"right",right:"left",bottom:"top",top:"bottom"};function Pg(e,t,n){return rn(e,po(t,n))}function Cr(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function ji(e){return e.split("-")[1]}function jm(e){return e==="x"?"y":"x"}function Om(e){return e==="y"?"height":"width"}function Gn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $m(e){return jm(Gn(e))}function tV(e,t,n){n===void 0&&(n=!1);const r=ji(e),o=$m(e),i=Om(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ed(l)),[l,ed(l)]}function nV(e){const t=ed(e);return[Rg(e),t,Rg(t)]}function Rg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const mw=["left","right"],yw=["right","left"],rV=["top","bottom"],oV=["bottom","top"];function sV(e,t,n){switch(e){case"top":case"bottom":return n?t?yw:mw:t?mw:yw;case"left":case"right":return t?rV:oV;default:return[]}}function iV(e,t,n,r){const o=ji(e);let i=sV(Er(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Rg)))),i}function ed(e){const t=Er(e);return eV[t]+e.slice(t.length)}function aV(e){return{top:0,right:0,bottom:0,left:0,...e}}function aC(e){return typeof e!="number"?aV(e):{top:e,right:e,bottom:e,left:e}}function td(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function vw(e,t,n){let{reference:r,floating:o}=e;const i=Gn(t),l=$m(t),c=Om(l),d=Er(t),f=i==="y",g=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,v=r[c]/2-o[c]/2;let x;switch(d){case"top":x={x:g,y:r.y-o.height};break;case"bottom":x={x:g,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:h};break;case"left":x={x:r.x-o.width,y:h};break;default:x={x:r.x,y:r.y}}switch(ji(t)){case"start":x[l]-=v*(n&&f?-1:1);break;case"end":x[l]+=v*(n&&f?-1:1);break}return x}async function lV(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:h="floating",altBoundary:v=!1,padding:x=0}=Cr(t,e),S=aC(x),E=c[v?h==="floating"?"reference":"floating":h],b=td(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(E)))==null||n?E:E.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:d})),N=h==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),P=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},A=td(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:k,strategy:d}):N);return{top:(b.top-A.top+S.top)/P.y,bottom:(A.bottom-b.bottom+S.bottom)/P.y,left:(b.left-A.left+S.left)/P.x,right:(A.right-b.right+S.right)/P.x}}const cV=50,uV=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:lV},d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:h}=vw(f,r,d),v=r,x=0;const S={};for(let w=0;w<i.length;w++){const E=i[w];if(!E)continue;const{name:b,fn:N}=E,{x:k,y:P,data:A,reset:I}=await N({x:g,y:h,initialPlacement:r,placement:v,strategy:o,middlewareData:S,rects:f,platform:c,elements:{reference:e,floating:t}});g=k??g,h=P??h,S[b]={...S[b],...A},I&&x<cV&&(x++,typeof I=="object"&&(I.placement&&(v=I.placement),I.rects&&(f=I.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):I.rects),{x:g,y:h}=vw(f,v,d)),w=-1)}return{x:g,y:h,placement:v,strategy:o,middlewareData:S}},dV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:d}=t,{element:f,padding:g=0}=Cr(e,t)||{};if(f==null)return{};const h=aC(g),v={x:n,y:r},x=$m(o),S=Om(x),w=await l.getDimensions(f),E=x==="y",b=E?"top":"left",N=E?"bottom":"right",k=E?"clientHeight":"clientWidth",P=i.reference[S]+i.reference[x]-v[x]-i.floating[S],A=v[x]-i.reference[x],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let R=I?I[k]:0;(!R||!await(l.isElement==null?void 0:l.isElement(I)))&&(R=c.floating[k]||i.floating[S]);const j=P/2-A/2,L=R/2-w[S]/2-1,U=po(h[b],L),$=po(h[N],L),B=U,G=R-w[S]-$,_=R/2-w[S]/2+j,O=Pg(B,_,G),M=!d.arrow&&ji(o)!=null&&_!==O&&i.reference[S]/2-(_<B?U:$)-w[S]/2<0,z=M?_<B?_-B:_-G:0;return{[x]:v[x]+z,data:{[x]:O,centerOffset:_-O-z,...M&&{alignmentOffset:z}},reset:M}}}),fV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:g=!0,crossAxis:h=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...E}=Cr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Er(o),N=Gn(c),k=Er(c)===c,P=await(d.isRTL==null?void 0:d.isRTL(f.floating)),A=v||(k||!w?[ed(c)]:nV(c)),I=S!=="none";!v&&I&&A.push(...iV(c,w,S,P));const R=[c,...A],j=await d.detectOverflow(t,E),L=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(g&&L.push(j[b]),h){const _=tV(o,l,P);L.push(j[_[0]],j[_[1]])}if(U=[...U,{placement:o,overflows:L}],!L.every(_=>_<=0)){var $,B;const _=((($=i.flip)==null?void 0:$.index)||0)+1,O=R[_];if(O&&(!(h==="alignment"?N!==Gn(O):!1)||U.every(H=>Gn(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:_,overflows:U},reset:{placement:O}};let M=(B=U.filter(z=>z.overflows[0]<=0).sort((z,H)=>z.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!M)switch(x){case"bestFit":{var G;const z=(G=U.filter(H=>{if(I){const W=Gn(H.placement);return W===N||W==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(W=>W>0).reduce((W,Z)=>W+Z,0)]).sort((H,W)=>H[1]-W[1])[0])==null?void 0:G[0];z&&(M=z);break}case"initialPlacement":M=c;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function xw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ww(e){return J4.some(t=>e[t]>=0)}const pV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Cr(e,t);switch(o){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),c=xw(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:ww(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),c=xw(l,n.floating);return{data:{escapedOffsets:c,escaped:ww(c)}}}default:return{}}}}},lC=new Set(["left","top"]);async function hV(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Er(n),c=ji(n),d=Gn(n)==="y",f=lC.has(l)?-1:1,g=i&&d?-1:1,h=Cr(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:S}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof S=="number"&&(x=c==="end"?S*-1:S),d?{x:x*g,y:v*f}:{x:v*f,y:x*g}}const gV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,d=await hV(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:l}}}}},mV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:d={fn:b=>{let{x:N,y:k}=b;return{x:N,y:k}}},...f}=Cr(e,t),g={x:n,y:r},h=await i.detectOverflow(t,f),v=Gn(Er(o)),x=jm(v);let S=g[x],w=g[v];if(l){const b=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=S+h[b],P=S-h[N];S=Pg(k,S,P)}if(c){const b=v==="y"?"top":"left",N=v==="y"?"bottom":"right",k=w+h[b],P=w-h[N];w=Pg(k,w,P)}const E=d.fn({...t,[x]:S,[v]:w});return{...E,data:{x:E.x-n,y:E.y-r,enabled:{[x]:l,[v]:c}}}}}},yV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Cr(e,t),g={x:n,y:r},h=Gn(o),v=jm(h);let x=g[v],S=g[h];const w=Cr(c,t),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const k=v==="y"?"height":"width",P=i.reference[v]-i.floating[k]+E.mainAxis,A=i.reference[v]+i.reference[k]-E.mainAxis;x<P?x=P:x>A&&(x=A)}if(f){var b,N;const k=v==="y"?"width":"height",P=lC.has(Er(o)),A=i.reference[h]-i.floating[k]+(P&&((b=l.offset)==null?void 0:b[h])||0)+(P?0:E.crossAxis),I=i.reference[h]+i.reference[k]+(P?0:((N=l.offset)==null?void 0:N[h])||0)-(P?E.crossAxis:0);S<A?S=A:S>I&&(S=I)}return{[v]:x,[h]:S}}}},vV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:c}=t,{apply:d=()=>{},...f}=Cr(e,t),g=await l.detectOverflow(t,f),h=Er(o),v=ji(o),x=Gn(o)==="y",{width:S,height:w}=i.floating;let E,b;h==="top"||h==="bottom"?(E=h,b=v===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(b=h,E=v==="end"?"top":"bottom");const N=w-g.top-g.bottom,k=S-g.left-g.right,P=po(w-g[E],N),A=po(S-g[b],k),I=!t.middlewareData.shift;let R=P,j=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),I&&!v){const U=rn(g.left,0),$=rn(g.right,0),B=rn(g.top,0),G=rn(g.bottom,0);x?j=S-2*(U!==0||$!==0?U+$:rn(g.left,g.right)):R=w-2*(B!==0||G!==0?B+G:rn(g.top,g.bottom))}await d({...t,availableWidth:j,availableHeight:R});const L=await l.getDimensions(c.floating);return S!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function Hd(){return typeof window<"u"}function Oi(e){return cC(e)?(e.nodeName||"").toLowerCase():"#document"}function sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function er(e){var t;return(t=(cC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cC(e){return Hd()?e instanceof Node||e instanceof sn(e).Node:!1}function jn(e){return Hd()?e instanceof Element||e instanceof sn(e).Element:!1}function Pr(e){return Hd()?e instanceof HTMLElement||e instanceof sn(e).HTMLElement:!1}function bw(e){return!Hd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof sn(e).ShadowRoot}function kl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=On(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function xV(e){return/^(table|td|th)$/.test(Oi(e))}function Bd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const wV=/transform|translate|scale|rotate|perspective|filter/,bV=/paint|layout|strict|content/,Wo=e=>!!e&&e!=="none";let Bh;function Lm(e){const t=jn(e)?On(e):e;return Wo(t.transform)||Wo(t.translate)||Wo(t.scale)||Wo(t.rotate)||Wo(t.perspective)||!Fm()&&(Wo(t.backdropFilter)||Wo(t.filter))||wV.test(t.willChange||"")||bV.test(t.contain||"")}function SV(e){let t=ho(e);for(;Pr(t)&&!hi(t);){if(Lm(t))return t;if(Bd(t))return null;t=ho(t)}return null}function Fm(){return Bh==null&&(Bh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Bh}function hi(e){return/^(html|body|#document)$/.test(Oi(e))}function On(e){return sn(e).getComputedStyle(e)}function Wd(e){return jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ho(e){if(Oi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bw(e)&&e.host||er(e);return bw(t)?t.host:t}function uC(e){const t=ho(e);return hi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pr(t)&&kl(t)?t:uC(t)}function sl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=uC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=sn(o);if(i){const c=Ig(l);return t.concat(l,l.visualViewport||[],kl(o)?o:[],c&&n?sl(c):[])}else return t.concat(o,sl(o,[],n))}function Ig(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dC(e){const t=On(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Pr(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=Ju(n)!==i||Ju(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function zm(e){return jn(e)?e:e.contextElement}function ci(e){const t=zm(e);if(!Pr(t))return Yn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=dC(t);let l=(i?Ju(n.width):n.width)/r,c=(i?Ju(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const CV=Yn(0);function fC(e){const t=sn(e);return!Fm()||!t.visualViewport?CV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function EV(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==sn(e)?!1:t}function os(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zm(e);let l=Yn(1);t&&(r?jn(r)&&(l=ci(r)):l=ci(e));const c=EV(i,n,r)?fC(i):Yn(0);let d=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,g=o.width/l.x,h=o.height/l.y;if(i){const v=sn(i),x=r&&jn(r)?sn(r):r;let S=v,w=Ig(S);for(;w&&r&&x!==S;){const E=ci(w),b=w.getBoundingClientRect(),N=On(w),k=b.left+(w.clientLeft+parseFloat(N.paddingLeft))*E.x,P=b.top+(w.clientTop+parseFloat(N.paddingTop))*E.y;d*=E.x,f*=E.y,g*=E.x,h*=E.y,d+=k,f+=P,S=sn(w),w=Ig(S)}}return td({width:g,height:h,x:d,y:f})}function Ud(e,t){const n=Wd(e).scrollLeft;return t?t.left+n:os(er(e)).left+n}function pC(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ud(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function NV(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=er(r),c=t?Bd(t.floating):!1;if(r===l||c&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Yn(1);const g=Yn(0),h=Pr(r);if((h||!h&&!i)&&((Oi(r)!=="body"||kl(l))&&(d=Wd(r)),h)){const x=os(r);f=ci(r),g.x=x.x+r.clientLeft,g.y=x.y+r.clientTop}const v=l&&!h&&!i?pC(l,d):Yn(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+g.x+v.x,y:n.y*f.y-d.scrollTop*f.y+g.y+v.y}}function kV(e){return Array.from(e.getClientRects())}function TV(e){const t=er(e),n=Wd(e),r=e.ownerDocument.body,o=rn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=rn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ud(e);const c=-n.scrollTop;return On(r).direction==="rtl"&&(l+=rn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}const Sw=25;function PV(e,t){const n=sn(e),r=er(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,d=0;if(o){i=o.width,l=o.height;const g=Fm();(!g||g&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const f=Ud(r);if(f<=0){const g=r.ownerDocument,h=g.body,v=getComputedStyle(h),x=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,S=Math.abs(r.clientWidth-h.clientWidth-x);S<=Sw&&(i-=S)}else f<=Sw&&(i+=f);return{width:i,height:l,x:c,y:d}}function RV(e,t){const n=os(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Pr(e)?ci(e):Yn(1),l=e.clientWidth*i.x,c=e.clientHeight*i.y,d=o*i.x,f=r*i.y;return{width:l,height:c,x:d,y:f}}function Cw(e,t,n){let r;if(t==="viewport")r=PV(e,n);else if(t==="document")r=TV(er(e));else if(jn(t))r=RV(t,n);else{const o=fC(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return td(r)}function hC(e,t){const n=ho(e);return n===t||!jn(n)||hi(n)?!1:On(n).position==="fixed"||hC(n,t)}function IV(e,t){const n=t.get(e);if(n)return n;let r=sl(e,[],!1).filter(c=>jn(c)&&Oi(c)!=="body"),o=null;const i=On(e).position==="fixed";let l=i?ho(e):e;for(;jn(l)&&!hi(l);){const c=On(l),d=Lm(l);!d&&c.position==="fixed"&&(o=null),(i?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||kl(l)&&!d&&hC(e,l))?r=r.filter(g=>g!==l):o=c,l=ho(l)}return t.set(e,r),r}function _V(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?Bd(t)?[]:IV(t,this._c):[].concat(n),r],c=Cw(t,l[0],o);let d=c.top,f=c.right,g=c.bottom,h=c.left;for(let v=1;v<l.length;v++){const x=Cw(t,l[v],o);d=rn(x.top,d),f=po(x.right,f),g=po(x.bottom,g),h=rn(x.left,h)}return{width:f-h,height:g-d,x:h,y:d}}function AV(e){const{width:t,height:n}=dC(e);return{width:t,height:n}}function MV(e,t,n){const r=Pr(t),o=er(t),i=n==="fixed",l=os(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Yn(0);function f(){d.x=Ud(o)}if(r||!r&&!i)if((Oi(t)!=="body"||kl(o))&&(c=Wd(t)),r){const x=os(t,!0,i,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else o&&f();i&&!r&&o&&f();const g=o&&!r&&!i?pC(o,c):Yn(0),h=l.left+c.scrollLeft-d.x-g.x,v=l.top+c.scrollTop-d.y-g.y;return{x:h,y:v,width:l.width,height:l.height}}function Wh(e){return On(e).position==="static"}function Ew(e,t){if(!Pr(e)||On(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return er(e)===n&&(n=n.ownerDocument.body),n}function gC(e,t){const n=sn(e);if(Bd(e))return n;if(!Pr(e)){let o=ho(e);for(;o&&!hi(o);){if(jn(o)&&!Wh(o))return o;o=ho(o)}return n}let r=Ew(e,t);for(;r&&xV(r)&&Wh(r);)r=Ew(r,t);return r&&hi(r)&&Wh(r)&&!Lm(r)?n:r||SV(e)||n}const DV=async function(e){const t=this.getOffsetParent||gC,n=this.getDimensions,r=await n(e.floating);return{reference:MV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jV(e){return On(e).direction==="rtl"}const OV={convertOffsetParentRelativeRectToViewportRelativeRect:NV,getDocumentElement:er,getClippingRect:_V,getOffsetParent:gC,getElementRects:DV,getClientRects:kV,getDimensions:AV,getScale:ci,isElement:jn,isRTL:jV};function mC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $V(e,t){let n=null,r;const o=er(e);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:g,top:h,width:v,height:x}=f;if(c||t(),!v||!x)return;const S=hu(h),w=hu(o.clientWidth-(g+v)),E=hu(o.clientHeight-(h+x)),b=hu(g),k={rootMargin:-S+"px "+-w+"px "+-E+"px "+-b+"px",threshold:rn(0,po(1,d))||1};let P=!0;function A(I){const R=I[0].intersectionRatio;if(R!==d){if(!P)return l();R?l(!1,R):r=setTimeout(()=>{l(!1,1e-7)},1e3)}R===1&&!mC(f,e.getBoundingClientRect())&&l(),P=!1}try{n=new IntersectionObserver(A,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,k)}n.observe(e)}return l(!0),i}function LV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=zm(e),g=o||i?[...f?sl(f):[],...t?sl(t):[]]:[];g.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=f&&c?$V(f,n):null;let v=-1,x=null;l&&(x=new ResizeObserver(b=>{let[N]=b;N&&N.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=x)==null||k.observe(t)})),n()}),f&&!d&&x.observe(f),t&&x.observe(t));let S,w=d?os(e):null;d&&E();function E(){const b=os(e);w&&!mC(w,b)&&n(),w=b,S=requestAnimationFrame(E)}return n(),()=>{var b;g.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h?.(),(b=x)==null||b.disconnect(),x=null,d&&cancelAnimationFrame(S)}}const FV=gV,zV=mV,VV=fV,HV=vV,BV=pV,Nw=dV,WV=yV,UV=(e,t,n)=>{const r=new Map,o={platform:OV,...n},i={...o.platform,_c:r};return uV(e,t,{...o,platform:i})};var KV=typeof document<"u",GV=function(){},ju=KV?m.useLayoutEffect:GV;function nd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nd(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!nd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function yC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kw(e,t){const n=yC(e);return Math.round(t*n)/n}function Uh(e){const t=m.useRef(e);return ju(()=>{t.current=e}),t}function YV(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[g,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=m.useState(r);nd(v,r)||x(r);const[S,w]=m.useState(null),[E,b]=m.useState(null),N=m.useCallback(H=>{H!==I.current&&(I.current=H,w(H))},[]),k=m.useCallback(H=>{H!==R.current&&(R.current=H,b(H))},[]),P=i||S,A=l||E,I=m.useRef(null),R=m.useRef(null),j=m.useRef(g),L=d!=null,U=Uh(d),$=Uh(o),B=Uh(f),G=m.useCallback(()=>{if(!I.current||!R.current)return;const H={placement:t,strategy:n,middleware:v};$.current&&(H.platform=$.current),UV(I.current,R.current,H).then(W=>{const Z={...W,isPositioned:B.current!==!1};_.current&&!nd(j.current,Z)&&(j.current=Z,hs.flushSync(()=>{h(Z)}))})},[v,t,n,$,B]);ju(()=>{f===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[f]);const _=m.useRef(!1);ju(()=>(_.current=!0,()=>{_.current=!1}),[]),ju(()=>{if(P&&(I.current=P),A&&(R.current=A),P&&A){if(U.current)return U.current(P,A,G);G()}},[P,A,G,U,L]);const O=m.useMemo(()=>({reference:I,floating:R,setReference:N,setFloating:k}),[N,k]),M=m.useMemo(()=>({reference:P,floating:A}),[P,A]),z=m.useMemo(()=>{const H={position:n,left:0,top:0};if(!M.floating)return H;const W=kw(M.floating,g.x),Z=kw(M.floating,g.y);return c?{...H,transform:"translate("+W+"px, "+Z+"px)",...yC(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Z}},[n,c,M.floating,g.x,g.y]);return m.useMemo(()=>({...g,update:G,refs:O,elements:M,floatingStyles:z}),[g,G,O,M,z])}const XV=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Nw({element:r.current,padding:o}).fn(n):{}:r?Nw({element:r,padding:o}).fn(n):{}}}},qV=(e,t)=>{const n=FV(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZV=(e,t)=>{const n=zV(e);return{name:n.name,fn:n.fn,options:[e,t]}},QV=(e,t)=>({fn:WV(e).fn,options:[e,t]}),JV=(e,t)=>{const n=VV(e);return{name:n.name,fn:n.fn,options:[e,t]}},eH=(e,t)=>{const n=HV(e);return{name:n.name,fn:n.fn,options:[e,t]}},tH=(e,t)=>{const n=BV(e);return{name:n.name,fn:n.fn,options:[e,t]}},nH=(e,t)=>{const n=XV(e);return{name:n.name,fn:n.fn,options:[e,t]}};var rH="Arrow",vC=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(ke.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});vC.displayName=rH;var oH=vC;function Vm(e){const[t,n]=m.useState(void 0);return wt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,c;if("borderBoxSize"in i){const d=i.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Hm="Popper",[xC,$i]=Ft(Hm),[sH,wC]=xC(Hm),bC=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return p.jsx(sH,{scope:t,anchor:r,onAnchorChange:o,children:n})};bC.displayName=Hm;var SC="PopperAnchor",CC=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=wC(SC,n),l=m.useRef(null),c=De(t,l),d=m.useRef(null);return m.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&i.onAnchorChange(d.current)}),r?null:p.jsx(ke.div,{...o,ref:c})});CC.displayName=SC;var Bm="PopperContent",[iH,aH]=xC(Bm),EC=m.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:g=0,sticky:h="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:S,...w}=e,E=wC(Bm,n),[b,N]=m.useState(null),k=De(t,K=>N(K)),[P,A]=m.useState(null),I=Vm(P),R=I?.width??0,j=I?.height??0,L=r+(i!=="center"?"-"+i:""),U=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},$=Array.isArray(f)?f:[f],B=$.length>0,G={padding:U,boundary:$.filter(cH),altBoundary:B},{refs:_,floatingStyles:O,placement:M,isPositioned:z,middlewareData:H}=YV({strategy:"fixed",placement:L,whileElementsMounted:(...K)=>LV(...K,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[qV({mainAxis:o+j,alignmentAxis:l}),d&&ZV({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?QV():void 0,...G}),d&&JV({...G}),eH({...G,apply:({elements:K,rects:q,availableWidth:oe,availableHeight:ce})=>{const{width:ge,height:ye}=q.reference,me=K.floating.style;me.setProperty("--radix-popper-available-width",`${oe}px`),me.setProperty("--radix-popper-available-height",`${ce}px`),me.setProperty("--radix-popper-anchor-width",`${ge}px`),me.setProperty("--radix-popper-anchor-height",`${ye}px`)}}),P&&nH({element:P,padding:c}),uH({arrowWidth:R,arrowHeight:j}),v&&tH({strategy:"referenceHidden",...G})]}),[W,Z]=TC(M),F=pt(S);wt(()=>{z&&F?.()},[z,F]);const V=H.arrow?.x,X=H.arrow?.y,Q=H.arrow?.centerOffset!==0,[ee,ne]=m.useState();return wt(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:z?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(iH,{scope:n,placedSide:W,onArrowChange:A,arrowX:V,arrowY:X,shouldHideArrow:Q,children:p.jsx(ke.div,{"data-side":W,"data-align":Z,...w,ref:k,style:{...w.style,animation:z?void 0:"none"}})})})});EC.displayName=Bm;var NC="PopperArrow",lH={top:"bottom",right:"left",bottom:"top",left:"right"},kC=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=aH(NC,r),l=lH[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(oH,{...o,ref:n,style:{...o.style,display:"block"}})})});kC.displayName=NC;function cH(e){return e!==null}var uH=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,l=o.arrow?.centerOffset!==0,c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,g]=TC(n),h={start:"0%",center:"50%",end:"100%"}[g],v=(o.arrow?.x??0)+c/2,x=(o.arrow?.y??0)+d/2;let S="",w="";return f==="bottom"?(S=l?h:`${v}px`,w=`${-d}px`):f==="top"?(S=l?h:`${v}px`,w=`${r.floating.height+d}px`):f==="right"?(S=`${-d}px`,w=l?h:`${x}px`):f==="left"&&(S=`${r.floating.width+d}px`,w=l?h:`${x}px`),{data:{x:S,y:w}}}});function TC(e){const[t,n="center"]=e.split("-");return[t,n]}var Wm=bC,Um=CC,Km=EC,Gm=kC,dH=Symbol("radix.slottable");function fH(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=dH,t}var PC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),pH="VisuallyHidden",Kd=m.forwardRef((e,t)=>p.jsx(ke.span,{...e,ref:t,style:{...PC,...e.style}}));Kd.displayName=pH;var hH=Kd,[Gd]=Ft("Tooltip",[$i]),Yd=$i(),RC="TooltipProvider",gH=700,_g="tooltip.open",[mH,Ym]=Gd(RC),IC=e=>{const{__scopeTooltip:t,delayDuration:n=gH,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,l=m.useRef(!0),c=m.useRef(!1),d=m.useRef(0);return m.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),p.jsx(mH,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:m.useCallback(f=>{c.current=f},[]),disableHoverableContent:o,children:i})};IC.displayName=RC;var il="Tooltip",[yH,Tl]=Gd(il),_C=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=e,d=Ym(il,e.__scopeTooltip),f=Yd(t),[g,h]=m.useState(null),v=kt(),x=m.useRef(0),S=l??d.disableHoverableContent,w=c??d.delayDuration,E=m.useRef(!1),[b,N]=cn({prop:r,defaultProp:o??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(_g))):d.onClose(),i?.(R)},caller:il}),k=m.useMemo(()=>b?E.current?"delayed-open":"instant-open":"closed",[b]),P=m.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,N(!0)},[N]),A=m.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),I=m.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,N(!0),x.current=0},w)},[w,N]);return m.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),p.jsx(Wm,{...f,children:p.jsx(yH,{scope:t,contentId:v,open:b,stateAttribute:k,trigger:g,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{d.isOpenDelayedRef.current?I():P()},[d.isOpenDelayedRef,I,P]),onTriggerLeave:m.useCallback(()=>{S?A():(window.clearTimeout(x.current),x.current=0)},[A,S]),onOpen:P,onClose:A,disableHoverableContent:S,children:n})})};_C.displayName=il;var Ag="TooltipTrigger",AC=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Tl(Ag,n),i=Ym(Ag,n),l=Yd(n),c=m.useRef(null),d=De(t,c,o.onTriggerChange),f=m.useRef(!1),g=m.useRef(!1),h=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),p.jsx(Um,{asChild:!0,...l,children:p.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:d,onPointerMove:ve(e.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),g.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),g.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ve(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});AC.displayName=Ag;var Xm="TooltipPortal",[vH,xH]=Gd(Xm,{forceMount:void 0}),MC=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Tl(Xm,t);return p.jsx(vH,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(Mi,{asChild:!0,container:o,children:r})})})};MC.displayName=Xm;var gi="TooltipContent",DC=m.forwardRef((e,t)=>{const n=xH(gi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,l=Tl(gi,e.__scopeTooltip);return p.jsx(Pt,{present:r||l.open,children:l.disableHoverableContent?p.jsx(jC,{side:o,...i,ref:t}):p.jsx(wH,{side:o,...i,ref:t})})}),wH=m.forwardRef((e,t)=>{const n=Tl(gi,e.__scopeTooltip),r=Ym(gi,e.__scopeTooltip),o=m.useRef(null),i=De(t,o),[l,c]=m.useState(null),{trigger:d,onClose:f}=n,g=o.current,{onPointerInTransitChange:h}=r,v=m.useCallback(()=>{c(null),h(!1)},[h]),x=m.useCallback((S,w)=>{const E=S.currentTarget,b={x:S.clientX,y:S.clientY},N=NH(b,E.getBoundingClientRect()),k=kH(b,N),P=TH(w.getBoundingClientRect()),A=RH([...k,...P]);c(A),h(!0)},[h]);return m.useEffect(()=>()=>v(),[v]),m.useEffect(()=>{if(d&&g){const S=E=>x(E,g),w=E=>x(E,d);return d.addEventListener("pointerleave",S),g.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",S),g.removeEventListener("pointerleave",w)}}},[d,g,x,v]),m.useEffect(()=>{if(l){const S=w=>{const E=w.target,b={x:w.clientX,y:w.clientY},N=d?.contains(E)||g?.contains(E),k=!PH(b,l);N?v():k&&(v(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[d,g,l,f,v]),p.jsx(jC,{...e,ref:i})}),[bH,SH]=Gd(il,{isInside:!1}),CH=fH("TooltipContent"),jC=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:l,...c}=e,d=Tl(gi,n),f=Yd(n),{onClose:g}=d;return m.useEffect(()=>(document.addEventListener(_g,g),()=>document.removeEventListener(_g,g)),[g]),m.useEffect(()=>{if(d.trigger){const h=v=>{v.target?.contains(d.trigger)&&g()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,g]),p.jsx(Ai,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:h=>h.preventDefault(),onDismiss:g,children:p.jsxs(Km,{"data-state":d.stateAttribute,...f,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(CH,{children:r}),p.jsx(bH,{scope:n,isInside:!0,children:p.jsx(hH,{id:d.contentId,role:"tooltip",children:o||r})})]})})});DC.displayName=gi;var OC="TooltipArrow",EH=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Yd(n);return SH(OC,n).isInside?null:p.jsx(Gm,{...o,...r,ref:t})});EH.displayName=OC;function NH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function kH(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function TH(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function PH(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const c=t[i],d=t[l],f=c.x,g=c.y,h=d.x,v=d.y;g>r!=v>r&&n<(h-f)*(r-g)/(v-g)+f&&(o=!o)}return o}function RH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),IH(t)}function IH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(o.y-l.y)>=(i.y-l.y)*(o.x-l.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(o.y-l.y)>=(i.y-l.y)*(o.x-l.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _H=IC,AH=_C,MH=AC,DH=MC,$C=DC;const LC=_H,al=AH,ll=MH,mi=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(DH,{children:p.jsx($C,{ref:r,sideOffset:t,className:Ce("fh-builder-portal font-sans z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));mi.displayName=$C.displayName;const Tw=e=>{let t;const n=new Set,r=(f,g)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const v=t;t=g??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(x=>x(t,v))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f))},d=t=e(r,o,c);return c},jH=(e=>e?Tw(e):Tw),OH=e=>e;function $H(e,t=OH){const n=Ze.useSyncExternalStore(e.subscribe,Ze.useCallback(()=>t(e.getState()),[e,t]),Ze.useCallback(()=>t(e.getInitialState()),[e,t]));return Ze.useDebugValue(n),n}const Pw=e=>{const t=jH(e),n=r=>$H(t,r);return Object.assign(n,t),n},Xd=(e=>e?Pw(e):Pw),Ye=Xd(e=>({byNodeId:{},byEdgeId:{},byChannelId:{},byMemoryId:{},byModelId:{},byFunctionId:{},setNodeDiagnostics:(t,n)=>e(r=>({byNodeId:{...r.byNodeId,[t]:n}})),clearNodeDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byNodeId;return{byNodeId:o}}),setEdgeDiagnostics:(t,n)=>e(r=>({byEdgeId:{...r.byEdgeId,[t]:n}})),clearEdgeDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byEdgeId;return{byEdgeId:o}}),setChannelDiagnostics:(t,n)=>e(r=>({byChannelId:{...r.byChannelId,[t]:n}})),clearChannelDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byChannelId;return{byChannelId:o}}),setMemoryDiagnostics:(t,n)=>e(r=>({byMemoryId:{...r.byMemoryId,[t]:n}})),clearMemoryDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byMemoryId;return{byMemoryId:o}}),setModelDiagnostics:(t,n)=>e(r=>({byModelId:{...r.byModelId,[t]:n}})),clearModelDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byModelId;return{byModelId:o}}),setFunctionDiagnostics:(t,n)=>e(r=>({byFunctionId:{...r.byFunctionId,[t]:n}})),clearFunctionDiagnostics:t=>e(n=>{const{[t]:r,...o}=n.byFunctionId;return{byFunctionId:o}})})),LH=(e={})=>t=>{const{limit:n=50,partialize:r=i=>i,equality:o=(i,l)=>JSON.stringify(i)!==JSON.stringify(l)}=e;return(i,l,c)=>({...t(i,l,c),_history_past:[],_history_future:[],mutationCount:0,takeCheckpoint:()=>{const f=r(l());i(g=>({...g,_history_past:[...g._history_past,{state:f,timestamp:Date.now()}].slice(-n),_history_future:[],mutationCount:g.mutationCount+1}))},withCheckpoint:f=>{const g=r(l()),h=f(),v=r(l());return o(g,v)||i(S=>({...S,_history_past:[...S._history_past,{state:g,timestamp:Date.now()}].slice(-n),_history_future:[],mutationCount:S.mutationCount+1})),h},undo:()=>{const f=l();if(f._history_past.length===0)return;const g=[...f._history_past],h=g.pop(),v=r(f);i({...f,...h.state,_history_past:g,_history_future:[...f._history_future,{state:v,timestamp:Date.now()}],mutationCount:f.mutationCount+1})},redo:()=>{const f=l();if(f._history_future.length===0)return;const g=[...f._history_future],h=g.pop(),v=r(f);i({...f,...h.state,_history_past:[...f._history_past,{state:v,timestamp:Date.now()}].slice(-n),_history_future:g,mutationCount:f.mutationCount+1})},clearHistory:()=>{i(f=>({...f,_history_past:[],_history_future:[],mutationCount:f.mutationCount+1}))},canUndo:()=>l()._history_past.length>0,canRedo:()=>l()._history_future.length>0,exportHistory:()=>({past:[...l()._history_past],future:[...l()._history_future]}),importHistory:f=>{i(g=>({...g,_history_past:[...f.past],_history_future:[...f.future],mutationCount:g.mutationCount+1}))}})},lo=1,qa=1,FH=[];function zH(e){const t=new Map;for(const n of e){if(!Number.isInteger(n.from)||n.from<qa||n.from>=lo)throw new Error(`[migration] from must be an integer in [${qa}, ${lo}), got ${n.from}`);if(t.has(n.from))throw new Error(`[migration] duplicate migration from ${n.from}`);t.set(n.from,n)}for(let n=qa;n<lo;n++)if(!t.has(n))throw new Error(`[migration] missing migration from ${n} -> ${n+1}`);return t}const VH=zH(FH);function HH(e){const t=e.schemaVersion;return typeof t=="number"&&Number.isInteger(t)&&t>=qa?t:qa}function BH(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("[migration] workflow document must be a JSON object");let t={...e};const n=HH(t);if(n>lo)throw new Error(`[migration] schemaVersion ${n} is newer than this build supports (${lo})`);for(let r=n;r<lo;r++)t=VH.get(r).migrate(t);return t.schemaVersion=lo,t}const WH=new Set(C1);function UH(e){const t=e.canvases[We];if(!t)throw new Error("Main canvas missing");const n=t.nodes.map(f=>L0(f,tl(f.id,f,t.edges))),r=t.edges.map(j0),o=Iw(t.variables),i=[];for(const[f,g]of Object.entries(e.functions)){const h=e.canvases[f];if(!h)throw new Error(`[workflow-core] function ${f} has no body canvas — cannot serialize`);const{functionInfo:v,outputAssignments:x}=$A(g);i.push({functionInfo:v,outputAssignments:x,nodes:h.nodes.map(S=>L0(S,tl(S.id,S,h.edges))),edges:h.edges.map(j0),declaredVariables:Iw(h.variables)})}const l=Object.values(e.channels).map(kA),c=Object.values(e.memory).map(_A),d=Object.values(e.models).map(jA);return{schemaVersion:lo,nodes:n,edges:r,functions:i,declaredVariables:o,channels:l,memory:c,models:d}}function KH(e){const t={},n={},r={};for(const h of e.functions??[])r[h.functionInfo.id]={...h.functionInfo,arguments:$0(h.functionInfo.arguments),returns:$0(h.functionInfo.returns)};const o=h=>r[h],i=e.nodes.map(h=>F0(h,o)),l=e.edges.map(O0),c=e.declaredVariables??[];t[We]={nodes:i,edges:l,variables:Rw(i,[],c)};for(const h of e.functions??[]){const v=r[h.functionInfo.id],x=LA(v,h.outputAssignments??{});n[x.id]=x;const S=h.nodes.map(E=>F0(E,o)),w=h.edges.map(O0);t[x.id]={nodes:S,edges:w,variables:Rw(S,x.arguments,h.declaredVariables??[])}}const d={};for(const h of e.channels??[]){if(!WH.has(h.type))continue;const v=TA(h);d[v.id]=v}const f={};for(const h of e.memory??[]){const v=AA(h);f[v.id]=v}const g={};for(const h of e.models??[]){const v=OA(h);g[v.id]=v}return{canvases:t,functions:n,channels:d,memory:f,models:g}}function qd(e){const t={};for(const n of e)for(const[r,o]of Object.entries(Uu(n)))t[el(n.id,r)]={kind:"node",nodeId:n.id,outputId:r,name:o.name,dataType:o.dataType};return t}function Rw(e,t,n){const r=qd(e);for(const o of t)r[um(o.uid)]={kind:"fnarg",uid:o.uid,name:o.name,dataType:o.dataType};for(const o of n)r[Pi(o.uid)]={kind:"declared",uid:o.uid,name:o.name,dataType:o.dataType,...o.initialValue!==void 0?{initialValue:o.initialValue}:{}};return r}function Iw(e){const t=[];for(const n of Object.values(e))n.kind==="declared"&&t.push({uid:n.uid,name:n.name,dataType:n.dataType,...n.initialValue!==void 0?{initialValue:n.initialValue}:{}});return t}function GH(e,t){e.getState().setVariables(n=>{const r={...n};for(const o of Object.keys(r))o.startsWith("fnarg:")&&delete r[o];for(const o of t)r[um(o.uid)]={kind:"fnarg",uid:o.uid,name:o.name,dataType:o.dataType};return r})}const YH=50,Mg=new Set;function Zd(){Mg.forEach(e=>e())}function _w(e){return Mg.add(e),()=>Mg.delete(e)}const xr=new Map;xr.set(We,qm());function qm(){const e=Xd(LH({limit:YH,partialize:n=>({nodes:n.nodes,edges:n.edges,variables:n.variables}),equality:(n,r)=>n.nodes===r.nodes&&n.edges===r.edges&&n.variables===r.variables})(n=>({nodes:[],edges:[],variables:{},viewport:null,setNodes:r=>n(o=>{const i=r(o.nodes);return i===o.nodes?o:{nodes:i}}),setEdges:r=>n(o=>{const i=r(o.edges);return i===o.edges?o:{edges:i}}),setVariables:r=>n(o=>{const i=r(o.variables);return i===o.variables?o:{variables:i}}),setViewport:r=>n({viewport:r}),setRFselect:(r,o)=>{const i=new Set(r),l=new Set(o);n(c=>({nodes:c.nodes.map(d=>{const f=i.has(d.id);return d.selected===f?d:{...d,selected:f}}),edges:c.edges.map(d=>{const f=l.has(d.id);return d.selected===f?d:{...d,selected:f}})}))},initialize:(r,o)=>{const i=qd(r.map(l=>l.data));n({nodes:r,edges:o,variables:i})}}))),t=e;return t.takeCheckpoint=()=>e.getState().takeCheckpoint(),t.withCheckpoint=n=>e.getState().withCheckpoint(n),t.undo=()=>e.getState().undo(),t.redo=()=>e.getState().redo(),t.clearHistory=()=>e.getState().clearHistory(),t.canUndo=()=>e.getState().canUndo(),t.canRedo=()=>e.getState().canRedo(),t.exportHistory=()=>e.getState().exportHistory(),t.importHistory=n=>e.getState().importHistory(n),t}function Zm(e){return xr.get(e)}function et(e){if(!xr.has(e)){const t=qm();if(e!==We){const n=ln(),r={id:n,type:xe.Trigger,position:{x:100,y:100},data:{id:n,type:"OnFunctionCall",arguments:{}}};t.getState().initialize([r],[])}xr.set(e,t)}return xr.get(e)}function Qm(){const e={};return xr.forEach((t,n)=>{e[n]=t}),e}function XH(e){e!==We&&(xr.delete(e),Zd())}function FC(){xr.clear(),xr.set(We,qm()),Zd()}function qH(){const e={id:"uart0",label:"Serial",type:"UART",arguments:{}};return{[e.id]:e}}const ja={kind:"none"};function qs(e){Zm(e)?.getState().setRFselect([],[])}const ue=Xd((e,t)=>({activeCanvasId:We,builderMode:{type:"edit"},selection:ja,activeSidebarTab:"nodes",channels:qH(),memory:{},models:{},functions:{},availableModels:[],mutationCount:0,setActiveCanvas:n=>e(r=>({activeCanvasId:n,selection:r.selection.kind==="variable"||r.selection.kind==="function"?ja:r.selection})),setBuilderMode:n=>e({builderMode:n}),selectGraph:(n,r)=>{e({selection:n.length||r.length?{kind:"graph",nodeIds:n,edgeIds:r}:ja}),et(t().activeCanvasId).getState().setRFselect(n,r)},syncSelectionFromRF:(n,r)=>{n.length||r.length?e({selection:{kind:"graph",nodeIds:n,edgeIds:r}}):t().selection.kind==="graph"&&e({selection:ja})},selectChannel:n=>{e({selection:{kind:"channel",id:n}}),qs(t().activeCanvasId)},selectMemory:n=>{e({selection:{kind:"memory",id:n}}),qs(t().activeCanvasId)},selectModel:n=>{e({selection:{kind:"model",id:n}}),qs(t().activeCanvasId)},selectFunction:n=>{qs(t().activeCanvasId),e({selection:{kind:"function",id:n},activeCanvasId:n})},selectVariable:n=>{e({selection:{kind:"variable",uid:n}}),qs(t().activeCanvasId)},clearSelection:()=>{e({selection:ja}),qs(t().activeCanvasId)},setActiveSidebarTab:n=>e({activeSidebarTab:n}),setChannels:n=>e(r=>{const o=n(r.channels);return o===r.channels?r:{channels:o,mutationCount:r.mutationCount+1}}),setMemory:n=>e(r=>{const o=n(r.memory);return o===r.memory?r:{memory:o,mutationCount:r.mutationCount+1}}),setModels:n=>e(r=>{const o=n(r.models);return o===r.models?r:{models:o,mutationCount:r.mutationCount+1}}),setFunctions:n=>e(r=>{const o=n(r.functions);return o===r.functions?r:{functions:o,mutationCount:r.mutationCount+1}}),setAvailableModels:n=>e({availableModels:n})}));function Qd(){const e=ue(r=>r.functions),t=m.useMemo(()=>Object.values(e),[e]),n=m.useCallback(r=>e[r],[e]);return{functions:e,functionsList:t,getFunction:n}}function Jm(e){return wg(e,mr.t.bind(mr))}const ey=()=>{const e=Lt.getAll(),{functions:t}=Qd(),n=m.useMemo(()=>Object.values(t).map(l=>Jm(Td(l))),[t]),r=m.useCallback(l=>{if(l.type==="FunctionCall"){const c=l;return n.find(d=>d.type==="FunctionCall"&&d.functionInfo.id===c.functionInfo.id)}return Lt.getByType(l.type)},[n]),o=m.useCallback(l=>{const c=Lt.getByCategory(l);return l===xe.Function?[...c,...n]:c},[n]),i=m.useCallback(()=>{const l=Lt.getAllCategories(),c=new Set([...l]);return n.length>0&&c.add(xe.Function),[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output].filter(f=>c.has(f))},[n]);return{nodeDefinitions:[...e,...n],getAllCategories:i,getNodeDefinition:r,getNodeDefinitionsByCategory:o}},ZH=({canvasId:e,onSelectNode:t,onSelectEdge:n})=>{const{t:r}=Xe(),{getNodeDefinition:o}=ey(),i=Ye(h=>h.byNodeId),l=Ye(h=>h.byEdgeId),c=et(e),d=c(h=>h.nodes),f=c(h=>h.edges),g=[];for(const[h,v]of Object.entries(i)){if(v.length===0)continue;const x=d.find(E=>E.id===h),S=x?o(x.data):void 0,w=x?.data?.label||S?.label||h;g.push({entityId:h,entityType:"node",label:w,diagnostics:v,errorCount:v.filter(E=>E.severity==="error").length,warningCount:v.filter(E=>E.severity==="warning").length})}for(const[h,v]of Object.entries(l)){if(v.length===0)continue;const x=f.find(A=>A.id===h),S=x?d.find(A=>A.id===x.source):void 0,w=x?d.find(A=>A.id===x.target):void 0,E=S?o(S.data):void 0,b=w?o(w.data):void 0,N=S?.data?.label||E?.label||"?",k=w?.data?.label||b?.label||"?",P=`${N} → ${k}`;g.push({entityId:h,entityType:"edge",label:P,diagnostics:v,errorCount:v.filter(A=>A.severity==="error").length,warningCount:v.filter(A=>A.severity==="warning").length})}return g.sort((h,v)=>{const x=h.errorCount>0?0:1,S=v.errorCount>0?0:1;if(x!==S)return x-S;const w=h.entityType==="node"?0:1,E=v.entityType==="node"?0:1;return w!==E?w-E:h.label.localeCompare(v.label)}),g.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-muted-foreground",children:[p.jsx(M1,{className:"w-8 h-8 text-success"}),p.jsx("span",{className:"text-sm",children:r("noIssuesFound")})]}):p.jsx("div",{className:"flex flex-col gap-1",children:g.map(h=>p.jsx(QH,{group:h,onSelect:()=>h.entityType==="node"?t(h.entityId):n(h.entityId)},`${h.entityType}-${h.entityId}`))})};function QH({group:e,onSelect:t}){const[n,r]=m.useState(!0);return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>{r(o=>!o),t()},className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted/50 text-left text-sm",children:[p.jsx(Ii,{className:Ce("w-3.5 h-3.5 shrink-0 transition-transform",!n&&"-rotate-90")}),p.jsx("span",{className:"truncate flex-1 font-medium",children:e.label}),p.jsxs("div",{className:"flex items-center gap-1",children:[e.errorCount>0&&p.jsx(fo,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 leading-4 border-destructive/40 text-destructive bg-destructive/10",children:e.errorCount}),e.warningCount>0&&p.jsx(fo,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 leading-4 border-warning/40 text-warning bg-warning/10",children:e.warningCount})]})]}),n&&p.jsx("div",{className:"ml-3 border-l border-border/50 pl-2 flex flex-col gap-0.5 pb-1",children:e.diagnostics.map((o,i)=>p.jsxs("button",{type:"button",onClick:t,className:"flex items-start gap-1.5 px-2 py-1 rounded text-xs text-left hover:bg-muted/50 transition-colors w-full",children:[o.severity==="error"?p.jsx(mo,{className:"w-3.5 h-3.5 text-destructive shrink-0 mt-0.5"}):p.jsx(Pd,{className:"w-3.5 h-3.5 text-warning shrink-0 mt-0.5"}),p.jsx("span",{className:"text-muted-foreground",children:o.message})]},i))})]})}const ss=m.forwardRef(({icon:e=ts,className:t,children:n,onClick:r,...o},i)=>p.jsxs(gt,{ref:i,variant:"outline",size:"sm",className:Ce("w-full text-xs border-dashed",t),onClick:l=>{l.detail!==0&&l.currentTarget.blur(),r?.(l)},...o,children:[p.jsx(e,{className:"w-3.5 h-3.5 mr-1"}),n]}));ss.displayName="AddButton";function Jd({items:e,selectedId:t,onSelect:n,diagnosticsSlot:r,badge:o,emptyIcon:i,emptyText:l,emptyHint:c,addActions:d}){const f=ue(h=>wn(h.builderMode)),g=p.jsx("div",{className:"flex flex-col gap-1.5",children:d.map(({label:h,icon:v,onAdd:x})=>p.jsx(ss,{icon:v,onClick:x,children:h},h))});return e.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[p.jsx(i,{className:"w-10 h-10 text-muted-foreground/50 mb-3"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:l}),p.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:c}),!f&&p.jsx("div",{className:"mt-3 w-full px-2",children:g})]}):p.jsxs("div",{className:"space-y-1.5",children:[e.map(h=>{const v=t===h.id,x=(r[h.id]??[]).some(S=>S.severity==="error");return p.jsx("div",{onClick:()=>n(h.id),className:Ce("p-3 rounded-lg transition-all cursor-pointer border ring-1",v?"bg-accent shadow-md":"bg-card shadow-sm hover:shadow-md",x?"border-destructive ring-destructive":v?"border-primary/40 ring-primary/40":"border-border ring-transparent"),children:p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("span",{className:"font-mono text-sm text-foreground truncate flex items-center gap-1.5",children:[x&&p.jsx(mo,{className:"w-3.5 h-3.5 text-destructive shrink-0"}),h.label]}),p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded border border-border/50 text-muted-foreground shrink-0",children:o(h)})]})},h.id)}),!f&&p.jsx("div",{className:"pt-1",children:g})]})}const JH=({onOpenFunction:e,onCreateFunction:t})=>{const{t:n}=Xe(),r=ue(c=>c.functions),o=ue(c=>c.selection),i=Ye(c=>c.byFunctionId),l=Object.values(r).map(c=>({id:c.id,label:c.name,inputs:c.arguments.length,outputs:c.outputs.length}));return p.jsx(Jd,{items:l,selectedId:o.kind==="function"?o.id:null,onSelect:e,diagnosticsSlot:i,badge:c=>`${c.inputs}→${c.outputs}`,emptyIcon:$1,emptyText:n("noFunctions"),emptyHint:n("addFunctionHint"),addActions:[{label:n("addFunction"),icon:ts,onAdd:()=>t()}]})};var ef="Collapsible",[eB]=Ft(ef),[tB,ty]=eB(ef),zC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...c}=e,[d,f]=cn({prop:r,defaultProp:o??!1,onChange:l,caller:ef});return p.jsx(tB,{scope:n,disabled:i,contentId:kt(),open:d,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),children:p.jsx(ke.div,{"data-state":ry(d),"data-disabled":i?"":void 0,...c,ref:t})})});zC.displayName=ef;var VC="CollapsibleTrigger",HC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ty(VC,n);return p.jsx(ke.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ry(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ve(e.onClick,o.onOpenToggle)})});HC.displayName=VC;var ny="CollapsibleContent",BC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ty(ny,e.__scopeCollapsible);return p.jsx(Pt,{present:n||o.open,children:({present:i})=>p.jsx(nB,{...r,ref:t,present:i})})});BC.displayName=ny;var nB=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=ty(ny,n),[c,d]=m.useState(r),f=m.useRef(null),g=De(t,f),h=m.useRef(0),v=h.current,x=m.useRef(0),S=x.current,w=l.open||c,E=m.useRef(w),b=m.useRef(void 0);return m.useEffect(()=>{const N=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(N)},[]),wt(()=>{const N=f.current;if(N){b.current=b.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();h.current=k.height,x.current=k.width,E.current||(N.style.transitionDuration=b.current.transitionDuration,N.style.animationName=b.current.animationName),d(r)}},[l.open,r]),p.jsx(ke.div,{"data-state":ry(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!w,...i,ref:g,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:w&&o})});function ry(e){return e?"open":"closed"}var rB=zC;const oB=rB,sB=HC,iB=BC,aB=yo("flex w-full bg-field border border-input rounded-2xl placeholder:text-muted-foreground/60 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground transition-all duration-300",{variants:{size:{sm:"h-9 px-3 py-1.5 text-sm",md:"h-10 px-4 py-2 text-sm",lg:"h-11 px-5 py-2.5 text-base"},variant:{default:"",subtle:"bg-muted/30 border-transparent backdrop-blur-md",ghost:"bg-transparent border-transparent hover:bg-card/40 hover:backdrop-blur-lg"},status:{none:"",success:"border-success focus:border-success focus:shadow-[0_0_0_3px_rgba(50,166,118,0.1)]",error:"border-destructive focus:border-destructive focus:shadow-[0_0_0_3px_rgba(220,38,38,0.1)]"}},defaultVariants:{size:"md",variant:"default",status:"none"}}),Mt=m.forwardRef(({className:e,type:t,size:n,variant:r,status:o,htmlSize:i,...l},c)=>p.jsx("input",{type:t,size:i,className:Ce(aB({size:n,variant:r,status:o}),e),ref:c,...l}));Mt.displayName="Input";const oy={[xe.Input]:Ez,[xe.Logic]:yz,[xe.Data]:Ku,[xe.Output]:_z,[xe.AI]:hz,[xe.Trigger]:$z,[xe.Tool]:Oz,[xe.Function]:gz},lB={[xe.Input]:"bg-node-input/10 text-node-input border-node-input/20",[xe.Logic]:"bg-node-logic/10 text-node-logic border-node-logic/20",[xe.Data]:"bg-node-data/10 text-node-data border-node-data/20",[xe.Output]:"bg-node-output/10 text-node-output border-node-output/20",[xe.AI]:"bg-node-agent/10 text-node-agent border-node-agent/20",[xe.Trigger]:"bg-node-trigger/10 text-node-trigger border-node-trigger/20",[xe.Tool]:"bg-node-tool/10 text-node-tool border-node-tool/20",[xe.Function]:"bg-node-function/10 text-node-function border-node-function/20"};function WC(e,t){return e(`nodes.${t.type}.description`,{defaultValue:t.description})}function cB(e,t,n){return n.description?e(`${t}.params.${n.id}.description`,{defaultValue:n.description}):""}function uB(e,t,n){return e(`edges.${n}.description`,{defaultValue:t.description})}const dB=e=>{switch(e){case"string":return H0;case"number":case"int":case"float":return Cz;case"boolean":case"bool":return Mz;case"dropdown":case"selection":return Ii;default:return H0}},fB=(e,t)=>{switch(e){case"string":return t("paramTypeText");case"int":case"float":case"number":return t("paramTypeNumber");case"boolean":case"bool":return t("paramTypeBoolean");case"dropdown":case"selection":return t("paramTypeSelection");case"expression":return t("paramTypeExpression");default:return e}},pB=({parameters:e,t})=>e.length===0?null:p.jsxs("div",{className:"space-y-2 max-w-sm",children:[p.jsx("div",{className:"font-medium text-sm",children:t("parametersLabel")}),e.map((n,r)=>{const o=dB(n.type),i=n.optional===!0;return p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(o,{className:"w-3 h-3"}),p.jsx("span",{className:"font-medium text-sm",children:n.label}),i?p.jsx(fo,{variant:"secondary",className:"text-xs",children:t("optional")}):p.jsx(fo,{variant:"destructive",className:"text-xs",children:t("required")})]}),p.jsxs("div",{className:"text-xs text-muted-foreground pl-5",children:[t("typeLabel")," ",fB(n.type,t),n.default!==void 0&&p.jsxs("span",{children:[" ","• ",t("defaultLabel")," ",String(n.default)]}),"options"in n&&n.options&&p.jsxs("span",{children:[" ","• ",t("optionsLabel")," ",n.options.map(l=>l.label||l.value).join(", ")]})]})]},r)})]}),hB=({onAddNode:e,nodeDefinitions:t,getAllCategories:n,functions:r,isFunctionCanvas:o})=>{const{t:i}=Xe(),l=ue(b=>wn(b.builderMode)),[c,d]=m.useState(""),[f,g]=m.useState(new Set),h=c.toLowerCase(),v=t.filter(b=>!b.isUnremovable&&!(o&&b.category===xe.Trigger)&&(b.label.toLowerCase().includes(h)||b.category.toLowerCase().includes(h)||(b.tags??[]).some(N=>N.toLowerCase().includes(h)))),x=new Set(v.map(b=>b.category)),S=b=>{const N=new Set(f);N.has(b)?N.delete(b):N.add(b),g(N)},w=b=>c.trim()&&x.has(b)?!0:f.has(b),E=v.length>0;return p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("div",{className:"relative shrink-0",children:[p.jsx(O1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),p.jsx(Mt,{placeholder:i("searchBlocks"),value:c,onChange:b=>d(b.target.value),className:"pl-10 h-9 rounded-lg"})]}),p.jsx(Di,{className:"flex-1 mt-3",children:p.jsx(LC,{disableHoverableContent:!0,children:p.jsxs("div",{className:"flex flex-col gap-0.5 px-1 pb-4",children:[!E&&p.jsx("p",{className:"text-sm text-muted-foreground text-center py-10",children:i("noResults","No matching nodes")}),n().map(b=>{const N=v.filter(I=>I.category===b);if(N.length===0)return null;const k=w(b),P=oy[b],A=lB[b]??"bg-muted text-muted-foreground border-border";return p.jsxs(oB,{open:k,onOpenChange:()=>S(b),children:[p.jsxs(sB,{className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-left hover:bg-muted/50 transition-colors group",children:[p.jsx(Ii,{className:`w-4 h-4 text-muted-foreground transition-transform duration-200 ${k?"":"-rotate-90"}`}),P&&p.jsx(P,{className:"w-4 h-4 text-muted-foreground shrink-0"}),p.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:b}),p.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:N.length})]}),p.jsx(iB,{children:p.jsx("div",{className:"grid grid-cols-2 gap-1.5 px-1 pt-1.5 pb-2",children:N.map(I=>{const R=I.parameters,j=`${I.type}-${"functionInfo"in I?I.functionInfo.id:""}`,L=R.length>0,U=WC(i,I),$=I.tags?.[0],B=p.jsxs("button",{type:"button",draggable:!l,onDragStart:l?void 0:_=>{const O={nodeDef:I};_.dataTransfer.setData("application/json",JSON.stringify(O)),_.dataTransfer.effectAllowed="copy"},onClick:l?void 0:()=>e(I),disabled:l,className:`relative flex flex-col items-center gap-2 rounded-lg border border-border bg-card p-2.5 text-center transition-colors duration-150 ${l?"opacity-60 cursor-default":"cursor-grab active:cursor-grabbing hover:border-primary/50 hover:bg-accent/40"}`,children:[p.jsx("div",{className:`flex items-center justify-center w-9 h-9 rounded-lg border ${A}`,children:P&&p.jsx(P,{className:"w-4 h-4"})}),p.jsx("span",{className:"text-[11px] font-medium leading-tight line-clamp-2 w-full",children:I.label}),$&&p.jsx(fo,{variant:"secondary",className:"absolute top-1 right-1 text-[9px] h-3.5 px-1 font-normal leading-none",children:$})]});return U||L?p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:B}),p.jsx(mi,{side:"right",className:"max-w-sm pointer-events-none",children:p.jsxs("div",{className:"space-y-2",children:[U&&p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:U}),L&&p.jsx(pB,{parameters:R,t:i})]})})]},j):p.jsx(Ze.Fragment,{children:B},j)})})})]},b)})]})})})]})};function UC(e){const t={};for(const n of e)"default"in n&&n.default!==void 0&&(t[n.id]=structuredClone(n.default));return t}function yi(e,t){const n=t instanceof Set?t:new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}function KC(e){const t={type:e},n={};for(const r of Ed.parameters)r.id!=="type"&&(r.activationRules?.length&&!Tr(r,t,!1)||"default"in r&&r.default!==void 0&&(n[r.id]=r.default));return n}function gB(e="GPIOIN"){const t=ln(),n=Object.values(ue.getState().channels).map(o=>o.label),r={id:t,label:yi("channel",n),type:e,arguments:KC(e)};return ue.getState().setChannels(o=>({...o,[t]:r})),r}function Kh(e,t){const n=e;ue.getState().setChannels(r=>{const o=r[n];if(!o)return r;const i=t.type??o.type,l={...o.arguments,...t.arguments??{}};if(t.type&&t.type!==o.type)for(const[c,d]of Object.entries(KC(i)))l[c]===void 0&&(l[c]=d);return{...r,[n]:{...o,...t.label!==void 0?{label:t.label}:{},type:i,arguments:l}}})}function mB(e){const t=e;ue.getState().setChannels(r=>{const{[t]:o,...i}=r;return i});const n=ue.getState().selection;n.kind==="channel"&&n.id===e&&ue.getState().clearSelection()}const yB=()=>{const{t:e}=Xe(),t=ue(i=>i.channels),n=ue(i=>i.selection),r=ue(i=>i.selectChannel),o=Ye(i=>i.byChannelId);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="channel"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:i=>i.type,emptyIcon:D1,emptyText:e("noChannels"),emptyHint:e("noChannelsHint"),addActions:[{label:e("addChannel"),icon:ts,onAdd:()=>r(gB("GPIOIN").id)}]})},vB={MemoryFile:"memory",VectorDatabase:"vectordb"};function xB(e){const t=ln(),n=Object.values(ue.getState().memory).map(o=>o.label),r={id:t,label:yi(vB[e],n),type:e,arguments:UC(Nd.getByType(e)?.parameters??[])};return ue.getState().setMemory(o=>({...o,[t]:r})),r}function Aw(e,t){const n=e;ue.getState().setMemory(r=>{const o=r[n];return o?{...r,[n]:{...o,...t.label!==void 0?{label:t.label}:{},...t.arguments?{arguments:{...o.arguments,...t.arguments}}:{}}}:r})}function wB(e){const t=e;ue.getState().setMemory(r=>{const{[t]:o,...i}=r;return i});const n=ue.getState().selection;n.kind==="memory"&&n.id===e&&ue.getState().clearSelection()}const bB={MemoryFile:"File",VectorDatabase:"Vector"},SB=()=>{const{t:e}=Xe(),t=ue(l=>l.memory),n=ue(l=>l.selection),r=ue(l=>l.selectMemory),o=Ye(l=>l.byMemoryId),i=l=>r(xB(l).id);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="memory"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:l=>bB[l.type],emptyIcon:bg,emptyText:e("noMemory","No memory declared yet"),emptyHint:e("noMemoryHint","Declare memory files for agents and vector databases for RAG"),addActions:[{label:e("addMemoryFile","Add Memory File"),icon:j1,onAdd:()=>i("MemoryFile")},{label:e("addVectorDatabase","Add Vector Database"),icon:bg,onAdd:()=>i("VectorDatabase")}]})},CB={LLMModel:"model"};function EB(e){const t=ln(),n=Object.values(ue.getState().models).map(o=>o.label),r={id:t,label:yi(CB[e],n),type:e,arguments:UC(kd.getByType(e)?.parameters??[])};return ue.getState().setModels(o=>({...o,[t]:r})),r}function Mw(e,t){const n=e;ue.getState().setModels(r=>{const o=r[n];return o?{...r,[n]:{...o,...t.label!==void 0?{label:t.label}:{},...t.arguments?{arguments:{...o.arguments,...t.arguments}}:{}}}:r})}function NB(e){const t=e;ue.getState().setModels(r=>{const{[t]:o,...i}=r;return i});const n=ue.getState().selection;n.kind==="model"&&n.id===e&&ue.getState().clearSelection()}const kB=()=>{const{t:e}=Xe(),t=ue(i=>i.models),n=ue(i=>i.selection),r=ue(i=>i.selectModel),o=Ye(i=>i.byModelId);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="model"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:()=>e("modelLLMBadge","LLM"),emptyIcon:_1,emptyText:e("noModels","No custom models yet"),emptyHint:e("noModelsHint","Built-in models are always available. Declare custom or self-hosted models here."),addActions:[{label:e("addCustomModel","Add Custom Model"),icon:ts,onAdd:()=>r(EB("LLMModel").id)}]})},Li=(e=We)=>{const t=et(e),n=t(o=>o.variables),r=t(o=>o.edges);return m.useMemo(()=>dm(n,r),[n,r])};function TB(e){let t=1;for(;e.includes(`var${t}`);)t++;return`var${t}`}function PB(e){const t=et(e);t.takeCheckpoint();const n=Object.values(t.getState().variables).filter(i=>i.kind==="declared").map(i=>i.name),r=ln(),o={kind:"declared",uid:r,name:TB(n),dataType:"int"};return t.getState().setVariables(i=>({...i,[Pi(r)]:o})),r}function Ha(e,t,n){const r=et(e);r.takeCheckpoint();const o=Pi(t);r.getState().setVariables(i=>{const l=i[o];return!l||l.kind!=="declared"?i:{...i,[o]:{...l,...n}}})}function RB(e,t,n){Ha(e,t,{dataType:n,initialValue:void 0})}function IB(e,t){const n=et(e);n.takeCheckpoint();const r=Pi(t);n.getState().setVariables(i=>{const{[r]:l,...c}=i;return c});const o=ue.getState().selection;o.kind==="variable"&&o.uid===t&&ue.getState().clearSelection()}const _B=({canvasId:e,onSelectNode:t})=>{const n=ue(b=>wn(b.builderMode)),{t:r}=Xe(),{list:o}=Li(e),i=ue(b=>b.selection),l=ue(b=>b.selectVariable),d=et(e)(b=>b.variables),f=e===We,g=Ze.useMemo(()=>{const b=[];for(const N of Object.values(d))N.kind==="declared"&&b.push({uid:N.uid,var:N});return b},[d]),h=()=>{const b=PB(e);l(b)},v=o.filter(b=>b.kind==="fnarg"),x=o.filter(b=>b.kind==="node");if(!(v.length>0||x.length>0||g.length>0))return p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[p.jsx(Ku,{className:"w-10 h-10 text-muted-foreground/50 mb-3"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:r("noVariables")}),p.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:r("addNodesForVariables")}),!n&&p.jsx("div",{className:"mt-3 w-full px-2",children:p.jsx(ss,{onClick:h,children:r("addVariable")})})]});const w=(b,N,k=!1)=>{const P=!!N;return p.jsx("div",{onClick:N,className:Ce("p-3 rounded-lg transition-all",k?"bg-accent shadow-md border border-primary/40 ring-1 ring-primary/40":"bg-card shadow-sm border border-border",P?"hover:shadow-md cursor-pointer":"cursor-default"),children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ku,{className:"w-4 h-4 text-muted-foreground"}),p.jsx("span",{className:"font-mono text-sm text-foreground",children:b.name})]}),p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded border border-border/50 text-muted-foreground shrink-0",children:b.dataType})]})},b.kind==="node"?`${b.nodeId}-${b.outputId}`:b.kind==="declared"?`declared-${b.uid}`:`fnarg-${b.uid}`)},E=({title:b})=>p.jsx("div",{className:"flex items-center justify-between px-1 mb-2",children:p.jsx("span",{className:"text-sm font-medium text-foreground/80",children:b})});return p.jsxs("div",{className:"space-y-5",children:[!f&&v.length>0&&p.jsxs("div",{children:[p.jsx(E,{title:r("functionArguments")}),p.jsx("div",{className:"space-y-1.5",children:v.map(b=>w(b))})]}),x.length>0&&p.jsxs("div",{children:[p.jsx(E,{title:r("nodeOutputVariables")}),p.jsx("div",{className:"space-y-1.5",children:x.map(b=>w(b,b.kind==="node"?()=>t(b.nodeId):void 0))})]}),p.jsxs("div",{children:[p.jsx(E,{title:r("definedVariables")}),p.jsxs("div",{className:"space-y-1.5",children:[g.map(({uid:b,var:N})=>w(N,n?void 0:()=>l(b),i.kind==="variable"&&i.uid===b)),!n&&p.jsx(ss,{onClick:h,children:r("addVariable")})]})]})]})};var AB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MB=AB.reduce((e,t)=>{const n=pm(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),DB="Label",GC=m.forwardRef((e,t)=>p.jsx(MB.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));GC.displayName=DB;var YC=GC;const jB=yo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),vi=m.forwardRef(({className:e,...t},n)=>p.jsx(YC,{ref:n,className:Ce(jB(),e),...t}));vi.displayName=YC.displayName;function sy(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tf="Switch",[OB]=Ft(tf),[$B,LB]=OB(tf),XC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:f,form:g,...h}=e,[v,x]=m.useState(null),S=De(t,k=>x(k)),w=m.useRef(!1),E=v?g||!!v.closest("form"):!0,[b,N]=cn({prop:o,defaultProp:i??!1,onChange:f,caller:tf});return p.jsxs($B,{scope:n,checked:b,disabled:c,children:[p.jsx(ke.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":JC(b),"data-disabled":c?"":void 0,disabled:c,value:d,...h,ref:S,onClick:ve(e.onClick,k=>{N(P=>!P),E&&(w.current=k.isPropagationStopped(),w.current||k.stopPropagation())})}),E&&p.jsx(QC,{control:v,bubbles:!w.current,name:r,value:d,checked:b,required:l,disabled:c,form:g,style:{transform:"translateX(-100%)"}})]})});XC.displayName=tf;var qC="SwitchThumb",ZC=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=LB(qC,n);return p.jsx(ke.span,{"data-state":JC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});ZC.displayName=qC;var FB="SwitchBubbleInput",QC=m.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},i)=>{const l=m.useRef(null),c=De(l,i),d=sy(n),f=Vm(t);return m.useEffect(()=>{const g=l.current;if(!g)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"checked").set;if(d!==n&&x){const S=new Event("click",{bubbles:r});x.call(g,n),g.dispatchEvent(S)}},[d,n,r]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});QC.displayName=FB;function JC(e){return e?"checked":"unchecked"}var eE=XC,zB=ZC;const nf=m.forwardRef(({className:e,...t},n)=>p.jsx(eE,{className:Ce("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:p.jsx(zB,{className:Ce("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));nf.displayName=eE.displayName;const is=Xd(e=>({phase:{status:"inactive"},context:{},console:[],nextConsoleId:0,setPhase:t=>e({phase:t}),setContext:t=>e({context:t}),updateContextVar:(t,n)=>e(r=>({context:{...r.context,[t]:n}})),appendConsole:(t,n)=>e(r=>({console:[...r.console,{id:r.nextConsoleId,timestamp:Date.now(),type:t,text:n}],nextConsoleId:r.nextConsoleId+1})),clearConsole:()=>e({console:[],nextConsoleId:0}),reset:()=>e({phase:{status:"inactive"},context:{},console:[],nextConsoleId:0})}));function VB(){const e=et(We).getState().variables,t=[];for(const n of Object.values(e))(n.kind==="declared"||n.kind==="node")&&t.push({key:n.name,name:n.name,dataType:n.dataType});return t.sort((n,r)=>n.name.localeCompare(r.name))}const HB=()=>{const{t:e}=Xe(),t=is(o=>o.context),n=is(o=>o.updateContextVar),r=VB();return r.length===0?p.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:e("debug.noVariables")}):p.jsx("div",{className:"space-y-3",children:r.map(({key:o,name:i,dataType:l})=>{const c=t[o];return p.jsxs("div",{className:"space-y-1",children:[p.jsxs(vi,{className:"text-xs font-medium flex items-center gap-1.5",children:[p.jsx("span",{children:i}),p.jsxs("span",{className:"text-muted-foreground font-mono",children:["(",l,")"]})]}),l==="bool"?p.jsx(nf,{checked:!!c,onCheckedChange:d=>n(o,d)}):l==="int"?p.jsx(Mt,{type:"number",step:1,value:c??0,onChange:d=>n(o,parseInt(d.target.value)||0),className:"h-8 font-mono text-sm"}):l==="float"?p.jsx(Mt,{type:"number",step:.1,value:c??0,onChange:d=>n(o,parseFloat(d.target.value)||0),className:"h-8 font-mono text-sm"}):p.jsx(Mt,{value:String(c??""),onChange:d=>n(o,d.target.value),className:"h-8 font-mono text-sm"})]},o)})})},BB=({canvasId:e,activeTab:t,onTabChange:n,onAddNode:r,nodeDefinitions:o,getAllCategories:i,onSelectNode:l,onSelectEdge:c,isFunctionCanvas:d,functions:f,onOpenFunction:g,onCreateFunction:h,isDebugMode:v})=>{const{t:x}=Xe(),S=m.useMemo(()=>[{id:"nodes",icon:pz,label:x("nodeLibrary")},{id:"variables",icon:Ku,label:x("variables")},{id:"channels",icon:D1,label:x("channels")},{id:"memory",icon:bg,label:x("memoryFiles","Memory")},{id:"models",icon:_1,label:x("models","AI Models")},{id:"functions",icon:mz,label:x("functions")},{id:"diagnostics",icon:mo,label:x("diagnostics")}],[x]),w=m.useMemo(()=>[{id:"debug-context",icon:vz,label:x("debug.context")}],[x]),E=Ye(_=>{let O=0;for(const M of Object.values(_.byNodeId))for(const z of M)z.severity==="error"&&O++;for(const M of Object.values(_.byEdgeId))for(const z of M)z.severity==="error"&&O++;return O}),b=Ye(_=>{let O=0;for(const M of Object.values(_.byNodeId))for(const z of M)z.severity==="warning"&&O++;for(const M of Object.values(_.byEdgeId))for(const z of M)z.severity==="warning"&&O++;return O}),N=Ye(_=>{let O=0;for(const M of Object.values(_.byChannelId))for(const z of M)z.severity==="error"&&O++;return O}),k=Ye(_=>{let O=0;for(const M of Object.values(_.byChannelId))for(const z of M)z.severity==="warning"&&O++;return O}),P=Ye(_=>{let O=0;for(const M of Object.values(_.byMemoryId))for(const z of M)z.severity==="error"&&O++;return O}),A=Ye(_=>{let O=0;for(const M of Object.values(_.byMemoryId))for(const z of M)z.severity==="warning"&&O++;return O}),I=Ye(_=>{let O=0;for(const M of Object.values(_.byModelId))for(const z of M)z.severity==="error"&&O++;return O}),R=Ye(_=>{let O=0;for(const M of Object.values(_.byModelId))for(const z of M)z.severity==="warning"&&O++;return O}),j=Ye(_=>{let O=0;for(const M of Object.values(_.byFunctionId))for(const z of M)z.severity==="error"&&O++;return O}),L=Ye(_=>{let O=0;for(const M of Object.values(_.byFunctionId))for(const z of M)z.severity==="warning"&&O++;return O}),U=m.useMemo(()=>v?w:S,[v,w,S]),$=_=>{n(t===_?null:_)},B=()=>{switch(t){case"nodes":return p.jsx(hB,{onAddNode:r,nodeDefinitions:o,getAllCategories:i,functions:f,isFunctionCanvas:!!d});case"variables":return p.jsx(_B,{canvasId:e,onSelectNode:l});case"channels":return p.jsx(yB,{});case"memory":return p.jsx(SB,{});case"models":return p.jsx(kB,{});case"functions":return p.jsx(JH,{onOpenFunction:g,onCreateFunction:h});case"diagnostics":return p.jsx(ZH,{canvasId:e,onSelectNode:l,onSelectEdge:c});case"debug-context":return p.jsx(HB,{});default:return null}},G=_=>U.find(M=>M.id===_)?.label??"";return p.jsxs("div",{className:"flex h-full",children:[p.jsx("div",{className:"w-14 bg-card border-r border-border/50 flex flex-col items-center py-3 gap-1 shrink-0",children:U.map(_=>{const O=_.icon,M=t===_.id;let z=0,H=0;_.id==="diagnostics"?(z=E,H=b):_.id==="channels"?(z=N,H=k):_.id==="memory"?(z=P,H=A):_.id==="models"?(z=I,H=R):_.id==="functions"&&(z=j,H=L);const W=z+H,Z=W>0,F=Z&&!M?z>0?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-warning hover:text-warning hover:bg-warning/10":void 0;return p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsxs(gt,{variant:"ghost",size:"icon",onClick:V=>{V.detail!==0&&V.currentTarget.blur(),$(_.id)},className:Ce("w-10 h-10 transition-all duration-200 relative",M?"bg-accent text-primary shadow-sm":F??"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:[p.jsx(O,{className:"w-5 h-5"}),Z&&p.jsx("span",{className:Ce("absolute -top-0.5 -right-0.5 min-w-[16px] h-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1 shadow-sm",z>0?"bg-destructive text-destructive-foreground":"bg-warning text-warning-foreground"),children:W})]})}),p.jsx(mi,{side:"right",sideOffset:8,children:_.label})]},_.id)})}),p.jsx("div",{className:Ce("bg-card/95 backdrop-blur-xl border-r border-border/50 transition-all duration-300 ease-in-out overflow-hidden flex flex-col",t?"w-64 opacity-100":"w-0 opacity-0"),children:t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border/50 shrink-0",children:[p.jsx("h3",{className:"font-semibold text-sm text-foreground",children:G(t)}),p.jsx(gt,{variant:"ghost",size:"icon",onClick:()=>n(null),className:"w-7 h-7 text-muted-foreground hover:text-foreground",children:p.jsx(Rd,{className:"w-4 h-4"})})]}),p.jsx(Di,{className:"flex-1",viewportClassName:"p-3",children:B()})]})})]})},WB=({tabs:e,activeTabId:t,onTabChange:n,onTabClose:r,onTabReorder:o})=>{const i=m.useRef(null),l=m.useRef(null),c=m.useRef(null);m.useEffect(()=>{const w=l.current;if(!w)return;const E=b=>{b.deltaY!==0&&(w.scrollWidth<=w.clientWidth||(b.preventDefault(),w.scrollLeft+=b.deltaY))};return w.addEventListener("wheel",E,{passive:!1}),()=>w.removeEventListener("wheel",E)},[]);const[d,f]=m.useState(null),[g,h]=m.useState(null),v=w=>e[w]?.id===We,x=m.useCallback(()=>{c.current=null,f(null),h(null)},[]),S=m.useCallback((w,E)=>{if(c.current===null||!i.current||e[E]?.id===We)return;w.preventDefault(),w.stopPropagation(),w.dataTransfer.dropEffect="move";const b=w.currentTarget.getBoundingClientRect(),N=i.current.getBoundingClientRect(),k=b.left+b.width/2,P=w.clientX<k,A=P?E:E+1,I=P?b.left-N.left:b.right-N.left,R=Math.round(Math.max(0,Math.min(I,i.current.clientWidth-2)));f(A),h(R)},[e]);return p.jsx(Di,{className:"bg-card/80 border-b border-border/50",viewportRef:l,children:p.jsxs("div",{ref:i,className:"relative flex items-stretch",onDragOver:w=>{c.current===null||!i.current||(w.preventDefault(),w.dataTransfer.dropEffect="move")},onDrop:w=>{if(w.preventDefault(),c.current!==null&&d!==null){const E=c.current,b=d>E?d-1:d;b>0&&b!==E&&o(E,b)}x()},children:[g!==null&&p.jsx("div",{className:"absolute top-0 bottom-0 bg-primary z-10 pointer-events-none",style:{left:0,width:"2px",transform:`translateX(${g}px)`}}),e.map((w,E)=>{const b=!v(E);return p.jsxs(Ze.Fragment,{children:[E>0&&p.jsx("div",{className:"w-px bg-border/70 shrink-0"}),p.jsxs("div",{draggable:b,onDragStart:N=>{b&&(c.current=E,N.dataTransfer.effectAllowed="move")},onDragOver:N=>S(N,E),onDragEnd:x,className:Ce("group flex items-center gap-1.5 pl-2 pr-1 text-sm font-medium cursor-pointer transition-colors","hover:bg-field/80",t===w.id?"bg-field text-foreground":"text-muted-foreground hover:text-foreground",b?"cursor-grab active:cursor-grabbing":"select-none"),onClick:()=>n(w.id),children:[v(E)?p.jsx(jz,{className:"w-3.5 h-3.5 shrink-0"}):p.jsx($1,{className:"w-3.5 h-3.5 shrink-0"}),p.jsx("span",{className:"truncate max-w-[120px] py-1",children:w.label}),w.id!==We?p.jsx("button",{type:"button","aria-label":`Close tab ${w.label}`,title:`Close tab ${w.label}`,className:"flex items-center justify-center w-4 h-4 shrink-0 rounded opacity-0 group-hover:opacity-100 transition-opacity hover:bg-destructive/15 hover:text-destructive",onClick:N=>{N.stopPropagation(),r(w.id)},children:p.jsx(Rd,{className:"w-3.5 h-3.5"})}):p.jsx("span",{className:"w-1 shrink-0"})]})]},w.id)})]})})};function tE(e,t,n){const r=Dn(t);return n.some(o=>o.target===e&&r.input.some(i=>i.type==="tool"&&i.id===o.targetHandle))}function UB(e,t,n){const r=Dn(t);return n.some(o=>o.target===e?r.input.some(i=>i.type==="control"&&i.id===o.targetHandle):o.source===e?r.output.some(i=>i.type==="control"&&i.id===o.sourceHandle):!1)}function Dg(e,t,n,r){const o=n.find(c=>c.id===e);if(!o)return!1;const l=Dn(o.data).output.find(c=>c.id===t);return!(!l||l.type==="control"&&!Lt.getByType(o.data.type)?.canBranch&&r.some(c=>c.source===e&&c.sourceHandle===t)||l.type==="control"&&tE(e,o.data,r))}function KB(e,t,n,r,o,i){const l=n.find(g=>g.id===e);if(!l)return[];const d=Dn(l.data).output.find(g=>g.id===t);if(!d)return[];const f=d.type;return o.filter(g=>g.isUnremovable||g.isSingleton&&n.some(v=>v.data.type===g.type)||i&&g.category==="Trigger"?!1:Dn({type:g.type}).input.some(v=>v.type===f))}const nE=(e,t,n,r,o,i)=>{if(n==null||r==null||e==null||t==null)return!1;const l=o.find(x=>x.id===e),c=o.find(x=>x.id===t);if(!l||!c||!Dg(e,n,o,i))return!1;const d=Dn(l.data),f=Dn(c.data),g=d.output.find(x=>x.id===n),h=f.input.find(x=>x.id===r);if(!g||!h||g.type!==h.type)return!1;const v=g.type;return v==="tool"&&UB(c.id,c.data,i)||v==="control"&&tE(c.id,c.data,i)?!1:v};function mt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=mt(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var GB={value:()=>{}};function rf(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Ou(n)}function Ou(e){this._=e}function YB(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ou.prototype=rf.prototype={constructor:Ou,on:function(e,t){var n=this._,r=YB(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((o=(e=r[i]).type)&&(o=XB(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(o=(e=r[i]).type)n[o]=Dw(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Dw(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ou(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function XB(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Dw(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=GB,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jg="http://www.w3.org/1999/xhtml";const jw={svg:"http://www.w3.org/2000/svg",xhtml:jg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function of(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),jw.hasOwnProperty(t)?{space:jw[t],local:e}:e}function qB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===jg&&t.documentElement.namespaceURI===jg?t.createElement(e):t.createElementNS(n,e)}}function ZB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rE(e){var t=of(e);return(t.local?ZB:qB)(t)}function QB(){}function iy(e){return e==null?QB:function(){return this.querySelector(e)}}function JB(e){typeof e!="function"&&(e=iy(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=new Array(l),d,f,g=0;g<l;++g)(d=i[g])&&(f=e.call(d,d.__data__,g,i))&&("__data__"in d&&(f.__data__=d.__data__),c[g]=f);return new un(r,this._parents)}function e8(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function t8(){return[]}function oE(e){return e==null?t8:function(){return this.querySelectorAll(e)}}function n8(e){return function(){return e8(e.apply(this,arguments))}}function r8(e){typeof e=="function"?e=n8(e):e=oE(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var l=t[i],c=l.length,d,f=0;f<c;++f)(d=l[f])&&(r.push(e.call(d,d.__data__,f,l)),o.push(d));return new un(r,o)}function sE(e){return function(){return this.matches(e)}}function iE(e){return function(t){return t.matches(e)}}var o8=Array.prototype.find;function s8(e){return function(){return o8.call(this.children,e)}}function i8(){return this.firstElementChild}function a8(e){return this.select(e==null?i8:s8(typeof e=="function"?e:iE(e)))}var l8=Array.prototype.filter;function c8(){return Array.from(this.children)}function u8(e){return function(){return l8.call(this.children,e)}}function d8(e){return this.selectAll(e==null?c8:u8(typeof e=="function"?e:iE(e)))}function f8(e){typeof e!="function"&&(e=sE(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&c.push(d);return new un(r,this._parents)}function aE(e){return new Array(e.length)}function p8(){return new un(this._enter||this._groups.map(aE),this._parents)}function rd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rd.prototype={constructor:rd,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function h8(e){return function(){return e}}function g8(e,t,n,r,o,i){for(var l=0,c,d=t.length,f=i.length;l<f;++l)(c=t[l])?(c.__data__=i[l],r[l]=c):n[l]=new rd(e,i[l]);for(;l<d;++l)(c=t[l])&&(o[l]=c)}function m8(e,t,n,r,o,i,l){var c,d,f=new Map,g=t.length,h=i.length,v=new Array(g),x;for(c=0;c<g;++c)(d=t[c])&&(v[c]=x=l.call(d,d.__data__,c,t)+"",f.has(x)?o[c]=d:f.set(x,d));for(c=0;c<h;++c)x=l.call(e,i[c],c,i)+"",(d=f.get(x))?(r[c]=d,d.__data__=i[c],f.delete(x)):n[c]=new rd(e,i[c]);for(c=0;c<g;++c)(d=t[c])&&f.get(v[c])===d&&(o[c]=d)}function y8(e){return e.__data__}function v8(e,t){if(!arguments.length)return Array.from(this,y8);var n=t?m8:g8,r=this._parents,o=this._groups;typeof e!="function"&&(e=h8(e));for(var i=o.length,l=new Array(i),c=new Array(i),d=new Array(i),f=0;f<i;++f){var g=r[f],h=o[f],v=h.length,x=x8(e.call(g,g&&g.__data__,f,r)),S=x.length,w=c[f]=new Array(S),E=l[f]=new Array(S),b=d[f]=new Array(v);n(g,h,w,E,b,x,t);for(var N=0,k=0,P,A;N<S;++N)if(P=w[N]){for(N>=k&&(k=N+1);!(A=E[k])&&++k<S;);P._next=A||null}}return l=new un(l,r),l._enter=c,l._exit=d,l}function x8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function w8(){return new un(this._exit||this._groups.map(aE),this._parents)}function b8(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function S8(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,l=Math.min(o,i),c=new Array(o),d=0;d<l;++d)for(var f=n[d],g=r[d],h=f.length,v=c[d]=new Array(h),x,S=0;S<h;++S)(x=f[S]||g[S])&&(v[S]=x);for(;d<o;++d)c[d]=n[d];return new un(c,this._parents)}function C8(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],l;--o>=0;)(l=r[o])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function E8(e){e||(e=N8);function t(h,v){return h&&v?e(h.__data__,v.__data__):!h-!v}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var l=n[i],c=l.length,d=o[i]=new Array(c),f,g=0;g<c;++g)(f=l[g])&&(d[g]=f);d.sort(t)}return new un(o,this._parents).order()}function N8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function k8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function T8(){return Array.from(this)}function P8(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var l=r[o];if(l)return l}return null}function R8(){let e=0;for(const t of this)++e;return e}function I8(){return!this.node()}function _8(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,l=o.length,c;i<l;++i)(c=o[i])&&e.call(c,c.__data__,i,o);return this}function A8(e){return function(){this.removeAttribute(e)}}function M8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function D8(e,t){return function(){this.setAttribute(e,t)}}function j8(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function O8(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function $8(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function L8(e,t){var n=of(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?M8:A8:typeof t=="function"?n.local?$8:O8:n.local?j8:D8)(n,t))}function lE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function F8(e){return function(){this.style.removeProperty(e)}}function z8(e,t,n){return function(){this.style.setProperty(e,t,n)}}function V8(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function H8(e,t,n){return arguments.length>1?this.each((t==null?F8:typeof t=="function"?V8:z8)(e,t,n??"")):xi(this.node(),e)}function xi(e,t){return e.style.getPropertyValue(t)||lE(e).getComputedStyle(e,null).getPropertyValue(t)}function B8(e){return function(){delete this[e]}}function W8(e,t){return function(){this[e]=t}}function U8(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function K8(e,t){return arguments.length>1?this.each((t==null?B8:typeof t=="function"?U8:W8)(e,t)):this.node()[e]}function cE(e){return e.trim().split(/^|\s+/)}function ay(e){return e.classList||new uE(e)}function uE(e){this._node=e,this._names=cE(e.getAttribute("class")||"")}uE.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function dE(e,t){for(var n=ay(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function fE(e,t){for(var n=ay(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function G8(e){return function(){dE(this,e)}}function Y8(e){return function(){fE(this,e)}}function X8(e,t){return function(){(t.apply(this,arguments)?dE:fE)(this,e)}}function q8(e,t){var n=cE(e+"");if(arguments.length<2){for(var r=ay(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?X8:t?G8:Y8)(n,t))}function Z8(){this.textContent=""}function Q8(e){return function(){this.textContent=e}}function J8(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function e6(e){return arguments.length?this.each(e==null?Z8:(typeof e=="function"?J8:Q8)(e)):this.node().textContent}function t6(){this.innerHTML=""}function n6(e){return function(){this.innerHTML=e}}function r6(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function o6(e){return arguments.length?this.each(e==null?t6:(typeof e=="function"?r6:n6)(e)):this.node().innerHTML}function s6(){this.nextSibling&&this.parentNode.appendChild(this)}function i6(){return this.each(s6)}function a6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function l6(){return this.each(a6)}function c6(e){var t=typeof e=="function"?e:rE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function u6(){return null}function d6(e,t){var n=typeof e=="function"?e:rE(e),r=t==null?u6:typeof t=="function"?t:iy(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function f6(){var e=this.parentNode;e&&e.removeChild(this)}function p6(){return this.each(f6)}function h6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function g6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function m6(e){return this.select(e?g6:h6)}function y6(e){return arguments.length?this.property("__data__",e):this.node().__data__}function v6(e){return function(t){e.call(this,t,this.__data__)}}function x6(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function w6(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function b6(e,t,n){return function(){var r=this.__on,o,i=v6(t);if(r){for(var l=0,c=r.length;l<c;++l)if((o=r[l]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function S6(e,t,n){var r=x6(e+""),o,i=r.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var d=0,f=c.length,g;d<f;++d)for(o=0,g=c[d];o<i;++o)if((l=r[o]).type===g.type&&l.name===g.name)return g.value}return}for(c=t?b6:w6,o=0;o<i;++o)this.each(c(r[o],t,n));return this}function pE(e,t,n){var r=lE(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function C6(e,t){return function(){return pE(this,e,t)}}function E6(e,t){return function(){return pE(this,e,t.apply(this,arguments))}}function N6(e,t){return this.each((typeof t=="function"?E6:C6)(e,t))}function*k6(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,l;o<i;++o)(l=r[o])&&(yield l)}var hE=[null];function un(e,t){this._groups=e,this._parents=t}function Pl(){return new un([[document.documentElement]],hE)}function T6(){return this}un.prototype=Pl.prototype={constructor:un,select:JB,selectAll:r8,selectChild:a8,selectChildren:d8,filter:f8,data:v8,enter:p8,exit:w8,join:b8,merge:S8,selection:T6,order:C8,sort:E8,call:k8,nodes:T8,node:P8,size:R8,empty:I8,each:_8,attr:L8,style:H8,property:K8,classed:q8,text:e6,html:o6,raise:i6,lower:l6,append:c6,insert:d6,remove:p6,clone:m6,datum:y6,on:S6,dispatch:N6,[Symbol.iterator]:k6};function on(e){return typeof e=="string"?new un([[document.querySelector(e)]],[document.documentElement]):new un([[e]],hE)}function P6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pn(e,t){if(e=P6(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const R6={passive:!1},cl={capture:!0,passive:!1};function Gh(e){e.stopImmediatePropagation()}function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function gE(e){var t=e.document.documentElement,n=on(e).on("dragstart.drag",ui,cl);"onselectstart"in t?n.on("selectstart.drag",ui,cl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function mE(e,t){var n=e.document.documentElement,r=on(e).on("dragstart.drag",null);t&&(r.on("click.drag",ui,cl),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const gu=e=>()=>e;function Og(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:l,y:c,dx:d,dy:f,dispatch:g}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:g}})}Og.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function I6(e){return!e.ctrlKey&&!e.button}function _6(){return this.parentNode}function A6(e,t){return t??{x:e.x,y:e.y}}function M6(){return navigator.maxTouchPoints||"ontouchstart"in this}function yE(){var e=I6,t=_6,n=A6,r=M6,o={},i=rf("start","drag","end"),l=0,c,d,f,g,h=0;function v(P){P.on("mousedown.drag",x).filter(r).on("touchstart.drag",E).on("touchmove.drag",b,R6).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(P,A){if(!(g||!e.call(this,P,A))){var I=k(this,t.call(this,P,A),P,A,"mouse");I&&(on(P.view).on("mousemove.drag",S,cl).on("mouseup.drag",w,cl),gE(P.view),Gh(P),f=!1,c=P.clientX,d=P.clientY,I("start",P))}}function S(P){if(ui(P),!f){var A=P.clientX-c,I=P.clientY-d;f=A*A+I*I>h}o.mouse("drag",P)}function w(P){on(P.view).on("mousemove.drag mouseup.drag",null),mE(P.view,f),ui(P),o.mouse("end",P)}function E(P,A){if(e.call(this,P,A)){var I=P.changedTouches,R=t.call(this,P,A),j=I.length,L,U;for(L=0;L<j;++L)(U=k(this,R,P,A,I[L].identifier,I[L]))&&(Gh(P),U("start",P,I[L]))}}function b(P){var A=P.changedTouches,I=A.length,R,j;for(R=0;R<I;++R)(j=o[A[R].identifier])&&(ui(P),j("drag",P,A[R]))}function N(P){var A=P.changedTouches,I=A.length,R,j;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),R=0;R<I;++R)(j=o[A[R].identifier])&&(Gh(P),j("end",P,A[R]))}function k(P,A,I,R,j,L){var U=i.copy(),$=Pn(L||I,A),B,G,_;if((_=n.call(P,new Og("beforestart",{sourceEvent:I,target:v,identifier:j,active:l,x:$[0],y:$[1],dx:0,dy:0,dispatch:U}),R))!=null)return B=_.x-$[0]||0,G=_.y-$[1]||0,function O(M,z,H){var W=$,Z;switch(M){case"start":o[j]=O,Z=l++;break;case"end":delete o[j],--l;case"drag":$=Pn(H||z,A),Z=l;break}U.call(M,P,new Og(M,{sourceEvent:z,subject:_,target:v,identifier:j,active:Z,x:$[0]+B,y:$[1]+G,dx:$[0]-W[0],dy:$[1]-W[1],dispatch:U}),R)}}return v.filter=function(P){return arguments.length?(e=typeof P=="function"?P:gu(!!P),v):e},v.container=function(P){return arguments.length?(t=typeof P=="function"?P:gu(P),v):t},v.subject=function(P){return arguments.length?(n=typeof P=="function"?P:gu(P),v):n},v.touchable=function(P){return arguments.length?(r=typeof P=="function"?P:gu(!!P),v):r},v.on=function(){var P=i.on.apply(i,arguments);return P===i?v:P},v.clickDistance=function(P){return arguments.length?(h=(P=+P)*P,v):Math.sqrt(h)},v}function ly(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function vE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Rl(){}var ul=.7,od=1/ul,di="\\s*([+-]?\\d+)\\s*",dl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",D6=/^#([0-9a-f]{3,8})$/,j6=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),O6=new RegExp(`^rgb\\(${Xn},${Xn},${Xn}\\)$`),$6=new RegExp(`^rgba\\(${di},${di},${di},${dl}\\)$`),L6=new RegExp(`^rgba\\(${Xn},${Xn},${Xn},${dl}\\)$`),F6=new RegExp(`^hsl\\(${dl},${Xn},${Xn}\\)$`),z6=new RegExp(`^hsla\\(${dl},${Xn},${Xn},${dl}\\)$`),Ow={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ly(Rl,as,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$w,formatHex:$w,formatHex8:V6,formatHsl:H6,formatRgb:Lw,toString:Lw});function $w(){return this.rgb().formatHex()}function V6(){return this.rgb().formatHex8()}function H6(){return xE(this).formatHsl()}function Lw(){return this.rgb().formatRgb()}function as(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=D6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Fw(t):n===3?new Yt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?mu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?mu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=j6.exec(e))?new Yt(t[1],t[2],t[3],1):(t=O6.exec(e))?new Yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$6.exec(e))?mu(t[1],t[2],t[3],t[4]):(t=L6.exec(e))?mu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=F6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,1):(t=z6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,t[4]):Ow.hasOwnProperty(e)?Fw(Ow[e]):e==="transparent"?new Yt(NaN,NaN,NaN,0):null}function Fw(e){return new Yt(e>>16&255,e>>8&255,e&255,1)}function mu(e,t,n,r){return r<=0&&(e=t=n=NaN),new Yt(e,t,n,r)}function B6(e){return e instanceof Rl||(e=as(e)),e?(e=e.rgb(),new Yt(e.r,e.g,e.b,e.opacity)):new Yt}function $g(e,t,n,r){return arguments.length===1?B6(e):new Yt(e,t,n,r??1)}function Yt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ly(Yt,$g,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new Yt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new Yt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Yt(Zo(this.r),Zo(this.g),Zo(this.b),sd(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:zw,formatHex:zw,formatHex8:W6,formatRgb:Vw,toString:Vw}));function zw(){return`#${Go(this.r)}${Go(this.g)}${Go(this.b)}`}function W6(){return`#${Go(this.r)}${Go(this.g)}${Go(this.b)}${Go((isNaN(this.opacity)?1:this.opacity)*255)}`}function Vw(){const e=sd(this.opacity);return`${e===1?"rgb(":"rgba("}${Zo(this.r)}, ${Zo(this.g)}, ${Zo(this.b)}${e===1?")":`, ${e})`}`}function sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Go(e){return e=Zo(e),(e<16?"0":"")+e.toString(16)}function Hw(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new In(e,t,n,r)}function xE(e){if(e instanceof In)return new In(e.h,e.s,e.l,e.opacity);if(e instanceof Rl||(e=as(e)),!e)return new In;if(e instanceof In)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),l=NaN,c=i-o,d=(i+o)/2;return c?(t===i?l=(n-r)/c+(n<r)*6:n===i?l=(r-t)/c+2:l=(t-n)/c+4,c/=d<.5?i+o:2-i-o,l*=60):c=d>0&&d<1?0:l,new In(l,c,d,e.opacity)}function U6(e,t,n,r){return arguments.length===1?xE(e):new In(e,t,n,r??1)}function In(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ly(In,U6,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new In(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new In(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new Yt(Yh(e>=240?e-240:e+120,o,r),Yh(e,o,r),Yh(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new In(Bw(this.h),yu(this.s),yu(this.l),sd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=sd(this.opacity);return`${e===1?"hsl(":"hsla("}${Bw(this.h)}, ${yu(this.s)*100}%, ${yu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bw(e){return e=(e||0)%360,e<0?e+360:e}function yu(e){return Math.max(0,Math.min(1,e||0))}function Yh(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cy=e=>()=>e;function K6(e,t){return function(n){return e+n*t}}function G6(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Y6(e){return(e=+e)==1?wE:function(t,n){return n-t?G6(t,n,e):cy(isNaN(t)?n:t)}}function wE(e,t){var n=t-e;return n?K6(e,n):cy(isNaN(e)?t:e)}const id=(function e(t){var n=Y6(t);function r(o,i){var l=n((o=$g(o)).r,(i=$g(i)).r),c=n(o.g,i.g),d=n(o.b,i.b),f=wE(o.opacity,i.opacity);return function(g){return o.r=l(g),o.g=c(g),o.b=d(g),o.opacity=f(g),o+""}}return r.gamma=e,r})(1);function X6(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function q6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Z6(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),l;for(l=0;l<r;++l)o[l]=Za(e[l],t[l]);for(;l<n;++l)i[l]=t[l];return function(c){for(l=0;l<r;++l)i[l]=o[l](c);return i}}function Q6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Wn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function J6(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Za(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Lg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xh=new RegExp(Lg.source,"g");function eW(e){return function(){return e}}function tW(e){return function(t){return e(t)+""}}function bE(e,t){var n=Lg.lastIndex=Xh.lastIndex=0,r,o,i,l=-1,c=[],d=[];for(e=e+"",t=t+"";(r=Lg.exec(e))&&(o=Xh.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),c[l]?c[l]+=i:c[++l]=i),(r=r[0])===(o=o[0])?c[l]?c[l]+=o:c[++l]=o:(c[++l]=null,d.push({i:l,x:Wn(r,o)})),n=Xh.lastIndex;return n<t.length&&(i=t.slice(n),c[l]?c[l]+=i:c[++l]=i),c.length<2?d[0]?tW(d[0].x):eW(t):(t=d.length,function(f){for(var g=0,h;g<t;++g)c[(h=d[g]).i]=h.x(f);return c.join("")})}function Za(e,t){var n=typeof t,r;return t==null||n==="boolean"?cy(t):(n==="number"?Wn:n==="string"?(r=as(t))?(t=r,id):bE:t instanceof as?id:t instanceof Date?Q6:q6(t)?X6:Array.isArray(t)?Z6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?J6:Wn)(e,t)}var Ww=180/Math.PI,Fg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function SE(e,t,n,r,o,i){var l,c,d;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,d/=c),e*r<t*n&&(e=-e,t=-t,d=-d,l=-l),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*Ww,skewX:Math.atan(d)*Ww,scaleX:l,scaleY:c}}var vu;function nW(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fg:SE(t.a,t.b,t.c,t.d,t.e,t.f)}function rW(e){return e==null||(vu||(vu=document.createElementNS("http://www.w3.org/2000/svg","g")),vu.setAttribute("transform",e),!(e=vu.transform.baseVal.consolidate()))?Fg:(e=e.matrix,SE(e.a,e.b,e.c,e.d,e.e,e.f))}function CE(e,t,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,g,h,v,x,S){if(f!==h||g!==v){var w=x.push("translate(",null,t,null,n);S.push({i:w-4,x:Wn(f,h)},{i:w-2,x:Wn(g,v)})}else(h||v)&&x.push("translate("+h+t+v+n)}function l(f,g,h,v){f!==g?(f-g>180?g+=360:g-f>180&&(f+=360),v.push({i:h.push(o(h)+"rotate(",null,r)-2,x:Wn(f,g)})):g&&h.push(o(h)+"rotate("+g+r)}function c(f,g,h,v){f!==g?v.push({i:h.push(o(h)+"skewX(",null,r)-2,x:Wn(f,g)}):g&&h.push(o(h)+"skewX("+g+r)}function d(f,g,h,v,x,S){if(f!==h||g!==v){var w=x.push(o(x)+"scale(",null,",",null,")");S.push({i:w-4,x:Wn(f,h)},{i:w-2,x:Wn(g,v)})}else(h!==1||v!==1)&&x.push(o(x)+"scale("+h+","+v+")")}return function(f,g){var h=[],v=[];return f=e(f),g=e(g),i(f.translateX,f.translateY,g.translateX,g.translateY,h,v),l(f.rotate,g.rotate,h,v),c(f.skewX,g.skewX,h,v),d(f.scaleX,f.scaleY,g.scaleX,g.scaleY,h,v),f=g=null,function(x){for(var S=-1,w=v.length,E;++S<w;)h[(E=v[S]).i]=E.x(x);return h.join("")}}}var oW=CE(nW,"px, ","px)","deg)"),sW=CE(rW,", ",")",")"),iW=1e-12;function Uw(e){return((e=Math.exp(e))+1/e)/2}function aW(e){return((e=Math.exp(e))-1/e)/2}function lW(e){return((e=Math.exp(2*e))-1)/(e+1)}const $u=(function e(t,n,r){function o(i,l){var c=i[0],d=i[1],f=i[2],g=l[0],h=l[1],v=l[2],x=g-c,S=h-d,w=x*x+S*S,E,b;if(w<iW)b=Math.log(v/f)/t,E=function(R){return[c+R*x,d+R*S,f*Math.exp(t*R*b)]};else{var N=Math.sqrt(w),k=(v*v-f*f+r*w)/(2*f*n*N),P=(v*v-f*f-r*w)/(2*v*n*N),A=Math.log(Math.sqrt(k*k+1)-k),I=Math.log(Math.sqrt(P*P+1)-P);b=(I-A)/t,E=function(R){var j=R*b,L=Uw(A),U=f/(n*N)*(L*lW(t*j+A)-aW(A));return[c+U*x,d+U*S,f*L/Uw(t*j+A)]}}return E.duration=b*1e3*t/Math.SQRT2,E}return o.rho=function(i){var l=Math.max(.001,+i),c=l*l,d=c*c;return e(l,c,d)},o})(Math.SQRT2,2,4);var wi=0,Ba=0,Oa=0,EE=1e3,ad,Wa,ld=0,ls=0,sf=0,fl=typeof performance=="object"&&performance.now?performance:Date,NE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function uy(){return ls||(NE(cW),ls=fl.now()+sf)}function cW(){ls=0}function cd(){this._call=this._time=this._next=null}cd.prototype=kE.prototype={constructor:cd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?uy():+n)+(t==null?0:+t),!this._next&&Wa!==this&&(Wa?Wa._next=this:ad=this,Wa=this),this._call=e,this._time=n,zg()},stop:function(){this._call&&(this._call=null,this._time=1/0,zg())}};function kE(e,t,n){var r=new cd;return r.restart(e,t,n),r}function uW(){uy(),++wi;for(var e=ad,t;e;)(t=ls-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wi}function Kw(){ls=(ld=fl.now())+sf,wi=Ba=0;try{uW()}finally{wi=0,fW(),ls=0}}function dW(){var e=fl.now(),t=e-ld;t>EE&&(sf-=t,ld=e)}function fW(){for(var e,t=ad,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ad=n);Wa=e,zg(r)}function zg(e){if(!wi){Ba&&(Ba=clearTimeout(Ba));var t=e-ls;t>24?(e<1/0&&(Ba=setTimeout(Kw,e-fl.now()-sf)),Oa&&(Oa=clearInterval(Oa))):(Oa||(ld=fl.now(),Oa=setInterval(dW,EE)),wi=1,NE(Kw))}}function Gw(e,t,n){var r=new cd;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var pW=rf("start","end","cancel","interrupt"),hW=[],TE=0,Yw=1,Vg=2,Lu=3,Xw=4,Hg=5,Fu=6;function af(e,t,n,r,o,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;gW(e,n,{name:t,index:r,group:o,on:pW,tween:hW,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:TE})}function dy(e,t){var n=Ln(e,t);if(n.state>TE)throw new Error("too late; already scheduled");return n}function tr(e,t){var n=Ln(e,t);if(n.state>Lu)throw new Error("too late; already running");return n}function Ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function gW(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=kE(i,0,n.time);function i(f){n.state=Yw,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var g,h,v,x;if(n.state!==Yw)return d();for(g in r)if(x=r[g],x.name===n.name){if(x.state===Lu)return Gw(l);x.state===Xw?(x.state=Fu,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete r[g]):+g<t&&(x.state=Fu,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete r[g])}if(Gw(function(){n.state===Lu&&(n.state=Xw,n.timer.restart(c,n.delay,n.time),c(f))}),n.state=Vg,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Vg){for(n.state=Lu,o=new Array(v=n.tween.length),g=0,h=-1;g<v;++g)(x=n.tween[g].value.call(e,e.__data__,n.index,n.group))&&(o[++h]=x);o.length=h+1}}function c(f){for(var g=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(d),n.state=Hg,1),h=-1,v=o.length;++h<v;)o[h].call(e,g);n.state===Hg&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Fu,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function zu(e,t){var n=e.__transition,r,o,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){i=!1;continue}o=r.state>Vg&&r.state<Hg,r.state=Fu,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}i&&delete e.__transition}}function mW(e){return this.each(function(){zu(this,e)})}function yW(e,t){var n,r;return function(){var o=tr(this,e),i=o.tween;if(i!==n){r=n=i;for(var l=0,c=r.length;l<c;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}o.tween=r}}function vW(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=tr(this,e),l=i.tween;if(l!==r){o=(r=l).slice();for(var c={name:t,value:n},d=0,f=o.length;d<f;++d)if(o[d].name===t){o[d]=c;break}d===f&&o.push(c)}i.tween=o}}function xW(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ln(this.node(),n).tween,o=0,i=r.length,l;o<i;++o)if((l=r[o]).name===e)return l.value;return null}return this.each((t==null?yW:vW)(n,e,t))}function fy(e,t,n){var r=e._id;return e.each(function(){var o=tr(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ln(o,r).value[t]}}function PE(e,t){var n;return(typeof t=="number"?Wn:t instanceof as?id:(n=as(t))?(t=n,id):bE)(e,t)}function wW(e){return function(){this.removeAttribute(e)}}function bW(e){return function(){this.removeAttributeNS(e.space,e.local)}}function SW(e,t,n){var r,o=n+"",i;return function(){var l=this.getAttribute(e);return l===o?null:l===r?i:i=t(r=l,n)}}function CW(e,t,n){var r,o=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===o?null:l===r?i:i=t(r=l,n)}}function EW(e,t,n){var r,o,i;return function(){var l,c=n(this),d;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),d=c+"",l===d?null:l===r&&d===o?i:(o=d,i=t(r=l,c)))}}function NW(e,t,n){var r,o,i;return function(){var l,c=n(this),d;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),d=c+"",l===d?null:l===r&&d===o?i:(o=d,i=t(r=l,c)))}}function kW(e,t){var n=of(e),r=n==="transform"?sW:PE;return this.attrTween(e,typeof t=="function"?(n.local?NW:EW)(n,r,fy(this,"attr."+e,t)):t==null?(n.local?bW:wW)(n):(n.local?CW:SW)(n,r,t))}function TW(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function PW(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function RW(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&PW(e,i)),n}return o._value=t,o}function IW(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&TW(e,i)),n}return o._value=t,o}function _W(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=of(e);return this.tween(n,(r.local?RW:IW)(r,t))}function AW(e,t){return function(){dy(this,e).delay=+t.apply(this,arguments)}}function MW(e,t){return t=+t,function(){dy(this,e).delay=t}}function DW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?AW:MW)(t,e)):Ln(this.node(),t).delay}function jW(e,t){return function(){tr(this,e).duration=+t.apply(this,arguments)}}function OW(e,t){return t=+t,function(){tr(this,e).duration=t}}function $W(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jW:OW)(t,e)):Ln(this.node(),t).duration}function LW(e,t){if(typeof t!="function")throw new Error;return function(){tr(this,e).ease=t}}function FW(e){var t=this._id;return arguments.length?this.each(LW(t,e)):Ln(this.node(),t).ease}function zW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;tr(this,e).ease=n}}function VW(e){if(typeof e!="function")throw new Error;return this.each(zW(this._id,e))}function HW(e){typeof e!="function"&&(e=sE(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&c.push(d);return new Nr(r,this._parents,this._name,this._id)}function BW(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),l=new Array(r),c=0;c<i;++c)for(var d=t[c],f=n[c],g=d.length,h=l[c]=new Array(g),v,x=0;x<g;++x)(v=d[x]||f[x])&&(h[x]=v);for(;c<r;++c)l[c]=t[c];return new Nr(l,this._parents,this._name,this._id)}function WW(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function UW(e,t,n){var r,o,i=WW(t)?dy:tr;return function(){var l=i(this,e),c=l.on;c!==r&&(o=(r=c).copy()).on(t,n),l.on=o}}function KW(e,t){var n=this._id;return arguments.length<2?Ln(this.node(),n).on.on(e):this.each(UW(n,e,t))}function GW(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function YW(){return this.on("end.remove",GW(this._id))}function XW(e){var t=this._name,n=this._id;typeof e!="function"&&(e=iy(e));for(var r=this._groups,o=r.length,i=new Array(o),l=0;l<o;++l)for(var c=r[l],d=c.length,f=i[l]=new Array(d),g,h,v=0;v<d;++v)(g=c[v])&&(h=e.call(g,g.__data__,v,c))&&("__data__"in g&&(h.__data__=g.__data__),f[v]=h,af(f[v],t,n,v,f,Ln(g,n)));return new Nr(i,this._parents,t,n)}function qW(e){var t=this._name,n=this._id;typeof e!="function"&&(e=oE(e));for(var r=this._groups,o=r.length,i=[],l=[],c=0;c<o;++c)for(var d=r[c],f=d.length,g,h=0;h<f;++h)if(g=d[h]){for(var v=e.call(g,g.__data__,h,d),x,S=Ln(g,n),w=0,E=v.length;w<E;++w)(x=v[w])&&af(x,t,n,w,v,S);i.push(v),l.push(g)}return new Nr(i,l,t,n)}var ZW=Pl.prototype.constructor;function QW(){return new ZW(this._groups,this._parents)}function JW(e,t){var n,r,o;return function(){var i=xi(this,e),l=(this.style.removeProperty(e),xi(this,e));return i===l?null:i===n&&l===r?o:o=t(n=i,r=l)}}function RE(e){return function(){this.style.removeProperty(e)}}function eU(e,t,n){var r,o=n+"",i;return function(){var l=xi(this,e);return l===o?null:l===r?i:i=t(r=l,n)}}function tU(e,t,n){var r,o,i;return function(){var l=xi(this,e),c=n(this),d=c+"";return c==null&&(d=c=(this.style.removeProperty(e),xi(this,e))),l===d?null:l===r&&d===o?i:(o=d,i=t(r=l,c))}}function nU(e,t){var n,r,o,i="style."+t,l="end."+i,c;return function(){var d=tr(this,e),f=d.on,g=d.value[i]==null?c||(c=RE(t)):void 0;(f!==n||o!==g)&&(r=(n=f).copy()).on(l,o=g),d.on=r}}function rU(e,t,n){var r=(e+="")=="transform"?oW:PE;return t==null?this.styleTween(e,JW(e,r)).on("end.style."+e,RE(e)):typeof t=="function"?this.styleTween(e,tU(e,r,fy(this,"style."+e,t))).each(nU(this._id,e)):this.styleTween(e,eU(e,r,t),n).on("end.style."+e,null)}function oU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function sU(e,t,n){var r,o;function i(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&oU(e,l,n)),r}return i._value=t,i}function iU(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,sU(e,t,n??""))}function aU(e){return function(){this.textContent=e}}function lU(e){return function(){var t=e(this);this.textContent=t??""}}function cU(e){return this.tween("text",typeof e=="function"?lU(fy(this,"text",e)):aU(e==null?"":e+""))}function uU(e){return function(t){this.textContent=e.call(this,t)}}function dU(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&uU(o)),t}return r._value=e,r}function fU(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,dU(e))}function pU(){for(var e=this._name,t=this._id,n=IE(),r=this._groups,o=r.length,i=0;i<o;++i)for(var l=r[i],c=l.length,d,f=0;f<c;++f)if(d=l[f]){var g=Ln(d,t);af(d,e,n,f,l,{time:g.time+g.delay+g.duration,delay:0,duration:g.duration,ease:g.ease})}return new Nr(r,this._parents,e,n)}function hU(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,l){var c={value:l},d={value:function(){--o===0&&i()}};n.each(function(){var f=tr(this,r),g=f.on;g!==e&&(t=(e=g).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(d)),f.on=t}),o===0&&i()})}var gU=0;function Nr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function IE(){return++gU}var hr=Pl.prototype;Nr.prototype={constructor:Nr,select:XW,selectAll:qW,selectChild:hr.selectChild,selectChildren:hr.selectChildren,filter:HW,merge:BW,selection:QW,transition:pU,call:hr.call,nodes:hr.nodes,node:hr.node,size:hr.size,empty:hr.empty,each:hr.each,on:KW,attr:kW,attrTween:_W,style:rU,styleTween:iU,text:cU,textTween:fU,remove:YW,tween:xW,delay:DW,duration:$W,ease:FW,easeVarying:VW,end:hU,[Symbol.iterator]:hr[Symbol.iterator]};function mU(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var yU={time:null,delay:0,duration:250,ease:mU};function vU(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function xU(e){var t,n;e instanceof Nr?(t=e._id,e=e._name):(t=IE(),(n=yU).time=uy(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var l=r[i],c=l.length,d,f=0;f<c;++f)(d=l[f])&&af(d,e,t,f,l,n||vU(d,t));return new Nr(r,this._parents,e,t)}Pl.prototype.interrupt=mW;Pl.prototype.transition=xU;const xu=e=>()=>e;function wU(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function yr(e,t,n){this.k=e,this.x=t,this.y=n}yr.prototype={constructor:yr,scale:function(e){return e===1?this:new yr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new yr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var lf=new yr(1,0,0);_E.prototype=yr.prototype;function _E(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lf;return e.__zoom}function qh(e){e.stopImmediatePropagation()}function $a(e){e.preventDefault(),e.stopImmediatePropagation()}function bU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function SU(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function qw(){return this.__zoom||lf}function CU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function EU(){return navigator.maxTouchPoints||"ontouchstart"in this}function NU(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function AE(){var e=bU,t=SU,n=NU,r=CU,o=EU,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,d=$u,f=rf("start","zoom","end"),g,h,v,x=500,S=150,w=0,E=10;function b(_){_.property("__zoom",qw).on("wheel.zoom",j,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",U).filter(o).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(_,O,M,z){var H=_.selection?_.selection():_;H.property("__zoom",qw),_!==H?A(_,O,M,z):H.interrupt().each(function(){I(this,arguments).event(z).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},b.scaleBy=function(_,O,M,z){b.scaleTo(_,function(){var H=this.__zoom.k,W=typeof O=="function"?O.apply(this,arguments):O;return H*W},M,z)},b.scaleTo=function(_,O,M,z){b.transform(_,function(){var H=t.apply(this,arguments),W=this.__zoom,Z=M==null?P(H):typeof M=="function"?M.apply(this,arguments):M,F=W.invert(Z),V=typeof O=="function"?O.apply(this,arguments):O;return n(k(N(W,V),Z,F),H,l)},M,z)},b.translateBy=function(_,O,M,z){b.transform(_,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),l)},null,z)},b.translateTo=function(_,O,M,z,H){b.transform(_,function(){var W=t.apply(this,arguments),Z=this.__zoom,F=z==null?P(W):typeof z=="function"?z.apply(this,arguments):z;return n(lf.translate(F[0],F[1]).scale(Z.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof M=="function"?-M.apply(this,arguments):-M),W,l)},z,H)};function N(_,O){return O=Math.max(i[0],Math.min(i[1],O)),O===_.k?_:new yr(O,_.x,_.y)}function k(_,O,M){var z=O[0]-M[0]*_.k,H=O[1]-M[1]*_.k;return z===_.x&&H===_.y?_:new yr(_.k,z,H)}function P(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function A(_,O,M,z){_.on("start.zoom",function(){I(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,W=arguments,Z=I(H,W).event(z),F=t.apply(H,W),V=M==null?P(F):typeof M=="function"?M.apply(H,W):M,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Q=H.__zoom,ee=typeof O=="function"?O.apply(H,W):O,ne=d(Q.invert(V).concat(X/Q.k),ee.invert(V).concat(X/ee.k));return function(K){if(K===1)K=ee;else{var q=ne(K),oe=X/q[2];K=new yr(oe,V[0]-q[0]*oe,V[1]-q[1]*oe)}Z.zoom(null,K)}})}function I(_,O,M){return!M&&_.__zooming||new R(_,O)}function R(_,O){this.that=_,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,O),this.taps=0}R.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,O){return this.mouse&&_!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var O=on(this.that).datum();f.call(_,this.that,new wU(_,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:f}),O)}};function j(_,...O){if(!e.apply(this,arguments))return;var M=I(this,O).event(_),z=this.__zoom,H=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),W=Pn(_);if(M.wheel)(M.mouse[0][0]!==W[0]||M.mouse[0][1]!==W[1])&&(M.mouse[1]=z.invert(M.mouse[0]=W)),clearTimeout(M.wheel);else{if(z.k===H)return;M.mouse=[W,z.invert(W)],zu(this),M.start()}$a(_),M.wheel=setTimeout(Z,S),M.zoom("mouse",n(k(N(z,H),M.mouse[0],M.mouse[1]),M.extent,l));function Z(){M.wheel=null,M.end()}}function L(_,...O){if(v||!e.apply(this,arguments))return;var M=_.currentTarget,z=I(this,O,!0).event(_),H=on(_.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",X,!0),W=Pn(_,M),Z=_.clientX,F=_.clientY;gE(_.view),qh(_),z.mouse=[W,this.__zoom.invert(W)],zu(this),z.start();function V(Q){if($a(Q),!z.moved){var ee=Q.clientX-Z,ne=Q.clientY-F;z.moved=ee*ee+ne*ne>w}z.event(Q).zoom("mouse",n(k(z.that.__zoom,z.mouse[0]=Pn(Q,M),z.mouse[1]),z.extent,l))}function X(Q){H.on("mousemove.zoom mouseup.zoom",null),mE(Q.view,z.moved),$a(Q),z.event(Q).end()}}function U(_,...O){if(e.apply(this,arguments)){var M=this.__zoom,z=Pn(_.changedTouches?_.changedTouches[0]:_,this),H=M.invert(z),W=M.k*(_.shiftKey?.5:2),Z=n(k(N(M,W),z,H),t.apply(this,O),l);$a(_),c>0?on(this).transition().duration(c).call(A,Z,z,_):on(this).call(b.transform,Z,z,_)}}function $(_,...O){if(e.apply(this,arguments)){var M=_.touches,z=M.length,H=I(this,O,_.changedTouches.length===z).event(_),W,Z,F,V;for(qh(_),Z=0;Z<z;++Z)F=M[Z],V=Pn(F,this),V=[V,this.__zoom.invert(V),F.identifier],H.touch0?!H.touch1&&H.touch0[2]!==V[2]&&(H.touch1=V,H.taps=0):(H.touch0=V,W=!0,H.taps=1+!!g);g&&(g=clearTimeout(g)),W&&(H.taps<2&&(h=V[0],g=setTimeout(function(){g=null},x)),zu(this),H.start())}}function B(_,...O){if(this.__zooming){var M=I(this,O).event(_),z=_.changedTouches,H=z.length,W,Z,F,V;for($a(_),W=0;W<H;++W)Z=z[W],F=Pn(Z,this),M.touch0&&M.touch0[2]===Z.identifier?M.touch0[0]=F:M.touch1&&M.touch1[2]===Z.identifier&&(M.touch1[0]=F);if(Z=M.that.__zoom,M.touch1){var X=M.touch0[0],Q=M.touch0[1],ee=M.touch1[0],ne=M.touch1[1],K=(K=ee[0]-X[0])*K+(K=ee[1]-X[1])*K,q=(q=ne[0]-Q[0])*q+(q=ne[1]-Q[1])*q;Z=N(Z,Math.sqrt(K/q)),F=[(X[0]+ee[0])/2,(X[1]+ee[1])/2],V=[(Q[0]+ne[0])/2,(Q[1]+ne[1])/2]}else if(M.touch0)F=M.touch0[0],V=M.touch0[1];else return;M.zoom("touch",n(k(Z,F,V),M.extent,l))}}function G(_,...O){if(this.__zooming){var M=I(this,O).event(_),z=_.changedTouches,H=z.length,W,Z;for(qh(_),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),W=0;W<H;++W)Z=z[W],M.touch0&&M.touch0[2]===Z.identifier?delete M.touch0:M.touch1&&M.touch1[2]===Z.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(Z=Pn(Z,this),Math.hypot(h[0]-Z[0],h[1]-Z[1])<E)){var F=on(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return b.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:xu(+_),b):r},b.filter=function(_){return arguments.length?(e=typeof _=="function"?_:xu(!!_),b):e},b.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:xu(!!_),b):o},b.extent=function(_){return arguments.length?(t=typeof _=="function"?_:xu([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),b):t},b.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],b):[i[0],i[1]]},b.translateExtent=function(_){return arguments.length?(l[0][0]=+_[0][0],l[1][0]=+_[1][0],l[0][1]=+_[0][1],l[1][1]=+_[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(_){return arguments.length?(n=_,b):n},b.duration=function(_){return arguments.length?(c=+_,b):c},b.interpolate=function(_){return arguments.length?(d=_,b):d},b.on=function(){var _=f.on.apply(f,arguments);return _===f?b:_},b.clickDistance=function(_){return arguments.length?(w=(_=+_)*_,b):Math.sqrt(w)},b.tapDistance=function(_){return arguments.length?(E=+_,b):E},b}const Qn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ME=["Enter"," ","Escape"],DE={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var bi;(function(e){e.Strict="strict",e.Loose="loose"})(bi||(bi={}));var Qo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qo||(Qo={}));var Si;(function(e){e.Partial="partial",e.Full="full"})(Si||(Si={}));const jE={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ao;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ao||(ao={}));var ud;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ud||(ud={}));var be;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(be||(be={}));const Zw={[be.Left]:be.Right,[be.Right]:be.Left,[be.Top]:be.Bottom,[be.Bottom]:be.Top};function OE(e){return e===null?null:e?"valid":"invalid"}const $E=e=>"id"in e&&"source"in e&&"target"in e,kU=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),py=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Il=(e,t=[0,0])=>{const{width:n,height:r}=Rr(e),o=e.origin??t,i=n*o[0],l=r*o[1];return{x:e.position.x-i,y:e.position.y-l}},TU=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let l=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(l=i?t.nodeLookup.get(o):py(o)?o:t.nodeLookup.get(o.id));const c=l?dd(l,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cf(r,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return uf(n)},_l=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=cf(n,dd(o)),r=!0)}),r?uf(n):{x:0,y:0,width:0,height:0}},hy=(e,t,[n,r,o]=[0,0,1],i=!1,l=!1)=>{const c={...Ml(t,[n,r,o]),width:t.width/o,height:t.height/o},d=[];for(const f of e.values()){const{measured:g,selectable:h=!0,hidden:v=!1}=f;if(l&&!h||v)continue;const x=g.width??f.width??f.initialWidth??null,S=g.height??f.height??f.initialHeight??null,w=hl(c,Ei(f)),E=(x??0)*(S??0),b=i&&w>0;(!f.internals.handleBounds||b||w>=E||f.dragging)&&d.push(f)}return d},PU=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function RU(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function IU({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},l){if(e.size===0)return Promise.resolve(!0);const c=RU(e,l),d=_l(c),f=gy(d,t,n,l?.minZoom??o,l?.maxZoom??i,l?.padding??.1);return await r.setViewport(f,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),Promise.resolve(!0)}function LE({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const l=n.get(e),c=l.parentId?n.get(l.parentId):void 0,{x:d,y:f}=c?c.internals.positionAbsolute:{x:0,y:0},g=l.origin??r;let h=l.extent||o;if(l.extent==="parent"&&!l.expandParent)if(!c)i?.("005",Qn.error005());else{const x=c.measured.width,S=c.measured.height;x&&S&&(h=[[d,f],[d+x,f+S]])}else c&&Ni(l.extent)&&(h=[[l.extent[0][0]+d,l.extent[0][1]+f],[l.extent[1][0]+d,l.extent[1][1]+f]]);const v=Ni(h)?cs(t,h,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&i?.("015",Qn.error015()),{position:{x:v.x-d+(l.measured.width??0)*g[0],y:v.y-f+(l.measured.height??0)*g[1]},positionAbsolute:v}}async function _U({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(v=>v.id)),l=[];for(const v of n){if(v.deletable===!1)continue;const x=i.has(v.id),S=!x&&v.parentId&&l.find(w=>w.id===v.parentId);(x||S)&&l.push(v)}const c=new Set(t.map(v=>v.id)),d=r.filter(v=>v.deletable!==!1),g=PU(l,d);for(const v of d)c.has(v.id)&&!g.find(S=>S.id===v.id)&&g.push(v);if(!o)return{edges:g,nodes:l};const h=await o({nodes:l,edges:g});return typeof h=="boolean"?h?{edges:g,nodes:l}:{edges:[],nodes:[]}:h}const Ci=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),cs=(e={x:0,y:0},t,n)=>({x:Ci(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ci(e.y,t[0][1],t[1][1]-(n?.height??0))});function FE(e,t,n){const{width:r,height:o}=Rr(n),{x:i,y:l}=n.internals.positionAbsolute;return cs(e,[[i,l],[i+r,l+o]],t)}const Qw=(e,t,n)=>e<t?Ci(Math.abs(e-t),1,t)/t:e>n?-Ci(Math.abs(e-n),1,t)/t:0,zE=(e,t,n=15,r=40)=>{const o=Qw(e.x,r,t.width-r)*n,i=Qw(e.y,r,t.height-r)*n;return[o,i]},cf=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Bg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uf=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ei=(e,t=[0,0])=>{const{x:n,y:r}=py(e)?e.internals.positionAbsolute:Il(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},dd=(e,t=[0,0])=>{const{x:n,y:r}=py(e)?e.internals.positionAbsolute:Il(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},VE=(e,t)=>uf(cf(Bg(e),Bg(t))),hl=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Jw=e=>_n(e.width)&&_n(e.height)&&_n(e.x)&&_n(e.y),_n=e=>!isNaN(e)&&isFinite(e),AU=(e,t)=>{},Al=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ml=({x:e,y:t},[n,r,o],i=!1,l=[1,1])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?Al(c,l):c},fd=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Zs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function MU(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Zs(e,n),o=Zs(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Zs(e.top??e.y??0,n),o=Zs(e.bottom??e.y??0,n),i=Zs(e.left??e.x??0,t),l=Zs(e.right??e.x??0,t);return{top:r,right:l,bottom:o,left:i,x:i+l,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function DU(e,t,n,r,o,i){const{x:l,y:c}=fd(e,[t,n,r]),{x:d,y:f}=fd({x:e.x+e.width,y:e.y+e.height},[t,n,r]),g=o-d,h=i-f;return{left:Math.floor(l),top:Math.floor(c),right:Math.floor(g),bottom:Math.floor(h)}}const gy=(e,t,n,r,o,i)=>{const l=MU(i,t,n),c=(t-l.x)/e.width,d=(n-l.y)/e.height,f=Math.min(c,d),g=Ci(f,r,o),h=e.x+e.width/2,v=e.y+e.height/2,x=t/2-h*g,S=n/2-v*g,w=DU(e,x,S,g,t,n),E={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:x-E.left+E.right,y:S-E.top+E.bottom,zoom:g}},gl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ni(e){return e!=null&&e!=="parent"}function Rr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function my(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function HE(e,t={width:0,height:0},n,r,o){const i={...e},l=r.get(n);if(l){const c=l.origin||o;i.x+=l.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=l.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function eb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function jU(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function OU(e){return{...DE,...e||{}}}function Qa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:l}=An(e),c=Ml({x:i-(o?.left??0),y:l-(o?.top??0)},r),{x:d,y:f}=n?Al(c,t):c;return{xSnapped:d,ySnapped:f,...c}}const yy=e=>({width:e.offsetWidth,height:e.offsetHeight}),BE=e=>e?.getRootNode?.()||window?.document,$U=["INPUT","SELECT","TEXTAREA"];function WE(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:$U.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const UE=e=>"clientX"in e,An=(e,t)=>{const n=UE(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},tb=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:o,position:l.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...yy(l)}})};function KE({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:l,targetControlY:c}){const d=e*.125+o*.375+l*.375+n*.125,f=t*.125+i*.375+c*.375+r*.125,g=Math.abs(d-e),h=Math.abs(f-t);return[d,f,g,h]}function wu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function nb({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case be.Left:return[t-wu(t-r,i),n];case be.Right:return[t+wu(r-t,i),n];case be.Top:return[t,n-wu(n-o,i)];case be.Bottom:return[t,n+wu(o-n,i)]}}function pd({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:r,targetY:o,targetPosition:i=be.Top,curvature:l=.25}){const[c,d]=nb({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[f,g]=nb({pos:i,x1:r,y1:o,x2:e,y2:t,c:l}),[h,v,x,S]=KE({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:c,sourceControlY:d,targetControlX:f,targetControlY:g});return[`M${e},${t} C${c},${d} ${f},${g} ${r},${o}`,h,v,x,S]}function GE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,l=Math.abs(r-t)/2,c=r<t?r+l:r-l;return[i,c,o,l]}function LU({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const l=o&&n?r+1e3:r,c=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return l+c}function FU({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=cf(dd(e),dd(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const l={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return hl(l,uf(i))>0}const zU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,VU=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),YE=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||zU;let o;return $E(e)?o={...e}:o={...e,id:r(e)},VU(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function XE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,l,c]=GE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,l,c]}const rb={[be.Left]:{x:-1,y:0},[be.Right]:{x:1,y:0},[be.Top]:{x:0,y:-1},[be.Bottom]:{x:0,y:1}},HU=({source:e,sourcePosition:t=be.Bottom,target:n})=>t===be.Left||t===be.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ob=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function BU({source:e,sourcePosition:t=be.Bottom,target:n,targetPosition:r=be.Top,center:o,offset:i,stepPosition:l}){const c=rb[t],d=rb[r],f={x:e.x+c.x*i,y:e.y+c.y*i},g={x:n.x+d.x*i,y:n.y+d.y*i},h=HU({source:f,sourcePosition:t,target:g}),v=h.x!==0?"x":"y",x=h[v];let S=[],w,E;const b={x:0,y:0},N={x:0,y:0},[,,k,P]=GE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[v]*d[v]===-1){v==="x"?(w=o.x??f.x+(g.x-f.x)*l,E=o.y??(f.y+g.y)/2):(w=o.x??(f.x+g.x)/2,E=o.y??f.y+(g.y-f.y)*l);const j=[{x:w,y:f.y},{x:w,y:g.y}],L=[{x:f.x,y:E},{x:g.x,y:E}];c[v]===x?S=v==="x"?j:L:S=v==="x"?L:j}else{const j=[{x:f.x,y:g.y}],L=[{x:g.x,y:f.y}];if(v==="x"?S=c.x===x?L:j:S=c.y===x?j:L,t===r){const _=Math.abs(e[v]-n[v]);if(_<=i){const O=Math.min(i-1,i-_);c[v]===x?b[v]=(f[v]>e[v]?-1:1)*O:N[v]=(g[v]>n[v]?-1:1)*O}}if(t!==r){const _=v==="x"?"y":"x",O=c[v]===d[_],M=f[_]>g[_],z=f[_]<g[_];(c[v]===1&&(!O&&M||O&&z)||c[v]!==1&&(!O&&z||O&&M))&&(S=v==="x"?j:L)}const U={x:f.x+b.x,y:f.y+b.y},$={x:g.x+N.x,y:g.y+N.y},B=Math.max(Math.abs(U.x-S[0].x),Math.abs($.x-S[0].x)),G=Math.max(Math.abs(U.y-S[0].y),Math.abs($.y-S[0].y));B>=G?(w=(U.x+$.x)/2,E=S[0].y):(w=S[0].x,E=(U.y+$.y)/2)}const A={x:f.x+b.x,y:f.y+b.y},I={x:g.x+N.x,y:g.y+N.y};return[[e,...A.x!==S[0].x||A.y!==S[0].y?[A]:[],...S,...I.x!==S[S.length-1].x||I.y!==S[S.length-1].y?[I]:[],n],w,E,k,P]}function WU(e,t,n,r){const o=Math.min(ob(e,t)/2,ob(t,n)/2,r),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,g=e.y<n.y?1:-1;return`L ${i+o*f},${l}Q ${i},${l} ${i},${l+o*g}`}const c=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${l+o*d}Q ${i},${l} ${i+o*c},${l}`}function Wg({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:r,targetY:o,targetPosition:i=be.Top,borderRadius:l=5,centerX:c,centerY:d,offset:f=20,stepPosition:g=.5}){const[h,v,x,S,w]=BU({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:c,y:d},offset:f,stepPosition:g});let E=`M${h[0].x} ${h[0].y}`;for(let b=1;b<h.length-1;b++)E+=WU(h[b-1],h[b],h[b+1],l);return E+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[E,v,x,S,w]}function sb(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function UU(e){const{sourceNode:t,targetNode:n}=e;if(!sb(t)||!sb(n))return null;const r=t.internals.handleBounds||ib(t.handles),o=n.internals.handleBounds||ib(n.handles),i=ab(r?.source??[],e.sourceHandle),l=ab(e.connectionMode===bi.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!l)return e.onError?.("008",Qn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||be.Bottom,d=l?.position||be.Top,f=us(t,i,c),g=us(n,l,d);return{sourceX:f.x,sourceY:f.y,targetX:g.x,targetY:g.y,sourcePosition:c,targetPosition:d}}function ib(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function us(e,t,n=be.Left,r=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:l,height:c}=t??Rr(e);if(r)return{x:o+l/2,y:i+c/2};switch(t?.position??n){case be.Top:return{x:o+l/2,y:i};case be.Right:return{x:o+l,y:i+c/2};case be.Bottom:return{x:o+l/2,y:i+c};case be.Left:return{x:o,y:i+c/2}}}function ab(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ug(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function KU(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((l,c)=>([c.markerStart||r,c.markerEnd||o].forEach(d=>{if(d&&typeof d=="object"){const f=Ug(d,t);i.has(f)||(l.push({id:f,color:d.color||n,...d}),i.add(f))}}),l),[]).sort((l,c)=>l.id.localeCompare(c.id))}const qE=1e3,GU=10,vy={nodeOrigin:[0,0],nodeExtent:pl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},YU={...vy,checkEquality:!0};function xy(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function XU(e,t,n){const r=xy(vy,n);for(const o of e.values())if(o.parentId)by(o,e,t,r);else{const i=Il(o,r.nodeOrigin),l=Ni(o.extent)?o.extent:r.nodeExtent,c=cs(i,l,Rr(o));o.internals.positionAbsolute=c}}function qU(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function wy(e){return e==="manual"}function Kg(e,t,n,r={}){const o=xy(YU,r),i={i:0},l=new Map(t),c=o?.elevateNodesOnSelect&&!wy(o.zIndexMode)?qE:0;let d=e.length>0,f=!1;t.clear(),n.clear();for(const g of e){let h=l.get(g.id);if(o.checkEquality&&g===h?.internals.userNode)t.set(g.id,h);else{const v=Il(g,o.nodeOrigin),x=Ni(g.extent)?g.extent:o.nodeExtent,S=cs(v,x,Rr(g));h={...o.defaults,...g,measured:{width:g.measured?.width,height:g.measured?.height},internals:{positionAbsolute:S,handleBounds:qU(g,h),z:ZE(g,c,o.zIndexMode),userNode:g}},t.set(g.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(d=!1),g.parentId&&by(h,t,n,r,i),f||=g.selected??!1}return{nodesInitialized:d,hasSelectedNodes:f}}function ZU(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function by(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:l,nodeExtent:c,zIndexMode:d}=xy(vy,r),f=e.parentId,g=t.get(f);if(!g){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ZU(e,n),o&&!g.parentId&&g.internals.rootParentIndex===void 0&&d==="auto"&&(g.internals.rootParentIndex=++o.i,g.internals.z=g.internals.z+o.i*GU),o&&g.internals.rootParentIndex!==void 0&&(o.i=g.internals.rootParentIndex);const h=i&&!wy(d)?qE:0,{x:v,y:x,z:S}=QU(e,g,l,c,h,d),{positionAbsolute:w}=e.internals,E=v!==w.x||x!==w.y;(E||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:v,y:x}:w,z:S}})}function ZE(e,t,n){const r=_n(e.zIndex)?e.zIndex:0;return wy(n)?r:r+(e.selected?t:0)}function QU(e,t,n,r,o,i){const{x:l,y:c}=t.internals.positionAbsolute,d=Rr(e),f=Il(e,n),g=Ni(e.extent)?cs(f,e.extent,d):f;let h=cs({x:l+g.x,y:c+g.y},r,d);e.extent==="parent"&&(h=FE(h,d,t));const v=ZE(e,o,i),x=t.internals.z??0;return{x:h.x,y:h.y,z:x>=v?x+1:v}}function Sy(e,t,n,r=[0,0]){const o=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=i.get(l.parentId)?.expandedRect??Ei(c),f=VE(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{const f=c.internals.positionAbsolute,g=Rr(c),h=c.origin??r,v=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,x=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,S=Math.max(g.width,Math.round(l.width)),w=Math.max(g.height,Math.round(l.height)),E=(S-g.width)*h[0],b=(w-g.height)*h[1];(v>0||x>0||E||b)&&(o.push({id:d,type:"position",position:{x:c.position.x-v+E,y:c.position.y-x+b}}),n.get(d)?.forEach(N=>{e.some(k=>k.id===N.id)||o.push({id:N.id,type:"position",position:{x:N.position.x+v,y:N.position.y+x}})})),(g.width<l.width||g.height<l.height||v||x)&&o.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:S+(v?h[0]*v-E:0),height:w+(x?h[1]*x-b:0)}})}),o}function JU(e,t,n,r,o,i,l){const c=r?.querySelector(".xyflow__viewport");let d=!1;if(!c)return{changes:[],updatedInternals:d};const f=[],g=window.getComputedStyle(c),{m22:h}=new window.DOMMatrixReadOnly(g.transform),v=[];for(const x of e.values()){const S=t.get(x.id);if(!S)continue;if(S.hidden){t.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),d=!0;continue}const w=yy(x.nodeElement),E=S.measured.width!==w.width||S.measured.height!==w.height;if(!!(w.width&&w.height&&(E||!S.internals.handleBounds||x.force))){const N=x.nodeElement.getBoundingClientRect(),k=Ni(S.extent)?S.extent:i;let{positionAbsolute:P}=S.internals;S.parentId&&S.extent==="parent"?P=FE(P,w,t.get(S.parentId)):k&&(P=cs(P,k,w));const A={...S,measured:w,internals:{...S.internals,positionAbsolute:P,handleBounds:{source:tb("source",x.nodeElement,N,h,S.id),target:tb("target",x.nodeElement,N,h,S.id)}}};t.set(S.id,A),S.parentId&&by(A,t,n,{nodeOrigin:o,zIndexMode:l}),d=!0,E&&(f.push({id:S.id,type:"dimensions",dimensions:w}),S.expandParent&&S.parentId&&v.push({id:S.id,parentId:S.parentId,rect:Ei(A,o)}))}}if(v.length>0){const x=Sy(v,t,n,o);f.push(...x)}return{changes:f,updatedInternals:d}}async function e9({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),c=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(c)}function lb(e,t,n,r,o,i){let l=o;const c=r.get(l)||new Map;r.set(l,c.set(n,t)),l=`${o}-${e}`;const d=r.get(l)||new Map;if(r.set(l,d.set(n,t)),i){l=`${o}-${e}-${i}`;const f=r.get(l)||new Map;r.set(l,f.set(n,t))}}function QE(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:l=null,targetHandle:c=null}=r,d={edgeId:r.id,source:o,target:i,sourceHandle:l,targetHandle:c},f=`${o}-${l}--${i}-${c}`,g=`${i}-${c}--${o}-${l}`;lb("source",d,g,e,o,l),lb("target",d,f,e,i,c),t.set(r.id,r)}}function JE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:JE(n,t):!1}function cb(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function t9(e,t,n,r){const o=new Map;for(const[i,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!JE(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const c=e.get(i);c&&o.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return o}function Zh({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const o=[];for(const[l,c]of t){const d=n.get(l)?.internals.userNode;d&&o.push({...d,position:c.position,dragging:r})}if(!e)return[o[0],o];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function n9({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},l=Al(i,t);return{x:l.x-i.x,y:l.y-i.y}}function r9({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},l=0,c=new Map,d=!1,f={x:0,y:0},g=null,h=!1,v=null,x=!1,S=!1,w=null;function E({noDragClassName:N,handleSelector:k,domNode:P,isSelectable:A,nodeId:I,nodeClickDistance:R=0}){v=on(P);function j({x:B,y:G}){const{nodeLookup:_,nodeExtent:O,snapGrid:M,snapToGrid:z,nodeOrigin:H,onNodeDrag:W,onSelectionDrag:Z,onError:F,updateNodePositions:V}=t();i={x:B,y:G};let X=!1;const Q=c.size>1,ee=Q&&O?Bg(_l(c)):null,ne=Q&&z?n9({dragItems:c,snapGrid:M,x:B,y:G}):null;for(const[K,q]of c){if(!_.has(K))continue;let oe={x:B-q.distance.x,y:G-q.distance.y};z&&(oe=ne?{x:Math.round(oe.x+ne.x),y:Math.round(oe.y+ne.y)}:Al(oe,M));let ce=null;if(Q&&O&&!q.extent&&ee){const{positionAbsolute:me}=q.internals,Ee=me.x-ee.x+O[0][0],Le=me.x+q.measured.width-ee.x2+O[1][0],Fe=me.y-ee.y+O[0][1],Ke=me.y+q.measured.height-ee.y2+O[1][1];ce=[[Ee,Fe],[Le,Ke]]}const{position:ge,positionAbsolute:ye}=LE({nodeId:K,nextPosition:oe,nodeLookup:_,nodeExtent:ce||O,nodeOrigin:H,onError:F});X=X||q.position.x!==ge.x||q.position.y!==ge.y,q.position=ge,q.internals.positionAbsolute=ye}if(S=S||X,!!X&&(V(c,!0),w&&(r||W||!I&&Z))){const[K,q]=Zh({nodeId:I,dragItems:c,nodeLookup:_});r?.(w,c,K,q),W?.(w,K,q),I||Z?.(w,q)}}async function L(){if(!g)return;const{transform:B,panBy:G,autoPanSpeed:_,autoPanOnNodeDrag:O}=t();if(!O){d=!1,cancelAnimationFrame(l);return}const[M,z]=zE(f,g,_);(M!==0||z!==0)&&(i.x=(i.x??0)-M/B[2],i.y=(i.y??0)-z/B[2],await G({x:M,y:z})&&j(i)),l=requestAnimationFrame(L)}function U(B){const{nodeLookup:G,multiSelectionActive:_,nodesDraggable:O,transform:M,snapGrid:z,snapToGrid:H,selectNodesOnDrag:W,onNodeDragStart:Z,onSelectionDragStart:F,unselectNodesAndEdges:V}=t();h=!0,(!W||!A)&&!_&&I&&(G.get(I)?.selected||V()),A&&W&&I&&e?.(I);const X=Qa(B.sourceEvent,{transform:M,snapGrid:z,snapToGrid:H,containerBounds:g});if(i=X,c=t9(G,O,X,I),c.size>0&&(n||Z||!I&&F)){const[Q,ee]=Zh({nodeId:I,dragItems:c,nodeLookup:G});n?.(B.sourceEvent,c,Q,ee),Z?.(B.sourceEvent,Q,ee),I||F?.(B.sourceEvent,ee)}}const $=yE().clickDistance(R).on("start",B=>{const{domNode:G,nodeDragThreshold:_,transform:O,snapGrid:M,snapToGrid:z}=t();g=G?.getBoundingClientRect()||null,x=!1,S=!1,w=B.sourceEvent,_===0&&U(B),i=Qa(B.sourceEvent,{transform:O,snapGrid:M,snapToGrid:z,containerBounds:g}),f=An(B.sourceEvent,g)}).on("drag",B=>{const{autoPanOnNodeDrag:G,transform:_,snapGrid:O,snapToGrid:M,nodeDragThreshold:z,nodeLookup:H}=t(),W=Qa(B.sourceEvent,{transform:_,snapGrid:O,snapToGrid:M,containerBounds:g});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||I&&!H.has(I))&&(x=!0),!x){if(!d&&G&&h&&(d=!0,L()),!h){const Z=An(B.sourceEvent,g),F=Z.x-f.x,V=Z.y-f.y;Math.sqrt(F*F+V*V)>z&&U(B)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&c&&h&&(f=An(B.sourceEvent,g),j(W))}}).on("end",B=>{if(!(!h||x)&&(d=!1,h=!1,cancelAnimationFrame(l),c.size>0)){const{nodeLookup:G,updateNodePositions:_,onNodeDragStop:O,onSelectionDragStop:M}=t();if(S&&(_(c,!1),S=!1),o||O||!I&&M){const[z,H]=Zh({nodeId:I,dragItems:c,nodeLookup:G,dragging:!1});o?.(B.sourceEvent,c,z,H),O?.(B.sourceEvent,z,H),I||M?.(B.sourceEvent,H)}}}).filter(B=>{const G=B.target;return!B.button&&(!N||!cb(G,`.${N}`,P))&&(!k||cb(G,k,P))});v.call($)}function b(){v?.on(".drag",null)}return{update:E,destroy:b}}function o9(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())hl(o,Ei(i))>0&&r.push(i);return r}const s9=250;function i9(e,t,n,r){let o=[],i=1/0;const l=o9(e,n,t+s9);for(const c of l){const d=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:g,y:h}=us(c,f,f.position,!0),v=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(h-e.y,2));v>t||(v<i?(o=[{...f,x:g,y:h}],i=v):v===i&&o.push({...f,x:g,y:h}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(d=>d.type===c)??o[0]}return o[0]}function eN(e,t,n,r,o,i=!1){const l=r.get(e);if(!l)return null;const c=o==="strict"?l.internals.handleBounds?.[t]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],d=(n?c?.find(f=>f.id===n):c?.[0])??null;return d&&i?{...d,...us(l,d,d.position,!0)}:d}function tN(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function a9(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const nN=()=>!0;function l9(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:l,domNode:c,nodeLookup:d,lib:f,autoPanOnConnect:g,flowId:h,panBy:v,cancelConnection:x,onConnectStart:S,onConnect:w,onConnectEnd:E,isValidConnection:b=nN,onReconnectEnd:N,updateConnection:k,getTransform:P,getFromHandle:A,autoPanSpeed:I,dragThreshold:R=1,handleDomNode:j}){const L=BE(e.target);let U=0,$;const{x:B,y:G}=An(e),_=tN(i,j),O=c?.getBoundingClientRect();let M=!1;if(!O||!_)return;const z=eN(o,_,r,d,t);if(!z)return;let H=An(e,O),W=!1,Z=null,F=!1,V=null;function X(){if(!g||!O)return;const[ge,ye]=zE(H,O,I);v({x:ge,y:ye}),U=requestAnimationFrame(X)}const Q={...z,nodeId:o,type:_,position:z.position},ee=d.get(o);let K={inProgress:!0,isValid:null,from:us(ee,Q,be.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ee,to:H,toHandle:null,toPosition:Zw[Q.position],toNode:null,pointer:H};function q(){M=!0,k(K),S?.(e,{nodeId:o,handleId:r,handleType:_})}R===0&&q();function oe(ge){if(!M){const{x:Ke,y:le}=An(ge),Se=Ke-B,Oe=le-G;if(!(Se*Se+Oe*Oe>R*R))return;q()}if(!A()||!Q){ce(ge);return}const ye=P();H=An(ge,O),$=i9(Ml(H,ye,!1,[1,1]),n,d,Q),W||(X(),W=!0);const me=rN(ge,{handle:$,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:l?"target":"source",isValidConnection:b,doc:L,lib:f,flowId:h,nodeLookup:d});V=me.handleDomNode,Z=me.connection,F=a9(!!$,me.isValid);const Ee=d.get(o),Le=Ee?us(Ee,Q,be.Left,!0):K.from,Fe={...K,from:Le,isValid:F,to:me.toHandle&&F?fd({x:me.toHandle.x,y:me.toHandle.y},ye):H,toHandle:me.toHandle,toPosition:F&&me.toHandle?me.toHandle.position:Zw[Q.position],toNode:me.toHandle?d.get(me.toHandle.nodeId):null,pointer:H};k(Fe),K=Fe}function ce(ge){if(!("touches"in ge&&ge.touches.length>0)){if(M){($||V)&&Z&&F&&w?.(Z);const{inProgress:ye,...me}=K,Ee={...me,toPosition:K.toHandle?K.toPosition:null};E?.(ge,Ee),i&&N?.(ge,Ee)}x(),cancelAnimationFrame(U),W=!1,F=!1,Z=null,V=null,L.removeEventListener("mousemove",oe),L.removeEventListener("mouseup",ce),L.removeEventListener("touchmove",oe),L.removeEventListener("touchend",ce)}}L.addEventListener("mousemove",oe),L.addEventListener("mouseup",ce),L.addEventListener("touchmove",oe),L.addEventListener("touchend",ce)}function rN(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:l,lib:c,flowId:d,isValidConnection:f=nN,nodeLookup:g}){const h=i==="target",v=t?l.querySelector(`.${c}-flow__handle[data-id="${d}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x,y:S}=An(e),w=l.elementFromPoint(x,S),E=w?.classList.contains(`${c}-flow__handle`)?w:v,b={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const N=tN(void 0,E),k=E.getAttribute("data-nodeid"),P=E.getAttribute("data-handleid"),A=E.classList.contains("connectable"),I=E.classList.contains("connectableend");if(!k||!N)return b;const R={source:h?k:r,sourceHandle:h?P:o,target:h?r:k,targetHandle:h?o:P};b.connection=R;const L=A&&I&&(n===bi.Strict?h&&N==="source"||!h&&N==="target":k!==r||P!==o);b.isValid=L&&f(R),b.toHandle=eN(k,N,P,g,n,!0)}return b}const Gg={onPointerDown:l9,isValid:rN};function c9({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=on(e);function i({translateExtent:c,width:d,height:f,zoomStep:g=1,pannable:h=!0,zoomable:v=!0,inversePan:x=!1}){const S=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const P=n(),A=k.sourceEvent.ctrlKey&&gl()?10:1,I=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*g,R=P[2]*Math.pow(2,I*A);t.scaleTo(R)};let w=[0,0];const E=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(w=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},b=k=>{const P=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const A=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],I=[A[0]-w[0],A[1]-w[1]];w=A;const R=r()*Math.max(P[2],Math.log(P[2]))*(x?-1:1),j={x:P[0]-I[0]*R,y:P[1]-I[1]*R},L=[[0,0],[d,f]];t.setViewportConstrained({x:j.x,y:j.y,zoom:P[2]},L,c)},N=AE().on("start",E).on("zoom",h?b:null).on("zoom.wheel",v?S:null);o.call(N,{})}function l(){o.on("zoom",null)}return{update:i,destroy:l,pointer:Pn}}const df=e=>({x:e.x,y:e.y,zoom:e.k}),Qh=({x:e,y:t,zoom:n})=>lf.translate(e,t).scale(n),ri=(e,t)=>e.target.closest(`.${t}`),oN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),u9=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jh=(e,t=0,n=u9,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},sN=e=>{const t=e.ctrlKey&&gl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function d9({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:l,onPanZoomStart:c,onPanZoom:d,onPanZoomEnd:f}){return g=>{if(ri(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(g.ctrlKey&&l){const E=Pn(g),b=sN(g),N=h*Math.pow(2,b);r.scaleTo(n,N,E,g);return}const v=g.deltaMode===1?20:1;let x=o===Qo.Vertical?0:g.deltaX*v,S=o===Qo.Horizontal?0:g.deltaY*v;!gl()&&g.shiftKey&&o!==Qo.Vertical&&(x=g.deltaY*v,S=0),r.translateBy(n,-(x/h)*i,-(S/h)*i,{internal:!0});const w=df(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d?.(g,w),e.panScrollTimeout=setTimeout(()=>{f?.(g,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(g,w))}}function f9({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",l=!t&&i&&!r.ctrlKey,c=ri(r,e);if(r.ctrlKey&&i&&c&&r.preventDefault(),l||c)return null;r.preventDefault(),n.call(this,r,o)}}function p9({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const o=df(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}function h9({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&oN(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,df(i.transform))}}function g9({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&oN(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&i(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=df(l.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(l.sourceEvent,c)},n?150:0)}}}function m9({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:l,noWheelClassName:c,noPanClassName:d,lib:f,connectionInProgress:g}){return h=>{const v=e||t,x=n&&h.ctrlKey,S=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(ri(h,`${f}-flow__node`)||ri(h,`${f}-flow__edge`)))return!0;if(!r&&!v&&!o&&!i&&!n||l||g&&!S||ri(h,c)&&S||ri(h,d)&&(!S||o&&S&&!e)||!n&&h.ctrlKey&&S)return!1;if(!n&&h.type==="touchstart"&&h.touches?.length>1)return h.preventDefault(),!1;if(!v&&!o&&!x&&S||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||S)&&w}}function y9({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect(),h=AE().scaleExtent([t,n]).translateExtent(r),v=on(e).call(h);N({x:o.x,y:o.y,zoom:Ci(o.zoom,t,n)},[[0,0],[g.width,g.height]],r);const x=v.on("wheel.zoom"),S=v.on("dblclick.zoom");h.wheelDelta(sN);function w($,B){return v?new Promise(G=>{h?.interpolate(B?.interpolate==="linear"?Za:$u).transform(Jh(v,B?.duration,B?.ease,()=>G(!0)),$)}):Promise.resolve(!1)}function E({noWheelClassName:$,noPanClassName:B,onPaneContextMenu:G,userSelectionActive:_,panOnScroll:O,panOnDrag:M,panOnScrollMode:z,panOnScrollSpeed:H,preventScrolling:W,zoomOnPinch:Z,zoomOnScroll:F,zoomOnDoubleClick:V,zoomActivationKeyPressed:X,lib:Q,onTransformChange:ee,connectionInProgress:ne,paneClickDistance:K,selectionOnDrag:q}){_&&!f.isZoomingOrPanning&&b();const oe=O&&!X&&!_;h.clickDistance(q?1/0:!_n(K)||K<0?0:K);const ce=oe?d9({zoomPanValues:f,noWheelClassName:$,d3Selection:v,d3Zoom:h,panOnScrollMode:z,panOnScrollSpeed:H,zoomOnPinch:Z,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):f9({noWheelClassName:$,preventScrolling:W,d3ZoomHandler:x});if(v.on("wheel.zoom",ce,{passive:!1}),!_){const ye=p9({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});h.on("start",ye);const me=h9({zoomPanValues:f,panOnDrag:M,onPaneContextMenu:!!G,onPanZoom:i,onTransformChange:ee});h.on("zoom",me);const Ee=g9({zoomPanValues:f,panOnDrag:M,panOnScroll:O,onPaneContextMenu:G,onPanZoomEnd:c,onDraggingChange:d});h.on("end",Ee)}const ge=m9({zoomActivationKeyPressed:X,panOnDrag:M,zoomOnScroll:F,panOnScroll:O,zoomOnDoubleClick:V,zoomOnPinch:Z,userSelectionActive:_,noPanClassName:B,noWheelClassName:$,lib:Q,connectionInProgress:ne});h.filter(ge),V?v.on("dblclick.zoom",S):v.on("dblclick.zoom",null)}function b(){h.on("zoom",null)}async function N($,B,G){const _=Qh($),O=h?.constrain()(_,B,G);return O&&await w(O),new Promise(M=>M(O))}async function k($,B){const G=Qh($);return await w(G,B),new Promise(_=>_(G))}function P($){if(v){const B=Qh($),G=v.property("__zoom");(G.k!==$.zoom||G.x!==$.x||G.y!==$.y)&&h?.transform(v,B,null,{sync:!0})}}function A(){const $=v?_E(v.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function I($,B){return v?new Promise(G=>{h?.interpolate(B?.interpolate==="linear"?Za:$u).scaleTo(Jh(v,B?.duration,B?.ease,()=>G(!0)),$)}):Promise.resolve(!1)}function R($,B){return v?new Promise(G=>{h?.interpolate(B?.interpolate==="linear"?Za:$u).scaleBy(Jh(v,B?.duration,B?.ease,()=>G(!0)),$)}):Promise.resolve(!1)}function j($){h?.scaleExtent($)}function L($){h?.translateExtent($)}function U($){const B=!_n($)||$<0?0:$;h?.clickDistance(B)}return{update:E,destroy:b,setViewport:k,setViewportConstrained:N,getViewport:A,scaleTo:I,scaleBy:R,setScaleExtent:j,setTranslateExtent:L,syncViewport:P,setClickDistance:U}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function v9({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const l=e-t,c=n-r,d=[l>0?1:l<0?-1:0,c>0?1:c<0?-1:0];return l&&o&&(d[0]=d[0]*-1),c&&i&&(d[1]=d[1]*-1),d}function ub(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function to(e,t){return Math.max(0,t-e)}function no(e,t){return Math.max(0,e-t)}function bu(e,t,n){return Math.max(0,t-e,e-n)}function db(e,t){return e?!t:t}function x9(e,t,n,r,o,i,l,c){let{affectsX:d,affectsY:f}=t;const{isHorizontal:g,isVertical:h}=t,v=g&&h,{xSnapped:x,ySnapped:S}=n,{minWidth:w,maxWidth:E,minHeight:b,maxHeight:N}=r,{x:k,y:P,width:A,height:I,aspectRatio:R}=e;let j=Math.floor(g?x-e.pointerX:0),L=Math.floor(h?S-e.pointerY:0);const U=A+(d?-j:j),$=I+(f?-L:L),B=-i[0]*A,G=-i[1]*I;let _=bu(U,w,E),O=bu($,b,N);if(l){let H=0,W=0;d&&j<0?H=to(k+j+B,l[0][0]):!d&&j>0&&(H=no(k+U+B,l[1][0])),f&&L<0?W=to(P+L+G,l[0][1]):!f&&L>0&&(W=no(P+$+G,l[1][1])),_=Math.max(_,H),O=Math.max(O,W)}if(c){let H=0,W=0;d&&j>0?H=no(k+j,c[0][0]):!d&&j<0&&(H=to(k+U,c[1][0])),f&&L>0?W=no(P+L,c[0][1]):!f&&L<0&&(W=to(P+$,c[1][1])),_=Math.max(_,H),O=Math.max(O,W)}if(o){if(g){const H=bu(U/R,b,N)*R;if(_=Math.max(_,H),l){let W=0;!d&&!f||d&&!f&&v?W=no(P+G+U/R,l[1][1])*R:W=to(P+G+(d?j:-j)/R,l[0][1])*R,_=Math.max(_,W)}if(c){let W=0;!d&&!f||d&&!f&&v?W=to(P+U/R,c[1][1])*R:W=no(P+(d?j:-j)/R,c[0][1])*R,_=Math.max(_,W)}}if(h){const H=bu($*R,w,E)/R;if(O=Math.max(O,H),l){let W=0;!d&&!f||f&&!d&&v?W=no(k+$*R+B,l[1][0])/R:W=to(k+(f?L:-L)*R+B,l[0][0])/R,O=Math.max(O,W)}if(c){let W=0;!d&&!f||f&&!d&&v?W=to(k+$*R,c[1][0])/R:W=no(k+(f?L:-L)*R,c[0][0])/R,O=Math.max(O,W)}}}L=L+(L<0?O:-O),j=j+(j<0?_:-_),o&&(v?U>$*R?L=(db(d,f)?-j:j)/R:j=(db(d,f)?-L:L)*R:g?(L=j/R,f=d):(j=L*R,d=f));const M=d?k+j:k,z=f?P+L:P;return{width:A+(d?-j:j),height:I+(f?-L:L),x:i[0]*j*(d?-1:1)+M,y:i[1]*L*(f?-1:1)+z}}const iN={width:0,height:0,x:0,y:0},w9={...iN,pointerX:0,pointerY:0,aspectRatio:1};function b9(e){return[[0,0],[e.measured.width,e.measured.height]]}function S9(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,l=e.measured.height??0,c=n[0]*i,d=n[1]*l;return[[r-c,o-d],[r+i-c,o+l-d]]}function C9({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=on(e);let l={controlDirection:ub("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:f,boundaries:g,keepAspectRatio:h,resizeDirection:v,onResizeStart:x,onResize:S,onResizeEnd:w,shouldResize:E}){let b={...iN},N={...w9};l={boundaries:g,resizeDirection:v,keepAspectRatio:h,controlDirection:ub(f)};let k,P=null,A=[],I,R,j,L=!1;const U=yE().on("start",$=>{const{nodeLookup:B,transform:G,snapGrid:_,snapToGrid:O,nodeOrigin:M,paneDomNode:z}=n();if(k=B.get(t),!k)return;P=z?.getBoundingClientRect()??null;const{xSnapped:H,ySnapped:W}=Qa($.sourceEvent,{transform:G,snapGrid:_,snapToGrid:O,containerBounds:P});b={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},N={...b,pointerX:H,pointerY:W,aspectRatio:b.width/b.height},I=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(I=B.get(k.parentId),R=I&&k.extent==="parent"?b9(I):void 0),A=[],j=void 0;for(const[Z,F]of B)if(F.parentId===t&&(A.push({id:Z,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const V=S9(F,k,F.origin??M);j?j=[[Math.min(V[0][0],j[0][0]),Math.min(V[0][1],j[0][1])],[Math.max(V[1][0],j[1][0]),Math.max(V[1][1],j[1][1])]]:j=V}x?.($,{...b})}).on("drag",$=>{const{transform:B,snapGrid:G,snapToGrid:_,nodeOrigin:O}=n(),M=Qa($.sourceEvent,{transform:B,snapGrid:G,snapToGrid:_,containerBounds:P}),z=[];if(!k)return;const{x:H,y:W,width:Z,height:F}=b,V={},X=k.origin??O,{width:Q,height:ee,x:ne,y:K}=x9(N,l.controlDirection,M,l.boundaries,l.keepAspectRatio,X,R,j),q=Q!==Z,oe=ee!==F,ce=ne!==H&&q,ge=K!==W&&oe;if(!ce&&!ge&&!q&&!oe)return;if((ce||ge||X[0]===1||X[1]===1)&&(V.x=ce?ne:b.x,V.y=ge?K:b.y,b.x=V.x,b.y=V.y,A.length>0)){const Le=ne-H,Fe=K-W;for(const Ke of A)Ke.position={x:Ke.position.x-Le+X[0]*(Q-Z),y:Ke.position.y-Fe+X[1]*(ee-F)},z.push(Ke)}if((q||oe)&&(V.width=q&&(!l.resizeDirection||l.resizeDirection==="horizontal")?Q:b.width,V.height=oe&&(!l.resizeDirection||l.resizeDirection==="vertical")?ee:b.height,b.width=V.width,b.height=V.height),I&&k.expandParent){const Le=X[0]*(V.width??0);V.x&&V.x<Le&&(b.x=Le,N.x=N.x-(V.x-Le));const Fe=X[1]*(V.height??0);V.y&&V.y<Fe&&(b.y=Fe,N.y=N.y-(V.y-Fe))}const ye=v9({width:b.width,prevWidth:Z,height:b.height,prevHeight:F,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),me={...b,direction:ye};E?.($,me)!==!1&&(L=!0,S?.($,me),r(V,z))}).on("end",$=>{L&&(w?.($,{...b}),o?.({...b}),L=!1)});i.call(U)}function d(){i.on(".drag",null)}return{update:c,destroy:d}}var eg={exports:{}},tg={},ng={exports:{}},rg={};var fb;function E9(){if(fb)return rg;fb=1;var e=wl();function t(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,l=e.useDebugValue;function c(h,v){var x=v(),S=r({inst:{value:x,getSnapshot:v}}),w=S[0].inst,E=S[1];return i(function(){w.value=x,w.getSnapshot=v,d(w)&&E({inst:w})},[h,x,v]),o(function(){return d(w)&&E({inst:w}),h(function(){d(w)&&E({inst:w})})},[h]),l(x),x}function d(h){var v=h.getSnapshot;h=h.value;try{var x=v();return!n(h,x)}catch{return!0}}function f(h,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return rg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,rg}var pb;function N9(){return pb||(pb=1,ng.exports=E9()),ng.exports}var hb;function k9(){if(hb)return tg;hb=1;var e=wl(),t=N9();function n(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,l=e.useEffect,c=e.useMemo,d=e.useDebugValue;return tg.useSyncExternalStoreWithSelector=function(f,g,h,v,x){var S=i(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=c(function(){function b(I){if(!N){if(N=!0,k=I,I=v(I),x!==void 0&&w.hasValue){var R=w.value;if(x(R,I))return P=R}return P=I}if(R=P,r(k,I))return R;var j=v(I);return x!==void 0&&x(R,j)?(k=I,R):(k=I,P=j)}var N=!1,k,P,A=h===void 0?null:h;return[function(){return b(g())},A===null?void 0:function(){return b(A())}]},[g,h,v,x]);var E=o(f,S[0],S[1]);return l(function(){w.hasValue=!0,w.value=E},[E]),d(E),E},tg}var gb;function T9(){return gb||(gb=1,eg.exports=k9()),eg.exports}var P9=T9();const R9=lm(P9),I9={},mb=e=>{let t;const n=new Set,r=(g,h)=>{const v=typeof g=="function"?g(t):g;if(!Object.is(v,t)){const x=t;t=h??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(S=>S(t,x))}},o=()=>t,d={setState:r,getState:o,getInitialState:()=>f,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(I9?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,o,d);return d},_9=e=>e?mb(e):mb,{useDebugValue:A9}=Ze,{useSyncExternalStoreWithSelector:M9}=R9,D9=e=>e;function aN(e,t=D9,n){const r=M9(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return A9(r),r}const yb=(e,t)=>{const n=_9(e),r=(o,i=t)=>aN(n,o,i);return Object.assign(r,n),r},j9=(e,t)=>e?yb(e,t):yb;function ot(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const ff=m.createContext(null),O9=ff.Provider,lN=Qn.error001();function He(e,t){const n=m.useContext(ff);if(n===null)throw new Error(lN);return aN(n,e,t)}function it(){const e=m.useContext(ff);if(e===null)throw new Error(lN);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const vb={display:"none"},$9={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},cN="react-flow__node-desc",uN="react-flow__edge-desc",L9="react-flow__aria-live",F9=e=>e.ariaLiveMessage,z9=e=>e.ariaLabelConfig;function V9({rfId:e}){const t=He(F9);return p.jsx("div",{id:`${L9}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:$9,children:t})}function H9({rfId:e,disableKeyboardA11y:t}){const n=He(z9);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${cN}-${e}`,style:vb,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${uN}-${e}`,style:vb,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(V9,{rfId:e})]})}const pf=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const l=`${e}`.split("-");return p.jsx("div",{className:mt(["react-flow__panel",n,...l]),style:r,ref:i,...o,children:t})});pf.displayName="Panel";function B9({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:p.jsx(pf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const W9=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Su=e=>e.id;function U9(e,t){return ot(e.selectedNodes.map(Su),t.selectedNodes.map(Su))&&ot(e.selectedEdges.map(Su),t.selectedEdges.map(Su))}function K9({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:r}=He(W9,U9);return m.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const G9=e=>!!e.onSelectionChangeHandlers;function Y9({onSelectionChange:e}){const t=He(G9);return e||t?p.jsx(K9,{onSelectionChange:e}):null}const Yg=typeof window<"u"?m.useLayoutEffect:m.useEffect,dN=[0,0],X9={x:0,y:0,zoom:1},q9=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],xb=[...q9,"rfId"],Z9=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),wb={translateExtent:pl,nodeOrigin:dN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Q9(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:d}=He(Z9,ot),f=it();Yg(()=>(d(e.defaultNodes,e.defaultEdges),()=>{g.current=wb,c()}),[]);const g=m.useRef(wb);return Yg(()=>{for(const h of xb){const v=e[h],x=g.current[h];v!==x&&(typeof e[h]>"u"||(h==="nodes"?t(v):h==="edges"?n(v):h==="minZoom"?r(v):h==="maxZoom"?o(v):h==="translateExtent"?i(v):h==="nodeExtent"?l(v):h==="ariaLabelConfig"?f.setState({ariaLabelConfig:OU(v)}):h==="fitView"?f.setState({fitViewQueued:v}):h==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[h]:v})))}g.current=e},xb.map(h=>e[h])),null}function bb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function J9(e){const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=bb(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:bb()?.matches?"dark":"light"}const Sb=typeof document<"u"?document:null;function ml(e=null,t={target:Sb,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),o=m.useRef(!1),i=m.useRef(new Set([])),[l,c]=m.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
54
+ `).replace(`
55
+
56
+ `,`
57
+ +`).split(`
58
+ `)),g=f.reduce((h,v)=>h.concat(...v),[]);return[f,g]}return[[],[]]},[e]);return m.useEffect(()=>{const d=t?.target??Sb,f=t?.actInsideInputWithModifier??!0;if(e!==null){const g=x=>{if(o.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!o.current||o.current&&!f)&&WE(x))return!1;const w=Eb(x.code,c);if(i.current.add(x[w]),Cb(l,i.current,!1)){const E=x.composedPath?.()?.[0]||x.target,b=E?.nodeName==="BUTTON"||E?.nodeName==="A";t.preventDefault!==!1&&(o.current||!b)&&x.preventDefault(),r(!0)}},h=x=>{const S=Eb(x.code,c);Cb(l,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[S]),x.key==="Meta"&&i.current.clear(),o.current=!1},v=()=>{i.current.clear(),r(!1)};return d?.addEventListener("keydown",g),d?.addEventListener("keyup",h),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{d?.removeEventListener("keydown",g),d?.removeEventListener("keyup",h),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,r]),n}function Cb(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Eb(e,t){return t.includes(e)?"code":"key"}const e7=()=>{const e=it();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:l,panZoom:c}=e.getState(),d=gy(t,r,o,i,l,n?.padding??.1);return c?(await c.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:l}=e.getState();if(!l)return t;const{x:c,y:d}=l.getBoundingClientRect(),f={x:t.x-c,y:t.y-d},g=n.snapGrid??o,h=n.snapToGrid??i;return Ml(f,r,h,g)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),l=fd(t,n);return{x:l.x+o,y:l.y+i}}}),[])};function fN(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const l=r.get(i.id);l?l.push(i):r.set(i.id,[i])}for(const i of t){const l=r.get(i.id);if(!l){n.push(i);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const c={...i};for(const d of l)t7(d,c);n.push(c)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function t7(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function pN(e,t){return fN(e,t)}function hN(e,t){return fN(e,t)}function Uo(e,t){return{id:e,type:"select",selected:t}}function oi(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const l=t.has(o);!(i.selected===void 0&&!l)&&i.selected!==l&&(n&&(i.selected=l),r.push(Uo(i.id,l)))}return r}function Nb({items:e=[],lookup:t}){const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,i]of e.entries()){const l=t.get(i.id),c=l?.internals?.userNode??l;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function kb(e){return{id:e.id,type:"remove"}}const Tb=e=>kU(e),n7=e=>$E(e);function gN(e){return m.forwardRef(e)}function Pb(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>r7(()=>n(o=>o+BigInt(1))));return Yg(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function r7(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const mN=m.createContext(null);function o7({children:e}){const t=it(),n=m.useCallback(c=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:g,onNodesChange:h,nodeLookup:v,fitViewQueued:x,onNodesChangeMiddlewareMap:S}=t.getState();let w=d;for(const b of c)w=typeof b=="function"?b(w):b;let E=Nb({items:w,lookup:v});for(const b of S.values())E=b(E);g&&f(w),E.length>0?h?.(E):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:N,setNodes:k}=t.getState();b&&k(N)})},[]),r=Pb(n),o=m.useCallback(c=>{const{edges:d=[],setEdges:f,hasDefaultEdges:g,onEdgesChange:h,edgeLookup:v}=t.getState();let x=d;for(const S of c)x=typeof S=="function"?S(x):S;g?f(x):h&&h(Nb({items:x,lookup:v}))},[]),i=Pb(o),l=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return p.jsx(mN.Provider,{value:l,children:e})}function s7(){const e=m.useContext(mN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const i7=e=>!!e.panZoom;function hf(){const e=e7(),t=it(),n=s7(),r=He(i7),o=m.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),l=h=>{n.nodeQueue.push(h)},c=h=>{n.edgeQueue.push(h)},d=h=>{const{nodeLookup:v,nodeOrigin:x}=t.getState(),S=Tb(h)?h:v.get(h.id),w=S.parentId?HE(S.position,S.measured,S.parentId,v,x):S.position,E={...S,position:w,width:S.measured?.width??S.width,height:S.measured?.height??S.height};return Ei(E)},f=(h,v,x={replace:!1})=>{l(S=>S.map(w=>{if(w.id===h){const E=typeof v=="function"?v(w):v;return x.replace&&Tb(E)?E:{...w,...E}}return w}))},g=(h,v,x={replace:!1})=>{c(S=>S.map(w=>{if(w.id===h){const E=typeof v=="function"?v(w):v;return x.replace&&n7(E)?E:{...w,...E}}return w}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>i(h)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(v=>({...v}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:l,setEdges:c,addNodes:h=>{const v=Array.isArray(h)?h:[h];n.nodeQueue.push(x=>[...x,...v])},addEdges:h=>{const v=Array.isArray(h)?h:[h];n.edgeQueue.push(x=>[...x,...v])},toObject:()=>{const{nodes:h=[],edges:v=[],transform:x}=t.getState(),[S,w,E]=x;return{nodes:h.map(b=>({...b})),edges:v.map(b=>({...b})),viewport:{x:S,y:w,zoom:E}}},deleteElements:async({nodes:h=[],edges:v=[]})=>{const{nodes:x,edges:S,onNodesDelete:w,onEdgesDelete:E,triggerNodeChanges:b,triggerEdgeChanges:N,onDelete:k,onBeforeDelete:P}=t.getState(),{nodes:A,edges:I}=await _U({nodesToRemove:h,edgesToRemove:v,nodes:x,edges:S,onBeforeDelete:P}),R=I.length>0,j=A.length>0;if(R){const L=I.map(kb);E?.(I),N(L)}if(j){const L=A.map(kb);w?.(A),b(L)}return(j||R)&&k?.({nodes:A,edges:I}),{deletedNodes:A,deletedEdges:I}},getIntersectingNodes:(h,v=!0,x)=>{const S=Jw(h),w=S?h:d(h),E=x!==void 0;return w?(x||t.getState().nodes).filter(b=>{const N=t.getState().nodeLookup.get(b.id);if(N&&!S&&(b.id===h.id||!N.internals.positionAbsolute))return!1;const k=Ei(E?b:N),P=hl(k,w);return v&&P>0||P>=k.width*k.height||P>=w.width*w.height}):[]},isNodeIntersecting:(h,v,x=!0)=>{const w=Jw(h)?h:d(h);if(!w)return!1;const E=hl(w,v);return x&&E>0||E>=v.width*v.height||E>=w.width*w.height},updateNode:f,updateNodeData:(h,v,x={replace:!1})=>{f(h,S=>{const w=typeof v=="function"?v(S):v;return x.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},x)},updateEdge:g,updateEdgeData:(h,v,x={replace:!1})=>{g(h,S=>{const w=typeof v=="function"?v(S):v;return x.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},x)},getNodesBounds:h=>{const{nodeLookup:v,nodeOrigin:x}=t.getState();return TU(h,{nodeLookup:v,nodeOrigin:x})},getHandleConnections:({type:h,id:v,nodeId:x})=>Array.from(t.getState().connectionLookup.get(`${x}-${h}${v?`-${v}`:""}`)?.values()??[]),getNodeConnections:({type:h,handleId:v,nodeId:x})=>Array.from(t.getState().connectionLookup.get(`${x}${h?v?`-${h}-${v}`:`-${h}`:""}`)?.values()??[]),fitView:async h=>{const v=t.getState().fitViewResolver??jU();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:v}),n.nodeQueue.push(x=>[...x]),v.promise}}},[]);return m.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const Rb=e=>e.selected,a7=typeof window<"u"?window:void 0;function l7({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=it(),{deleteElements:r}=hf(),o=ml(e,{actInsideInputWithModifier:!1}),i=ml(t,{target:a7});m.useEffect(()=>{if(o){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(Rb),edges:l.filter(Rb)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function c7(e){const t=it();m.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=yy(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",Qn.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const gf={position:"absolute",width:"100%",height:"100%",top:0,left:0},u7=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function d7({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Qo.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:f,minZoom:g,maxZoom:h,zoomActivationKeyCode:v,preventScrolling:x=!0,children:S,noWheelClassName:w,noPanClassName:E,onViewportChange:b,isControlledViewport:N,paneClickDistance:k,selectionOnDrag:P}){const A=it(),I=m.useRef(null),{userSelectionActive:R,lib:j,connectionInProgress:L}=He(u7,ot),U=ml(v),$=m.useRef();c7(I);const B=m.useCallback(G=>{b?.({x:G[0],y:G[1],zoom:G[2]}),N||A.setState({transform:G})},[b,N]);return m.useEffect(()=>{if(I.current){$.current=y9({domNode:I.current,minZoom:g,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:M=>A.setState(z=>z.paneDragging===M?z:{paneDragging:M}),onPanZoomStart:(M,z)=>{const{onViewportChangeStart:H,onMoveStart:W}=A.getState();W?.(M,z),H?.(z)},onPanZoom:(M,z)=>{const{onViewportChange:H,onMove:W}=A.getState();W?.(M,z),H?.(z)},onPanZoomEnd:(M,z)=>{const{onViewportChangeEnd:H,onMoveEnd:W}=A.getState();W?.(M,z),H?.(z)}});const{x:G,y:_,zoom:O}=$.current.getViewport();return A.setState({panZoom:$.current,transform:[G,_,O],domNode:I.current.closest(".react-flow")}),()=>{$.current?.destroy()}}},[]),m.useEffect(()=>{$.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:U,preventScrolling:x,noPanClassName:E,userSelectionActive:R,noWheelClassName:w,lib:j,onTransformChange:B,connectionInProgress:L,selectionOnDrag:P,paneClickDistance:k})},[e,t,n,r,o,i,l,c,U,x,E,R,w,j,B,L,P,k]),p.jsx("div",{className:"react-flow__renderer",ref:I,style:gf,children:S})}const f7=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function p7(){const{userSelectionActive:e,userSelectionRect:t}=He(f7,ot);return e&&t?p.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const og=(e,t)=>n=>{n.target===t.current&&e?.(n)},h7=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function g7({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Si.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:l,onSelectionEnd:c,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:g,onPaneMouseEnter:h,onPaneMouseMove:v,onPaneMouseLeave:x,children:S}){const w=it(),{userSelectionActive:E,elementsSelectable:b,dragging:N,connectionInProgress:k}=He(h7,ot),P=b&&(e||E),A=m.useRef(null),I=m.useRef(),R=m.useRef(new Set),j=m.useRef(new Set),L=m.useRef(!1),U=H=>{if(L.current||k){L.current=!1;return}d?.(H),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=H=>{if(Array.isArray(r)&&r?.includes(2)){H.preventDefault();return}f?.(H)},B=g?H=>g(H):void 0,G=H=>{L.current&&(H.stopPropagation(),L.current=!1)},_=H=>{const{domNode:W}=w.getState();if(I.current=W?.getBoundingClientRect(),!I.current)return;const Z=H.target===A.current;if(!Z&&!!H.target.closest(".nokey")||!e||!(i&&Z||t)||H.button!==0||!H.isPrimary)return;H.target?.setPointerCapture?.(H.pointerId),L.current=!1;const{x:X,y:Q}=An(H.nativeEvent,I.current);w.setState({userSelectionRect:{width:0,height:0,startX:X,startY:Q,x:X,y:Q}}),Z||(H.stopPropagation(),H.preventDefault())},O=H=>{const{userSelectionRect:W,transform:Z,nodeLookup:F,edgeLookup:V,connectionLookup:X,triggerNodeChanges:Q,triggerEdgeChanges:ee,defaultEdgeOptions:ne,resetSelectedElements:K}=w.getState();if(!I.current||!W)return;const{x:q,y:oe}=An(H.nativeEvent,I.current),{startX:ce,startY:ge}=W;if(!L.current){const Fe=t?0:o;if(Math.hypot(q-ce,oe-ge)<=Fe)return;K(),l?.(H)}L.current=!0;const ye={startX:ce,startY:ge,x:q<ce?q:ce,y:oe<ge?oe:ge,width:Math.abs(q-ce),height:Math.abs(oe-ge)},me=R.current,Ee=j.current;R.current=new Set(hy(F,ye,Z,n===Si.Partial,!0).map(Fe=>Fe.id)),j.current=new Set;const Le=ne?.selectable??!0;for(const Fe of R.current){const Ke=X.get(Fe);if(Ke)for(const{edgeId:le}of Ke.values()){const Se=V.get(le);Se&&(Se.selectable??Le)&&j.current.add(le)}}if(!eb(me,R.current)){const Fe=oi(F,R.current,!0);Q(Fe)}if(!eb(Ee,j.current)){const Fe=oi(V,j.current);ee(Fe)}w.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},M=H=>{H.button===0&&(H.target?.releasePointerCapture?.(H.pointerId),!E&&H.target===A.current&&w.getState().userSelectionRect&&U?.(H),w.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(c?.(H),w.setState({nodesSelectionActive:R.current.size>0})))},z=r===!0||Array.isArray(r)&&r.includes(0);return p.jsxs("div",{className:mt(["react-flow__pane",{draggable:z,dragging:N,selection:e}]),onClick:P?void 0:og(U,A),onContextMenu:og($,A),onWheel:og(B,A),onPointerEnter:P?void 0:h,onPointerMove:P?O:v,onPointerUp:P?M:void 0,onPointerDownCapture:P?_:void 0,onClickCapture:P?G:void 0,onPointerLeave:x,ref:A,style:gf,children:[S,p.jsx(p7,{})]})}function Xg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:l,nodeLookup:c,onError:d}=t.getState(),f=c.get(e);if(!f){d?.("012",Qn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])}function yN({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:l}){const c=it(),[d,f]=m.useState(!1),g=m.useRef();return m.useEffect(()=>{g.current=r9({getStoreItems:()=>c.getState(),onNodeMouseDown:h=>{Xg({id:h,store:c,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!g.current))return g.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:l}),()=>{g.current?.destroy()}},[n,r,t,i,e,o,l]),d}const m7=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function vN(){const e=it();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:l,onError:c,updateNodePositions:d,nodeLookup:f,nodeOrigin:g}=e.getState(),h=new Map,v=m7(l),x=o?i[0]:5,S=o?i[1]:5,w=n.direction.x*x*n.factor,E=n.direction.y*S*n.factor;for(const[,b]of f){if(!v(b))continue;let N={x:b.internals.positionAbsolute.x+w,y:b.internals.positionAbsolute.y+E};o&&(N=Al(N,i));const{position:k,positionAbsolute:P}=LE({nodeId:b.id,nextPosition:N,nodeLookup:f,nodeExtent:r,nodeOrigin:g,onError:c});b.position=k,b.internals.positionAbsolute=P,h.set(b.id,b)}d(h)},[])}const Cy=m.createContext(null),y7=Cy.Provider;Cy.Consumer;const xN=()=>m.useContext(Cy),v7=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),x7=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:l}=r,{fromHandle:c,toHandle:d,isValid:f}=l,g=d?.nodeId===e&&d?.id===t&&d?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:g,clickConnecting:o?.nodeId===e&&o?.id===t&&o?.type===n,isPossibleEndHandle:i===bi.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:g&&f}};function w7({type:e="source",position:t=be.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:l,onConnect:c,children:d,className:f,onMouseDown:g,onTouchStart:h,...v},x){const S=l||null,w=e==="target",E=it(),b=xN(),{connectOnClick:N,noPanClassName:k,rfId:P}=He(v7,ot),{connectingFrom:A,connectingTo:I,clickConnecting:R,isPossibleEndHandle:j,connectionInProcess:L,clickConnectionInProcess:U,valid:$}=He(x7(b,S,e),ot);b||E.getState().onError?.("010",Qn.error010());const B=O=>{const{defaultEdgeOptions:M,onConnect:z,hasDefaultEdges:H}=E.getState(),W={...M,...O};if(H){const{edges:Z,setEdges:F}=E.getState();F(YE(W,Z))}z?.(W),c?.(W)},G=O=>{if(!b)return;const M=UE(O.nativeEvent);if(o&&(M&&O.button===0||!M)){const z=E.getState();Gg.onPointerDown(O.nativeEvent,{handleDomNode:O.currentTarget,autoPanOnConnect:z.autoPanOnConnect,connectionMode:z.connectionMode,connectionRadius:z.connectionRadius,domNode:z.domNode,nodeLookup:z.nodeLookup,lib:z.lib,isTarget:w,handleId:S,nodeId:b,flowId:z.rfId,panBy:z.panBy,cancelConnection:z.cancelConnection,onConnectStart:z.onConnectStart,onConnectEnd:(...H)=>E.getState().onConnectEnd?.(...H),updateConnection:z.updateConnection,onConnect:B,isValidConnection:n||((...H)=>E.getState().isValidConnection?.(...H)??!0),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:z.autoPanSpeed,dragThreshold:z.connectionDragThreshold})}M?g?.(O):h?.(O)},_=O=>{const{onClickConnectStart:M,onClickConnectEnd:z,connectionClickStartHandle:H,connectionMode:W,isValidConnection:Z,lib:F,rfId:V,nodeLookup:X,connection:Q}=E.getState();if(!b||!H&&!o)return;if(!H){M?.(O.nativeEvent,{nodeId:b,handleId:S,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:b,type:e,id:S}});return}const ee=BE(O.target),ne=n||Z,{connection:K,isValid:q}=Gg.isValid(O.nativeEvent,{handle:{nodeId:b,id:S,type:e},connectionMode:W,fromNodeId:H.nodeId,fromHandleId:H.id||null,fromType:H.type,isValidConnection:ne,flowId:V,doc:ee,lib:F,nodeLookup:X});q&&K&&B(K);const oe=structuredClone(Q);delete oe.inProgress,oe.toPosition=oe.toHandle?oe.toHandle.position:null,z?.(O,oe),E.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":S,"data-nodeid":b,"data-handlepos":t,"data-id":`${P}-${b}-${S}-${e}`,className:mt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,f,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:R,connectingfrom:A,connectingto:I,valid:$,connectionindicator:r&&(!L||j)&&(L||U?i:o)}]),onMouseDown:G,onTouchStart:G,onClick:N?_:void 0,ref:x,...v,children:d})}const yl=m.memo(gN(w7));function b7({data:e,isConnectable:t,sourcePosition:n=be.Bottom}){return p.jsxs(p.Fragment,{children:[e?.label,p.jsx(yl,{type:"source",position:n,isConnectable:t})]})}function S7({data:e,isConnectable:t,targetPosition:n=be.Top,sourcePosition:r=be.Bottom}){return p.jsxs(p.Fragment,{children:[p.jsx(yl,{type:"target",position:n,isConnectable:t}),e?.label,p.jsx(yl,{type:"source",position:r,isConnectable:t})]})}function C7(){return null}function E7({data:e,isConnectable:t,targetPosition:n=be.Top}){return p.jsxs(p.Fragment,{children:[p.jsx(yl,{type:"target",position:n,isConnectable:t}),e?.label]})}const hd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ib={input:b7,default:S7,output:E7,group:C7};function N7(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const k7=e=>{const{width:t,height:n,x:r,y:o}=_l(e.nodeLookup,{filter:i=>!!i.selected});return{width:_n(t)?t:null,height:_n(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function T7({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=it(),{width:o,height:i,transformString:l,userSelectionActive:c}=He(k7,ot),d=vN(),f=m.useRef(null);m.useEffect(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const g=!c&&o!==null&&i!==null;if(yN({nodeRef:f,disabled:!g}),!g)return null;const h=e?x=>{const S=r.getState().nodes.filter(w=>w.selected);e(x,S)}:void 0,v=x=>{Object.prototype.hasOwnProperty.call(hd,x.key)&&(x.preventDefault(),d({direction:hd[x.key],factor:x.shiftKey?4:1}))};return p.jsx("div",{className:mt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:p.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:o,height:i}})})}const _b=typeof window<"u"?window:void 0,P7=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function wN({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:g,selectionMode:h,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:w,zoomActivationKeyCode:E,elementsSelectable:b,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:P,panOnScrollSpeed:A,panOnScrollMode:I,zoomOnDoubleClick:R,panOnDrag:j,defaultViewport:L,translateExtent:U,minZoom:$,maxZoom:B,preventScrolling:G,onSelectionContextMenu:_,noWheelClassName:O,noPanClassName:M,disableKeyboardA11y:z,onViewportChange:H,isControlledViewport:W}){const{nodesSelectionActive:Z,userSelectionActive:F}=He(P7,ot),V=ml(f,{target:_b}),X=ml(w,{target:_b}),Q=X||j,ee=X||P,ne=g&&Q!==!0,K=V||F||ne;return l7({deleteKeyCode:d,multiSelectionKeyCode:S}),p.jsx(d7,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:ee,panOnScrollSpeed:A,panOnScrollMode:I,zoomOnDoubleClick:R,panOnDrag:!V&&Q,defaultViewport:L,translateExtent:U,minZoom:$,maxZoom:B,zoomActivationKeyCode:E,preventScrolling:G,noWheelClassName:O,noPanClassName:M,onViewportChange:H,isControlledViewport:W,paneClickDistance:c,selectionOnDrag:ne,children:p.jsxs(g7,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:Q,isSelecting:!!K,selectionMode:h,selectionKeyPressed:V,paneClickDistance:c,selectionOnDrag:ne,children:[e,Z&&p.jsx(T7,{onSelectionContextMenu:_,noPanClassName:M,disableKeyboardA11y:z})]})})}wN.displayName="FlowRenderer";const R7=m.memo(wN),I7=e=>t=>e?hy(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function _7(e){return He(m.useCallback(I7(e),[e]),ot)}const A7=e=>e.updateNodeInternals;function M7(){const e=He(A7),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t?.disconnect()},[t]),t}function D7({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=it(),i=m.useRef(null),l=m.useRef(null),c=m.useRef(e.sourcePosition),d=m.useRef(e.targetPosition),f=m.useRef(t),g=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!g||l.current!==i.current)&&(l.current&&r?.unobserve(l.current),r?.observe(i.current),l.current=i.current)},[g,e.hidden]),m.useEffect(()=>()=>{l.current&&(r?.unobserve(l.current),l.current=null)},[]),m.useEffect(()=>{if(i.current){const h=f.current!==t,v=c.current!==e.sourcePosition,x=d.current!==e.targetPosition;(h||v||x)&&(f.current=t,c.current=e.sourcePosition,d.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function j7({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:l,nodesDraggable:c,elementsSelectable:d,nodesConnectable:f,nodesFocusable:g,resizeObserver:h,noDragClassName:v,noPanClassName:x,disableKeyboardA11y:S,rfId:w,nodeTypes:E,nodeClickDistance:b,onError:N}){const{node:k,internals:P,isParent:A}=He(q=>{const oe=q.nodeLookup.get(e),ce=q.parentLookup.has(e);return{node:oe,internals:oe.internals,isParent:ce}},ot);let I=k.type||"default",R=E?.[I]||Ib[I];R===void 0&&(N?.("003",Qn.error003(I)),I="default",R=E?.default||Ib.default);const j=!!(k.draggable||c&&typeof k.draggable>"u"),L=!!(k.selectable||d&&typeof k.selectable>"u"),U=!!(k.connectable||f&&typeof k.connectable>"u"),$=!!(k.focusable||g&&typeof k.focusable>"u"),B=it(),G=my(k),_=D7({node:k,nodeType:I,hasDimensions:G,resizeObserver:h}),O=yN({nodeRef:_,disabled:k.hidden||!j,noDragClassName:v,handleSelector:k.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:b}),M=vN();if(k.hidden)return null;const z=Rr(k),H=N7(k),W=L||j||t||n||r||o,Z=n?q=>n(q,{...P.userNode}):void 0,F=r?q=>r(q,{...P.userNode}):void 0,V=o?q=>o(q,{...P.userNode}):void 0,X=i?q=>i(q,{...P.userNode}):void 0,Q=l?q=>l(q,{...P.userNode}):void 0,ee=q=>{const{selectNodesOnDrag:oe,nodeDragThreshold:ce}=B.getState();L&&(!oe||!j||ce>0)&&Xg({id:e,store:B,nodeRef:_}),t&&t(q,{...P.userNode})},ne=q=>{if(!(WE(q.nativeEvent)||S)){if(ME.includes(q.key)&&L){const oe=q.key==="Escape";Xg({id:e,store:B,unselect:oe,nodeRef:_})}else if(j&&k.selected&&Object.prototype.hasOwnProperty.call(hd,q.key)){q.preventDefault();const{ariaLabelConfig:oe}=B.getState();B.setState({ariaLiveMessage:oe["node.a11yDescription.ariaLiveMessage"]({direction:q.key.replace("Arrow","").toLowerCase(),x:~~P.positionAbsolute.x,y:~~P.positionAbsolute.y})}),M({direction:hd[q.key],factor:q.shiftKey?4:1})}}},K=()=>{if(S||!_.current?.matches(":focus-visible"))return;const{transform:q,width:oe,height:ce,autoPanOnNodeFocus:ge,setCenter:ye}=B.getState();if(!ge)return;hy(new Map([[e,k]]),{x:0,y:0,width:oe,height:ce},q,!0).length>0||ye(k.position.x+z.width/2,k.position.y+z.height/2,{zoom:q[2]})};return p.jsx("div",{className:mt(["react-flow__node",`react-flow__node-${I}`,{[x]:j},k.className,{selected:k.selected,selectable:L,parent:A,draggable:j,dragging:O}]),ref:_,style:{zIndex:P.z,transform:`translate(${P.positionAbsolute.x}px,${P.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:G?"visible":"hidden",...k.style,...H},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Z,onMouseMove:F,onMouseLeave:V,onContextMenu:X,onClick:ee,onDoubleClick:Q,onKeyDown:$?ne:void 0,tabIndex:$?0:void 0,onFocus:$?K:void 0,role:k.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${cN}-${w}`,"aria-label":k.ariaLabel,...k.domAttributes,children:p.jsx(y7,{value:e,children:p.jsx(R,{id:e,data:k.data,type:I,positionAbsoluteX:P.positionAbsolute.x,positionAbsoluteY:P.positionAbsolute.y,selected:k.selected??!1,selectable:L,draggable:j,deletable:k.deletable??!0,isConnectable:U,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:O,dragHandle:k.dragHandle,zIndex:P.z,parentId:k.parentId,...z})})})}var O7=m.memo(j7);const $7=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function bN(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=He($7,ot),l=_7(e.onlyRenderVisibleElements),c=M7();return p.jsx("div",{className:"react-flow__nodes",style:gf,children:l.map(d=>p.jsx(O7,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},d))})}bN.displayName="NodeRenderer";const L7=m.memo(bN);function F7(e){return He(m.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),l=n.nodeLookup.get(o.target);i&&l&&FU({sourceNode:i,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),ot)}const z7=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return p.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},V7=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return p.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ab={[ud.Arrow]:z7,[ud.ArrowClosed]:V7};function H7(e){const t=it();return m.useMemo(()=>Object.prototype.hasOwnProperty.call(Ab,e)?Ab[e]:(t.getState().onError?.("009",Qn.error009(e)),null),[e])}const B7=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const d=H7(t);return d?p.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:p.jsx(d,{color:n,strokeWidth:l})}):null},SN=({defaultColor:e,rfId:t})=>{const n=He(i=>i.edges),r=He(i=>i.defaultEdgeOptions),o=m.useMemo(()=>KU(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?p.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:p.jsx("defs",{children:o.map(i=>p.jsx(B7,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};SN.displayName="MarkerDefinitions";var W7=m.memo(SN);function CN({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:d,className:f,...g}){const[h,v]=m.useState({x:1,y:0,width:0,height:0}),x=mt(["react-flow__edge-textwrapper",f]),S=m.useRef(null);return m.useEffect(()=>{if(S.current){const w=S.current.getBBox();v({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?p.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:x,visibility:h.width?"visible":"hidden",...g,children:[o&&p.jsx("rect",{width:h.width+2*l[0],x:-l[0],y:-l[1],height:h.height+2*l[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),p.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:S,style:r,children:n}),d]}):null}CN.displayName="EdgeText";const U7=m.memo(CN);function Dl({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d,interactionWidth:f=20,...g}){return p.jsxs(p.Fragment,{children:[p.jsx("path",{...g,d:e,fill:"none",className:mt(["react-flow__edge-path",g.className])}),f?p.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&_n(t)&&_n(n)?p.jsx(U7,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function Mb({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===be.Left||e===be.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function EN({sourceX:e,sourceY:t,sourcePosition:n=be.Bottom,targetX:r,targetY:o,targetPosition:i=be.Top}){const[l,c]=Mb({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=Mb({pos:i,x1:r,y1:o,x2:e,y2:t}),[g,h,v,x]=KE({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${r},${o}`,g,h,v,x]}function NN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l,targetPosition:c,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:w,markerStart:E,interactionWidth:b})=>{const[N,k,P]=EN({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c}),A=e.isInternal?void 0:t;return p.jsx(Dl,{id:A,path:N,labelX:k,labelY:P,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:w,markerStart:E,interactionWidth:b})})}const K7=NN({isInternal:!1}),kN=NN({isInternal:!0});K7.displayName="SimpleBezierEdge";kN.displayName="SimpleBezierEdgeInternal";function TN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,sourcePosition:x=be.Bottom,targetPosition:S=be.Top,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:N})=>{const[k,P,A]=Wg({sourceX:n,sourceY:r,sourcePosition:x,targetX:o,targetY:i,targetPosition:S,borderRadius:b?.borderRadius,offset:b?.offset,stepPosition:b?.stepPosition}),I=e.isInternal?void 0:t;return p.jsx(Dl,{id:I,path:k,labelX:P,labelY:A,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:w,markerStart:E,interactionWidth:N})})}const PN=TN({isInternal:!1}),RN=TN({isInternal:!0});PN.displayName="SmoothStepEdge";RN.displayName="SmoothStepEdgeInternal";function IN(e){return m.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return p.jsx(PN,{...n,id:r,pathOptions:m.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const G7=IN({isInternal:!1}),_N=IN({isInternal:!0});G7.displayName="StepEdge";_N.displayName="StepEdgeInternal";function AN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:x,markerStart:S,interactionWidth:w})=>{const[E,b,N]=XE({sourceX:n,sourceY:r,targetX:o,targetY:i}),k=e.isInternal?void 0:t;return p.jsx(Dl,{id:k,path:E,labelX:b,labelY:N,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:x,markerStart:S,interactionWidth:w})})}const Y7=AN({isInternal:!1}),MN=AN({isInternal:!0});Y7.displayName="StraightEdge";MN.displayName="StraightEdgeInternal";function DN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l=be.Bottom,targetPosition:c=be.Top,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:N})=>{const[k,P,A]=pd({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c,curvature:b?.curvature}),I=e.isInternal?void 0:t;return p.jsx(Dl,{id:I,path:k,labelX:P,labelY:A,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:w,markerStart:E,interactionWidth:N})})}const X7=DN({isInternal:!1}),jN=DN({isInternal:!0});X7.displayName="BezierEdge";jN.displayName="BezierEdgeInternal";const Db={default:jN,straight:MN,step:_N,smoothstep:RN,simplebezier:kN},jb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},q7=(e,t,n)=>n===be.Left?e-t:n===be.Right?e+t:e,Z7=(e,t,n)=>n===be.Top?e-t:n===be.Bottom?e+t:e,Ob="react-flow__edgeupdater";function $b({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:l,type:c}){return p.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:l,className:mt([Ob,`${Ob}-${c}`]),cx:q7(t,r,e),cy:Z7(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Q7({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:l,sourcePosition:c,targetPosition:d,onReconnect:f,onReconnectStart:g,onReconnectEnd:h,setReconnecting:v,setUpdateHover:x}){const S=it(),w=(P,A)=>{if(P.button!==0)return;const{autoPanOnConnect:I,domNode:R,connectionMode:j,connectionRadius:L,lib:U,onConnectStart:$,cancelConnection:B,nodeLookup:G,rfId:_,panBy:O,updateConnection:M}=S.getState(),z=A.type==="target",H=(F,V)=>{v(!1),h?.(F,n,A.type,V)},W=F=>f?.(n,F),Z=(F,V)=>{v(!0),g?.(P,n,A.type),$?.(F,V)};Gg.onPointerDown(P.nativeEvent,{autoPanOnConnect:I,connectionMode:j,connectionRadius:L,domNode:R,handleId:A.id,nodeId:A.nodeId,nodeLookup:G,isTarget:z,edgeUpdaterType:A.type,lib:U,flowId:_,cancelConnection:B,panBy:O,isValidConnection:(...F)=>S.getState().isValidConnection?.(...F)??!0,onConnect:W,onConnectStart:Z,onConnectEnd:(...F)=>S.getState().onConnectEnd?.(...F),onReconnectEnd:H,updateConnection:M,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:P.currentTarget})},E=P=>w(P,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),b=P=>w(P,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>x(!0),k=()=>x(!1);return p.jsxs(p.Fragment,{children:[(e===!0||e==="source")&&p.jsx($b,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:N,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&p.jsx($b,{position:d,centerX:i,centerY:l,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:k,type:"target"})]})}function J7({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:f,reconnectRadius:g,onReconnect:h,onReconnectStart:v,onReconnectEnd:x,rfId:S,edgeTypes:w,noPanClassName:E,onError:b,disableKeyboardA11y:N}){let k=He(ye=>ye.edgeLookup.get(e));const P=He(ye=>ye.defaultEdgeOptions);k=P?{...P,...k}:k;let A=k.type||"default",I=w?.[A]||Db[A];I===void 0&&(b?.("011",Qn.error011(A)),A="default",I=w?.default||Db.default);const R=!!(k.focusable||t&&typeof k.focusable>"u"),j=typeof h<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),L=!!(k.selectable||r&&typeof k.selectable>"u"),U=m.useRef(null),[$,B]=m.useState(!1),[G,_]=m.useState(!1),O=it(),{zIndex:M,sourceX:z,sourceY:H,targetX:W,targetY:Z,sourcePosition:F,targetPosition:V}=He(m.useCallback(ye=>{const me=ye.nodeLookup.get(k.source),Ee=ye.nodeLookup.get(k.target);if(!me||!Ee)return{zIndex:k.zIndex,...jb};const Le=UU({id:e,sourceNode:me,targetNode:Ee,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ye.connectionMode,onError:b});return{zIndex:LU({selected:k.selected,zIndex:k.zIndex,sourceNode:me,targetNode:Ee,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Le||jb}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),ot),X=m.useMemo(()=>k.markerStart?`url('#${Ug(k.markerStart,S)}')`:void 0,[k.markerStart,S]),Q=m.useMemo(()=>k.markerEnd?`url('#${Ug(k.markerEnd,S)}')`:void 0,[k.markerEnd,S]);if(k.hidden||z===null||H===null||W===null||Z===null)return null;const ee=ye=>{const{addSelectedEdges:me,unselectNodesAndEdges:Ee,multiSelectionActive:Le}=O.getState();L&&(O.setState({nodesSelectionActive:!1}),k.selected&&Le?(Ee({nodes:[],edges:[k]}),U.current?.blur()):me([e])),o&&o(ye,k)},ne=i?ye=>{i(ye,{...k})}:void 0,K=l?ye=>{l(ye,{...k})}:void 0,q=c?ye=>{c(ye,{...k})}:void 0,oe=d?ye=>{d(ye,{...k})}:void 0,ce=f?ye=>{f(ye,{...k})}:void 0,ge=ye=>{if(!N&&ME.includes(ye.key)&&L){const{unselectNodesAndEdges:me,addSelectedEdges:Ee}=O.getState();ye.key==="Escape"?(U.current?.blur(),me({edges:[k]})):Ee([e])}};return p.jsx("svg",{style:{zIndex:M},children:p.jsxs("g",{className:mt(["react-flow__edge",`react-flow__edge-${A}`,k.className,E,{selected:k.selected,animated:k.animated,inactive:!L&&!o,updating:$,selectable:L}]),onClick:ee,onDoubleClick:ne,onContextMenu:K,onMouseEnter:q,onMouseMove:oe,onMouseLeave:ce,onKeyDown:R?ge:void 0,tabIndex:R?0:void 0,role:k.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":R?`${uN}-${S}`:void 0,ref:U,...k.domAttributes,children:[!G&&p.jsx(I,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:L,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:z,sourceY:H,targetX:W,targetY:Z,sourcePosition:F,targetPosition:V,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:X,markerEnd:Q,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),j&&p.jsx(Q7,{edge:k,isReconnectable:j,reconnectRadius:g,onReconnect:h,onReconnectStart:v,onReconnectEnd:x,sourceX:z,sourceY:H,targetX:W,targetY:Z,sourcePosition:F,targetPosition:V,setUpdateHover:B,setReconnecting:_})]})})}var eK=m.memo(J7);const tK=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ON({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:g,reconnectRadius:h,onEdgeDoubleClick:v,onReconnectStart:x,onReconnectEnd:S,disableKeyboardA11y:w}){const{edgesFocusable:E,edgesReconnectable:b,elementsSelectable:N,onError:k}=He(tK,ot),P=F7(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(W7,{defaultColor:e,rfId:n}),P.map(A=>p.jsx(eK,{id:A,edgesFocusable:E,edgesReconnectable:b,elementsSelectable:N,noPanClassName:o,onReconnect:i,onContextMenu:l,onMouseEnter:c,onMouseMove:d,onMouseLeave:f,onClick:g,reconnectRadius:h,onDoubleClick:v,onReconnectStart:x,onReconnectEnd:S,rfId:n,onError:k,edgeTypes:r,disableKeyboardA11y:w},A))]})}ON.displayName="EdgeRenderer";const nK=m.memo(ON),rK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oK({children:e}){const t=He(rK);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function sK(e){const t=hf(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const iK=e=>e.panZoom?.syncViewport;function aK(e){const t=He(iK),n=it();return m.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function lK(e){return e.connection.inProgress?{...e.connection,to:Ml(e.connection.to,e.transform)}:{...e.connection}}function cK(e){return lK}function uK(e){const t=cK();return He(t,ot)}const dK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function fK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:l,isValid:c,inProgress:d}=He(dK,ot);return!(i&&o&&d)?null:p.jsx("svg",{style:e,width:i,height:l,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:mt(["react-flow__connection",OE(c)]),children:p.jsx($N,{style:t,type:n,CustomComponent:r,isValid:c})})})}const $N=({style:e,type:t=ao.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:l,fromHandle:c,fromPosition:d,to:f,toNode:g,toHandle:h,toPosition:v,pointer:x}=uK();if(!o)return;if(n)return p.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:i.x,fromY:i.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:v,connectionStatus:OE(r),toNode:g,toHandle:h,pointer:x});let S="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:v};switch(t){case ao.Bezier:[S]=pd(w);break;case ao.SimpleBezier:[S]=EN(w);break;case ao.Step:[S]=Wg({...w,borderRadius:0});break;case ao.SmoothStep:[S]=Wg(w);break;default:[S]=XE(w)}return p.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};$N.displayName="ConnectionLine";const pK={};function Lb(e=pK){m.useRef(e),it(),m.useEffect(()=>{},[e])}function hK(){it(),m.useRef(!1),m.useEffect(()=>{},[])}function LN({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:g,onSelectionContextMenu:h,onSelectionStart:v,onSelectionEnd:x,connectionLineType:S,connectionLineStyle:w,connectionLineComponent:E,connectionLineContainerStyle:b,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,multiSelectionKeyCode:A,panActivationKeyCode:I,zoomActivationKeyCode:R,deleteKeyCode:j,onlyRenderVisibleElements:L,elementsSelectable:U,defaultViewport:$,translateExtent:B,minZoom:G,maxZoom:_,preventScrolling:O,defaultMarkerColor:M,zoomOnScroll:z,zoomOnPinch:H,panOnScroll:W,panOnScrollSpeed:Z,panOnScrollMode:F,zoomOnDoubleClick:V,panOnDrag:X,onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:K,onPaneScroll:q,onPaneContextMenu:oe,paneClickDistance:ce,nodeClickDistance:ge,onEdgeContextMenu:ye,onEdgeMouseEnter:me,onEdgeMouseMove:Ee,onEdgeMouseLeave:Le,reconnectRadius:Fe,onReconnect:Ke,onReconnectStart:le,onReconnectEnd:Se,noDragClassName:Oe,noWheelClassName:qe,noPanClassName:yt,disableKeyboardA11y:Dt,nodeExtent:Qe,rfId:So,viewport:nr,onViewportChange:rr}){return Lb(e),Lb(t),hK(),sK(n),aK(nr),p.jsx(R7,{onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:K,onPaneContextMenu:oe,onPaneScroll:q,paneClickDistance:ce,deleteKeyCode:j,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:A,panActivationKeyCode:I,zoomActivationKeyCode:R,elementsSelectable:U,zoomOnScroll:z,zoomOnPinch:H,zoomOnDoubleClick:V,panOnScroll:W,panOnScrollSpeed:Z,panOnScrollMode:F,panOnDrag:X,defaultViewport:$,translateExtent:B,minZoom:G,maxZoom:_,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:Oe,noWheelClassName:qe,noPanClassName:yt,disableKeyboardA11y:Dt,onViewportChange:rr,isControlledViewport:!!nr,children:p.jsxs(oK,{children:[p.jsx(nK,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:Ke,onReconnectStart:le,onReconnectEnd:Se,onlyRenderVisibleElements:L,onEdgeContextMenu:ye,onEdgeMouseEnter:me,onEdgeMouseMove:Ee,onEdgeMouseLeave:Le,reconnectRadius:Fe,defaultMarkerColor:M,noPanClassName:yt,disableKeyboardA11y:Dt,rfId:So}),p.jsx(fK,{style:w,type:S,component:E,containerStyle:b}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(L7,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:g,nodeClickDistance:ge,onlyRenderVisibleElements:L,noPanClassName:yt,noDragClassName:Oe,disableKeyboardA11y:Dt,nodeExtent:Qe,rfId:So}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}LN.displayName="GraphView";const gK=m.memo(LN),Fb=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:d=.5,maxZoom:f=2,nodeOrigin:g,nodeExtent:h,zIndexMode:v="basic"}={})=>{const x=new Map,S=new Map,w=new Map,E=new Map,b=r??t??[],N=n??e??[],k=g??[0,0],P=h??pl;QE(w,E,b);const{nodesInitialized:A}=Kg(N,x,S,{nodeOrigin:k,nodeExtent:P,zIndexMode:v});let I=[0,0,1];if(l&&o&&i){const R=_l(x,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:j,y:L,zoom:U}=gy(R,o,i,d,f,c?.padding??.1);I=[j,L,U]}return{rfId:"1",width:o??0,height:i??0,transform:I,nodes:N,nodesInitialized:A,nodeLookup:x,parentLookup:S,edges:b,edgeLookup:E,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:pl,nodeExtent:P,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...jE},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:AU,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:DE,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},mK=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:f,nodeOrigin:g,nodeExtent:h,zIndexMode:v})=>j9((x,S)=>{async function w(){const{nodeLookup:E,panZoom:b,fitViewOptions:N,fitViewResolver:k,width:P,height:A,minZoom:I,maxZoom:R}=S();b&&(await IU({nodes:E,width:P,height:A,panZoom:b,minZoom:I,maxZoom:R},N),k?.resolve(!0),x({fitViewResolver:null}))}return{...Fb({nodes:e,edges:t,width:o,height:i,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:f,nodeOrigin:g,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:v}),setNodes:E=>{const{nodeLookup:b,parentLookup:N,nodeOrigin:k,elevateNodesOnSelect:P,fitViewQueued:A,zIndexMode:I,nodesSelectionActive:R}=S(),{nodesInitialized:j,hasSelectedNodes:L}=Kg(E,b,N,{nodeOrigin:k,nodeExtent:h,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:I}),U=R&&L;A&&j?(w(),x({nodes:E,nodesInitialized:j,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:U})):x({nodes:E,nodesInitialized:j,nodesSelectionActive:U})},setEdges:E=>{const{connectionLookup:b,edgeLookup:N}=S();QE(b,N,E),x({edges:E})},setDefaultNodesAndEdges:(E,b)=>{if(E){const{setNodes:N}=S();N(E),x({hasDefaultNodes:!0})}if(b){const{setEdges:N}=S();N(b),x({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:b,nodeLookup:N,parentLookup:k,domNode:P,nodeOrigin:A,nodeExtent:I,debug:R,fitViewQueued:j,zIndexMode:L}=S(),{changes:U,updatedInternals:$}=JU(E,N,k,P,A,I,L);$&&(XU(N,k,{nodeOrigin:A,nodeExtent:I,zIndexMode:L}),j?(w(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),U?.length>0&&(R&&console.log("React Flow: trigger node changes",U),b?.(U)))},updateNodePositions:(E,b=!1)=>{const N=[];let k=[];const{nodeLookup:P,triggerNodeChanges:A,connection:I,updateConnection:R,onNodesChangeMiddlewareMap:j}=S();for(const[L,U]of E){const $=P.get(L),B=!!($?.expandParent&&$?.parentId&&U?.position),G={id:L,type:"position",position:B?{x:Math.max(0,U.position.x),y:Math.max(0,U.position.y)}:U.position,dragging:b};if($&&I.inProgress&&I.fromNode.id===$.id){const _=us($,I.fromHandle,be.Left,!0);R({...I,from:_})}B&&$.parentId&&N.push({id:L,parentId:$.parentId,rect:{...U.internals.positionAbsolute,width:U.measured.width??0,height:U.measured.height??0}}),k.push(G)}if(N.length>0){const{parentLookup:L,nodeOrigin:U}=S(),$=Sy(N,P,L,U);k.push(...$)}for(const L of j.values())k=L(k);A(k)},triggerNodeChanges:E=>{const{onNodesChange:b,setNodes:N,nodes:k,hasDefaultNodes:P,debug:A}=S();if(E?.length){if(P){const I=pN(E,k);N(I)}A&&console.log("React Flow: trigger node changes",E),b?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:b,setEdges:N,edges:k,hasDefaultEdges:P,debug:A}=S();if(E?.length){if(P){const I=hN(E,k);N(I)}A&&console.log("React Flow: trigger edge changes",E),b?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:b,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:A}=S();if(b){const I=E.map(R=>Uo(R,!0));P(I);return}P(oi(k,new Set([...E]),!0)),A(oi(N))},addSelectedEdges:E=>{const{multiSelectionActive:b,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:A}=S();if(b){const I=E.map(R=>Uo(R,!0));A(I);return}A(oi(N,new Set([...E]))),P(oi(k,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:b}={})=>{const{edges:N,nodes:k,nodeLookup:P,triggerNodeChanges:A,triggerEdgeChanges:I}=S(),R=E||k,j=b||N,L=[];for(const $ of R){if(!$.selected)continue;const B=P.get($.id);B&&(B.selected=!1),L.push(Uo($.id,!1))}const U=[];for(const $ of j)$.selected&&U.push(Uo($.id,!1));A(L),I(U)},setMinZoom:E=>{const{panZoom:b,maxZoom:N}=S();b?.setScaleExtent([E,N]),x({minZoom:E})},setMaxZoom:E=>{const{panZoom:b,minZoom:N}=S();b?.setScaleExtent([N,E]),x({maxZoom:E})},setTranslateExtent:E=>{S().panZoom?.setTranslateExtent(E),x({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:b,triggerNodeChanges:N,triggerEdgeChanges:k,elementsSelectable:P}=S();if(!P)return;const A=b.reduce((R,j)=>j.selected?[...R,Uo(j.id,!1)]:R,[]),I=E.reduce((R,j)=>j.selected?[...R,Uo(j.id,!1)]:R,[]);N(A),k(I)},setNodeExtent:E=>{const{nodes:b,nodeLookup:N,parentLookup:k,nodeOrigin:P,elevateNodesOnSelect:A,nodeExtent:I,zIndexMode:R}=S();E[0][0]===I[0][0]&&E[0][1]===I[0][1]&&E[1][0]===I[1][0]&&E[1][1]===I[1][1]||(Kg(b,N,k,{nodeOrigin:P,nodeExtent:E,elevateNodesOnSelect:A,checkEquality:!1,zIndexMode:R}),x({nodeExtent:E}))},panBy:E=>{const{transform:b,width:N,height:k,panZoom:P,translateExtent:A}=S();return e9({delta:E,panZoom:P,transform:b,translateExtent:A,width:N,height:k})},setCenter:async(E,b,N)=>{const{width:k,height:P,maxZoom:A,panZoom:I}=S();if(!I)return Promise.resolve(!1);const R=typeof N?.zoom<"u"?N.zoom:A;return await I.setViewport({x:k/2-E*R,y:P/2-b*R,zoom:R},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...jE}})},updateConnection:E=>{x({connection:E})},reset:()=>x({...Fb()})}},Object.is);function FN({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:d,fitView:f,nodeOrigin:g,nodeExtent:h,zIndexMode:v,children:x}){const[S]=m.useState(()=>mK({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:f,minZoom:l,maxZoom:c,fitViewOptions:d,nodeOrigin:g,nodeExtent:h,zIndexMode:v}));return p.jsx(O9,{value:S,children:p.jsx(o7,{children:x})})}function yK({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:l,fitView:c,fitViewOptions:d,minZoom:f,maxZoom:g,nodeOrigin:h,nodeExtent:v,zIndexMode:x}){return m.useContext(ff)?p.jsx(p.Fragment,{children:e}):p.jsx(FN,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:l,fitView:c,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:g,nodeOrigin:h,nodeExtent:v,zIndexMode:x,children:e})}const vK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function xK({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:l,onNodeClick:c,onEdgeClick:d,onInit:f,onMove:g,onMoveStart:h,onMoveEnd:v,onConnect:x,onConnectStart:S,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:b,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:A,onNodeDoubleClick:I,onNodeDragStart:R,onNodeDrag:j,onNodeDragStop:L,onNodesDelete:U,onEdgesDelete:$,onDelete:B,onSelectionChange:G,onSelectionDragStart:_,onSelectionDrag:O,onSelectionDragStop:M,onSelectionContextMenu:z,onSelectionStart:H,onSelectionEnd:W,onBeforeDelete:Z,connectionMode:F,connectionLineType:V=ao.Bezier,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:ee,deleteKeyCode:ne="Backspace",selectionKeyCode:K="Shift",selectionOnDrag:q=!1,selectionMode:oe=Si.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:ge=gl()?"Meta":"Control",zoomActivationKeyCode:ye=gl()?"Meta":"Control",snapToGrid:me,snapGrid:Ee,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:Fe,nodesDraggable:Ke,autoPanOnNodeFocus:le,nodesConnectable:Se,nodesFocusable:Oe,nodeOrigin:qe=dN,edgesFocusable:yt,edgesReconnectable:Dt,elementsSelectable:Qe=!0,defaultViewport:So=X9,minZoom:nr=.5,maxZoom:rr=2,translateExtent:Co=pl,preventScrolling:Vl=!0,nodeExtent:or,defaultMarkerColor:Eo="#b1b1b7",zoomOnScroll:Tf=!0,zoomOnPinch:Hl=!0,panOnScroll:Bl=!1,panOnScrollSpeed:Pf=.5,panOnScrollMode:Vi=Qo.Free,zoomOnDoubleClick:Hi=!0,panOnDrag:Bi=!0,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:_r,onPaneMouseLeave:Ar,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl=1,nodeClickDistance:Gl=0,children:Yl,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:No,onEdgeContextMenu:Gi,onEdgeDoubleClick:ko,onEdgeMouseEnter:Rf,onEdgeMouseMove:To,onEdgeMouseLeave:ys,reconnectRadius:vs=10,onNodesChange:Yi,onEdgesChange:If,noDragClassName:_f="nodrag",noWheelClassName:Af="nowheel",noPanClassName:Fn="nopan",fitView:Xi,fitViewOptions:qi,connectOnClick:Mf,attributionPosition:ql,proOptions:Zl,defaultEdgeOptions:Ql,elevateNodesOnSelect:Jl=!0,elevateEdgesOnSelect:Df=!1,disableKeyboardA11y:ec=!1,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,connectionRadius:tc,isValidConnection:xs,onError:Of,style:nc,id:Po,nodeDragThreshold:dn,connectionDragThreshold:$f,viewport:Zt,onViewportChange:Lf,width:Ff,height:zf,colorMode:ws="light",debug:bs,onScroll:Mr,ariaLabelConfig:Ss,zIndexMode:rc="basic",...Vf},Qi){const Cs=Po||"1",Ji=J9(ws),Ro=m.useCallback(oc=>{oc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Mr?.(oc)},[Mr]);return p.jsx("div",{"data-testid":"rf__wrapper",...Vf,onScroll:Ro,style:{...nc,...vK},ref:Qi,className:mt(["react-flow",o,Ji]),id:Po,role:"application",children:p.jsxs(yK,{nodes:e,edges:t,width:Ff,height:zf,fitView:Xi,fitViewOptions:qi,minZoom:nr,maxZoom:rr,nodeOrigin:qe,nodeExtent:or,zIndexMode:rc,children:[p.jsx(Q9,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:S,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:b,nodesDraggable:Ke,autoPanOnNodeFocus:le,nodesConnectable:Se,nodesFocusable:Oe,edgesFocusable:yt,edgesReconnectable:Dt,elementsSelectable:Qe,elevateNodesOnSelect:Jl,elevateEdgesOnSelect:Df,minZoom:nr,maxZoom:rr,nodeExtent:or,onNodesChange:Yi,onEdgesChange:If,snapToGrid:me,snapGrid:Ee,connectionMode:F,translateExtent:Co,connectOnClick:Mf,defaultEdgeOptions:Ql,fitView:Xi,fitViewOptions:qi,onNodesDelete:U,onEdgesDelete:$,onDelete:B,onNodeDragStart:R,onNodeDrag:j,onNodeDragStop:L,onSelectionDrag:O,onSelectionDragStart:_,onSelectionDragStop:M,onMove:g,onMoveStart:h,onMoveEnd:v,noPanClassName:Fn,nodeOrigin:qe,rfId:Cs,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,onError:Of,connectionRadius:tc,isValidConnection:xs,selectNodesOnDrag:Fe,nodeDragThreshold:dn,connectionDragThreshold:$f,onBeforeDelete:Z,debug:bs,ariaLabelConfig:Ss,zIndexMode:rc}),p.jsx(gK,{onInit:f,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:A,onNodeDoubleClick:I,nodeTypes:i,edgeTypes:l,connectionLineType:V,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:ee,selectionKeyCode:K,selectionOnDrag:q,selectionMode:oe,deleteKeyCode:ne,multiSelectionKeyCode:ge,panActivationKeyCode:ce,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Le,defaultViewport:So,translateExtent:Co,minZoom:nr,maxZoom:rr,preventScrolling:Vl,zoomOnScroll:Tf,zoomOnPinch:Hl,zoomOnDoubleClick:Hi,panOnScroll:Bl,panOnScrollSpeed:Pf,panOnScrollMode:Vi,panOnDrag:Bi,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:_r,onPaneMouseLeave:Ar,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl,nodeClickDistance:Gl,onSelectionContextMenu:z,onSelectionStart:H,onSelectionEnd:W,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:No,onEdgeContextMenu:Gi,onEdgeDoubleClick:ko,onEdgeMouseEnter:Rf,onEdgeMouseMove:To,onEdgeMouseLeave:ys,reconnectRadius:vs,defaultMarkerColor:Eo,noDragClassName:_f,noWheelClassName:Af,noPanClassName:Fn,rfId:Cs,disableKeyboardA11y:ec,nodeExtent:or,viewport:Zt,onViewportChange:Lf}),p.jsx(Y9,{onSelectionChange:G}),Yl,p.jsx(B9,{proOptions:Zl,position:ql}),p.jsx(H9,{rfId:Cs,disableKeyboardA11y:ec})]})})}var wK=gN(xK);const bK=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function SK({children:e}){const t=He(bK);return t?hs.createPortal(e,t):null}const CK=e=>e.edges;function EK(){return He(CK,ot)}const NK=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!my(n.userNode))return!1;return!0};function kK(e={includeHiddenNodes:!1}){return He(NK(e))}function TK({dimensions:e,lineWidth:t,variant:n,className:r}){return p.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:mt(["react-flow__background-pattern",n,r])})}function PK({radius:e,className:t}){return p.jsx("circle",{cx:e,cy:e,r:e,className:mt(["react-flow__background-pattern","dots",t])})}var wr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(wr||(wr={}));const RK={[wr.Dots]:1,[wr.Lines]:1,[wr.Cross]:6},IK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function zN({id:e,variant:t=wr.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:l,bgColor:c,style:d,className:f,patternClassName:g}){const h=m.useRef(null),{transform:v,patternId:x}=He(IK,ot),S=r||RK[t],w=t===wr.Dots,E=t===wr.Cross,b=Array.isArray(n)?n:[n,n],N=[b[0]*v[2]||1,b[1]*v[2]||1],k=S*v[2],P=Array.isArray(i)?i:[i,i],A=E?[k,k]:N,I=[P[0]*v[2]||1+A[0]/2,P[1]*v[2]||1+A[1]/2],R=`${x}${e||""}`;return p.jsxs("svg",{className:mt(["react-flow__background",f]),style:{...d,...gf,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:h,"data-testid":"rf__background",children:[p.jsx("pattern",{id:R,x:v[0]%N[0],y:v[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`,children:w?p.jsx(PK,{radius:k/2,className:g}):p.jsx(TK,{dimensions:A,lineWidth:o,variant:t,className:g})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}zN.displayName="Background";const _K=m.memo(zN);function AK(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:p.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function MK(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:p.jsx("path",{d:"M0 0h32v4.2H0z"})})}function DK(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:p.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 jK(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.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 OK(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.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 Cu({children:e,className:t,...n}){return p.jsx("button",{type:"button",className:mt(["react-flow__controls-button",t]),...n,children:e})}const $K=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function VN({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:l,onFitView:c,onInteractiveChange:d,className:f,children:g,position:h="bottom-left",orientation:v="vertical","aria-label":x}){const S=it(),{isInteractive:w,minZoomReached:E,maxZoomReached:b,ariaLabelConfig:N}=He($K,ot),{zoomIn:k,zoomOut:P,fitView:A}=hf(),I=()=>{k(),i?.()},R=()=>{P(),l?.()},j=()=>{A(o),c?.()},L=()=>{S.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},U=v==="horizontal"?"horizontal":"vertical";return p.jsxs(pf,{className:mt(["react-flow__controls",U,f]),position:h,style:e,"data-testid":"rf__controls","aria-label":x??N["controls.ariaLabel"],children:[t&&p.jsxs(p.Fragment,{children:[p.jsx(Cu,{onClick:I,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:b,children:p.jsx(AK,{})}),p.jsx(Cu,{onClick:R,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:E,children:p.jsx(MK,{})})]}),n&&p.jsx(Cu,{className:"react-flow__controls-fitview",onClick:j,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:p.jsx(DK,{})}),r&&p.jsx(Cu,{className:"react-flow__controls-interactive",onClick:L,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:w?p.jsx(OK,{}):p.jsx(jK,{})}),g]})}VN.displayName="Controls";const LK=m.memo(VN);function FK({id:e,x:t,y:n,width:r,height:o,style:i,color:l,strokeColor:c,strokeWidth:d,className:f,borderRadius:g,shapeRendering:h,selected:v,onClick:x}){const{background:S,backgroundColor:w}=i||{},E=l||S||w;return p.jsx("rect",{className:mt(["react-flow__minimap-node",{selected:v},f]),x:t,y:n,rx:g,ry:g,width:r,height:o,style:{fill:E,stroke:c,strokeWidth:d},shapeRendering:h,onClick:x?b=>x(b,e):void 0})}const zK=m.memo(FK),VK=e=>e.nodes.map(t=>t.id),sg=e=>e instanceof Function?e:()=>e;function HK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=zK,onClick:l}){const c=He(VK,ot),d=sg(t),f=sg(e),g=sg(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return p.jsx(p.Fragment,{children:c.map(v=>p.jsx(WK,{id:v,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:g,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:l,shapeRendering:h},v))})}function BK({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:l,NodeComponent:c,onClick:d}){const{node:f,x:g,y:h,width:v,height:x}=He(S=>{const w=S.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const E=w.internals.userNode,{x:b,y:N}=w.internals.positionAbsolute,{width:k,height:P}=Rr(E);return{node:E,x:b,y:N,width:k,height:P}},ot);return!f||f.hidden||!my(f)?null:p.jsx(c,{x:g,y:h,width:v,height:x,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:o,strokeColor:n(f),strokeWidth:i,shapeRendering:l,onClick:d,id:f.id})}const WK=m.memo(BK);var UK=m.memo(HK);const KK=200,GK=150,YK=e=>!e.hidden,XK=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?VE(_l(e.nodeLookup,{filter:YK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},qK="react-flow__minimap-desc";function HN({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:d,maskColor:f,maskStrokeColor:g,maskStrokeWidth:h,position:v="bottom-right",onClick:x,onNodeClick:S,pannable:w=!1,zoomable:E=!1,ariaLabel:b,inversePan:N,zoomStep:k=1,offsetScale:P=5}){const A=it(),I=m.useRef(null),{boundingRect:R,viewBB:j,rfId:L,panZoom:U,translateExtent:$,flowWidth:B,flowHeight:G,ariaLabelConfig:_}=He(XK,ot),O=e?.width??KK,M=e?.height??GK,z=R.width/O,H=R.height/M,W=Math.max(z,H),Z=W*O,F=W*M,V=P*W,X=R.x-(Z-R.width)/2-V,Q=R.y-(F-R.height)/2-V,ee=Z+V*2,ne=F+V*2,K=`${qK}-${L}`,q=m.useRef(0),oe=m.useRef();q.current=W,m.useEffect(()=>{if(I.current&&U)return oe.current=c9({domNode:I.current,panZoom:U,getTransform:()=>A.getState().transform,getViewScale:()=>q.current}),()=>{oe.current?.destroy()}},[U]),m.useEffect(()=>{oe.current?.update({translateExtent:$,width:B,height:G,inversePan:N,pannable:w,zoomStep:k,zoomable:E})},[w,E,N,k,$,B,G]);const ce=x?me=>{const[Ee,Le]=oe.current?.pointer(me)||[0,0];x(me,{x:Ee,y:Le})}:void 0,ge=S?m.useCallback((me,Ee)=>{const Le=A.getState().nodeLookup.get(Ee).internals.userNode;S(me,Le)},[]):void 0,ye=b??_["minimap.ariaLabel"];return p.jsx(pf,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*W:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:mt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:p.jsxs("svg",{width:O,height:M,viewBox:`${X} ${Q} ${ee} ${ne}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":K,ref:I,onClick:ce,children:[ye&&p.jsx("title",{id:K,children:ye}),p.jsx(UK,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-V},${Q-V}h${ee+V*2}v${ne+V*2}h${-ee-V*2}z
59
+ M${j.x},${j.y}h${j.width}v${j.height}h${-j.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}HN.displayName="MiniMap";const ZK=m.memo(HN),QK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,JK={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function eG({nodeId:e,position:t,variant:n=ki.Handle,className:r,style:o=void 0,children:i,color:l,minWidth:c=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:v,autoScale:x=!0,shouldResize:S,onResizeStart:w,onResize:E,onResizeEnd:b}){const N=xN(),k=typeof e=="string"?e:N,P=it(),A=m.useRef(null),I=n===ki.Handle,R=He(m.useCallback(QK(I&&x),[I,x]),ot),j=m.useRef(null),L=t??JK[n];m.useEffect(()=>{if(!(!A.current||!k))return j.current||(j.current=C9({domNode:A.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:$,transform:B,snapGrid:G,snapToGrid:_,nodeOrigin:O,domNode:M}=P.getState();return{nodeLookup:$,transform:B,snapGrid:G,snapToGrid:_,nodeOrigin:O,paneDomNode:M}},onChange:($,B)=>{const{triggerNodeChanges:G,nodeLookup:_,parentLookup:O,nodeOrigin:M}=P.getState(),z=[],H={x:$.x,y:$.y},W=_.get(k);if(W&&W.expandParent&&W.parentId){const Z=W.origin??M,F=$.width??W.measured.width??0,V=$.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:F,height:V,...HE({x:$.x??W.position.x,y:$.y??W.position.y},{width:F,height:V},W.parentId,_,Z)}},Q=Sy([X],_,O,M);z.push(...Q),H.x=$.x?Math.max(Z[0]*F,$.x):void 0,H.y=$.y?Math.max(Z[1]*V,$.y):void 0}if(H.x!==void 0&&H.y!==void 0){const Z={id:k,type:"position",position:{...H}};z.push(Z)}if($.width!==void 0&&$.height!==void 0){const F={id:k,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};z.push(F)}for(const Z of B){const F={...Z,type:"position"};z.push(F)}G(z)},onEnd:({width:$,height:B})=>{const G={id:k,type:"dimensions",resizing:!1,dimensions:{width:$,height:B}};P.getState().triggerNodeChanges([G])}})),j.current.update({controlPosition:L,boundaries:{minWidth:c,minHeight:d,maxWidth:f,maxHeight:g},keepAspectRatio:h,resizeDirection:v,onResizeStart:w,onResize:E,onResizeEnd:b,shouldResize:S}),()=>{j.current?.destroy()}},[L,c,d,f,g,h,w,E,b,S]);const U=L.split("-");return p.jsx("div",{className:mt(["react-flow__resize-control","nodrag",...U,n,r]),ref:A,style:{...o,scale:R,...l&&{[I?"backgroundColor":"borderColor"]:l}},children:i})}m.memo(eG);function BN(){const[e,t]=m.useState(()=>ig());return m.useEffect(()=>{if(typeof document>"u")return;const n=document.documentElement,r=new MutationObserver(()=>t(ig()));return r.observe(n,{attributes:!0,attributeFilter:["class"]}),t(ig()),()=>r.disconnect()},[]),e}function ig(){return typeof document>"u"?"dark":document.documentElement.classList.contains("light")?"light":"dark"}const Eu=({id:e,nodeId:t,type:n,position:r,portType:o,label:i,style:l,disabled:c,showPlus:d})=>{const f=()=>{const S={width:"12px",height:"12px",border:"2px solid hsl(var(--edge-default))"};if(c)return{...S,backgroundColor:"hsl(var(--muted-foreground) / 0.3)",border:"2px solid hsl(var(--muted-foreground) / 0.4)",borderRadius:o==="control"||o==="tool"?"2px":"50%",opacity:.8,cursor:"not-allowed",...o==="tool"?{clipPath:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"}:{}};switch(o){case"control":return{...S,backgroundColor:"hsl(var(--card))",borderRadius:"2px"};case"tool":return{...S,backgroundColor:"hsl(var(--edge-default))",border:"none",borderRadius:"0",clipPath:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"};default:return{...S,backgroundColor:"white",borderRadius:"50%"}}},g=()=>{switch(r){case be.Left:return"right-full mr-3 text-right";case be.Right:return"left-full ml-3 text-left";case be.Top:return"bottom-full mb-2 text-center left-1/2 -translate-x-1/2";case be.Bottom:return"top-full mt-2 text-center left-1/2 -translate-x-1/2";default:return"left-full ml-3 text-left"}},h=()=>r===be.Left||r===be.Right?{top:"50%",transform:"translateY(calc(-50% + 12px))"}:{},v=()=>r===be.Bottom?"top-[15px] left-1/2 -ml-2":"left-[15px] top-1/2 -mt-2",x=r===be.Top?"translateY(1px)":r===be.Bottom?"translateY(-1px)":r===be.Left?"translateX(1px)":"translateX(-1px)";return p.jsxs("div",{className:"absolute z-20",style:l,children:[p.jsx(yl,{id:e,type:n,position:r,isConnectable:!c,style:{width:"12px",height:"12px",background:"transparent",border:"none",minWidth:0,minHeight:0},children:p.jsx("div",{style:{...f(),position:"absolute",inset:0,transform:x,pointerEvents:"none"},children:o==="tool"&&!c&&p.jsx("div",{style:{position:"absolute",inset:"2px",backgroundColor:"hsl(var(--node-tool))",clipPath:"polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)"}})})}),i&&!c&&p.jsx("div",{className:`absolute text-xs text-muted-foreground pointer-events-none select-none whitespace-nowrap ${g()}`,style:h(),children:i}),d&&!c&&t&&p.jsx("button",{type:"button",title:"Add port",className:`nodrag absolute flex items-center justify-center w-4 h-4 rounded-full bg-muted-foreground/60 text-card hover:bg-primary hover:scale-110 transition-all cursor-pointer ${v()}`,onClick:S=>{S.stopPropagation(),S.preventDefault();const w={nodeId:t,handleId:e,portType:o};S.currentTarget.dispatchEvent(new CustomEvent("port-plus-click",{detail:w,bubbles:!0}))},onPointerDown:S=>S.stopPropagation(),children:p.jsx(ts,{className:"w-2.5 h-2.5",strokeWidth:3})})]})};function tG(e,t,n,r,o,i){switch(e.type){case"variableSelect":{const l=t;if(!l?.varId)return{text:""};const c=n[vr(l)];return c?{text:c.name}:{text:"unknown",isInvalid:!0}}case"bool":return{text:t?"true":"false"};case"weekdays":{const l=t;return{text:l?.length?l.join(", "):"every day"}}case"selection":return{text:e.options.find(c=>c.value===t)?.label??String(t??"")};case"memorySelect":{const l=t;return l?o?.[l]?{text:o[l]}:{text:"unknown",isInvalid:!0}:{text:""}}case"channelSelect":{const l=t;return l?r?.[l]?{text:r[l]}:{text:"unknown",isInvalid:!0}:{text:""}}case"modelSelect":{const l=t;return l?{text:i?.[l]??l}:{text:""}}default:return{text:String(t??"")}}}function nG(e){let t=e.expression;return e.variables.forEach(n=>{t=t.replace(/\$\{\}/,n?.name||"unknown")}),t}const WN=m.memo(({id:e,data:t,selected:n,nodeDefinition:r,isStale:o=!1,isDeleted:i=!1})=>{const l=t,c=n??!1,d=ue(le=>wn(le.builderMode))||!!t?._preview,f=is(m.useCallback(le=>{const Se=le.phase;return(Se.status==="paused"||Se.status==="stepping")&&Se.cursorNodeId===e},[e])),g=ue.getState().activeCanvasId,h=et(g),v=h(le=>le.edges),x=h(le=>le.nodes),S=ue(le=>le.channels),w=ue(le=>le.memory),E=ue(le=>le.models),b=ue(le=>le.availableModels),{lookup:N}=Li(g),k=m.useMemo(()=>{const le={};for(const Se of Object.values(S))le[Se.id]=Se.label;return le},[S]),P=m.useMemo(()=>{const le={};for(const Se of Object.values(w))le[Se.id]=Se.label;return le},[w]),{modelLabels:A,availableModelIds:I}=m.useMemo(()=>{const le={},Se=new Set;for(const Oe of b)le[Oe.id]=Oe.label,Se.add(Oe.id);for(const Oe of Object.values(E))le[Oe.id]=Oe.label;return{modelLabels:le,availableModelIds:Se}},[b,E]),R=Dn(l),{executionInputs:j,toolInputs:L,executionOutputs:U,toolOutputs:$}=m.useMemo(()=>({executionInputs:R.input.filter(le=>le.type==="control"),toolInputs:R.input.filter(le=>le.type==="tool"),executionOutputs:R.output.filter(le=>le.type==="control"),toolOutputs:R.output.filter(le=>le.type==="tool")}),[R]),B=m.useMemo(()=>tl(e,l,v),[e,l,v]),G=Sd(l),_=m.useMemo(()=>{const le=new Set;for(const Se of r?.parameters??[])Tr(Se,G,B)||le.add(Se.id);return le.size>0?le:null},[B,r,G]),O=r?.category,M=m.useMemo(()=>E1({canvasId:g,nodeId:e,nodeData:l,nodeDefinition:r,availableVariables:N,channels:S,memory:w,models:E,availableModelIds:I,edges:v,isStale:o,isDeleted:i}),[g,e,l,r,N,S,w,E,I,v,o,i]),z=m.useMemo(()=>{const le={},Se=r?.parameters??[];for(const Oe of Se){if(_?.has(Oe.id))continue;const qe=G[Oe.id];if(es(qe)){const yt=Sl(qe,N),Dt=Cd(yt);le[Oe.id]={expr:yt,parseRes:Dt}}}return le},[G,N,_,r]),H=M.some(le=>le.severity==="error"),W=M.some(le=>le.severity==="warning"),Z=Ye(le=>le.setNodeDiagnostics),F=Ye(le=>le.clearNodeDiagnostics);m.useEffect(()=>{if(!d)return Z(e,M),()=>F(e)},[e,M,Z,F,d]);const V=m.useMemo(()=>v.some(le=>le.source===e?U.some(Se=>Se.id===le.sourceHandle):le.target===e?j.some(Se=>Se.id===le.targetHandle):!1),[v,e,j,U]),X=O?oy[O]:null,Q=m.useMemo(()=>O==="Trigger"?"tapered-right":"rectangle",[O]),ee=m.useMemo(()=>O===xe.Trigger?"--node-trigger":O===xe.Tool?"--node-tool":O===xe.AI?"--node-agent":O===xe.Input?"--node-input":O===xe.Output?"--node-output":O===xe.Logic?"--node-logic":O===xe.Data?"--node-data":O===xe.Function?"--node-function":"--primary",[O]),ne=O===xe.Tool||O===xe.Trigger||O===xe.AI,K=m.useMemo(()=>{const le=r?.parameters??[];return _?le.filter(Se=>!_.has(Se.id)):le},[r,_]),q=m.useMemo(()=>{const le=Math.min(K.length,3),Se=K.length>3?1:0;return le+Se},[K]),oe=Math.max(j.length,U.length),ce=200,ge=24,ye=16,me=50,Ee=m.useMemo(()=>{const le=q*ye,Se=me+le;return Q==="tapered-right"?Math.max(Se,60+Math.max(oe,1)*40):Math.max(Se,80+oe*40)},[Q,oe,q]);if(!r)return p.jsx("div",{className:"min-w-[200px] p-3 border border-destructive/50 bg-destructive/10 rounded-lg",children:p.jsxs("div",{className:"text-destructive text-sm",children:["Unknown node: ",l.type]})});const Le=(le,Se)=>Se===1?Ee/2:20+(Ee-40)/(Se+1)*(le+1),Fe=(le,Se)=>Se===1?ce/2:20+(ce-40)/(Se+1)*(le+1),Ke=()=>{const le=`node-gradient-${l.id}`,Se=2,Oe="hsl(var(--canvas-background))",qe=`color-mix(in srgb, hsl(var(${ee})), hsl(var(--canvas-background)) 80%)`,yt="hsl(var(--card))",Dt=f?{filter:"drop-shadow(0 0 14px hsl(var(--warning) / 0.7)) drop-shadow(0 0 24px hsl(var(--warning) / 0.5))",animation:"debug-cursor-pulse 1.5s ease-in-out infinite"}:c?{filter:"drop-shadow(0 0 12px hsl(var(--selection-glow) / 0.6)) drop-shadow(0 0 20px hsl(var(--selection-glow) / 0.4))"}:{};if(Q==="tapered-right"){const Qe=Se/2;return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:ce,height:Ee,viewBox:`0 0 ${ce} ${Ee}`,preserveAspectRatio:"none",style:Dt,children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:le,x1:"0%",y1:"70%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:Oe}),p.jsx("stop",{offset:"100%",stopColor:qe})]})}),p.jsx("path",{d:`
60
+ M ${12+Qe} ${0+Qe}
61
+ L ${ce-ge-Qe} ${0+Qe}
62
+ L ${ce-Qe} ${Ee/2}
63
+ L ${ce-ge-Qe} ${Ee-Qe}
64
+ L ${12+Qe} ${Ee-Qe}
65
+ Q ${0+Qe} ${Ee-Qe} ${0+Qe} ${Ee-12-Qe}
66
+ L ${0+Qe} ${12+Qe}
67
+ Q ${0+Qe} ${0+Qe} ${12+Qe} ${0+Qe}
68
+ Z
69
+ `,fill:`url(#${le})`,stroke:H?"hsl(var(--destructive))":ne?`hsl(var(${ee})/0.5)`:"hsl(var(--edge-default))",strokeWidth:Se})]})}return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:ce,height:Ee,viewBox:`0 0 ${ce} ${Ee}`,preserveAspectRatio:"none",style:Dt,children:[ne&&p.jsx("defs",{children:p.jsxs("linearGradient",{id:le,x1:"0%",y1:"70%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:Oe}),p.jsx("stop",{offset:"120%",stopColor:qe})]})}),p.jsx("rect",{x:Se/2,y:Se/2,width:ce-Se,height:Ee-Se,rx:"10",ry:"10",fill:ne?`url(#${le})`:yt,stroke:H?"hsl(var(--destructive))":ne?`hsl(var(${ee})/0.5)`:"hsl(var(--edge-default))",strokeWidth:Se})]})};return p.jsxs("div",{className:"relative z-0",style:{height:`${Ee}px`,width:`${ce}px`},children:[L.map((le,Se)=>p.jsx(Eu,{id:le.id,type:"target",position:be.Top,portType:le.type,label:le.label,disabled:V,style:{left:`${Fe(Se,L.length)}px`}},le.id)),j.map((le,Se)=>p.jsx(Eu,{id:le.id,type:"target",position:be.Left,portType:le.type,label:le.label,disabled:B,style:{top:Q==="tapered-right"?`${Ee/2}px`:`${Le(Se,j.length)}px`}},le.id)),Ke(),H&&p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsx("div",{className:"absolute -top-4 -left-4 z-30 cursor-help",children:p.jsx(mo,{className:"h-8 w-8 text-destructive fill-card",strokeWidth:2})})}),p.jsx(mi,{side:"top",className:"bg-destructive text-destructive-foreground text-xs px-2 py-1",children:M.find(le=>le.severity==="error")?.message??"This node has errors"})]}),!H&&W&&p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsx("div",{className:"absolute -top-4 -left-4 z-30 cursor-help",children:p.jsx(Pd,{className:"h-8 w-8 text-warning fill-card",strokeWidth:2})})}),p.jsx(mi,{side:"top",className:"bg-warning text-warning-foreground text-xs px-2 py-1",children:M.find(le=>le.severity==="warning")?.message??"This node has warnings"})]}),p.jsxs("div",{className:`relative z-10 p-3 ${Q==="tapered-right"?"pr-8":""}`,children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 mb-1.5",children:[X&&p.jsx(X,{className:"w-4 h-4 shrink-0",style:{color:`hsl(var(${ee}))`}}),p.jsx(fo,{variant:"secondary",className:"text-sm truncate max-w-full text-foreground",style:{backgroundColor:`hsl(var(${ee}) / 0.3)`,borderColor:`hsl(var(${ee}) / 0.4)`},children:l.label||r.label})]}),K.length>0&&p.jsxs("div",{className:"space-y-0.5",children:[K.slice(0,3).map(le=>{const Se=G[le.id],Oe=z[le.id],qe=Oe?null:tG(le,Se,N,k,P,A),yt=Oe?!Oe.parseRes.isValid:!!qe?.isInvalid;return p.jsxs("div",{className:"text-xs leading-4 flex items-baseline gap-1 truncate",children:[p.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[le.label,":"]}),p.jsx("span",{className:`font-mono truncate ${yt?"text-destructive":"text-foreground"}`,children:Oe?nG(Oe.expr):qe.text})]},le.id)}),K.length>3&&p.jsxs("div",{className:"text-xs text-muted-foreground",children:["+",K.length-3," more..."]})]})]}),U.map((le,Se)=>{const Oe=!d&&!B&&Dg(e,le.id,x,v);return p.jsx(Eu,{id:le.id,type:"source",position:be.Right,portType:le.type,label:le.label,disabled:B,showPlus:Oe,nodeId:e,style:{top:Q==="tapered-right"?`${Ee/2}px`:`${Le(Se,U.length)}px`,right:"0"}},le.id)}),$.map((le,Se)=>{const Oe=!d&&Dg(e,le.id,x,v);return p.jsx(Eu,{id:le.id,type:"source",position:be.Bottom,portType:le.type,label:le.label,showPlus:Oe,nodeId:e,style:{left:`${Fe(Se,$.length)}px`,bottom:0}},le.id)})]})}),Nu=m.memo(e=>{const t=e.data,n=m.useMemo(()=>Lt.getByType(t.type),[t.type]);return p.jsx(WN,{...e,nodeDefinition:n})}),rG=m.memo(e=>{const t=e.data,{getFunction:n}=Qd(),r=n(t.functionInfo.id),o=!r,i=r?t.functionInfo.version!==r.version:!1,l=m.useMemo(()=>{const c=r?.name??t.functionInfo.name;return Jm({...t.functionInfo,name:c})},[t.functionInfo,r?.name]);return p.jsx(WN,{...e,nodeDefinition:l,isStale:i,isDeleted:o})}),ku="hsl(var(--edge-default))",Tu="hsl(var(--node-agent))",ag="hsl(var(--destructive))";function oG(e){switch(e){case"control":case"tool":return{source:ku,target:ku};case"agentTask":return{source:ku,target:Tu};case"agentChoice":return{source:Tu,target:ku};case"agentDelegate":return{source:Tu,target:Tu}}}const La=({id:e,source:t,type:n,sourceX:r,sourceY:o,targetX:i,targetY:l,data:c,selected:d})=>{const f=d??!1,g=ue(G=>wn(G.builderMode)),h=n??"control",v=EK(),x=ue.getState().activeCanvasId,{lookup:S}=Li(x),w=v.filter(G=>G.source===t&&cm(G.type)).length,E=m.useMemo(()=>N1({canvasId:x,edgeId:e,edgeType:h,edgeData:c,availableVariables:S,sourceControlEdgeCount:w}),[h,w,c,S,x,e]),b=E.length>0,N=Ye(G=>G.setEdgeDiagnostics),k=Ye(G=>G.clearEdgeDiagnostics);m.useEffect(()=>{if(!g)return N(e,E),()=>k(e)},[e,E,N,k,g]);const P=()=>{if(p1(h))return pd({sourceX:r,sourceY:o-3,targetX:i,targetY:l+3});const G=2;return pd({sourceX:r-G,sourceY:o,sourcePosition:be.Right,targetX:i+G,targetY:l,targetPosition:be.Left})},[A,I,R]=P(),j=b?{source:ag,target:ag}:oG(h),L=3,U=`edge-gradient-${e}`,$=b?ag:"hsl(var(--selection-glow))",B=f?`drop-shadow(0 0 8px ${$}) drop-shadow(0 0 16px ${$})`:void 0;return p.jsxs(p.Fragment,{children:[p.jsxs("g",{style:{filter:B},children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:U,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:l,children:[p.jsx("stop",{offset:"0%",stopColor:j.source}),p.jsx("stop",{offset:"100%",stopColor:j.target})]})}),p.jsx(Dl,{id:e,path:A,style:{stroke:`url(#${U})`,strokeWidth:L,strokeDasharray:"none"}})]}),p.jsx(SK,{children:p.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${I}px,${R}px)`,pointerEvents:"all"},className:"flex flex-col items-center gap-0.5",children:b&&p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsx("div",{className:"cursor-help",children:p.jsx(mo,{className:"h-5 w-5 text-destructive fill-background"})})}),p.jsx(mi,{side:"top",className:"bg-destructive text-destructive-foreground text-xs px-2 py-1",children:E[0]?.message??"This edge has errors"})]})})})]})},sG={Standard:Nu,FunctionCall:rG,[xe.Trigger]:Nu,[xe.Tool]:Nu,[xe.AI]:Nu},iG={control:La,tool:La,agentTask:La,agentChoice:La,agentDelegate:La},aG=({canvasId:e,onConnect:t,onSelectionChange:n,onSelectionStart:r,onSelectionStop:o,onPaneClick:i,onAddNode:l,onNodeDragStart:c,viewportCenterRef:d})=>{const f=ue(O=>wn(O.builderMode)),g=BN(),{screenToFlowPosition:h,getViewport:v,fitView:x}=hf(),S=kK();m.useEffect(()=>{d.current=()=>{const O=document.querySelector(".react-flow");if(!O)return{x:250,y:100};const{width:M,height:z}=O.getBoundingClientRect(),{x:H,y:W,zoom:Z}=v();return{x:(-H+M/2)/Z-90,y:(-W+z/2)/Z-50}}},[v,d]);const w=et(e),E=w(O=>O.nodes),b=w(O=>O.edges),N=w(O=>O.setNodes),k=w(O=>O.setEdges),P=w(O=>O.setViewport),A=m.useRef(w.getState().viewport).current,[I,R]=m.useState(A!=null);m.useEffect(()=>{if(I||A!=null)return;if(E.length===0){R(!0);return}if(!S)return;x({padding:.15,maxZoom:1});const O=requestAnimationFrame(()=>{P(v()),R(!0)});return()=>cancelAnimationFrame(O)},[I,A,E.length,S,x,v,P]);const j=O=>{switch(O.type){case xe.Trigger:return"hsl(var(--node-trigger))";case xe.Tool:return"hsl(var(--node-tool))";case xe.AI:return"hsl(var(--node-agent))";default:return"hsl(var(--muted))"}},L=m.useCallback(O=>{N(M=>pN(O,M))},[N]),U=m.useCallback(O=>{k(M=>hN(O,M))},[k]),$=m.useCallback(O=>{if(O.preventDefault(),!(!l||f))try{const M=JSON.parse(O.dataTransfer.getData("application/json")),z=h({x:O.clientX,y:O.clientY});l(M.nodeDef,z)}catch(M){console.error("Failed to parse node data:",M)}},[l,h,f]),B=O=>{f||(O.preventDefault(),O.dataTransfer.dropEffect="copy")},G=O=>{O.button===1&&O.preventDefault()},_=O=>{O.button===1&&O.preventDefault()};return p.jsx("div",{className:"w-full h-full",style:{opacity:I?1:0},children:p.jsxs(wK,{nodes:E,edges:b,onNodesChange:L,onEdgesChange:U,onConnect:t,isValidConnection:O=>!!nE(O.source,O.target,O.sourceHandle,O.targetHandle,E,b),onPaneClick:i,onNodeDragStart:c,onSelectionChange:n,onSelectionStart:r,onSelectionEnd:o,onMoveEnd:(O,M)=>P(M),nodeTypes:sG,edgeTypes:iG,defaultViewport:A??void 0,selectionOnDrag:!f,panOnDrag:[1,2],selectionMode:Si.Partial,selectNodesOnDrag:!1,nodesConnectable:!f,nodesDraggable:!f,zoomOnScroll:!0,zoomOnPinch:!0,onDrop:$,onDragOver:B,deleteKeyCode:null,onContextMenu:O=>O.preventDefault(),onMouseDownCapture:G,onAuxClick:_,colorMode:g,style:{"--xy-background-color":"hsl(var(--canvas-background))"},children:[p.jsx(_K,{variant:wr.Dots,color:"hsl(var(--muted-foreground))",gap:24,size:1.5,className:"opacity-40"}),p.jsx(LK,{className:"glass-forest-panel !border !shadow-lg [&_button]:glass-forest-button [&_button]:!text-foreground hover:[&_button]:!scale-105"}),p.jsx(ZK,{nodeColor:j,className:"glass-forest-panel !border !shadow-lg",maskColor:"hsl(var(--primary) / 0.15)",nodeBorderRadius:12,nodeStrokeWidth:2,style:{width:120,height:80}})]})})},lG=e=>p.jsx("div",{className:"w-full h-full overflow-hidden overscroll-contain",children:p.jsx(FN,{children:p.jsx(aG,{...e})})});var zb=1,cG=.9,uG=.8,dG=.17,lg=.1,cg=.999,fG=.9999,pG=.99,hG=/[\\\/_+.#"@\[\(\{&]/,gG=/[\\\/_+.#"@\[\(\{&]/g,mG=/[\s-]/,UN=/[\s-]/g;function qg(e,t,n,r,o,i,l){if(i===t.length)return o===e.length?zb:pG;var c=`${o},${i}`;if(l[c]!==void 0)return l[c];for(var d=r.charAt(i),f=n.indexOf(d,o),g=0,h,v,x,S;f>=0;)h=qg(e,t,n,r,f+1,i+1,l),h>g&&(f===o?h*=zb:hG.test(e.charAt(f-1))?(h*=uG,x=e.slice(o,f-1).match(gG),x&&o>0&&(h*=Math.pow(cg,x.length))):mG.test(e.charAt(f-1))?(h*=cG,S=e.slice(o,f-1).match(UN),S&&o>0&&(h*=Math.pow(cg,S.length))):(h*=dG,o>0&&(h*=Math.pow(cg,f-o))),e.charAt(f)!==t.charAt(i)&&(h*=fG)),(h<lg&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(v=qg(e,t,n,r,f+1,i+2,l),v*lg>h&&(h=v*lg)),h>g&&(g=h),f=n.indexOf(d,f+1);return l[c]=g,g}function Vb(e){return e.toLowerCase().replace(UN," ")}function yG(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,qg(e,t,Vb(e),Vb(t),0,0,{})}var Fa='[cmdk-group=""]',ug='[cmdk-group-items=""]',vG='[cmdk-group-heading=""]',KN='[cmdk-item=""]',Hb=`${KN}:not([aria-disabled="true"])`,Zg="cmdk-item-select",ei="data-value",xG=(e,t,n)=>yG(e,t,n),GN=m.createContext(void 0),jl=()=>m.useContext(GN),YN=m.createContext(void 0),Ey=()=>m.useContext(YN),XN=m.createContext(void 0),qN=m.forwardRef((e,t)=>{let n=ti(()=>{var V,X;return{search:"",value:(X=(V=e.value)!=null?V:e.defaultValue)!=null?X:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=ti(()=>new Set),o=ti(()=>new Map),i=ti(()=>new Map),l=ti(()=>new Set),c=ZN(e),{label:d,children:f,value:g,onValueChange:h,filter:v,shouldFilter:x,loop:S,disablePointerSelection:w=!1,vimBindings:E=!0,...b}=e,N=kt(),k=kt(),P=kt(),A=m.useRef(null),I=IG();ds(()=>{if(g!==void 0){let V=g.trim();n.current.value=V,R.emit()}},[g]),ds(()=>{I(6,G)},[]);let R=m.useMemo(()=>({subscribe:V=>(l.current.add(V),()=>l.current.delete(V)),snapshot:()=>n.current,setState:(V,X,Q)=>{var ee,ne,K,q;if(!Object.is(n.current[V],X)){if(n.current[V]=X,V==="search")B(),U(),I(1,$);else if(V==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let oe=document.getElementById(P);oe?oe.focus():(ee=document.getElementById(N))==null||ee.focus()}if(I(7,()=>{var oe;n.current.selectedItemId=(oe=_())==null?void 0:oe.id,R.emit()}),Q||I(5,G),((ne=c.current)==null?void 0:ne.value)!==void 0){let oe=X??"";(q=(K=c.current).onValueChange)==null||q.call(K,oe);return}}R.emit()}},emit:()=>{l.current.forEach(V=>V())}}),[]),j=m.useMemo(()=>({value:(V,X,Q)=>{var ee;X!==((ee=i.current.get(V))==null?void 0:ee.value)&&(i.current.set(V,{value:X,keywords:Q}),n.current.filtered.items.set(V,L(X,Q)),I(2,()=>{U(),R.emit()}))},item:(V,X)=>(r.current.add(V),X&&(o.current.has(X)?o.current.get(X).add(V):o.current.set(X,new Set([V]))),I(3,()=>{B(),U(),n.current.value||$(),R.emit()}),()=>{i.current.delete(V),r.current.delete(V),n.current.filtered.items.delete(V);let Q=_();I(4,()=>{B(),Q?.getAttribute("id")===V&&$(),R.emit()})}),group:V=>(o.current.has(V)||o.current.set(V,new Set),()=>{i.current.delete(V),o.current.delete(V)}),filter:()=>c.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:P,labelId:k,listInnerRef:A}),[]);function L(V,X){var Q,ee;let ne=(ee=(Q=c.current)==null?void 0:Q.filter)!=null?ee:xG;return V?ne(V,n.current.search,X):0}function U(){if(!n.current.search||c.current.shouldFilter===!1)return;let V=n.current.filtered.items,X=[];n.current.filtered.groups.forEach(ee=>{let ne=o.current.get(ee),K=0;ne.forEach(q=>{let oe=V.get(q);K=Math.max(oe,K)}),X.push([ee,K])});let Q=A.current;O().sort((ee,ne)=>{var K,q;let oe=ee.getAttribute("id"),ce=ne.getAttribute("id");return((K=V.get(ce))!=null?K:0)-((q=V.get(oe))!=null?q:0)}).forEach(ee=>{let ne=ee.closest(ug);ne?ne.appendChild(ee.parentElement===ne?ee:ee.closest(`${ug} > *`)):Q.appendChild(ee.parentElement===Q?ee:ee.closest(`${ug} > *`))}),X.sort((ee,ne)=>ne[1]-ee[1]).forEach(ee=>{var ne;let K=(ne=A.current)==null?void 0:ne.querySelector(`${Fa}[${ei}="${encodeURIComponent(ee[0])}"]`);K?.parentElement.appendChild(K)})}function $(){let V=O().find(Q=>Q.getAttribute("aria-disabled")!=="true"),X=V?.getAttribute(ei);R.setState("value",X||void 0)}function B(){var V,X,Q,ee;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let K of r.current){let q=(X=(V=i.current.get(K))==null?void 0:V.value)!=null?X:"",oe=(ee=(Q=i.current.get(K))==null?void 0:Q.keywords)!=null?ee:[],ce=L(q,oe);n.current.filtered.items.set(K,ce),ce>0&&ne++}for(let[K,q]of o.current)for(let oe of q)if(n.current.filtered.items.get(oe)>0){n.current.filtered.groups.add(K);break}n.current.filtered.count=ne}function G(){var V,X,Q;let ee=_();ee&&(((V=ee.parentElement)==null?void 0:V.firstChild)===ee&&((Q=(X=ee.closest(Fa))==null?void 0:X.querySelector(vG))==null||Q.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function _(){var V;return(V=A.current)==null?void 0:V.querySelector(`${KN}[aria-selected="true"]`)}function O(){var V;return Array.from(((V=A.current)==null?void 0:V.querySelectorAll(Hb))||[])}function M(V){let X=O()[V];X&&R.setState("value",X.getAttribute(ei))}function z(V){var X;let Q=_(),ee=O(),ne=ee.findIndex(q=>q===Q),K=ee[ne+V];(X=c.current)!=null&&X.loop&&(K=ne+V<0?ee[ee.length-1]:ne+V===ee.length?ee[0]:ee[ne+V]),K&&R.setState("value",K.getAttribute(ei))}function H(V){let X=_(),Q=X?.closest(Fa),ee;for(;Q&&!ee;)Q=V>0?PG(Q,Fa):RG(Q,Fa),ee=Q?.querySelector(Hb);ee?R.setState("value",ee.getAttribute(ei)):z(V)}let W=()=>M(O().length-1),Z=V=>{V.preventDefault(),V.metaKey?W():V.altKey?H(1):z(1)},F=V=>{V.preventDefault(),V.metaKey?M(0):V.altKey?H(-1):z(-1)};return m.createElement(ke.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:V=>{var X;(X=b.onKeyDown)==null||X.call(b,V);let Q=V.nativeEvent.isComposing||V.keyCode===229;if(!(V.defaultPrevented||Q))switch(V.key){case"n":case"j":{E&&V.ctrlKey&&Z(V);break}case"ArrowDown":{Z(V);break}case"p":case"k":{E&&V.ctrlKey&&F(V);break}case"ArrowUp":{F(V);break}case"Home":{V.preventDefault(),M(0);break}case"End":{V.preventDefault(),W();break}case"Enter":{V.preventDefault();let ee=_();if(ee){let ne=new Event(Zg);ee.dispatchEvent(ne)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:AG},d),mf(e,V=>m.createElement(YN.Provider,{value:R},m.createElement(GN.Provider,{value:j},V))))}),wG=m.forwardRef((e,t)=>{var n,r;let o=kt(),i=m.useRef(null),l=m.useContext(XN),c=jl(),d=ZN(e),f=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;ds(()=>{if(!f)return c.item(o,l?.id)},[f]);let g=QN(o,i,[e.value,e.children,i],e.keywords),h=Ey(),v=go(I=>I.value&&I.value===g.current),x=go(I=>f||c.filter()===!1?!0:I.search?I.filtered.items.get(o)>0:!0);m.useEffect(()=>{let I=i.current;if(!(!I||e.disabled))return I.addEventListener(Zg,S),()=>I.removeEventListener(Zg,S)},[x,e.onSelect,e.disabled]);function S(){var I,R;w(),(R=(I=d.current).onSelect)==null||R.call(I,g.current)}function w(){h.setState("value",g.current,!0)}if(!x)return null;let{disabled:E,value:b,onSelect:N,forceMount:k,keywords:P,...A}=e;return m.createElement(ke.div,{ref:Xt(i,t),...A,id:o,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!v,"data-disabled":!!E,"data-selected":!!v,onPointerMove:E||c.getDisablePointerSelection()?void 0:w,onClick:E?void 0:S},e.children)}),bG=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,l=kt(),c=m.useRef(null),d=m.useRef(null),f=kt(),g=jl(),h=go(x=>o||g.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);ds(()=>g.group(l),[]),QN(l,c,[e.value,e.heading,d]);let v=m.useMemo(()=>({id:l,forceMount:o}),[o]);return m.createElement(ke.div,{ref:Xt(c,t),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&m.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),mf(e,x=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},m.createElement(XN.Provider,{value:v},x))))}),SG=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),i=go(l=>!l.search);return!n&&!i?null:m.createElement(ke.div,{ref:Xt(o,t),...r,"cmdk-separator":"",role:"separator"})}),CG=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=Ey(),l=go(f=>f.search),c=go(f=>f.selectedItemId),d=jl();return m.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),m.createElement(ke.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:o?e.value:l,onChange:f=>{o||i.setState("search",f.target.value),n?.(f.target.value)}})}),EG=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=m.useRef(null),l=m.useRef(null),c=go(f=>f.selectedItemId),d=jl();return m.useEffect(()=>{if(l.current&&i.current){let f=l.current,g=i.current,h,v=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let x=f.offsetHeight;g.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return v.observe(f),()=>{cancelAnimationFrame(h),v.unobserve(f)}}},[]),m.createElement(ke.div,{ref:Xt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:d.listId},mf(e,f=>m.createElement("div",{ref:Xt(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),NG=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:l,...c}=e;return m.createElement(bm,{open:n,onOpenChange:r},m.createElement(Sm,{container:l},m.createElement(Dd,{"cmdk-overlay":"",className:o}),m.createElement(jd,{"aria-label":e.label,"cmdk-dialog":"",className:i},m.createElement(qN,{ref:t,...c}))))}),kG=m.forwardRef((e,t)=>go(n=>n.filtered.count===0)?m.createElement(ke.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),TG=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return m.createElement(ke.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},mf(e,l=>m.createElement("div",{"aria-hidden":!0},l)))}),qt=Object.assign(qN,{List:EG,Item:wG,Input:CG,Group:bG,Separator:SG,Dialog:NG,Empty:kG,Loading:TG});function PG(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function RG(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ZN(e){let t=m.useRef(e);return ds(()=>{t.current=e}),t}var ds=typeof window>"u"?m.useEffect:m.useLayoutEffect;function ti(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function go(e){let t=Ey(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function QN(e,t,n,r=[]){let o=m.useRef(),i=jl();return ds(()=>{var l;let c=(()=>{var f;for(let g of n){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(f=g.current.textContent)==null?void 0:f.trim():o.current}})(),d=r.map(f=>f.trim());i.value(e,c,d),(l=t.current)==null||l.setAttribute(ei,c),o.current=c}),o}var IG=()=>{let[e,t]=m.useState(),n=ti(()=>new Map);return ds(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function _G(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function mf({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(_G(t),{ref:t.ref},n(t.props.children)):n(t)}var AG={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const JN=m.forwardRef(({className:e,...t},n)=>p.jsx(qt,{ref:n,className:Ce("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));JN.displayName=qt.displayName;const MG=({children:e,...t})=>p.jsx(bS,{...t,children:p.jsx(km,{className:"overflow-hidden p-0 shadow-lg",children:p.jsx(JN,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),ek=m.forwardRef(({className:e,...t},n)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(O1,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(qt.Input,{ref:n,className:Ce("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));ek.displayName=qt.Input.displayName;const tk=m.forwardRef(({className:e,...t},n)=>p.jsx(qt.List,{ref:n,className:Ce("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));tk.displayName=qt.List.displayName;const nk=m.forwardRef((e,t)=>p.jsx(qt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nk.displayName=qt.Empty.displayName;const rk=m.forwardRef(({className:e,...t},n)=>p.jsx(qt.Group,{ref:n,className:Ce("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));rk.displayName=qt.Group.displayName;const DG=m.forwardRef(({className:e,...t},n)=>p.jsx(qt.Separator,{ref:n,className:Ce("-mx-1 h-px bg-border",e),...t}));DG.displayName=qt.Separator.displayName;const ok=m.forwardRef(({className:e,...t},n)=>p.jsx(qt.Item,{ref:n,className:Ce("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-primary data-[disabled=true]:opacity-50",e),...t}));ok.displayName=qt.Item.displayName;const jG=[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output];function OG({open:e,onOpenChange:t,compatibleDefs:n,onSelect:r}){const{t:o}=Xe(),[i,l]=m.useState("");m.useEffect(()=>{e&&l("")},[e]);const c=new Map;for(const d of n){const f=c.get(d.category)??[];f.push(d),c.set(d.category,f)}return p.jsxs(MG,{open:e,onOpenChange:t,children:[p.jsx(ek,{placeholder:o("nodePickerSearch","Search nodes..."),value:i,onValueChange:l}),p.jsxs(tk,{children:[p.jsx(nk,{children:o("nodePickerEmpty","No compatible nodes found.")}),jG.filter(d=>c.has(d)).map(d=>{const f=oy[d];return p.jsx(rk,{heading:d,children:c.get(d).map(g=>p.jsxs(ok,{onSelect:()=>{r(g),t(!1)},children:[f&&p.jsx(f,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),p.jsxs("div",{className:"flex flex-col min-w-0",children:[p.jsx("span",{className:"truncate",children:g.label}),g.description&&p.jsx("span",{className:"text-xs text-muted-foreground truncate",children:g.description})]})]},g.type+(g.type==="FunctionCall"?`-${g.label}`:"")))},d)})]})]})}const $G=({canvasId:e,viewportCenterRef:t,nodeDefinitions:n,onConnect:r,onAddNode:o,onAddNodeAndConnect:i,onSelectionChange:l,onPaneClick:c,onNodeDragStart:d,setSelectionDrag:f})=>{const g=e!==We,[h,v]=m.useState(null),x=m.useRef(null);m.useEffect(()=>{const E=x.current;if(!E)return;const b=N=>v(N.detail);return E.addEventListener("port-plus-click",b),()=>E.removeEventListener("port-plus-click",b)},[]);const S=m.useMemo(()=>{if(!h)return[];const{nodes:E,edges:b}=et(e).getState();return KB(h.nodeId,h.handleId,E,b,n,g)},[h,e,n,g]),w=m.useCallback(E=>{if(!h)return;const{nodes:b}=et(e).getState(),N=b.find(R=>R.id===h.nodeId);if(!N)return;const k=N.position,P=h.portType==="tool"?{x:k.x,y:k.y+200}:{x:k.x+280,y:k.y},I=Dn({type:E.type}).input.find(R=>R.type===h.portType);I&&(i(E,P,{source:h.nodeId,sourceHandle:h.handleId,target:"",targetHandle:I.id}),v(null))},[h,e,i]);return p.jsxs("div",{ref:x,className:"h-full flex flex-col",children:[p.jsx("div",{className:"flex-1 relative",children:p.jsx(lG,{canvasId:e,onConnect:r,onSelectionChange:l,onSelectionStart:()=>f(!0),onSelectionStop:()=>f(!1),onPaneClick:c,onAddNode:o,onNodeDragStart:d,viewportCenterRef:t})}),p.jsx(OG,{open:h!==null,onOpenChange:E=>{E||v(null)},compatibleDefs:S,onSelect:w})]})};var LG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],FG=LG.reduce((e,t)=>{const n=pm(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(d,{...c,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),zG="Separator",Bb="horizontal",VG=["horizontal","vertical"],sk=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Bb,...o}=e,i=HG(r)?r:Bb,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(FG.div,{"data-orientation":i,...c,...o,ref:t})});sk.displayName=zG;function HG(e){return VG.includes(e)}var ik=sk;const $t=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>p.jsx(ik,{ref:o,decorative:n,orientation:t,className:Ce("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));$t.displayName=ik.displayName;const BG=yo("flex w-full rounded-md border ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive",{variants:{size:{sm:"min-h-[72px] px-3 py-2 text-sm",md:"min-h-[80px] px-3 py-2 text-sm",lg:"min-h-[96px] px-4 py-3 text-base"},variant:{default:"border-input bg-field",subtle:"border-transparent bg-muted focus-visible:border-input",ghost:"border-border bg-transparent focus-visible:bg-background/60"},status:{none:"",success:"border-success focus-visible:ring-success",error:"border-destructive focus-visible:ring-destructive"}},defaultVariants:{size:"md",variant:"default",status:"none"}}),ak=m.forwardRef(({className:e,size:t,variant:n,status:r,...o},i)=>p.jsx("textarea",{className:Ce(BG({size:t,variant:n,status:r}),e),ref:i,...o}));ak.displayName="Textarea";function Wb(e){const t=WG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(KG);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function WG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=YG(o),c=GG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UG=Symbol("radix.slottable");function KG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UG}function GG(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function YG(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function yf(e){const t=e+"CollectionProvider",[n,r]=Ft(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:E,children:b}=w,N=Ze.useRef(null),k=Ze.useRef(new Map).current;return p.jsx(o,{scope:E,itemMap:k,collectionRef:N,children:b})};l.displayName=t;const c=e+"CollectionSlot",d=Wb(c),f=Ze.forwardRef((w,E)=>{const{scope:b,children:N}=w,k=i(c,b),P=De(E,k.collectionRef);return p.jsx(d,{ref:P,children:N})});f.displayName=c;const g=e+"CollectionItemSlot",h="data-radix-collection-item",v=Wb(g),x=Ze.forwardRef((w,E)=>{const{scope:b,children:N,...k}=w,P=Ze.useRef(null),A=De(E,P),I=i(g,b);return Ze.useEffect(()=>(I.itemMap.set(P,{ref:P,...k}),()=>{I.itemMap.delete(P)})),p.jsx(v,{[h]:"",ref:A,children:N})});x.displayName=g;function S(w){const E=i(e+"CollectionConsumer",w);return Ze.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(E.itemMap.values()).sort((I,R)=>k.indexOf(I.ref.current)-k.indexOf(R.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},S,r]}function XG(e){const t=qG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(QG);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function qG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=eY(o),c=JG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ZG=Symbol("radix.slottable");function QG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ZG}function JG(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function eY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tY=[" ","Enter","ArrowUp","ArrowDown"],nY=[" ","Enter"],fs="Select",[vf,xf,rY]=yf(fs),[Fi]=Ft(fs,[rY,$i]),wf=$i(),[oY,vo]=Fi(fs),[sY,iY]=Fi(fs),lk=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:l,defaultValue:c,onValueChange:d,dir:f,name:g,autoComplete:h,disabled:v,required:x,form:S}=e,w=wf(t),[E,b]=m.useState(null),[N,k]=m.useState(null),[P,A]=m.useState(!1),I=Nl(f),[R,j]=cn({prop:r,defaultProp:o??!1,onChange:i,caller:fs}),[L,U]=cn({prop:l,defaultProp:c,onChange:d,caller:fs}),$=m.useRef(null),B=E?S||!!E.closest("form"):!0,[G,_]=m.useState(new Set),O=Array.from(G).map(M=>M.props.value).join(";");return p.jsx(Wm,{...w,children:p.jsxs(oY,{required:x,scope:t,trigger:E,onTriggerChange:b,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:P,onValueNodeHasChildrenChange:A,contentId:kt(),value:L,onValueChange:U,open:R,onOpenChange:j,dir:I,triggerPointerDownPosRef:$,disabled:v,children:[p.jsx(vf.Provider,{scope:t,children:p.jsx(sY,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(M=>{_(z=>new Set(z).add(M))},[]),onNativeOptionRemove:m.useCallback(M=>{_(z=>{const H=new Set(z);return H.delete(M),H})},[]),children:n})}),B?p.jsxs(Ak,{"aria-hidden":!0,required:x,tabIndex:-1,name:g,autoComplete:h,value:L,onChange:M=>U(M.target.value),disabled:v,form:S,children:[L===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},O):null]})})};lk.displayName=fs;var ck="SelectTrigger",uk=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=wf(n),l=vo(ck,n),c=l.disabled||r,d=De(t,l.onTriggerChange),f=xf(n),g=m.useRef("touch"),[h,v,x]=Dk(w=>{const E=f().filter(k=>!k.disabled),b=E.find(k=>k.value===l.value),N=jk(E,w,b);N!==void 0&&l.onValueChange(N.value)}),S=w=>{c||(l.onOpenChange(!0),x()),w&&(l.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return p.jsx(Um,{asChild:!0,...i,children:p.jsx(ke.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Mk(l.value)?"":void 0,...o,ref:d,onClick:ve(o.onClick,w=>{w.currentTarget.focus(),g.current!=="mouse"&&S(w)}),onPointerDown:ve(o.onPointerDown,w=>{g.current=w.pointerType;const E=w.target;E.hasPointerCapture(w.pointerId)&&E.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(S(w),w.preventDefault())}),onKeyDown:ve(o.onKeyDown,w=>{const E=h.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&v(w.key),!(E&&w.key===" ")&&tY.includes(w.key)&&(S(),w.preventDefault())})})})});uk.displayName=ck;var dk="SelectValue",fk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...c}=e,d=vo(dk,n),{onValueNodeHasChildrenChange:f}=d,g=i!==void 0,h=De(t,d.onValueNodeChange);return wt(()=>{f(g)},[f,g]),p.jsx(ke.span,{...c,ref:h,style:{pointerEvents:"none"},children:Mk(d.value)?p.jsx(p.Fragment,{children:l}):i})});fk.displayName=dk;var aY="SelectIcon",pk=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});pk.displayName=aY;var lY="SelectPortal",hk=e=>p.jsx(Mi,{asChild:!0,...e});hk.displayName=lY;var ps="SelectContent",gk=m.forwardRef((e,t)=>{const n=vo(ps,e.__scopeSelect),[r,o]=m.useState();if(wt(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?hs.createPortal(p.jsx(mk,{scope:e.__scopeSelect,children:p.jsx(vf.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(yk,{...e,ref:t})});gk.displayName=ps;var Tn=10,[mk,xo]=Fi(ps),cY="SelectContentImpl",uY=XG("SelectContent.RemoveScroll"),yk=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:c,sideOffset:d,align:f,alignOffset:g,arrowPadding:h,collisionBoundary:v,collisionPadding:x,sticky:S,hideWhenDetached:w,avoidCollisions:E,...b}=e,N=vo(ps,n),[k,P]=m.useState(null),[A,I]=m.useState(null),R=De(t,K=>P(K)),[j,L]=m.useState(null),[U,$]=m.useState(null),B=xf(n),[G,_]=m.useState(!1),O=m.useRef(!1);m.useEffect(()=>{if(k)return ym(k)},[k]),mm();const M=m.useCallback(K=>{const[q,...oe]=B().map(ye=>ye.ref.current),[ce]=oe.slice(-1),ge=document.activeElement;for(const ye of K)if(ye===ge||(ye?.scrollIntoView({block:"nearest"}),ye===q&&A&&(A.scrollTop=0),ye===ce&&A&&(A.scrollTop=A.scrollHeight),ye?.focus(),document.activeElement!==ge))return},[B,A]),z=m.useCallback(()=>M([j,k]),[M,j,k]);m.useEffect(()=>{G&&z()},[G,z]);const{onOpenChange:H,triggerPointerDownPosRef:W}=N;m.useEffect(()=>{if(k){let K={x:0,y:0};const q=ce=>{K={x:Math.abs(Math.round(ce.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(W.current?.y??0))}},oe=ce=>{K.x<=10&&K.y<=10?ce.preventDefault():k.contains(ce.target)||H(!1),document.removeEventListener("pointermove",q),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",q),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",q),document.removeEventListener("pointerup",oe,{capture:!0})}}},[k,H,W]),m.useEffect(()=>{const K=()=>H(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[H]);const[Z,F]=Dk(K=>{const q=B().filter(ge=>!ge.disabled),oe=q.find(ge=>ge.ref.current===document.activeElement),ce=jk(q,K,oe);ce&&setTimeout(()=>ce.ref.current.focus())}),V=m.useCallback((K,q,oe)=>{const ce=!O.current&&!oe;(N.value!==void 0&&N.value===q||ce)&&(L(K),ce&&(O.current=!0))},[N.value]),X=m.useCallback(()=>k?.focus(),[k]),Q=m.useCallback((K,q,oe)=>{const ce=!O.current&&!oe;(N.value!==void 0&&N.value===q||ce)&&$(K)},[N.value]),ee=r==="popper"?Qg:vk,ne=ee===Qg?{side:c,sideOffset:d,align:f,alignOffset:g,arrowPadding:h,collisionBoundary:v,collisionPadding:x,sticky:S,hideWhenDetached:w,avoidCollisions:E}:{};return p.jsx(mk,{scope:n,content:k,viewport:A,onViewportChange:I,itemRefCallback:V,selectedItem:j,onItemLeave:X,itemTextRefCallback:Q,focusSelectedItem:z,selectedItemText:U,position:r,isPositioned:G,searchRef:Z,children:p.jsx(Ad,{as:uY,allowPinchZoom:!0,children:p.jsx(Id,{asChild:!0,trapped:N.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ve(o,K=>{N.trigger?.focus({preventScroll:!0}),K.preventDefault()}),children:p.jsx(Ai,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:p.jsx(ee,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:K=>K.preventDefault(),...b,...ne,onPlaced:()=>_(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,K=>{const q=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!q&&K.key.length===1&&F(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ce=B().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const ge=K.target,ye=ce.indexOf(ge);ce=ce.slice(ye+1)}setTimeout(()=>M(ce)),K.preventDefault()}})})})})})})});yk.displayName=cY;var dY="SelectItemAlignedPosition",vk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=vo(ps,n),l=xo(ps,n),[c,d]=m.useState(null),[f,g]=m.useState(null),h=De(t,R=>g(R)),v=xf(n),x=m.useRef(!1),S=m.useRef(!0),{viewport:w,selectedItem:E,selectedItemText:b,focusSelectedItem:N}=l,k=m.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&f&&w&&E&&b){const R=i.trigger.getBoundingClientRect(),j=f.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),U=b.getBoundingClientRect();if(i.dir!=="rtl"){const ge=U.left-j.left,ye=L.left-ge,me=R.left-ye,Ee=R.width+me,Le=Math.max(Ee,j.width),Fe=window.innerWidth-Tn,Ke=kg(ye,[Tn,Math.max(Tn,Fe-Le)]);c.style.minWidth=Ee+"px",c.style.left=Ke+"px"}else{const ge=j.right-U.right,ye=window.innerWidth-L.right-ge,me=window.innerWidth-R.right-ye,Ee=R.width+me,Le=Math.max(Ee,j.width),Fe=window.innerWidth-Tn,Ke=kg(ye,[Tn,Math.max(Tn,Fe-Le)]);c.style.minWidth=Ee+"px",c.style.right=Ke+"px"}const $=v(),B=window.innerHeight-Tn*2,G=w.scrollHeight,_=window.getComputedStyle(f),O=parseInt(_.borderTopWidth,10),M=parseInt(_.paddingTop,10),z=parseInt(_.borderBottomWidth,10),H=parseInt(_.paddingBottom,10),W=O+M+G+H+z,Z=Math.min(E.offsetHeight*5,W),F=window.getComputedStyle(w),V=parseInt(F.paddingTop,10),X=parseInt(F.paddingBottom,10),Q=R.top+R.height/2-Tn,ee=B-Q,ne=E.offsetHeight/2,K=E.offsetTop+ne,q=O+M+K,oe=W-q;if(q<=Q){const ge=$.length>0&&E===$[$.length-1].ref.current;c.style.bottom="0px";const ye=f.clientHeight-w.offsetTop-w.offsetHeight,me=Math.max(ee,ne+(ge?X:0)+ye+z),Ee=q+me;c.style.height=Ee+"px"}else{const ge=$.length>0&&E===$[0].ref.current;c.style.top="0px";const me=Math.max(Q,O+w.offsetTop+(ge?V:0)+ne)+oe;c.style.height=me+"px",w.scrollTop=q-Q+w.offsetTop}c.style.margin=`${Tn}px 0`,c.style.minHeight=Z+"px",c.style.maxHeight=B+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,i.trigger,i.valueNode,c,f,w,E,b,i.dir,r]);wt(()=>k(),[k]);const[P,A]=m.useState();wt(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);const I=m.useCallback(R=>{R&&S.current===!0&&(k(),N?.(),S.current=!1)},[k,N]);return p.jsx(pY,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:I,children:p.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:p.jsx(ke.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});vk.displayName=dY;var fY="SelectPopperPosition",Qg=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Tn,...i}=e,l=wf(n);return p.jsx(Km,{...l,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Qg.displayName=fY;var[pY,Ny]=Fi(ps,{}),Jg="SelectViewport",xk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=xo(Jg,n),l=Ny(Jg,n),c=De(t,i.onViewportChange),d=m.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(vf.Slot,{scope:n,children:p.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,f=>{const g=f.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:v}=l;if(v?.current&&h){const x=Math.abs(d.current-g.scrollTop);if(x>0){const S=window.innerHeight-Tn*2,w=parseFloat(h.style.minHeight),E=parseFloat(h.style.height),b=Math.max(w,E);if(b<S){const N=b+x,k=Math.min(S,N),P=N-k;h.style.height=k+"px",h.style.bottom==="0px"&&(g.scrollTop=P>0?P:0,h.style.justifyContent="flex-end")}}}d.current=g.scrollTop})})})]})});xk.displayName=Jg;var wk="SelectGroup",[hY,gY]=Fi(wk),mY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=kt();return p.jsx(hY,{scope:n,id:o,children:p.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});mY.displayName=wk;var bk="SelectLabel",Sk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=gY(bk,n);return p.jsx(ke.div,{id:o.id,...r,ref:t})});Sk.displayName=bk;var gd="SelectItem",[yY,Ck]=Fi(gd),Ek=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,c=vo(gd,n),d=xo(gd,n),f=c.value===r,[g,h]=m.useState(i??""),[v,x]=m.useState(!1),S=De(t,N=>d.itemRefCallback?.(N,r,o)),w=kt(),E=m.useRef("touch"),b=()=>{o||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(yY,{scope:n,value:r,disabled:o,textId:w,isSelected:f,onItemTextChange:m.useCallback(N=>{h(k=>k||(N?.textContent??"").trim())},[]),children:p.jsx(vf.ItemSlot,{scope:n,value:r,disabled:o,textValue:g,children:p.jsx(ke.div,{role:"option","aria-labelledby":w,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:S,onFocus:ve(l.onFocus,()=>x(!0)),onBlur:ve(l.onBlur,()=>x(!1)),onClick:ve(l.onClick,()=>{E.current!=="mouse"&&b()}),onPointerUp:ve(l.onPointerUp,()=>{E.current==="mouse"&&b()}),onPointerDown:ve(l.onPointerDown,N=>{E.current=N.pointerType}),onPointerMove:ve(l.onPointerMove,N=>{E.current=N.pointerType,o?d.onItemLeave?.():E.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(l.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:ve(l.onKeyDown,N=>{d.searchRef?.current!==""&&N.key===" "||(nY.includes(N.key)&&b(),N.key===" "&&N.preventDefault())})})})})});Ek.displayName=gd;var Ua="SelectItemText",Nk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=vo(Ua,n),c=xo(Ua,n),d=Ck(Ua,n),f=iY(Ua,n),[g,h]=m.useState(null),v=De(t,b=>h(b),d.onItemTextChange,b=>c.itemTextRefCallback?.(b,d.value,d.disabled)),x=g?.textContent,S=m.useMemo(()=>p.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:w,onNativeOptionRemove:E}=f;return wt(()=>(w(S),()=>E(S)),[w,E,S]),p.jsxs(p.Fragment,{children:[p.jsx(ke.span,{id:d.textId,...i,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?hs.createPortal(i.children,l.valueNode):null]})});Nk.displayName=Ua;var kk="SelectItemIndicator",Tk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ck(kk,n).isSelected?p.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Tk.displayName=kk;var em="SelectScrollUpButton",Pk=m.forwardRef((e,t)=>{const n=xo(em,e.__scopeSelect),r=Ny(em,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return wt(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollTop>0;i(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?p.jsx(Ik,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Pk.displayName=em;var tm="SelectScrollDownButton",Rk=m.forwardRef((e,t)=>{const n=xo(tm,e.__scopeSelect),r=Ny(tm,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return wt(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,g=Math.ceil(d.scrollTop)<f;i(g)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?p.jsx(Ik,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Rk.displayName=tm;var Ik=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=xo("SelectScrollButton",n),l=m.useRef(null),c=xf(n),d=m.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return m.useEffect(()=>()=>d(),[d]),wt(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),p.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{i.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{d()})})}),vY="SelectSeparator",_k=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});_k.displayName=vY;var nm="SelectArrow",xY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wf(n),i=vo(nm,n),l=xo(nm,n);return i.open&&l.position==="popper"?p.jsx(Gm,{...o,...r,ref:t}):null});xY.displayName=nm;var wY="SelectBubbleInput",Ak=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=m.useRef(null),i=De(r,o),l=sy(t);return m.useEffect(()=>{const c=o.current;if(!c)return;const d=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&g){const h=new Event("change",{bubbles:!0});g.call(c,t),c.dispatchEvent(h)}},[l,t]),p.jsx(ke.select,{...n,style:{...PC,...n.style},ref:i,defaultValue:t})});Ak.displayName=wY;function Mk(e){return e===""||e===void 0}function Dk(e){const t=pt(e),n=m.useRef(""),r=m.useRef(0),o=m.useCallback(l=>{const c=n.current+l;t(c),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),i=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function jk(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=bY(e,Math.max(i,0));o.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function bY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var SY=lk,Ok=uk,CY=fk,EY=pk,NY=hk,$k=gk,kY=xk,Lk=Sk,Fk=Ek,TY=Nk,PY=Tk,zk=Pk,Vk=Rk,Hk=_k;const br=SY,Sr=CY,qn=m.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Ok,{ref:r,className:Ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-field px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(EY,{asChild:!0,children:p.jsx(Ii,{className:"h-4 w-4 opacity-50"})})]}));qn.displayName=Ok.displayName;const Bk=m.forwardRef(({className:e,...t},n)=>p.jsx(zk,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(xz,{className:"h-4 w-4"})}));Bk.displayName=zk.displayName;const Wk=m.forwardRef(({className:e,...t},n)=>p.jsx(Vk,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(Ii,{className:"h-4 w-4"})}));Wk.displayName=Vk.displayName;const Zn=m.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(NY,{children:p.jsxs($k,{ref:o,className:Ce("fh-builder-portal font-sans relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[p.jsx(Bk,{}),p.jsx(kY,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),p.jsx(Wk,{})]})}));Zn.displayName=$k.displayName;const RY=m.forwardRef(({className:e,...t},n)=>p.jsx(Lk,{ref:n,className:Ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));RY.displayName=Lk.displayName;const an=m.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Fk,{ref:r,className:Ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(PY,{children:p.jsx(A1,{className:"h-4 w-4"})})}),p.jsx(TY,{children:t})]}));an.displayName=Fk.displayName;const IY=m.forwardRef(({className:e,...t},n)=>p.jsx(Hk,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));IY.displayName=Hk.displayName;const _Y=yo("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Uk=m.forwardRef(({className:e,variant:t,...n},r)=>p.jsx("div",{ref:r,role:"alert",className:Ce(_Y({variant:t}),e),...n}));Uk.displayName="Alert";const AY=m.forwardRef(({className:e,...t},n)=>p.jsx("h5",{ref:n,className:Ce("mb-1 font-medium leading-none tracking-tight",e),...t}));AY.displayName="AlertTitle";const Kk=m.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:Ce("text-sm [&_p]:leading-relaxed",e),...t}));Kk.displayName="AlertDescription";var dg="rovingFocusGroup.onEntryFocus",MY={bubbles:!1,cancelable:!0},Ol="RovingFocusGroup",[rm,Gk,DY]=yf(Ol),[jY,bf]=Ft(Ol,[DY]),[OY,$Y]=jY(Ol),Yk=m.forwardRef((e,t)=>p.jsx(rm.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(rm.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(LY,{...e,ref:t})})}));Yk.displayName=Ol;var LY=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:g=!1,...h}=e,v=m.useRef(null),x=De(t,v),S=Nl(i),[w,E]=cn({prop:l,defaultProp:c??null,onChange:d,caller:Ol}),[b,N]=m.useState(!1),k=pt(f),P=Gk(n),A=m.useRef(!1),[I,R]=m.useState(0);return m.useEffect(()=>{const j=v.current;if(j)return j.addEventListener(dg,k),()=>j.removeEventListener(dg,k)},[k]),p.jsx(OY,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:w,onItemFocus:m.useCallback(j=>E(j),[E]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R(j=>j+1),[]),onFocusableItemRemove:m.useCallback(()=>R(j=>j-1),[]),children:p.jsx(ke.div,{tabIndex:b||I===0?-1:0,"data-orientation":r,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{A.current=!0}),onFocus:ve(e.onFocus,j=>{const L=!A.current;if(j.target===j.currentTarget&&L&&!b){const U=new CustomEvent(dg,MY);if(j.currentTarget.dispatchEvent(U),!U.defaultPrevented){const $=P().filter(M=>M.focusable),B=$.find(M=>M.active),G=$.find(M=>M.id===w),O=[B,G,...$].filter(Boolean).map(M=>M.ref.current);Zk(O,g)}}A.current=!1}),onBlur:ve(e.onBlur,()=>N(!1))})})}),Xk="RovingFocusGroupItem",qk=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:l,...c}=e,d=kt(),f=i||d,g=$Y(Xk,n),h=g.currentTabStopId===f,v=Gk(n),{onFocusableItemAdd:x,onFocusableItemRemove:S,currentTabStopId:w}=g;return m.useEffect(()=>{if(r)return x(),()=>S()},[r,x,S]),p.jsx(rm.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:p.jsx(ke.span,{tabIndex:h?0:-1,"data-orientation":g.orientation,...c,ref:t,onMouseDown:ve(e.onMouseDown,E=>{r?g.onItemFocus(f):E.preventDefault()}),onFocus:ve(e.onFocus,()=>g.onItemFocus(f)),onKeyDown:ve(e.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){g.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const b=VY(E,g.orientation,g.dir);if(b!==void 0){if(E.metaKey||E.ctrlKey||E.altKey||E.shiftKey)return;E.preventDefault();let k=v().filter(P=>P.focusable).map(P=>P.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const P=k.indexOf(E.currentTarget);k=g.loop?HY(k,P+1):k.slice(P+1)}setTimeout(()=>Zk(k))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:w!=null}):l})})});qk.displayName=Xk;var FY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function zY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VY(e,t,n){const r=zY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return FY[r]}function Zk(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function HY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Qk=Yk,Jk=qk,eT="Toggle",ky=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:o,...i}=e,[l,c]=cn({prop:n,onChange:o,defaultProp:r??!1,caller:eT});return p.jsx(ke.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:ve(e.onClick,()=>{e.disabled||c(!l)})})});ky.displayName=eT;var tT=ky,wo="ToggleGroup",[nT]=Ft(wo,[bf]),rT=bf(),Ty=Ze.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const o=r;return p.jsx(BY,{...o,ref:t})}if(n==="multiple"){const o=r;return p.jsx(WY,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${wo}\``)});Ty.displayName=wo;var[oT,sT]=nT(wo),BY=Ze.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=cn({prop:n,defaultProp:r??"",onChange:o,caller:wo});return p.jsx(oT,{scope:e.__scopeToggleGroup,type:"single",value:Ze.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:Ze.useCallback(()=>c(""),[c]),children:p.jsx(iT,{...i,ref:t})})}),WY=Ze.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=cn({prop:n,defaultProp:r??[],onChange:o,caller:wo}),d=Ze.useCallback(g=>c((h=[])=>[...h,g]),[c]),f=Ze.useCallback(g=>c((h=[])=>h.filter(v=>v!==g)),[c]);return p.jsx(oT,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:d,onItemDeactivate:f,children:p.jsx(iT,{...i,ref:t})})});Ty.displayName=wo;var[UY,KY]=nT(wo),iT=Ze.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:o=!0,orientation:i,dir:l,loop:c=!0,...d}=e,f=rT(n),g=Nl(l),h={role:"group",dir:g,...d};return p.jsx(UY,{scope:n,rovingFocus:o,disabled:r,children:o?p.jsx(Qk,{asChild:!0,...f,orientation:i,dir:g,loop:c,children:p.jsx(ke.div,{...h,ref:t})}):p.jsx(ke.div,{...h,ref:t})})}),md="ToggleGroupItem",aT=Ze.forwardRef((e,t)=>{const n=sT(md,e.__scopeToggleGroup),r=KY(md,e.__scopeToggleGroup),o=rT(e.__scopeToggleGroup),i=n.value.includes(e.value),l=r.disabled||e.disabled,c={...e,pressed:i,disabled:l},d=Ze.useRef(null);return r.rovingFocus?p.jsx(Jk,{asChild:!0,...o,focusable:!l,active:i,ref:d,children:p.jsx(Ub,{...c,ref:t})}):p.jsx(Ub,{...c,ref:t})});aT.displayName=md;var Ub=Ze.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...o}=e,i=sT(md,n),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},c=i.type==="single"?l:void 0;return p.jsx(ky,{...c,...o,ref:t,onPressedChange:d=>{d?i.onItemActivate(r):i.onItemDeactivate(r)}})}),lT=Ty,cT=aT;const uT=yo("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-primary/20 hover:text-foreground data-[state=on]:relative data-[state=on]:z-10 data-[state=on]:border-primary"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),GY=m.forwardRef(({className:e,variant:t,size:n,...r},o)=>p.jsx(tT,{ref:o,className:Ce(uT({variant:t,size:n,className:e})),...r}));GY.displayName=tT.displayName;const dT=m.createContext({size:"default",variant:"default"}),yd=m.forwardRef(({className:e,variant:t,size:n,children:r,...o},i)=>p.jsx(lT,{ref:i,className:Ce("flex items-center justify-center gap-1",e),...o,children:p.jsx(dT.Provider,{value:{variant:t,size:n},children:r})}));yd.displayName=lT.displayName;const Yo=m.forwardRef(({className:e,children:t,variant:n,size:r,...o},i)=>{const l=m.useContext(dT);return p.jsx(cT,{ref:i,className:Ce(uT({variant:l.variant||n,size:l.size||r}),e),...o,children:t})});Yo.displayName=cT.displayName;const fT=({value:e,onChange:t,expressionType:n,availableVariables:r,placeholder:o})=>{const{t:i}=Xe(),l=o??"${var1}",c=m.useMemo(()=>Sl(e,r),[e,r]),d=m.useMemo(()=>Object.values(r),[r]),[f,g]=m.useState(c?.expression??""),[h,v]=m.useState(!1),[x,S]=m.useState(0),[w,E]=m.useState(""),[b,N]=m.useState(0),k=m.useRef(null),P=m.useRef(null),A=m.useRef(!1),I=m.useMemo(()=>d.filter(M=>M.name.toLowerCase().includes(w.toLowerCase())),[d,w]),R=ue(M=>M.activeCanvasId),j=m.useMemo(()=>{const M={};if(!h)return M;for(const z of et(R).getState().nodes)M[z.id]=z.data.label??Lt.getByType(z.data.type)?.label??z.data.type;return M},[h,R]),L=m.useCallback(M=>d.find(z=>z.name===M),[d]),U=m.useCallback(M=>{const z=[],H=/\$\{([^}]+)\}/g;let W,Z=M;const F=[];for(;(W=H.exec(M))!==null;)F.push({name:W[1]??"",start:W.index,end:W.index+W[0].length});let V=0;for(const X of F){const Q=L(X.name);Q?Q.kind==="node"?z.push({srcId:Q.nodeId,varId:Q.outputId}):Q.kind==="fnarg"?z.push({srcId:"fnarg",varId:Q.uid}):z.push({srcId:"declared",varId:Q.uid}):z.push({srcId:"",varId:""});const ee=Z.slice(0,X.start+V),ne=Z.slice(X.end+V);Z=ee+"${}"+ne,V-=X.name.length}return{expression:Z,references:z,dataType:n}},[L,n]),$=m.useCallback(M=>{if(!M)return"";let z=M.expression,H=0;return z=z.replace(/\$\{\}/g,()=>{if(H<M.variables.length){const W=M.variables[H];return H++,`\${${W?.name??"unknown"}}`}return"${}"}),z},[]);m.useEffect(()=>{if(A.current)return;const M=$(c);M!==f&&g(M)},[c,$,f]);const B=M=>{A.current=!0;const z=M.target.value,H=M.target.selectionStart??0;g(z);const W=z.slice(0,H),Z=W.lastIndexOf("$");if(Z!==-1){const F=W.slice(Z+1);if(!(F.startsWith("{")&&F.includes("}"))&&(F===""||F.startsWith("{")||/^[a-zA-Z_]/.test(F))){const X=F.replace(/^\{?/,"");E(X),S(Z),v(!0),N(0);return}}v(!1),t(U(z))},G=()=>{A.current=!1,t(U(f))},_=M=>{const z=f.slice(0,x),W=f.slice(k.current?.selectionStart??f.length).replace(/^[{]?[a-zA-Z_]*[}]?/,""),Z=`${z}\${${M.name}}${W}`;g(Z),v(!1),t(U(Z)),setTimeout(()=>{k.current?.focus();const F=z.length+M.name.length+3;k.current?.setSelectionRange(F,F)},0)},O=M=>{if(h)switch(M.key){case"ArrowDown":M.preventDefault(),N(z=>Math.min(z+1,I.length-1));break;case"ArrowUp":M.preventDefault(),N(z=>Math.max(z-1,0));break;case"Enter":case"Tab":M.preventDefault(),I[b]&&_(I[b]);break;case"Escape":v(!1);break}};return m.useEffect(()=>{const M=z=>{P.current&&!P.current.contains(z.target)&&v(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]),p.jsx("div",{ref:P,children:p.jsxs("div",{className:"relative",children:[p.jsx("input",{ref:k,type:"text",value:f,onChange:B,onKeyDown:O,onBlur:G,placeholder:l,className:"w-full h-9 px-3 py-1 text-sm bg-field border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring font-mono"}),h&&I.length>0&&p.jsx("div",{className:"absolute z-50 mt-1 w-full bg-popover border border-border rounded-md shadow-lg max-h-48 overflow-auto",children:I.map((M,z)=>p.jsxs("button",{onClick:()=>_(M),className:Ce("w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-accent",z===b&&"bg-accent"),children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("span",{className:"font-mono",children:["$","{",M.name,"}"]}),p.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[150px]",children:M.kind==="node"?i("fromNode",{node:j[M.nodeId]??M.nodeId}):M.kind==="declared"?i("globalVariable"):i("fnarg")})]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:M.dataType})]},so(M)))}),p.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2 pointer-events-none",children:p.jsxs("span",{className:"text-xs text-muted-foreground",children:["→ ",n]})})]})})};function Pu({value:e,options:t,isStale:n,loading:r,placeholder:o,onChange:i}){const l="__none__",c=n?void 0:e??l;return p.jsxs(br,{value:c,onValueChange:d=>i(d===l?void 0:d),disabled:r,children:[p.jsx(qn,{children:p.jsx(Sr,{placeholder:n?p.jsx("span",{className:"text-destructive",children:"Deleted reference"}):r?"Loading...":o})}),p.jsxs(Zn,{children:[p.jsx(an,{value:l,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.map(d=>p.jsx(an,{value:d.value,children:d.label},d.value))]})]})}function YY(e){switch(e){case"int":case"float":return"${var1} + ${var2}";case"bool":return"${var1} > ${var2}";case"string":return"hello ${var1}";default:return"${var1}"}}const Py=({canvasId:e,parameter:t,value:n,allArguments:r,onChange:o,errors:i,translationPrefix:l})=>{const{t:c}=Xe(),d=n,{list:f,lookup:g}=Li(e),h=ue(b=>b.channels),v=ue(b=>b.memory),x=ue(b=>b.models),S=ue(b=>b.availableModels),w=()=>{switch(t.type){case"variableSelect":{const b=d,N=b?.varId?vr(b):void 0,k=!!(N&&!g[N]),P=f.map(A=>({value:so(A),label:`${A.name} (${A.dataType})`}));return p.jsx(Pu,{value:N,options:P,isStale:k,placeholder:"Select variable...",onChange:A=>{if(!A){o(void 0);return}const I=g[A];if(!I)return;const R=I.kind==="node"?{srcId:I.nodeId,varId:I.outputId}:I.kind==="declared"?{srcId:"declared",varId:I.uid}:{srcId:"fnarg",varId:I.uid};o(R)}})}case"expression":{const N=m1(t,r,g),k=d&&typeof d=="object"&&"expression"in d?d:{expression:"",references:[],dataType:N};return p.jsx(fT,{value:k,onChange:o,expressionType:N,availableVariables:g,placeholder:YY(N)})}case"string":return t.multiline?p.jsx(ak,{value:d||"",onChange:b=>o(b.target.value),placeholder:String(t.default??""),rows:4}):p.jsx(Mt,{value:d||"",onChange:b=>o(b.target.value),placeholder:String(t.default??"")});case"int":return p.jsx(Mt,{type:"number",step:1,value:d??"",onChange:b=>{const N=parseInt(b.target.value,10);o(isNaN(N)?void 0:N)},placeholder:t.default?.toString()||"0"});case"float":return p.jsx(Mt,{type:"number",step:"any",className:"[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [-moz-appearance:textfield]",value:d??"",onChange:b=>{const N=parseFloat(b.target.value);o(isNaN(N)?void 0:N)},placeholder:t.default?.toString()||"0"});case"bool":{const b=d;return p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(nf,{checked:b,onCheckedChange:o}),p.jsx("span",{className:"text-sm text-muted-foreground",children:b?"Enabled":"Disabled"})]})}case"selection":{const b="__none__",N=d??(t.optional?b:"");return p.jsxs(br,{value:N,onValueChange:k=>o(k===b?void 0:k),children:[p.jsx(qn,{children:p.jsx(Sr,{placeholder:"Select..."})}),p.jsxs(Zn,{children:[t.optional&&p.jsx(an,{value:b,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.options.map(k=>p.jsx(an,{value:k.value,children:k.label},k.value))]})]})}case"memorySelect":{const N=v1(t,r),k=Object.values(v).filter(R=>N.includes(R.type)),P=d,A=!!(P&&!k.some(R=>R.id===P)),I=k.map(R=>({value:R.id,label:R.label}));return p.jsx(Pu,{value:P,options:I,isStale:A,placeholder:c("selectMemory","Select memory..."),onChange:R=>o(R)})}case"modelSelect":{const b=t,N=x1(b,r),k=cA(b,r),P=$=>!k?.length||k.every(B=>$.includes(B)),A=S.filter($=>P($.capabilities)).map($=>({value:$.id,label:$.label})),I=Object.values(x).filter($=>N.includes($.type)&&P($.arguments.capabilities??["chat"])).map($=>({value:$.id,label:$.label})),R=new Set(A.map($=>$.value)),j=[...A,...I.filter($=>!R.has($.value))],L=d,U=!!(L&&!j.some($=>$.value===L));return j.length===0?p.jsxs(Uk,{variant:"destructive",children:[p.jsx(mo,{className:"h-4 w-4"}),p.jsx(Kk,{children:c("noModelsAvailable")})]}):p.jsx(Pu,{value:L,options:j,isStale:U,placeholder:c("selectModel","Select model..."),onChange:$=>o($)})}case"time":return p.jsx(Mt,{type:"time",value:d??"",onChange:b=>o(b.target.value)});case"weekdays":{const b=[{code:"mon",label:"Mon"},{code:"tue",label:"Tue"},{code:"wed",label:"Wed"},{code:"thu",label:"Thu"},{code:"fri",label:"Fri"},{code:"sat",label:"Sat"},{code:"sun",label:"Sun"}],N=d||[],k=P=>{const A=N.includes(P)?N.filter(I=>I!==P):[...N,P];o(A)};return p.jsx("div",{className:"space-y-1.5",children:p.jsx("div",{className:"flex gap-1",children:b.map(P=>p.jsx("button",{type:"button",onClick:()=>k(P.code),className:`px-2 py-1 text-xs rounded-md border transition-colors ${N.includes(P.code)?"bg-primary text-primary-foreground border-primary":"bg-field text-muted-foreground border-input hover:bg-muted/50"}`,children:P.label},P.code))})})}case"memory-refs":{const b=d??[],N=Object.values(v).filter(j=>j.type==="MemoryFile"),k=new Map(N.map(j=>[j.id,j])),P=(j,L)=>o(b.map((U,$)=>$===j?L:U)),A=j=>o(b.filter((L,U)=>U!==j)),I=()=>{const j=new Set(b.map(U=>U.id)),L=N.find(U=>!j.has(U.id));o([...b,{id:L?.id??"",mode:"r"}])},R=N.length>b.length;return p.jsxs("div",{className:"space-y-2",children:[b.length===0&&N.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground italic px-2 py-1",children:c("noMemoryFilesForAgent","No memory files declared yet. Add one from the Memory tab in the sidebar.")}),b.map((j,L)=>{const U=j.id?k.get(j.id):void 0,$=!!(j.id&&!U),B=new Set(b.filter((_,O)=>O!==L).map(_=>_.id)),G=N.filter(_=>_.id===j.id||!B.has(_.id));return p.jsxs("div",{className:"rounded-lg bg-card shadow-sm border border-border p-2 space-y-2 transition-all hover:shadow-md",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(br,{value:j.id||void 0,onValueChange:_=>P(L,{...j,id:_}),children:[p.jsx(qn,{className:"h-7 text-xs flex-1",children:p.jsx(Sr,{placeholder:$?p.jsx("span",{className:"text-destructive",children:c("memoryRefStale","Deleted memory file")}):c("selectMemoryFile","Select memory file...")})}),p.jsx(Zn,{children:G.map(_=>p.jsx(an,{value:_.id,children:_.label},_.id))})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>A(L),"aria-label":c("removeMemoryRef","Remove memory ref"),children:p.jsx(El,{className:"w-3.5 h-3.5"})})]}),p.jsxs(yd,{type:"single",value:j.mode,onValueChange:_=>_&&P(L,{...j,mode:_}),className:"gap-0 justify-start",children:[p.jsx(Yo,{value:"r",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-r-none",children:c("memoryModeRead","Read")}),p.jsx(Yo,{value:"rw",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-l-none -ml-px",children:c("memoryModeReadWrite","Read + Write")})]})]},L)}),R&&p.jsx(ss,{onClick:I,children:c("addMemoryRef","Add memory ref")})]})}case"channelSelect":{const N=y1(t,r),k=Object.values(h).filter(R=>N.includes(R.type)),P=d,A=!!(P&&!k.some(R=>R.id===P)),I=k.map(R=>({value:R.id,label:R.label}));return p.jsx(Pu,{value:P,options:I,isStale:A,placeholder:c("selectChannel"),onChange:R=>o(R)})}default:return t}},E=i&&i.length>0;return p.jsxs("div",{className:`space-y-2 ${E?"ring-1 ring-destructive rounded-md p-2":""}`,children:[p.jsxs(vi,{className:"text-sm font-medium",children:[t.label,t.optional!==!0&&p.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.description&&p.jsx("p",{className:"text-xs text-muted-foreground",children:l?cB(c,l,t):t.description}),w(),E&&p.jsx("div",{className:"space-y-0.5",children:i.map((b,N)=>p.jsx("p",{className:"text-xs text-destructive",children:b},N))})]})};function Ry(e){return m.useMemo(()=>{const t=new Map;if(!e)return t;for(const n of e)if(n.paramId&&n.severity==="error"){const r=t.get(n.paramId);r?r.push(n.message):t.set(n.paramId,[n.message])}return t},[e])}function $l(){const{t:e}=Xe();return p.jsx("div",{className:"text-xs font-medium text-muted-foreground bg-muted/50 rounded px-2 py-1",children:e("preview.viewOnly")})}const zi=m.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(gt,{ref:r,variant:"destructive",className:Ce("w-full",e),...n,children:[p.jsx(El,{className:"w-4 h-4 mr-2"}),t]}));zi.displayName="DeleteButton";const Iy=({resetKey:e,label:t,labelTitle:n,onLabelChange:r,description:o,belowLabel:i,parameters:l,getValue:c,allArguments:d,onParamChange:f,diagnostics:g,translationPrefix:h,deleteLabel:v,onDelete:x,onClose:S,canvasId:w=We})=>{const E=ue(P=>wn(P.builderMode)),b=Ry(g),[N,k]=m.useState(t);return m.useEffect(()=>{k(t)},[e,t]),p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"group flex items-center gap-1.5 rounded-md border border-transparent px-1.5 -mx-1.5 hover:border-input focus-within:border-input transition-colors",children:p.jsx("input",{type:"text",title:n,className:"font-semibold text-lg bg-transparent w-full outline-none cursor-text py-0.5",value:N,readOnly:E,onChange:P=>{k(P.target.value),r(P.target.value)}})}),p.jsx("p",{className:"text-sm text-muted-foreground",children:o}),i]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"shrink-0",onClick:S,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),E&&p.jsx($l,{}),l.length>0&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx("div",{className:`space-y-3 ${E?"pointer-events-none opacity-60":""}`,children:l.map(P=>p.jsx(Py,{canvasId:w,parameter:P,value:c(P),allArguments:d,onChange:A=>f(P.id,A),errors:b.get(P.id),translationPrefix:h},P.id))})]}),!E&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(zi,{onClick:x,children:v})]})]})})},XY=({channel:e,onClose:t})=>{const{t:n}=Xe(),r={...e.arguments,type:e.type},o=Ed.parameters.filter(c=>Tr(c,r,!1)),i=Ye(c=>c.byChannelId[e.id]),l=(c,d)=>{c==="type"?Kh(e.id,{type:d}):Kh(e.id,{arguments:{[c]:d}})};return p.jsx(Iy,{resetKey:e.id,label:e.label,labelTitle:n("channelLabel","Channel label"),onLabelChange:c=>Kh(e.id,{label:c}),description:n("channelDescription","Hardware interface declaration"),parameters:o,getValue:c=>c.id==="type"?e.type:e.arguments[c.id],allArguments:r,onParamChange:l,diagnostics:i,translationPrefix:"channels",deleteLabel:n("deleteChannel","Delete channel"),onDelete:()=>mB(e.id),onClose:t})},qY=({canvasId:e,onStep:t,getNodeCategory:n})=>{const{t:r}=Xe(),o=is(b=>b.phase),i=QY(o),c=et(e)(b=>i?b.nodes.find(N=>N.id===i)?.data??null:null),d=m.useMemo(()=>c?uA(c):[],[c]),f=c?n(c)===xe.Trigger:!1,g=o.status==="stepping",h=o.status==="paused"||o.status==="idle"&&i,[v,x]=m.useState({}),[S,w]=m.useState([""]),E=m.useCallback(()=>{t(i??void 0)},[i,t]);return i?f?p.jsx("div",{className:"space-y-3",children:p.jsx("div",{className:"text-sm text-muted-foreground bg-muted/50 rounded px-3 py-2",children:r("debug.triggerNotSteppable")})}):p.jsxs("div",{className:"space-y-4",children:[p.jsx("div",{className:"text-sm font-medium",children:c?.label||c?.type}),d.length===0?p.jsx("div",{className:"text-xs text-muted-foreground",children:r("debug.noInputsNeeded")}):p.jsx("div",{className:"space-y-3",children:d.map((b,N)=>p.jsx(ZY,{requirement:b,gpioValues:v,setGpioValues:x,serialValues:S,setSerialValues:w,serialIndex:d.slice(0,N).filter(k=>k.kind==="serial").length},N))}),p.jsx(gt,{className:"w-full gap-2",onClick:E,disabled:!h||g,children:g?p.jsxs(p.Fragment,{children:[p.jsx(Nz,{className:"w-4 h-4 animate-spin"}),r("debug.stepping")]}):p.jsxs(p.Fragment,{children:[p.jsx(Tz,{className:"w-4 h-4"}),r("debug.step")]})})]}):p.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:r("debug.selectNode")})};function ZY({requirement:e,gpioValues:t,setGpioValues:n,serialValues:r,setSerialValues:o,serialIndex:i}){const{t:l}=Xe();if(e.kind==="gpio"){const c=String(e.pinReference??"?"),d=t[c]??0;return p.jsxs("div",{className:"space-y-1",children:[p.jsxs(vi,{className:"text-xs font-medium",children:[l("debug.gpioPin",{pin:e.pinReference??"?"}),p.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",e.dataType,")"]})]}),e.dataType==="bool"?p.jsx(nf,{checked:!!d,onCheckedChange:f=>n(g=>({...g,[c]:f?1:0}))}):p.jsx(Mt,{type:"number",value:d,onChange:f=>n(g=>({...g,[c]:parseInt(f.target.value)||0})),className:"h-8 font-mono text-sm",min:0,max:4095})]})}return p.jsxs("div",{className:"space-y-1",children:[p.jsx(vi,{className:"text-xs font-medium",children:l("debug.serialInput")}),p.jsx(Mt,{value:r[i]??"",onChange:c=>{o(d=>{const f=[...d];return f[i]=c.target.value,f})},placeholder:l("debug.serialPlaceholder"),className:"h-8 font-mono text-sm"})]})}function QY(e){return e.status==="paused"||e.status==="stepping"?e.cursorNodeId:null}const JY=({canvasId:e,edgeId:t,edgeType:n,edgeData:r,sourceControlEdgeCount:o,onEdgeUpdate:i,onEdgeDelete:l,onClose:c})=>{const{t:d}=Xe(),f=ue(S=>wn(S.builderMode)),g=f1(n),h=Ye(S=>S.byEdgeId[t]),v=Ry(h),x=m.useCallback((S,w)=>{i(t,{[S]:w})},[t,i]);return p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"font-semibold text-lg",children:g.label}),p.jsx("p",{className:"text-sm text-muted-foreground",children:uB(d,g,n)})]}),p.jsx(gt,{variant:"ghost",size:"icon",onClick:c,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),f&&p.jsx($l,{}),p.jsx($t,{}),p.jsx("div",{className:f?"pointer-events-none opacity-60":"",children:g.parameters.length>0?g.parameters.map(S=>{const E=S.id==="description"&&o<=1&&(n==="agentChoice"||n==="agentDelegate")?{...S,optional:!0}:S;return p.jsx(Py,{canvasId:e,parameter:E,value:r[S.id],allArguments:r,onChange:b=>x(S.id,b),errors:v.get(S.id),translationPrefix:`edges.${n}`},S.id)}):p.jsx("p",{className:"text-sm text-muted-foreground",children:d("noEdgeParams")})}),!f&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(zi,{onClick:()=>l(t),children:d("deleteEdge")})]})]})};var eX=Symbol("radix.slottable");function tX(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=eX,t}var pT="AlertDialog",[nX]=Ft(pT,[sS]),Ir=sS(),hT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ir(t);return p.jsx(bm,{...r,...n,modal:!0})};hT.displayName=pT;var rX="AlertDialogTrigger",oX=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(a4,{...o,...r,ref:t})});oX.displayName=rX;var sX="AlertDialogPortal",gT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ir(t);return p.jsx(Sm,{...r,...n})};gT.displayName=sX;var iX="AlertDialogOverlay",mT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Dd,{...o,...r,ref:t})});mT.displayName=iX;var fi="AlertDialogContent",[aX,lX]=nX(fi),cX=tX("AlertDialogContent"),yT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Ir(n),l=m.useRef(null),c=De(t,l),d=m.useRef(null);return p.jsx(r4,{contentName:fi,titleName:vT,docsSlug:"alert-dialog",children:p.jsx(aX,{scope:n,cancelRef:d,children:p.jsxs(jd,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:ve(o.onOpenAutoFocus,f=>{f.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[p.jsx(cX,{children:r}),p.jsx(dX,{contentRef:l})]})})})});yT.displayName=fi;var vT="AlertDialogTitle",xT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Cm,{...o,...r,ref:t})});xT.displayName=vT;var wT="AlertDialogDescription",bT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Em,{...o,...r,ref:t})});bT.displayName=wT;var uX="AlertDialogAction",ST=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Nm,{...o,...r,ref:t})});ST.displayName=uX;var CT="AlertDialogCancel",ET=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=lX(CT,n),i=Ir(n),l=De(t,o);return p.jsx(Nm,{...i,...r,ref:l})});ET.displayName=CT;var dX=({contentRef:e})=>{const t=`\`${fi}\` requires a description for the component to be accessible for screen reader users.
70
+
71
+ You can add a description to the \`${fi}\` by passing a \`${wT}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
72
+
73
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${fi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
74
+
75
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},fX=hT,pX=gT,NT=mT,kT=yT,TT=ST,PT=ET,RT=xT,IT=bT;const hX=fX,gX=pX,_T=m.forwardRef(({className:e,...t},n)=>p.jsx(NT,{className:Ce("fixed inset-0 z-50 bg-[hsl(var(--overlay))] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));_T.displayName=NT.displayName;const AT=m.forwardRef(({className:e,...t},n)=>p.jsxs(gX,{children:[p.jsx(_T,{}),p.jsx(kT,{ref:n,className:Ce("fh-builder-portal font-sans fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));AT.displayName=kT.displayName;const MT=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});MT.displayName="AlertDialogHeader";const DT=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});DT.displayName="AlertDialogFooter";const jT=m.forwardRef(({className:e,...t},n)=>p.jsx(RT,{ref:n,className:Ce("font-heading text-lg font-semibold",e),...t}));jT.displayName=RT.displayName;const OT=m.forwardRef(({className:e,...t},n)=>p.jsx(IT,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));OT.displayName=IT.displayName;const $T=m.forwardRef(({className:e,...t},n)=>p.jsx(TT,{ref:n,className:Ce(hm(),e),...t}));$T.displayName=TT.displayName;const LT=m.forwardRef(({className:e,...t},n)=>p.jsx(PT,{ref:n,className:Ce(hm({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));LT.displayName=PT.displayName;const mX=["int","float","bool","string"];function yX({port:e,onUpdate:t,onRemove:n,errors:r,children:o}){const i=!!r?.length;return p.jsxs("div",{className:`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${i?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Mt,{className:"h-7 text-xs flex-1",value:e.name,placeholder:"name",onChange:l=>t({name:l.target.value})}),p.jsxs(br,{value:e.dataType,onValueChange:l=>t({dataType:l}),children:[p.jsx(qn,{className:"h-7 text-xs w-20",children:p.jsx(Sr,{})}),p.jsx(Zn,{children:mX.map(l=>p.jsx(an,{value:l,className:"text-xs",children:l},l))})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive",onClick:n,children:p.jsx(El,{className:"w-3.5 h-3.5"})})]}),o,i&&p.jsx("div",{className:"space-y-0.5",children:r.map((l,c)=>p.jsx("p",{className:"text-xs text-destructive",children:l},c))})]})}function Kb({title:e,description:t,addLabel:n,emptyText:r,ports:o,onAdd:i,onUpdate:l,onRemove:c,errorsFor:d,renderExtra:f}){return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{children:[p.jsx(vi,{className:"text-sm font-medium",children:e}),p.jsx("p",{className:"text-xs text-muted-foreground",children:t})]}),o.length===0?p.jsx("p",{className:"text-xs text-muted-foreground italic",children:r}):p.jsx("div",{className:"space-y-2",children:o.map((g,h)=>p.jsx(yX,{port:g,onUpdate:v=>l(h,v),onRemove:()=>c(h),errors:d?.(g),children:f?.(g,h)},g.uid))}),p.jsx(ss,{onClick:i,children:n})]})}const vX=e=>({expression:"",references:[],dataType:e});function xX(e){const t=Zm(e.id);t&&GH(t,e.arguments)}function bo(e,t,n){let r;ue.getState().setFunctions(o=>{const i=o[e];if(!i)return o;const l=t(i);return r=n?{...l,version:i.version+1}:l,{...o,[e]:r}}),r&&n&&xX(r)}function wX(){const e=ln(),t=Object.values(ue.getState().functions).map(r=>r.name),n={id:e,version:1,name:yi("function",t),arguments:[],outputs:[]};return ue.getState().setFunctions(r=>({...r,[e]:n})),et(e),Zd(),n}function bX(e){ue.getState().setFunctions(n=>{const{[e]:r,...o}=n;return o}),XH(e);const t=ue.getState().selection;t.kind==="function"&&t.id===e&&ue.getState().clearSelection()}function SX(e,t){bo(e,n=>({...n,name:t}),!1)}function CX(e){bo(e,t=>({...t,arguments:[...t.arguments,h1({name:`input${t.arguments.length+1}`,dataType:"string"})]}),!0)}function EX(e,t,n){bo(e,r=>{const o=r.arguments[t];if(!o)return r;const i=[...r.arguments];return i[t]={...o,...n},{...r,arguments:i}},!0)}function NX(e,t){bo(e,n=>({...n,arguments:n.arguments.filter((r,o)=>o!==t)}),!0)}function kX(e){bo(e,t=>{const n="string";return{...t,outputs:[...t.outputs,{uid:ln(),name:`output${t.outputs.length+1}`,dataType:n,expression:vX(n)}]}},!0)}function TX(e,t,n){bo(e,r=>{const o=r.outputs[t];if(!o)return r;const i=n.dataType??o.dataType,l=[...r.outputs];return l[t]={...o,...n,dataType:i,expression:n.dataType?{...o.expression,dataType:i}:o.expression},{...r,outputs:l}},!0)}function PX(e,t){bo(e,n=>({...n,outputs:n.outputs.filter((r,o)=>o!==t)}),!0)}function RX(e,t,n){bo(e,r=>{const o=r.outputs[t];if(!o)return r;const i=[...r.outputs];return i[t]={...o,expression:n},{...r,outputs:i}},!1)}const IX=({func:e,onClose:t})=>{const{t:n}=Xe(),r=ue(S=>wn(S.builderMode)),{id:o,arguments:i,outputs:l}=e,[c,d]=m.useState(!1),[f,g]=m.useState(e.name);m.useEffect(()=>{g(e.name)},[o,e.name]);const{lookup:h}=Li(o),v=Ye(S=>S.byFunctionId[o]),x=m.useMemo(()=>{const S=new Map;for(const w of v??[]){if(!w.outputId)continue;const E=S.get(w.outputId);E?E.push(w.message):S.set(w.outputId,[w.message])}return S},[v]);return p.jsxs("div",{className:"p-4",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"group flex items-center gap-1.5 rounded-md border border-transparent px-1.5 -mx-1.5 hover:border-input focus-within:border-input transition-colors",children:p.jsx("input",{type:"text",title:n("functionName"),className:"font-semibold text-lg bg-transparent w-full outline-none cursor-text py-0.5 font-mono",value:f,readOnly:r,placeholder:n("functionNamePlaceholder"),onChange:S=>{g(S.target.value),SX(o,S.target.value)}})}),p.jsx("p",{className:"text-sm text-muted-foreground",children:n("functionDefinition")})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"shrink-0",onClick:t,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),r&&p.jsx($l,{}),p.jsxs("div",{className:`space-y-4 ${r?"pointer-events-none opacity-60":""}`,children:[p.jsx($t,{}),p.jsx(Kb,{title:n("inputs"),description:n("functionInputsDesc"),addLabel:n("add"),emptyText:n("noInputs"),ports:i,onAdd:()=>CX(o),onUpdate:(S,w)=>EX(o,S,w),onRemove:S=>NX(o,S)}),p.jsx($t,{}),p.jsx(Kb,{title:n("outputs"),description:n("functionOutputsDesc"),addLabel:n("add"),emptyText:n("noOutputs"),ports:l,onAdd:()=>kX(o),onUpdate:(S,w)=>TX(o,S,w),onRemove:S=>PX(o,S),errorsFor:S=>x.get(S.uid)??[],renderExtra:(S,w)=>p.jsx(fT,{value:S.expression,onChange:E=>RX(o,w,E),expressionType:S.dataType,availableVariables:h,placeholder:`${n("expressionFor")} ${S.name}...`})})]}),!r&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(zi,{onClick:()=>d(!0),children:n("deleteFunction")})]})]}),p.jsx(hX,{open:c,onOpenChange:d,children:p.jsxs(AT,{children:[p.jsxs(MT,{children:[p.jsx(jT,{children:n("deleteFunctionTitle")}),p.jsx(OT,{children:n("deleteFunctionDesc")})]}),p.jsxs(DT,{children:[p.jsx(LT,{children:n("cancel")}),p.jsx($T,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{bX(o),d(!1),t()},children:n("delete")})]})]})})]})},_X=({memory:e,onClose:t})=>{const{t:n}=Xe(),r=ue(f=>f.memory),o=Nd.getByType(e.type),i=Ye(f=>f.byMemoryId[e.id]),l=e.type==="MemoryFile"&&e.label.trim()!==""&&Object.values(r).some(f=>f.id!==e.id&&f.type==="MemoryFile"&&f.label===e.label),c=e.label.trim()==="",d=p.jsxs(p.Fragment,{children:[c&&p.jsx("p",{className:"text-xs text-destructive mt-1",children:n("memoryLabelRequired","Label is required")}),l&&p.jsx("p",{className:"text-xs text-destructive mt-1",children:n("memoryLabelDuplicate","Label must be unique per agent")})]});return p.jsx(Iy,{resetKey:e.id,label:e.label,labelTitle:n("memoryLabel","Memory label"),onLabelChange:f=>Aw(e.id,{label:f}),description:o?.description??"",belowLabel:d,parameters:o?.parameters??[],getValue:f=>e.arguments[f.id],allArguments:{...e.arguments},onParamChange:(f,g)=>Aw(e.id,{arguments:{[f]:g}}),diagnostics:i,translationPrefix:"memory",deleteLabel:n("deleteMemory","Delete memory"),onDelete:()=>wB(e.id),onClose:t})},AX=({model:e,onClose:t})=>{const{t:n}=Xe(),r=kd.getByType(e.type),o=Ye(l=>l.byModelId[e.id]),i=e.label.trim()==="";return p.jsx(Iy,{resetKey:e.id,label:e.label,labelTitle:n("modelLabel","Model label"),onLabelChange:l=>Mw(e.id,{label:l}),description:r?.description??n("modelCustomDescription","Custom model mapped to a provider at deploy"),belowLabel:i?p.jsx("p",{className:"text-xs text-destructive mt-1",children:n("modelLabelRequired","Label is required")}):void 0,parameters:r?.parameters??[],getValue:l=>e.arguments[l.id],allArguments:{...e.arguments},onParamChange:(l,c)=>Mw(e.id,{arguments:{[l]:c}}),diagnostics:o,translationPrefix:"models",deleteLabel:n("deleteModel","Delete model"),onDelete:()=>NB(e.id),onClose:t})};var Sf="Checkbox",[MX]=Ft(Sf),[DX,_y]=MX(Sf);function jX(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:l,name:c,onCheckedChange:d,required:f,value:g="on",internal_do_not_use_render:h}=e,[v,x]=cn({prop:n,defaultProp:o??!1,onChange:d,caller:Sf}),[S,w]=m.useState(null),[E,b]=m.useState(null),N=m.useRef(!1),k=S?!!l||!!S.closest("form"):!0,P={checked:v,disabled:i,setChecked:x,control:S,setControl:w,name:c,form:l,value:g,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:uo(o)?!1:o,isFormControl:k,bubbleInput:E,setBubbleInput:b};return p.jsx(DX,{scope:t,...P,children:OX(h)?h(P):r})}var FT="CheckboxTrigger",zT=m.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:l,disabled:c,checked:d,required:f,setControl:g,setChecked:h,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:S}=_y(FT,e),w=De(o,g),E=m.useRef(d);return m.useEffect(()=>{const b=i?.form;if(b){const N=()=>h(E.current);return b.addEventListener("reset",N),()=>b.removeEventListener("reset",N)}},[i,h]),p.jsx(ke.button,{type:"button",role:"checkbox","aria-checked":uo(d)?"mixed":d,"aria-required":f,"data-state":UT(d),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:w,onKeyDown:ve(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:ve(n,b=>{h(N=>uo(N)?!0:!N),S&&x&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})})});zT.displayName=FT;var Ay=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:l,disabled:c,value:d,onCheckedChange:f,form:g,...h}=e;return p.jsx(jX,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:c,required:l,onCheckedChange:f,name:r,form:g,value:d,internal_do_not_use_render:({isFormControl:v})=>p.jsxs(p.Fragment,{children:[p.jsx(zT,{...h,ref:t,__scopeCheckbox:n}),v&&p.jsx(WT,{__scopeCheckbox:n})]})})});Ay.displayName=Sf;var VT="CheckboxIndicator",HT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=_y(VT,n);return p.jsx(Pt,{present:r||uo(i.checked)||i.checked===!0,children:p.jsx(ke.span,{"data-state":UT(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});HT.displayName=VT;var BT="CheckboxBubbleInput",WT=m.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:l,required:c,disabled:d,name:f,value:g,form:h,bubbleInput:v,setBubbleInput:x}=_y(BT,e),S=De(n,x),w=sy(i),E=Vm(r);m.useEffect(()=>{const N=v;if(!N)return;const k=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(k,"checked").set,I=!o.current;if(w!==i&&A){const R=new Event("click",{bubbles:I});N.indeterminate=uo(i),A.call(N,uo(i)?!1:i),N.dispatchEvent(R)}},[v,w,i,o]);const b=m.useRef(uo(i)?!1:i);return p.jsx(ke.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:d,name:f,value:g,form:h,...t,tabIndex:-1,ref:S,style:{...t.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});WT.displayName=BT;function OX(e){return typeof e=="function"}function uo(e){return e==="indeterminate"}function UT(e){return uo(e)?"indeterminate":e?"checked":"unchecked"}const KT=m.forwardRef(({className:e,...t},n)=>p.jsx(Ay,{ref:n,className:Ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:p.jsx(HT,{className:Ce("flex items-center justify-center text-current"),children:p.jsx(A1,{className:"h-4 w-4"})})}));KT.displayName=Ay.displayName;function GT(e){const t=e.getState().variables;return new Set(Object.values(t).map(n=>n.name))}function YT(e,t){const n=e.arguments,r=i=>{const l=n[i];if(!l||!l.active||l.mode!=="emit"||!t.has(l.name))return;const c=yi(l.name,t);t.add(c),n[i]={active:!0,mode:"emit",name:c}};if(e.type==="FunctionCall"){for(const i of e.functionInfo.returns)r(Jo(i));return}const o=Lt.getByType(e.type);if(o?.outputs)for(const i of o.outputs)if(i.type==="static")r(i.id);else{const l=n[i.id]??[];for(const c of l){if(c.mode!=="emit"||!t.has(c.name))continue;const d=yi(c.name,t);t.add(d),c.name=d}}}function XT(e,t){if(t.isUnremovable)return!1;if(t.isSingleton){const{nodes:n}=e.getState();if(n.some(r=>r.data.type===t.type))return!1}return!0}function Gb(e,t,n){if(!XT(e,t))return null;const r=ln(),o={};t.parameters.forEach(x=>{x.default!==void 0&&(o[x.id]=structuredClone(x.default))});for(const x of t.outputs??[])x.type==="static"?o[x.id]={active:!0,mode:"emit",name:x.id}:o[x.id]=[];const i={id:r,type:t.type,arguments:o};if(t.type==="FunctionCall"){const x=t,S=i;S.functionInfo=x.functionInfo;for(const w of x.functionInfo.arguments)o[Jo(w)]={expression:"",references:[],dataType:w.dataType};for(const w of x.functionInfo.returns)o[Jo(w)]={active:!0,mode:"emit",name:w.name}}const l=GT(e);YT(i,l);const c=e.getState().nodes;let d=n||{x:250,y:100};const f=50;for(;c.some(x=>Math.abs(x.position.x-d.x)<f&&Math.abs(x.position.y-d.y)<f);)d={x:d.x+40,y:d.y+40};const g={id:i.id,type:QT(t.type),position:d,data:i},{setNodes:h,setVariables:v}=e.getState();return h(x=>[...x,g]),v(x=>({...x,...qd([g.data])})),r}function qT(e,t,n){const{setNodes:r,setVariables:o}=e.getState();let i={},l={},c=!1,d=!1;return r(f=>{const g=f.findIndex(b=>b.id===t);if(g===-1)return f;const h=f[g];if(!h)return f;d=!0;const v=h.data;i=Uu(v);let x;if(n.arguments){const b=n.functionInfo?n.arguments:{...v.arguments,...n.arguments};x={...v,...n,arguments:b}}else x={...v,...n};l=Uu(x);const S=f.map((b,N)=>N===g?{...b,data:x}:b),w=Object.keys(i),E=Object.keys(l);return c=w.length!==E.length||E.some(b=>{const N=i[b],k=l[b];return!N||!k||N.name!==k.name||N.dataType!==k.dataType}),S}),c&&o(f=>{const g={...f};for(const h of Object.keys(i))h in l||delete g[el(t,h)];for(const[h,v]of Object.entries(l)){const x=el(t,h),S=f[x];(!S||S.name!==v.name||S.dataType!==v.dataType)&&(g[x]={kind:"node",nodeId:t,outputId:h,name:v.name,dataType:v.dataType})}return g}),d}function Yb(e,t,n){const{nodes:r,edges:o,setNodes:i,setEdges:l,setVariables:c}=e.getState(),d=r.find(g=>g.id===t);if(!d||n&&(n(d.data)?.isUnremovable??!1))return!1;i(g=>g.filter(h=>h.id!==t)),l(g=>g.filter(h=>h.source!==t&&h.target!==t));const f=Object.keys(Uu(d.data));return f.length>0&&c(g=>{const h={...g};for(const v of f)delete h[el(t,v)];return h}),!0}function $X(e,t,n){const r=t.data.type==="Agent",o=n.data.type==="Agent";return e==="control"?r&&o?"agentDelegate":o?"agentTask":r?"agentChoice":"control":e}function Xb(e,t){const{nodes:n,edges:r,setEdges:o}=e.getState(),i=nE(t.source,t.target,t.sourceHandle,t.targetHandle,n,r);if(!i)return!1;const l=n.find(f=>f.id===t.source),c=n.find(f=>f.id===t.target);if(!l||!c)return!1;const d=$X(i,l,c);return o(f=>YE({...t,type:d},f)),d}function LX(e,t,n){const{edges:r,setEdges:o}=e.getState();return r.find(l=>l.id===t)?(o(l=>l.map(c=>c.id===t?{...c,data:{...c.data,...n}}:c)),!0):!1}function qb(e,t){const{setEdges:n}=e.getState(),r=new Set(t);n(o=>o.filter(i=>!r.has(i.id)))}function FX(e,t,n={x:50,y:50},r){const o={pasted:!1,skippedLabels:[]};if(t.nodes.length===0)return o;const{setNodes:i,setEdges:l,setVariables:c}=e.getState(),d=[],f=t.nodes.filter(S=>{if(!r)return!0;const w=r(S.data);return w?XT(e,w)?!0:(d.push(w.label),!1):!0});if(f.length===0)return{pasted:!1,skippedLabels:d};const g=new Map;f.forEach(S=>{const w=ln();g.set(S.id,w)});const h=f.map(S=>{const w=g.get(S.id),E=JSON.parse(JSON.stringify(S.data));return E.id=w,E.arguments=ZT(Sd(E),g),{...S,id:w,position:{x:S.position.x+n.x,y:S.position.y+n.y},data:E,selected:!0}}),v=GT(e);for(const S of h)YT(S.data,v);const x=t.edges.filter(S=>g.has(S.source)&&g.has(S.target)).map(S=>{const w={...S,id:ln(),source:g.get(S.source),target:g.get(S.target),data:S.data?{...S.data}:S.data};if(w.data?.prompt&&es(w.data.prompt)){const E=w.data.prompt;w.data={...w.data,prompt:{...E,references:E.references.map(b=>({srcId:g.get(b.srcId)??b.srcId,varId:b.varId}))}}}return w});return i(S=>[...S.map(w=>({...w,selected:!1})),...h]),l(S=>[...S,...x]),c(S=>({...S,...qd(h.map(w=>w.data))})),{pasted:!0,skippedLabels:d}}function ZT(e,t){const n={};for(const[r,o]of Object.entries(e))if(es(o)){const i={expression:o.expression,dataType:o.dataType,references:o.references.map(l=>({srcId:t.get(l.srcId)??l.srcId,varId:l.varId}))};n[r]=i}else Array.isArray(o)?n[r]=o.map(i=>es(i)?{expression:i.expression,dataType:i.dataType,references:i.references.map(l=>({srcId:t.get(l.srcId)??l.srcId,varId:l.varId}))}:i):o!==null&&typeof o=="object"?n[r]=ZT(o,t):n[r]=o;return n}function QT(e){if(e==="FunctionCall")return"FunctionCall";const t=Lt.getByType(e)?.category??"Uncategorized";switch(t){case xe.Trigger:case xe.Tool:case xe.AI:return t;default:return"Standard"}}function zX(e,t){const n=e.arguments,r={};for(const o of t.arguments){const i=Jo(o),l=n[i];r[i]=l?{...l,dataType:o.dataType}:{expression:"",references:[],dataType:o.dataType}}for(const o of t.returns){const i=Jo(o),l=n[i];r[i]=l??{active:!0,mode:"emit",name:o.name}}return{functionInfo:{...t},arguments:r}}function JT(){const e=Qm(),t={};for(const[r,o]of Object.entries(ue.getState().functions))t[r]=Td(o);let n=0;for(const[,r]of Object.entries(e)){const o=r.getState().nodes;for(const i of o){if(i.data.type!=="FunctionCall")continue;const l=i.data,c=t[l.functionInfo.id];c&&(l.functionInfo.version===c.version&&l.functionInfo.name===c.name||(qT(r,i.id,zX(l,c)),n++))}}n>0&&Gt({title:mr.t("functionCallNodesMigrated"),description:mr.t("functionCallNodesMigratedDesc",{count:n})})}let Zb=ue.getState().functions;ue.subscribe(e=>{e.functions!==Zb&&(Zb=e.functions,JT())});const VX=({canvasId:e,selectedNode:t,onNodeUpdate:n,onNodeDelete:r,onClose:o,onOpenTest:i,getNodeDef:l})=>{const{t:c}=Xe(),d=ue(U=>wn(U.builderMode)),[f,g]=m.useState(t.label||""),[h,v]=m.useState(!1);m.useEffect(()=>{g(t.label||"")},[t.id,t.label]);const x=t.type==="FunctionCall"?t.functionInfo.id:null,{getFunction:S}=Qd(),w=x?S(x):void 0,E=t.type!=="FunctionCall"||!w?!1:t.functionInfo.version!==w.version,b=t.type==="FunctionCall"?Jm({...t.functionInfo,name:w?.name??t.functionInfo.name}):l(t),N=b?.isUnremovable??!1,k=et(e)(U=>U.edges),P=m.useMemo(()=>tl(t.id,t,k),[t,k]),A=Ye(U=>U.byNodeId[t.id]),I=Ry(A);if(!b)return p.jsx("div",{className:"p-4",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:c("unknownNodeType",{type:t.type})})});const R=Sd(t),j=b.parameters.filter(U=>Tr(U,R,P)),L=(b.outputs??[]).length>0;return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"group flex items-center gap-1.5 rounded-md border border-transparent px-1.5 -mx-1.5 hover:border-input focus-within:border-input transition-colors",children:p.jsx("input",{type:"text",title:c("nodeLabel"),className:"font-semibold text-lg bg-transparent w-full outline-none cursor-text py-0.5",value:h?f:f||b.label,readOnly:d,onFocus:()=>{d||(v(!0),f||g(b.label))},onBlur:()=>{v(!1),(!f||f===b.label)&&(g(""),n(t.id,{label:void 0}))},onChange:U=>{g(U.target.value),n(t.id,{label:U.target.value})}})}),p.jsx("p",{className:"text-sm text-muted-foreground",children:WC(c,b)})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"shrink-0",onClick:o,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),d&&p.jsx($l,{}),j.length>0&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx("div",{className:`space-y-3 ${d?"pointer-events-none opacity-60":""}`,children:j.map(U=>p.jsx(Py,{canvasId:e,parameter:U,value:R[U.id],allArguments:R,onChange:$=>n(t.id,{arguments:{[U.id]:$}}),errors:I.get(U.id),translationPrefix:`nodes.${t.type}`},U.id))})]}),!d&&E&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsxs(gt,{variant:"outline",className:"w-full border-warning text-warning hover:bg-warning/10",onClick:()=>JT(),children:[p.jsx(Rz,{className:"w-4 h-4 mr-2"}),c("updateToLatestDefinition")]})]}),!d&&L&&!P&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(UX,{canvasId:e,node:t,nodeDefinition:b,onNodeUpdate:n,nodeDiags:A})]}),!d&&t.type==="Agent"&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(gt,{variant:"outline",className:"w-full",onClick:()=>i(t.id),children:c("testAgent")})]}),!d&&!N&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(zi,{onClick:()=>r(t.id),children:c("deleteNode")})]})]})})},HX=["int","float","bool","string"],BX={int:"int",float:"float",bool:"bool",string:"string"};function WX(e,t){return`${e}[${t}]`}function Qb(e){return e.kind==="node"?{srcId:e.nodeId,varId:e.outputId}:e.kind==="declared"?{srcId:"declared",varId:e.uid}:{srcId:"fnarg",varId:e.uid}}function UX({canvasId:e,node:t,nodeDefinition:n,onNodeUpdate:r,nodeDiags:o}){const{t:i}=Xe(),{list:l}=Li(e),c=m.useMemo(()=>S1(t),[t]),d=m.useMemo(()=>(n.outputs??[]).filter(b=>b.type==="static"),[n]),f=m.useMemo(()=>(n.outputs??[]).filter(b=>b.type==="list"),[n]),g=m.useMemo(()=>{const b=new Map;if(!o)return b;for(const N of o)if(N.outputId&&N.severity==="error"){const k=b.get(N.outputId);k?k.push(N.message):b.set(N.outputId,[N.message])}return b},[o]),h=m.useCallback((b,N)=>{r(t.id,{arguments:{[b]:N}})},[t.id,r]),v=m.useCallback((b,N)=>r(t.id,{arguments:{[b]:N}}),[t.id,r]),x=m.useCallback(b=>l.filter(N=>N.dataType===b&&!("nodeId"in N&&N.nodeId===t.id)),[l,t.id]);if(d.length===0&&f.length===0)return null;const S=(b,N,k)=>{const P=b1(t,b)??{active:!0,mode:"emit",name:N.name},A=x(N.dataType),I=g.get(b),R=!!I?.length,j=P.active,L=$=>{$!==j&&h(b,{...P,active:$})},U=$=>{$!==P.mode&&($==="emit"?h(b,{active:P.active,mode:"emit",name:N.name}):h(b,{active:P.active,mode:"assign",target:{srcId:"",varId:""}}))};return p.jsxs("div",{className:`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${R?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(KT,{checked:j,onCheckedChange:$=>L($===!0),"aria-label":i("outputBinding.enable","Enable output"),className:"shrink-0"}),p.jsx("span",{className:`text-xs font-medium flex-1 truncate ${j?"":"opacity-50"}`,children:k}),p.jsx("span",{className:`text-xs text-muted-foreground ${j?"":"opacity-50"}`,children:BX[N.dataType]})]}),p.jsxs("div",{className:j?"":"opacity-50",children:[p.jsxs("div",{className:`flex items-center gap-2 ${j?"":"pointer-events-none"}`,children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:$=>$&&U($),className:"gap-0",children:[p.jsx(Yo,{value:"emit",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-r-none","aria-label":i("outputBinding.emit","Emit"),title:i("outputBinding.emit","Emit"),children:p.jsx(ts,{className:"w-3.5 h-3.5"})}),p.jsx(Yo,{value:"assign",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-l-none -ml-px","aria-label":i("outputBinding.assign","Assign"),title:i("outputBinding.assign","Assign"),children:p.jsx(V0,{className:"w-3.5 h-3.5"})})]}),P.mode==="emit"?p.jsx(Mt,{className:"h-7 text-xs flex-1",value:P.name,disabled:!j,onChange:$=>h(b,{active:P.active,mode:"emit",name:$.target.value})}):A.length>0?p.jsxs(br,{value:P.target.srcId?vr(P.target):"",onValueChange:$=>{const B=l.find(G=>so(G)===$);B&&h(b,{active:P.active,mode:"assign",target:Qb(B)})},disabled:!j,children:[p.jsx(qn,{className:"h-7 text-xs flex-1",children:p.jsx(Sr,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(Zn,{children:A.map($=>p.jsx(an,{value:so($),children:$.name},so($)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),R&&p.jsx("div",{className:"space-y-0.5",children:I.map(($,B)=>p.jsx("p",{className:"text-xs text-destructive",children:$},B))})]})]},b)},w=(b,N,k)=>{const P=N[k];if(!P)return null;const A=x(P.dataType),I=WX(b,k),R=g.get(I),j=!!R?.length,L=_=>v(b,N.map((O,M)=>M===k?_:O)),U=()=>v(b,N.filter((_,O)=>O!==k)),$=_=>{P.mode!==_&&L(_==="emit"?{mode:"emit",uid:ln(),name:P.name,dataType:P.dataType}:{mode:"assign",name:P.name,dataType:P.dataType,target:{srcId:"",varId:""}})},B=_=>L({...P,name:_}),G=_=>L({...P,dataType:_});return p.jsxs("div",{className:`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${j?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(gt,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:U,children:p.jsx(El,{className:"w-3.5 h-3.5"})}),p.jsx(Mt,{className:"h-7 text-xs flex-1",value:P.name,placeholder:i("outputBinding.name","Name"),onChange:_=>B(_.target.value)}),p.jsxs(br,{value:P.dataType,onValueChange:_=>G(_),children:[p.jsx(qn,{className:"h-7 text-xs w-20",children:p.jsx(Sr,{})}),p.jsx(Zn,{children:HX.map(_=>p.jsx(an,{value:_,children:_},_))})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:_=>_&&$(_),className:"gap-0",children:[p.jsx(Yo,{value:"emit",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-r-none","aria-label":i("outputBinding.emit","Emit"),title:i("outputBinding.emit","Emit"),children:p.jsx(ts,{className:"w-3.5 h-3.5"})}),p.jsx(Yo,{value:"assign",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-l-none -ml-px","aria-label":i("outputBinding.assign","Assign"),title:i("outputBinding.assign","Assign"),children:p.jsx(V0,{className:"w-3.5 h-3.5"})})]}),P.mode==="emit"?p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.emitHint","creates new variable in scope")}):A.length>0?p.jsxs(br,{value:P.target.srcId?vr(P.target):"",onValueChange:_=>{const O=l.find(M=>so(M)===_);O&&L({...P,target:Qb(O)})},children:[p.jsx(qn,{className:"h-7 text-xs flex-1",children:p.jsx(Sr,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(Zn,{children:A.map(_=>p.jsx(an,{value:so(_),children:_.name},so(_)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),j&&p.jsx("div",{className:"space-y-0.5",children:R.map((_,O)=>p.jsx("p",{className:"text-xs text-destructive",children:_},O))})]},`${b}-${P.mode==="emit"?P.uid:`assign-${k}`}`)},E=(b,N)=>{const k={mode:"emit",uid:ln(),name:`output${N.length+1}`,dataType:"string"};v(b,[...N,k])};return p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:i("outputs","Outputs")}),p.jsxs("div",{className:"space-y-2",children:[d.map(b=>{const N=c[b.id];return N?S(b.id,N,b.label):null}),f.map(b=>{const N=t.arguments[b.id]??[];return p.jsxs(m.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[p.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:b.label}),p.jsx("div",{className:"flex-1 h-px bg-border/60"})]}),N.map((k,P)=>w(b.id,N,P)),p.jsx(ss,{onClick:()=>E(b.id,N),children:i("addOutput",{label:b.label,defaultValue:`Add ${b.label.toLowerCase()}`})})]},b.id)})]})]})}const KX=["int","float","bool","string"],GX=({canvasId:e,variable:t,onClose:n})=>{const{t:r}=Xe(),o=ue(f=>wn(f.builderMode)),[i,l]=m.useState(t.name);m.useEffect(()=>{l(t.name)},[t.uid,t.name]);const c=t.name.trim()==="",d=()=>{switch(t.dataType){case"bool":return p.jsxs(br,{value:t.initialValue!=null?String(t.initialValue):"false",onValueChange:f=>Ha(e,t.uid,{initialValue:f==="true"}),children:[p.jsx(qn,{className:"h-8 text-sm",children:p.jsx(Sr,{})}),p.jsxs(Zn,{children:[p.jsx(an,{value:"false",children:"false"}),p.jsx(an,{value:"true",children:"true"})]})]});case"string":return p.jsx(Mt,{className:"h-8 text-sm",value:t.initialValue??"",onChange:f=>Ha(e,t.uid,{initialValue:f.target.value}),placeholder:'""'});case"int":case"float":return p.jsx(Mt,{type:"number",step:t.dataType==="float"?"any":1,className:"h-8 text-sm",value:t.initialValue!=null?Number(t.initialValue):"",onChange:f=>{const g=t.dataType==="float"?parseFloat(f.target.value):parseInt(f.target.value,10);Ha(e,t.uid,{initialValue:isNaN(g)?void 0:g})},placeholder:"0"});default:return null}};return p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"group flex items-center gap-1.5 rounded-md border border-transparent px-1.5 -mx-1.5 hover:border-input focus-within:border-input transition-colors",children:p.jsx("input",{type:"text",title:r("variableName","Variable name"),className:"font-semibold text-lg font-mono bg-transparent w-full outline-none cursor-text py-0.5",value:i,readOnly:o,onChange:f=>{l(f.target.value),Ha(e,t.uid,{name:f.target.value})}})}),p.jsx("p",{className:"text-sm text-muted-foreground",children:r("variableDescription","A declared variable you can read and write across this canvas")}),c&&p.jsx("p",{className:"text-xs text-destructive mt-1",children:r("variableNameRequired","Name is required")})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"shrink-0",onClick:n,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),o&&p.jsx($l,{}),p.jsx($t,{}),p.jsxs("div",{className:`space-y-4 ${o?"pointer-events-none opacity-60":""}`,children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("label",{className:"text-xs font-medium text-foreground/80",children:r("dataType","Data type")}),p.jsxs(br,{value:t.dataType,onValueChange:f=>RB(e,t.uid,f),children:[p.jsx(qn,{className:"h-8 text-sm",children:p.jsx(Sr,{})}),p.jsx(Zn,{children:KX.map(f=>p.jsx(an,{value:f,children:f},f))})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("label",{className:"text-xs font-medium text-foreground/80",children:[r("initialValue")," ",p.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",r("optional","optional"),")"]})]}),d()]})]}),!o&&p.jsxs(p.Fragment,{children:[p.jsx($t,{}),p.jsx(zi,{onClick:()=>IB(e,t.uid),children:r("deleteVariable","Delete variable")})]})]})})},YX=({canvasId:e,isDebugMode:t,selectionDrag:n,getNodeDef:r,onNodeUpdate:o,onNodeDelete:i,onEdgeUpdate:l,onEdgeDelete:c,onClearSelection:d,onTestNode:f,onDebugStep:g})=>{const h=ue(G=>G.selection),v=ue(G=>G.clearSelection),x=ue(G=>G.channels),S=ue(G=>G.memory),w=ue(G=>G.models),E=ue(G=>G.functions),b=et(e),N=b(m.useCallback(G=>h.kind!=="graph"||h.nodeIds.length!==1?null:G.nodes.find(O=>O.id===h.nodeIds[0])?.data??null,[h])),k=b(m.useCallback(G=>{if(h.kind!=="variable")return null;const _=G.variables[Pi(h.uid)];return _&&_.kind==="declared"?_:null},[h])),P=b(m.useCallback(G=>h.kind!=="graph"||h.edgeIds.length!==1||h.nodeIds.length>0?null:G.edges.find(_=>_.id===h.edgeIds[0])??null,[h])),A=P?{id:P.id,source:P.source,type:P.type??"control",data:P.data??{}}:null,I=b(m.useCallback(G=>A?G.edges.filter(_=>_.source===A.source&&cm(_.type)).length:0,[A?.source])),R=m.useMemo(()=>h.kind==="channel"?Object.values(x).find(G=>G.id===h.id)??null:null,[h,x]),j=m.useMemo(()=>h.kind==="memory"?Object.values(S).find(G=>G.id===h.id)??null:null,[h,S]),L=m.useMemo(()=>h.kind==="model"?Object.values(w).find(G=>G.id===h.id)??null:null,[h,w]),U=m.useMemo(()=>h.kind==="function"?E[h.id]??null:null,[h,E]),$=m.useCallback(G=>r(G)?.category,[r]),B=m.useCallback(G=>f?.(G),[f]);return n?null:t?N?p.jsx(ro,{bg:"bg-background",pad:!0,children:p.jsx(qY,{canvasId:e,onStep:g??(()=>{}),getNodeCategory:$})}):null:N?p.jsx(ro,{children:p.jsx(VX,{canvasId:e,selectedNode:N,onNodeUpdate:o,onNodeDelete:i,onClose:d,onOpenTest:B,getNodeDef:r})}):A?p.jsx(ro,{children:p.jsx(JY,{canvasId:e,edgeId:A.id,edgeType:A.type,edgeData:A.data,sourceControlEdgeCount:I,onEdgeUpdate:l,onEdgeDelete:c,onClose:d})}):k?p.jsx(ro,{children:p.jsx(GX,{canvasId:e,variable:k,onClose:v})}):R?p.jsx(ro,{children:p.jsx(XY,{channel:R,onClose:v})}):j?p.jsx(ro,{children:p.jsx(_X,{memory:j,onClose:v})}):L?p.jsx(ro,{children:p.jsx(AX,{model:L,onClose:v})}):U?p.jsx(ro,{children:p.jsx(IX,{func:U,onClose:v})}):null},ro=({bg:e="bg-card",pad:t=!1,children:n})=>p.jsx(Di,{className:Ce("w-80 border-l border-border",e),viewportClassName:t?"p-3":void 0,children:n}),XX=(e=We)=>{const t=et(e);return{undo:t.undo,redo:t.redo,takeCheckpoint:t.takeCheckpoint,withCheckpoint:t.withCheckpoint,clearHistory:t.clearHistory,canUndo:t.canUndo,canRedo:t.canRedo}},Jb={current:null},qX=(e=We,t=!1)=>{const n=et(e),r=n(N=>N.nodes),o=n(N=>N.edges),{withCheckpoint:i}=n,{getNodeDefinition:l}=ey(),c=m.useCallback(N=>{if(!t)return i(N)},[t,i]),d=m.useCallback((N,k)=>c(()=>Gb(n,N,k))??null,[n,c]),f=m.useCallback((N,k)=>{c(()=>qT(n,N,k))},[n,c]),g=m.useCallback(N=>{c(()=>Yb(n,N,l))},[n,l,c]),h=m.useCallback(N=>c(()=>Xb(n,N))??!1,[n,c]),v=m.useCallback((N,k)=>{c(()=>LX(n,N,k))},[n,c]),x=m.useCallback(N=>{c(()=>qb(n,N))},[n,c]),S=m.useCallback((N,k)=>{N.length===0&&k.length===0||c(()=>{for(const P of N)Yb(n,P,l);k.length>0&&qb(n,k)})},[n,l,c]),w=m.useCallback(N=>{if(N.length===0)return;const k=new Set(N),P=r.filter(I=>k.has(I.id)).map(I=>JSON.parse(JSON.stringify(I))),A=o.filter(I=>k.has(I.source)&&k.has(I.target)).map(I=>JSON.parse(JSON.stringify(I)));Jb.current={nodes:P,edges:A}},[r,o]),E=m.useCallback(N=>{const k=Jb.current;if(k)return c(()=>FX(n,k,N,l))},[n,l,c]),b=m.useCallback((N,k,P)=>c(()=>{const A=Gb(n,N,k);return A==null?null:(Xb(n,{...P,target:A}),A)})??null,[n,c]);return{nodes:r,edges:o,addNode:d,updateNode:f,updateEdge:v,deleteNode:g,deleteEdges:x,deleteSelected:S,onConnect:h,addNodeAndConnect:b,copySelection:w,pasteSelection:E}},ZX=()=>{const{t:e}=Xe(),t=is(o=>o.console),n=is(o=>o.clearConsole),r=m.useRef(null);return m.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t]),p.jsxs("div",{className:"h-full flex flex-col bg-background border-t border-border",children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[p.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:e("debug.console")}),p.jsx(gt,{variant:"ghost",size:"icon",className:"w-6 h-6 text-muted-foreground hover:text-foreground",onClick:n,title:e("debug.clearConsole"),children:p.jsx(El,{className:"w-3.5 h-3.5"})})]}),p.jsx(Di,{className:"flex-1",viewportRef:r,viewportClassName:"p-2",children:p.jsx("div",{className:"font-mono text-xs space-y-0.5",children:t.length===0?p.jsx("div",{className:"text-muted-foreground text-center py-4",children:e("debug.consoleEmpty")}):t.map(o=>p.jsx(QX,{entry:o},o.id))})})]})};function QX({entry:e}){const t=new Date(e.timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),n=e.type==="error"?"text-destructive":e.type==="system"?"text-muted-foreground":"text-foreground";return p.jsxs("div",{className:`flex gap-2 leading-relaxed ${n}`,children:[p.jsx("span",{className:"text-muted-foreground/50 shrink-0",children:t}),p.jsx("span",{className:"whitespace-pre-wrap break-all",children:e.text})]})}const JX=({functions:e,onOpenFunction:t,onCreateFunction:n,canvasTabs:r,onCanvasTabChange:o,onCanvasTabClose:i,onCanvasTabReorder:l,onTestNode:c,onDebugStep:d})=>{const f=ue(K=>K.activeCanvasId),g=ue(K=>K.builderMode),h=wn(g),v=g.type==="debug",{nodeDefinitions:x,getNodeDefinition:S,getAllCategories:w}=ey(),E=qX(f,h),{undo:b,redo:N,takeCheckpoint:k,canUndo:P,canRedo:A}=XX(f),I=ue(K=>K.selection),R=ue(K=>K.selectGraph),j=ue(K=>K.syncSelectionFromRF),L=ue(K=>K.clearSelection),U=ue(K=>K.activeSidebarTab),$=ue(K=>K.setActiveSidebarTab);m.useEffect(()=>{const K=U==="debug-context";v&&!K?$("debug-context"):!v&&K&&$("nodes")},[v,U,$]);const[B,G]=m.useState(!1),_=m.useRef(null),O=m.useCallback(K=>R([K],[]),[R]),M=m.useCallback(K=>R([],[K]),[R]),z=m.useCallback((K,q)=>{const oe=q??_.current?.(),ce=E.addNode(K,oe);return ce==null&&Gt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),ce},[E]),H=m.useCallback(K=>{const q=E.onConnect(K);if(q&&q!=="control"&&q!=="tool"){const{edges:oe}=et(f).getState(),ce=oe.find(ge=>ge.source===K.source&&ge.target===K.target&&ge.sourceHandle===K.sourceHandle&&ge.targetHandle===K.targetHandle);ce&&M(ce.id)}},[E,f,M]),W=m.useCallback((K,q,oe)=>{const ce=E.addNodeAndConnect(K,q,oe);return ce==null&&Gt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),ce},[E]),Z=m.useCallback(({nodes:K,edges:q})=>{j(K.map(oe=>oe.id),q.map(oe=>oe.id))},[j]),F=m.useCallback(K=>{E.deleteEdges([K]),L()},[E,L]),V=m.useCallback(()=>{k()},[k]),X=m.useCallback(()=>{const K=ue.getState().selection,q=K.kind==="graph"?K.nodeIds:[],oe=K.kind==="graph"?K.edgeIds:[];E.deleteSelected(q,oe),L()},[E,L]),Q=m.useCallback(K=>{const q=E.pasteSelection(K);if(q?.skippedLabels.length)for(const oe of q.skippedLabels)Gt({title:`Only one ${oe} node allowed per canvas`,variant:"destructive"});return q},[E]);m.useEffect(()=>{const K=q=>{const oe=q.target;if(!(oe?.tagName==="INPUT"||oe?.tagName==="TEXTAREA"||oe?.isContentEditable)){if(h){q.key==="Escape"&&L();return}if((q.ctrlKey||q.metaKey)&&q.key==="z"&&!q.shiftKey){q.preventDefault(),P()&&(L(),b());return}if((q.ctrlKey||q.metaKey)&&(q.key==="y"||q.key==="z"&&q.shiftKey)){q.preventDefault(),A()&&(L(),N());return}if((q.ctrlKey||q.metaKey)&&q.key==="c"){I.kind==="graph"&&I.nodeIds.length>0&&(q.preventDefault(),E.copySelection(I.nodeIds));return}if((q.ctrlKey||q.metaKey)&&q.key==="v"){q.preventDefault(),Q();return}(q.key==="Delete"||q.key==="Backspace")&&X(),q.key==="Escape"&&L()}};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[P,A,b,N,L,X,I,E,Q,h]);const ee=f!==We,ne=p.jsxs("div",{className:"flex flex-col h-full min-w-0",children:[p.jsx(WB,{tabs:r,activeTabId:f,onTabChange:o,onTabClose:i,onTabReorder:l}),p.jsx("div",{className:"flex-1 relative",children:p.jsx($G,{canvasId:f,viewportCenterRef:_,nodeDefinitions:x,onConnect:H,onAddNode:z,onAddNodeAndConnect:W,onSelectionChange:Z,onPaneClick:L,onNodeDragStart:V,setSelectionDrag:G},f)})]});return p.jsx("div",{className:"h-full bg-canvas-bg flex flex-col",children:p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsx(BB,{canvasId:f,activeTab:U,onTabChange:$,onAddNode:z,nodeDefinitions:x,getAllCategories:w,onSelectNode:O,onSelectEdge:M,isFunctionCanvas:ee,functions:e,onOpenFunction:t,onCreateFunction:n,isDebugMode:v}),p.jsx("div",{className:"flex-1 flex flex-col h-full min-w-0",children:v?p.jsxs($4,{direction:"vertical",children:[p.jsx(hw,{defaultSize:75,minSize:30,children:ne}),p.jsx(L4,{withHandle:!0}),p.jsx(hw,{defaultSize:25,minSize:10,children:p.jsx(ZX,{})})]}):ne}),p.jsx(YX,{canvasId:f,isDebugMode:v,selectionDrag:B,getNodeDef:S,onNodeUpdate:E.updateNode,onNodeDelete:E.deleteNode,onEdgeUpdate:E.updateEdge,onEdgeDelete:F,onClearSelection:L,onTestNode:c,onDebugStep:d})]})})};var My="ToastProvider",[Dy,eq,tq]=yf("Toast"),[eP]=Ft("Toast",[tq]),[nq,Cf]=eP(My),tP=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:i=50,children:l}=e,[c,d]=m.useState(null),[f,g]=m.useState(0),h=m.useRef(!1),v=m.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${My}\`. Expected non-empty \`string\`.`),p.jsx(Dy.Provider,{scope:t,children:p.jsx(nq,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:f,viewport:c,onViewportChange:d,onToastAdd:m.useCallback(()=>g(x=>x+1),[]),onToastRemove:m.useCallback(()=>g(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:v,children:l})})};tP.displayName=My;var nP="ToastViewport",rq=["F8"],om="toast.viewportPause",sm="toast.viewportResume",rP=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=rq,label:o="Notifications ({hotkey})",...i}=e,l=Cf(nP,n),c=eq(n),d=m.useRef(null),f=m.useRef(null),g=m.useRef(null),h=m.useRef(null),v=De(t,h,l.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=l.toastCount>0;m.useEffect(()=>{const E=b=>{r.length!==0&&r.every(k=>b[k]||b.code===k)&&h.current?.focus()};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[r]),m.useEffect(()=>{const E=d.current,b=h.current;if(S&&E&&b){const N=()=>{if(!l.isClosePausedRef.current){const I=new CustomEvent(om);b.dispatchEvent(I),l.isClosePausedRef.current=!0}},k=()=>{if(l.isClosePausedRef.current){const I=new CustomEvent(sm);b.dispatchEvent(I),l.isClosePausedRef.current=!1}},P=I=>{!E.contains(I.relatedTarget)&&k()},A=()=>{E.contains(document.activeElement)||k()};return E.addEventListener("focusin",N),E.addEventListener("focusout",P),E.addEventListener("pointermove",N),E.addEventListener("pointerleave",A),window.addEventListener("blur",N),window.addEventListener("focus",k),()=>{E.removeEventListener("focusin",N),E.removeEventListener("focusout",P),E.removeEventListener("pointermove",N),E.removeEventListener("pointerleave",A),window.removeEventListener("blur",N),window.removeEventListener("focus",k)}}},[S,l.isClosePausedRef]);const w=m.useCallback(({tabbingDirection:E})=>{const N=c().map(k=>{const P=k.ref.current,A=[P,...mq(P)];return E==="forwards"?A:A.reverse()});return(E==="forwards"?N.reverse():N).flat()},[c]);return m.useEffect(()=>{const E=h.current;if(E){const b=N=>{const k=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!k){const A=document.activeElement,I=N.shiftKey;if(N.target===E&&I){f.current?.focus();return}const L=w({tabbingDirection:I?"backwards":"forwards"}),U=L.findIndex($=>$===A);fg(L.slice(U+1))?N.preventDefault():I?f.current?.focus():g.current?.focus()}};return E.addEventListener("keydown",b),()=>E.removeEventListener("keydown",b)}},[c,w]),p.jsxs(Y3,{ref:d,role:"region","aria-label":o.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&p.jsx(im,{ref:f,onFocusFromOutsideViewport:()=>{const E=w({tabbingDirection:"forwards"});fg(E)}}),p.jsx(Dy.Slot,{scope:n,children:p.jsx(ke.ol,{tabIndex:-1,...i,ref:v})}),S&&p.jsx(im,{ref:g,onFocusFromOutsideViewport:()=>{const E=w({tabbingDirection:"backwards"});fg(E)}})]})});rP.displayName=nP;var oP="ToastFocusProxy",im=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=Cf(oP,n);return p.jsx(Kd,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});im.displayName=oP;var Ll="Toast",oq="toast.swipeStart",sq="toast.swipeMove",iq="toast.swipeCancel",aq="toast.swipeEnd",sP=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...l}=e,[c,d]=cn({prop:r,defaultProp:o??!0,onChange:i,caller:Ll});return p.jsx(Pt,{present:n||c,children:p.jsx(uq,{open:c,...l,ref:t,onClose:()=>d(!1),onPause:pt(e.onPause),onResume:pt(e.onResume),onSwipeStart:ve(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ve(e.onSwipeMove,f=>{const{x:g,y:h}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${g}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:ve(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ve(e.onSwipeEnd,f=>{const{x:g,y:h}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${g}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),d(!1)})})})});sP.displayName=Ll;var[lq,cq]=eP(Ll,{onClose(){}}),uq=m.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:l,onEscapeKeyDown:c,onPause:d,onResume:f,onSwipeStart:g,onSwipeMove:h,onSwipeCancel:v,onSwipeEnd:x,...S}=e,w=Cf(Ll,n),[E,b]=m.useState(null),N=De(t,_=>b(_)),k=m.useRef(null),P=m.useRef(null),A=o||w.duration,I=m.useRef(0),R=m.useRef(A),j=m.useRef(0),{onToastAdd:L,onToastRemove:U}=w,$=pt(()=>{E?.contains(document.activeElement)&&w.viewport?.focus(),l()}),B=m.useCallback(_=>{!_||_===1/0||(window.clearTimeout(j.current),I.current=new Date().getTime(),j.current=window.setTimeout($,_))},[$]);m.useEffect(()=>{const _=w.viewport;if(_){const O=()=>{B(R.current),f?.()},M=()=>{const z=new Date().getTime()-I.current;R.current=R.current-z,window.clearTimeout(j.current),d?.()};return _.addEventListener(om,M),_.addEventListener(sm,O),()=>{_.removeEventListener(om,M),_.removeEventListener(sm,O)}}},[w.viewport,A,d,f,B]),m.useEffect(()=>{i&&!w.isClosePausedRef.current&&B(A)},[i,A,w.isClosePausedRef,B]),m.useEffect(()=>(L(),()=>U()),[L,U]);const G=m.useMemo(()=>E?fP(E):null,[E]);return w.viewport?p.jsxs(p.Fragment,{children:[G&&p.jsx(dq,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:G}),p.jsx(lq,{scope:n,onClose:$,children:hs.createPortal(p.jsx(Dy.ItemSlot,{scope:n,children:p.jsx(G3,{asChild:!0,onEscapeKeyDown:ve(c,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(ke.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...S,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ve(e.onKeyDown,_=>{_.key==="Escape"&&(c?.(_.nativeEvent),_.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:ve(e.onPointerDown,_=>{_.button===0&&(k.current={x:_.clientX,y:_.clientY})}),onPointerMove:ve(e.onPointerMove,_=>{if(!k.current)return;const O=_.clientX-k.current.x,M=_.clientY-k.current.y,z=!!P.current,H=["left","right"].includes(w.swipeDirection),W=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,Z=H?W(0,O):0,F=H?0:W(0,M),V=_.pointerType==="touch"?10:2,X={x:Z,y:F},Q={originalEvent:_,delta:X};z?(P.current=X,Ru(sq,h,Q,{discrete:!1})):e1(X,w.swipeDirection,V)?(P.current=X,Ru(oq,g,Q,{discrete:!1}),_.target.setPointerCapture(_.pointerId)):(Math.abs(O)>V||Math.abs(M)>V)&&(k.current=null)}),onPointerUp:ve(e.onPointerUp,_=>{const O=P.current,M=_.target;if(M.hasPointerCapture(_.pointerId)&&M.releasePointerCapture(_.pointerId),P.current=null,k.current=null,O){const z=_.currentTarget,H={originalEvent:_,delta:O};e1(O,w.swipeDirection,w.swipeThreshold)?Ru(aq,x,H,{discrete:!0}):Ru(iq,v,H,{discrete:!0}),z.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),dq=e=>{const{__scopeToast:t,children:n,...r}=e,o=Cf(Ll,t),[i,l]=m.useState(!1),[c,d]=m.useState(!1);return hq(()=>l(!0)),m.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:p.jsx(Mi,{asChild:!0,children:p.jsx(Kd,{...r,children:i&&p.jsxs(p.Fragment,{children:[o.label," ",n]})})})},fq="ToastTitle",iP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(ke.div,{...r,ref:t})});iP.displayName=fq;var pq="ToastDescription",aP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(ke.div,{...r,ref:t})});aP.displayName=pq;var lP="ToastAction",cP=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?p.jsx(dP,{altText:n,asChild:!0,children:p.jsx(jy,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${lP}\`. Expected non-empty \`string\`.`),null)});cP.displayName=lP;var uP="ToastClose",jy=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=cq(uP,n);return p.jsx(dP,{asChild:!0,children:p.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,o.onClose)})})});jy.displayName=uP;var dP=m.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return p.jsx(ke.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function fP(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),gq(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...fP(r))}}),t}function Ru(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?gm(o,i):o.dispatchEvent(i)}var e1=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),i=r>o;return t==="left"||t==="right"?i&&r>n:!i&&o>n};function hq(e=()=>{}){const t=pt(e);wt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function gq(e){return e.nodeType===e.ELEMENT_NODE}function mq(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fg(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var yq=tP,pP=rP,hP=sP,gP=iP,mP=aP,yP=cP,vP=jy;const vq=yq,xP=m.forwardRef(({className:e,...t},n)=>p.jsx(pP,{ref:n,className:Ce("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));xP.displayName=pP.displayName;const xq=yo("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),wP=m.forwardRef(({className:e,variant:t,...n},r)=>p.jsx(hP,{ref:r,className:Ce(xq({variant:t}),e),...n}));wP.displayName=hP.displayName;const wq=m.forwardRef(({className:e,...t},n)=>p.jsx(yP,{ref:n,className:Ce("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));wq.displayName=yP.displayName;const bP=m.forwardRef(({className:e,...t},n)=>p.jsx(vP,{ref:n,className:Ce("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:p.jsx(Rd,{className:"h-4 w-4"})}));bP.displayName=vP.displayName;const SP=m.forwardRef(({className:e,...t},n)=>p.jsx(gP,{ref:n,className:Ce("text-sm font-semibold",e),...t}));SP.displayName=gP.displayName;const CP=m.forwardRef(({className:e,...t},n)=>p.jsx(mP,{ref:n,className:Ce("text-sm opacity-90",e),...t}));CP.displayName=mP.displayName;function bq(){const{toasts:e}=cz();return p.jsxs(vq,{children:[e.map(function({id:t,title:n,description:r,action:o,...i}){return p.jsxs(wP,{...i,children:[p.jsxs("div",{className:"grid gap-1",children:[n&&p.jsx(SP,{children:n}),r&&p.jsx(CP,{children:r})]}),o,p.jsx(bP,{})]},t)}),p.jsx(xP,{})]})}const Sq=()=>{const[e,t]=m.useState([{id:We,label:"Main"}]),n=ue(w=>w.activeCanvasId),r=ue(w=>w.setActiveCanvas),o=ue(w=>w.selectFunction),i=ue(w=>w.functions);m.useEffect(()=>{t(w=>{let E=!1;const b=w.flatMap(N=>{if(N.id===We)return[N];const k=i[N.id];return k?k.name!==N.label?(E=!0,[{...N,label:k.name}]):[N]:(E=!0,[])});return E?b:w}),n!==We&&!i[n]&&r(We)},[i,n,r]);const l=m.useCallback(w=>{w!==We&&i[w]?o(w):r(w)},[i,o,r]),c=m.useCallback((w,E)=>(t(b=>b.find(k=>k.id===w)?b:[...b,{id:w,label:E}]),r(w),w),[r]),d=m.useCallback(w=>{w!==We&&t(E=>{const b=E.filter(N=>N.id!==w);return w===n&&r(We),b})},[n,r]),f=m.useCallback(w=>{w!==We&&t(E=>{const b=E.filter(N=>N.id!==w);return w===n&&r(We),b})},[n,r]),g=m.useCallback((w,E)=>{t(b=>b.map(N=>N.id===w?{...N,label:E}:N))},[]),h=m.useCallback((w,E)=>{w===0||E===0||t(b=>{const N=[...b],[k]=N.splice(w,1);return k?(N.splice(E,0,k),N):b})},[]),v=m.useCallback(()=>{t([{id:We,label:"Main"}]),r(We)},[r]),x=m.useCallback((w,E)=>{t(w),r(E)},[r]),S=m.useCallback(w=>e.find(E=>E.id===w)?.label||"Unknown",[e]);return{tabs:e,activeTabId:n,setActiveTabId:l,openTab:c,closeTab:d,removeTab:f,renameTab:g,reorderTabs:h,resetToMain:v,restoreTabState:x,getTabLabel:S,isMainCanvas:n===We}};function pg(e){const t=ue(e.selectItems);m.useEffect(()=>{const n=Ye.getState(),r=new Set;for(const o of Object.values(t))r.add(o.id),e.set(n,o.id,e.validate(o));for(const o of Object.keys(e.getStored(n)))r.has(o)||e.clear(n,o)},[t])}function Cq(){const e=ue(t=>t.functions);m.useEffect(()=>{const t=Ye.getState(),n=new Set;for(const[r,o]of Object.entries(e)){n.add(r);const i=Zm(r),l=i?dm(i.getState().variables,i.getState().edges).lookup:void 0;t.setFunctionDiagnostics(r,FA(o,l))}for(const r of Object.keys(t.byFunctionId))n.has(r)||t.clearFunctionDiagnostics(r)},[e])}function Eq(){const e=BN();m.useEffect(()=>{if(typeof document>"u")return;const t=document.documentElement;let n=t.classList.contains("light"),r=0;const o=new MutationObserver(()=>{const i=t.classList.contains("light");i!==n&&(n=i,t.classList.add("theme-changing"),t.offsetHeight,clearTimeout(r),r=window.setTimeout(()=>t.classList.remove("theme-changing"),120))});return o.observe(t,{attributes:!0,attributeFilter:["class"]}),()=>{o.disconnect(),clearTimeout(r),t.classList.remove("theme-changing")}},[]),m.useLayoutEffect(()=>{if(typeof document>"u")return;const t=document.documentElement;t.classList.contains("theme-changing")&&(t.offsetHeight,t.classList.remove("theme-changing"))},[e])}const Nq=({onOpenTab:e})=>{const{functionsList:t,getFunction:n}=Qd(),r=ue(l=>l.selectFunction),o=m.useCallback(l=>{const c=n(l);c&&(et(l),e(l,c.name),r(l))},[n,e,r]),i=m.useCallback(()=>{const l=wX();return e(l.id,l.name),r(l.id),l.id},[e,r]);return{functions:t,openFunction:o,createFunction:i}};function kq(){const e=m.useCallback(n=>{const r=KH(BH(n));FC();for(const[c,d]of Object.entries(r.canvases)){const f=et(c),g=d.nodes.map(v=>({id:v.id,type:QT(v.type),position:v.position,data:v})),h=d.edges.map(v=>({id:v.id,type:v.type,source:v.source,sourceHandle:v.sourceHandle,target:v.target,targetHandle:v.targetHandle,...v.data?{data:v.data}:{}}));f.getState().initialize(g,h),f.getState().setVariables(()=>d.variables)}const{channels:o,memory:i,models:l}=r;o&&Object.keys(o).length>0&&ue.getState().setChannels(()=>o),i&&Object.keys(i).length>0&&ue.getState().setMemory(()=>i),l&&Object.keys(l).length>0&&ue.getState().setModels(()=>l),ue.getState().setFunctions(()=>r.functions),Zd()},[]);return{exportProject:m.useCallback(()=>UH(EP()),[]),importProject:e}}function EP(){const e={};for(const[o,i]of Object.entries(Qm())){const l=i.getState();e[o]={nodes:l.nodes.map(c=>({...c.data,position:c.position})),edges:l.edges.map(c=>({id:c.id,type:c.type,source:c.source,sourceHandle:c.sourceHandle,target:c.target,targetHandle:c.targetHandle,...c.data?{data:c.data}:{}})),variables:l.variables}}const t={};for(const o of Object.values(ue.getState().channels))t[o.id]=o;const n={};for(const o of Object.values(ue.getState().memory))n[o.id]=o;const r={};for(const o of Object.values(ue.getState().models))r[o.id]=o;return{canvases:e,functions:ue.getState().functions,channels:t,memory:n,models:r}}function wn(e){return e.type!=="edit"}const Tq=m.forwardRef(function(t,n){const{initialWorkflow:r,initialMode:o,models:i,language:l,onTestNode:c,onDebugStep:d,onChange:f,onHistoryChange:g,onError:h}=t;m.useLayoutEffect(()=>{l&&mr.language!==l&&mr.changeLanguage(l)},[l]);const{importProject:v,exportProject:x}=kq();Eq(),pg({selectItems:R=>R.channels,validate:k1,getStored:R=>R.byChannelId,set:(R,j,L)=>R.setChannelDiagnostics(j,L),clear:(R,j)=>R.clearChannelDiagnostics(j)}),pg({selectItems:R=>R.memory,validate:T1,getStored:R=>R.byMemoryId,set:(R,j,L)=>R.setMemoryDiagnostics(j,L),clear:(R,j)=>R.clearMemoryDiagnostics(j)}),pg({selectItems:R=>R.models,validate:P1,getStored:R=>R.byModelId,set:(R,j,L)=>R.setModelDiagnostics(j,L),clear:(R,j)=>R.clearModelDiagnostics(j)}),Cq(),m.useEffect(()=>{ue.getState().setAvailableModels(i??[])},[i]);const S=Sq(),w=Nq({onOpenTab:S.openTab}),[E,b]=m.useState(null),N=m.useCallback(()=>{const R=VA(EP());R.totalErrors===0&&R.totalWarnings===0?Gt({title:mr.t("validationPassed")}):b(R)},[]),k=m.useCallback(R=>{const j=ue.getState();R.channelId?(j.setActiveSidebarTab("channels"),j.selectChannel(R.channelId)):R.memoryId?(j.setActiveSidebarTab("memory"),j.selectMemory(R.memoryId)):R.modelId?(j.setActiveSidebarTab("models"),j.selectModel(R.modelId)):R.canvasId&&(R.canvasId===We?j.setActiveCanvas(We):w.openFunction(R.canvasId),R.nodeId?j.selectGraph([R.nodeId],[]):R.edgeId&&j.selectGraph([],[R.edgeId])),b(null)},[w]),P=m.useRef(!1);m.useEffect(()=>{if(!P.current){P.current=!0;try{o&&ue.getState().setBuilderMode(o),r&&v(r)}catch(R){h?.(R instanceof Error?R:new Error(String(R)))}}},[]);const A=m.useRef(f),I=m.useRef(g);return A.current=f,I.current=g,m.useEffect(()=>{const R=[],j=new WeakSet;function L(_){if(j.has(_))return;j.add(_);let O=_.getState().mutationCount;const M=_.subscribe(z=>{z.mutationCount!==O&&(O=z.mutationCount,A.current?.())});R.push(M)}function U(){for(const _ of Object.values(Qm()))L(_)}U();const $=_w(()=>{U()});R.push($);let B=ue.getState().mutationCount;const G=ue.subscribe(_=>{_.mutationCount!==B&&(B=_.mutationCount,A.current?.())});return R.push(G),()=>{for(const _ of R)_()}},[]),m.useEffect(()=>{let R=null,j=null,L=null;const U=()=>{const O=et(ue.getState().activeCanvasId),M=O.canUndo(),z=O.canRedo();M===R&&z===j||(R=M,j=z,I.current?.({canUndo:M,canRedo:z}))},$=()=>{L?.(),L=et(ue.getState().activeCanvasId).subscribe(U),U()};$();let B=ue.getState().activeCanvasId;const G=ue.subscribe(O=>{O.activeCanvasId!==B&&(B=O.activeCanvasId,$())}),_=_w($);return()=>{L?.(),G(),_()}},[]),m.useImperativeHandle(n,()=>({loadWorkflow:R=>{try{v(R)}catch(j){h?.(j instanceof Error?j:new Error(String(j)))}},exportWorkflow:()=>x(),clear:()=>{FC(),ue.getState().setFunctions(()=>({})),ue.getState().clearSelection()},setMode:R=>ue.getState().setBuilderMode(R),getMode:()=>ue.getState().builderMode,validate:N,undo:()=>et(ue.getState().activeCanvasId).undo(),redo:()=>et(ue.getState().activeCanvasId).redo(),setDebugPhase:R=>is.getState().setPhase(R)}),[v,x,h,N]),p.jsx(T_,{i18n:mr,children:p.jsx(LC,{delayDuration:300,children:p.jsxs("div",{className:"fh-builder h-full w-full bg-background text-foreground font-sans antialiased",children:[p.jsx(JX,{functions:w.functions,onOpenFunction:w.openFunction,onCreateFunction:w.createFunction,canvasTabs:S.tabs,onCanvasTabChange:S.setActiveTabId,onCanvasTabClose:S.closeTab,onCanvasTabReorder:S.reorderTabs,onTestNode:c,onDebugStep:d}),p.jsx(bq,{}),E&&p.jsx(c4,{open:!0,onOpenChange:R=>{R||b(null)},validation:E,onSelectDiagnostic:k})]})})})});function Pq({theme:e,onToggle:t}){const{t:n}=Xe();return p.jsx("button",{onClick:t,className:"p-2 rounded hover:bg-muted/50 text-muted-foreground hover:text-foreground transition-colors",title:n("a11y.toggleTheme"),"aria-label":n("a11y.toggleTheme"),children:e==="dark"?p.jsx(Az,{className:"w-5 h-5"}):p.jsx(kz,{className:"w-5 h-5"})})}function Rq(e){const t=Iq(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(Aq);if(d){const f=d.props.children,g=c.map(h=>h===d?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return p.jsx(t,{...l,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,g):null})}return p.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function Iq(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=Dq(o),c=Mq(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Xt(r,l):l),m.cloneElement(o,c)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _q=Symbol("radix.slottable");function Aq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_q}function Mq(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...c)=>{const d=i(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Dq(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var am=["Enter"," "],jq=["ArrowDown","PageUp","Home"],NP=["ArrowUp","PageDown","End"],Oq=[...jq,...NP],$q={ltr:[...am,"ArrowRight"],rtl:[...am,"ArrowLeft"]},Lq={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fl="Menu",[vl,Fq,zq]=yf(Fl),[gs,kP]=Ft(Fl,[zq,$i,bf]),Ef=$i(),TP=bf(),[Vq,ms]=gs(Fl),[Hq,zl]=gs(Fl),PP=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:l=!0}=e,c=Ef(t),[d,f]=m.useState(null),g=m.useRef(!1),h=pt(i),v=Nl(o);return m.useEffect(()=>{const x=()=>{g.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>g.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),p.jsx(Wm,{...c,children:p.jsx(Vq,{scope:t,open:n,onOpenChange:h,content:d,onContentChange:f,children:p.jsx(Hq,{scope:t,onClose:m.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:g,dir:v,modal:l,children:r})})})};PP.displayName=Fl;var Bq="MenuAnchor",Oy=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Um,{...o,...r,ref:t})});Oy.displayName=Bq;var $y="MenuPortal",[Wq,RP]=gs($y,{forceMount:void 0}),IP=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=ms($y,t);return p.jsx(Wq,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(Mi,{asChild:!0,container:o,children:r})})})};IP.displayName=$y;var vn="MenuContent",[Uq,Ly]=gs(vn),_P=m.forwardRef((e,t)=>{const n=RP(vn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=ms(vn,e.__scopeMenu),l=zl(vn,e.__scopeMenu);return p.jsx(vl.Provider,{scope:e.__scopeMenu,children:p.jsx(Pt,{present:r||i.open,children:p.jsx(vl.Slot,{scope:e.__scopeMenu,children:l.modal?p.jsx(Kq,{...o,ref:t}):p.jsx(Gq,{...o,ref:t})})})})}),Kq=m.forwardRef((e,t)=>{const n=ms(vn,e.__scopeMenu),r=m.useRef(null),o=De(t,r);return m.useEffect(()=>{const i=r.current;if(i)return ym(i)},[]),p.jsx(Fy,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Gq=m.forwardRef((e,t)=>{const n=ms(vn,e.__scopeMenu);return p.jsx(Fy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Yq=Rq("MenuContent.ScrollLock"),Fy=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:v,onDismiss:x,disableOutsideScroll:S,...w}=e,E=ms(vn,n),b=zl(vn,n),N=Ef(n),k=TP(n),P=Fq(n),[A,I]=m.useState(null),R=m.useRef(null),j=De(t,R,E.onContentChange),L=m.useRef(0),U=m.useRef(""),$=m.useRef(0),B=m.useRef(null),G=m.useRef("right"),_=m.useRef(0),O=S?Ad:m.Fragment,M=S?{as:Yq,allowPinchZoom:!0}:void 0,z=W=>{const Z=U.current+W,F=P().filter(K=>!K.disabled),V=document.activeElement,X=F.find(K=>K.ref.current===V)?.textValue,Q=F.map(K=>K.textValue),ee=iZ(Q,Z,X),ne=F.find(K=>K.textValue===ee)?.ref.current;(function K(q){U.current=q,window.clearTimeout(L.current),q!==""&&(L.current=window.setTimeout(()=>K(""),1e3))})(Z),ne&&setTimeout(()=>ne.focus())};m.useEffect(()=>()=>window.clearTimeout(L.current),[]),mm();const H=m.useCallback(W=>G.current===B.current?.side&&lZ(W,B.current?.area),[]);return p.jsx(Uq,{scope:n,searchRef:U,onItemEnter:m.useCallback(W=>{H(W)&&W.preventDefault()},[H]),onItemLeave:m.useCallback(W=>{H(W)||(R.current?.focus(),I(null))},[H]),onTriggerLeave:m.useCallback(W=>{H(W)&&W.preventDefault()},[H]),pointerGraceTimerRef:$,onPointerGraceIntentChange:m.useCallback(W=>{B.current=W},[]),children:p.jsx(O,{...M,children:p.jsx(Id,{asChild:!0,trapped:o,onMountAutoFocus:ve(i,W=>{W.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:p.jsx(Ai,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:v,onDismiss:x,children:p.jsx(Qk,{asChild:!0,...k,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:I,onEntryFocus:ve(d,W=>{b.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Km,{role:"menu","aria-orientation":"vertical","data-state":GP(E.open),"data-radix-menu-content":"",dir:b.dir,...N,...w,ref:j,style:{outline:"none",...w.style},onKeyDown:ve(w.onKeyDown,W=>{const F=W.target.closest("[data-radix-menu-content]")===W.currentTarget,V=W.ctrlKey||W.altKey||W.metaKey,X=W.key.length===1;F&&(W.key==="Tab"&&W.preventDefault(),!V&&X&&z(W.key));const Q=R.current;if(W.target!==Q||!Oq.includes(W.key))return;W.preventDefault();const ne=P().filter(K=>!K.disabled).map(K=>K.ref.current);NP.includes(W.key)&&ne.reverse(),oZ(ne)}),onBlur:ve(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(L.current),U.current="")}),onPointerMove:ve(e.onPointerMove,xl(W=>{const Z=W.target,F=_.current!==W.clientX;if(W.currentTarget.contains(Z)&&F){const V=W.clientX>_.current?"right":"left";G.current=V,_.current=W.clientX}}))})})})})})})});_P.displayName=vn;var Xq="MenuGroup",zy=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(ke.div,{role:"group",...r,ref:t})});zy.displayName=Xq;var qq="MenuLabel",AP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(ke.div,{...r,ref:t})});AP.displayName=qq;var vd="MenuItem",t1="menu.itemSelect",Nf=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=m.useRef(null),l=zl(vd,e.__scopeMenu),c=Ly(vd,e.__scopeMenu),d=De(t,i),f=m.useRef(!1),g=()=>{const h=i.current;if(!n&&h){const v=new CustomEvent(t1,{bubbles:!0,cancelable:!0});h.addEventListener(t1,x=>r?.(x),{once:!0}),gm(h,v),v.defaultPrevented?f.current=!1:l.onClose()}};return p.jsx(MP,{...o,ref:d,disabled:n,onClick:ve(e.onClick,g),onPointerDown:h=>{e.onPointerDown?.(h),f.current=!0},onPointerUp:ve(e.onPointerUp,h=>{f.current||h.currentTarget?.click()}),onKeyDown:ve(e.onKeyDown,h=>{const v=c.searchRef.current!=="";n||v&&h.key===" "||am.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Nf.displayName=vd;var MP=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,l=Ly(vd,n),c=TP(n),d=m.useRef(null),f=De(t,d),[g,h]=m.useState(!1),[v,x]=m.useState("");return m.useEffect(()=>{const S=d.current;S&&x((S.textContent??"").trim())},[i.children]),p.jsx(vl.ItemSlot,{scope:n,disabled:r,textValue:o??v,children:p.jsx(Jk,{asChild:!0,...c,focusable:!r,children:p.jsx(ke.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:f,onPointerMove:ve(e.onPointerMove,xl(S=>{r?l.onItemLeave(S):(l.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ve(e.onPointerLeave,xl(S=>l.onItemLeave(S))),onFocus:ve(e.onFocus,()=>h(!0)),onBlur:ve(e.onBlur,()=>h(!1))})})})}),Zq="MenuCheckboxItem",DP=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(FP,{scope:e.__scopeMenu,checked:n,children:p.jsx(Nf,{role:"menuitemcheckbox","aria-checked":xd(n)?"mixed":n,...o,ref:t,"data-state":Hy(n),onSelect:ve(o.onSelect,()=>r?.(xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DP.displayName=Zq;var jP="MenuRadioGroup",[Qq,Jq]=gs(jP,{value:void 0,onValueChange:()=>{}}),OP=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=pt(r);return p.jsx(Qq,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(zy,{...o,ref:t})})});OP.displayName=jP;var $P="MenuRadioItem",LP=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Jq($P,e.__scopeMenu),i=n===o.value;return p.jsx(FP,{scope:e.__scopeMenu,checked:i,children:p.jsx(Nf,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Hy(i),onSelect:ve(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});LP.displayName=$P;var Vy="MenuItemIndicator",[FP,eZ]=gs(Vy,{checked:!1}),zP=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=eZ(Vy,n);return p.jsx(Pt,{present:r||xd(i.checked)||i.checked===!0,children:p.jsx(ke.span,{...o,ref:t,"data-state":Hy(i.checked)})})});zP.displayName=Vy;var tZ="MenuSeparator",VP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});VP.displayName=tZ;var nZ="MenuArrow",HP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Gm,{...o,...r,ref:t})});HP.displayName=nZ;var rZ="MenuSub",[lQ,BP]=gs(rZ),Ka="MenuSubTrigger",WP=m.forwardRef((e,t)=>{const n=ms(Ka,e.__scopeMenu),r=zl(Ka,e.__scopeMenu),o=BP(Ka,e.__scopeMenu),i=Ly(Ka,e.__scopeMenu),l=m.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,f={__scopeMenu:e.__scopeMenu},g=m.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return m.useEffect(()=>g,[g]),m.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),d(null)}},[c,d]),p.jsx(Oy,{asChild:!0,...f,children:p.jsx(MP,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":GP(n.open),...e,ref:Xt(t,o.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ve(e.onPointerMove,xl(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(i.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),g()},100))})),onPointerLeave:ve(e.onPointerLeave,xl(h=>{g();const v=n.content?.getBoundingClientRect();if(v){const x=n.content?.dataset.side,S=x==="right",w=S?-5:5,E=v[S?"left":"right"],b=v[S?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+w,y:h.clientY},{x:E,y:v.top},{x:b,y:v.top},{x:b,y:v.bottom},{x:E,y:v.bottom}],side:x}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ve(e.onKeyDown,h=>{const v=i.searchRef.current!=="";e.disabled||v&&h.key===" "||$q[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});WP.displayName=Ka;var UP="MenuSubContent",KP=m.forwardRef((e,t)=>{const n=RP(vn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=ms(vn,e.__scopeMenu),l=zl(vn,e.__scopeMenu),c=BP(UP,e.__scopeMenu),d=m.useRef(null),f=De(t,d);return p.jsx(vl.Provider,{scope:e.__scopeMenu,children:p.jsx(Pt,{present:r||i.open,children:p.jsx(vl.Slot,{scope:e.__scopeMenu,children:p.jsx(Fy,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:f,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{l.isUsingKeyboardRef.current&&d.current?.focus(),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:ve(e.onFocusOutside,g=>{g.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ve(e.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:ve(e.onKeyDown,g=>{const h=g.currentTarget.contains(g.target),v=Lq[l.dir].includes(g.key);h&&v&&(i.onOpenChange(!1),c.trigger?.focus(),g.preventDefault())})})})})})});KP.displayName=UP;function GP(e){return e?"open":"closed"}function xd(e){return e==="indeterminate"}function Hy(e){return xd(e)?"indeterminate":e?"checked":"unchecked"}function oZ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function sZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function iZ(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let l=sZ(e,Math.max(i,0));o.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function aZ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const c=t[i],d=t[l],f=c.x,g=c.y,h=d.x,v=d.y;g>r!=v>r&&n<(h-f)*(r-g)/(v-g)+f&&(o=!o)}return o}function lZ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return aZ(n,t)}function xl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var cZ=PP,uZ=Oy,dZ=IP,fZ=_P,pZ=zy,hZ=AP,gZ=Nf,mZ=DP,yZ=OP,vZ=LP,xZ=zP,wZ=VP,bZ=HP,SZ=WP,CZ=KP,kf="DropdownMenu",[EZ]=Ft(kf,[kP]),zt=kP(),[NZ,YP]=EZ(kf),XP=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,d=zt(t),f=m.useRef(null),[g,h]=cn({prop:o,defaultProp:i??!1,onChange:l,caller:kf});return p.jsx(NZ,{scope:t,triggerId:kt(),triggerRef:f,contentId:kt(),open:g,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(v=>!v),[h]),modal:c,children:p.jsx(cZ,{...d,open:g,onOpenChange:h,dir:r,modal:c,children:n})})};XP.displayName=kf;var qP="DropdownMenuTrigger",ZP=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=YP(qP,n),l=zt(n);return p.jsx(uZ,{asChild:!0,...l,children:p.jsx(ke.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:Xt(t,i.triggerRef),onPointerDown:ve(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(i.onOpenToggle(),i.open||c.preventDefault())}),onKeyDown:ve(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&i.onOpenToggle(),c.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});ZP.displayName=qP;var kZ="DropdownMenuPortal",QP=e=>{const{__scopeDropdownMenu:t,...n}=e,r=zt(t);return p.jsx(dZ,{...r,...n})};QP.displayName=kZ;var JP="DropdownMenuContent",eR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=YP(JP,n),i=zt(n),l=m.useRef(!1);return p.jsx(fZ,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:ve(e.onCloseAutoFocus,c=>{l.current||o.triggerRef.current?.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:ve(e.onInteractOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0,g=d.button===2||f;(!o.modal||g)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eR.displayName=JP;var TZ="DropdownMenuGroup",PZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(pZ,{...o,...r,ref:t})});PZ.displayName=TZ;var RZ="DropdownMenuLabel",IZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(hZ,{...o,...r,ref:t})});IZ.displayName=RZ;var _Z="DropdownMenuItem",tR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(gZ,{...o,...r,ref:t})});tR.displayName=_Z;var AZ="DropdownMenuCheckboxItem",MZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(mZ,{...o,...r,ref:t})});MZ.displayName=AZ;var DZ="DropdownMenuRadioGroup",jZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(yZ,{...o,...r,ref:t})});jZ.displayName=DZ;var OZ="DropdownMenuRadioItem",$Z=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(vZ,{...o,...r,ref:t})});$Z.displayName=OZ;var LZ="DropdownMenuItemIndicator",FZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(xZ,{...o,...r,ref:t})});FZ.displayName=LZ;var zZ="DropdownMenuSeparator",VZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(wZ,{...o,...r,ref:t})});VZ.displayName=zZ;var HZ="DropdownMenuArrow",BZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(bZ,{...o,...r,ref:t})});BZ.displayName=HZ;var WZ="DropdownMenuSubTrigger",UZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(SZ,{...o,...r,ref:t})});UZ.displayName=WZ;var KZ="DropdownMenuSubContent",GZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=zt(n);return p.jsx(CZ,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});GZ.displayName=KZ;var YZ=XP,XZ=ZP,qZ=QP,ZZ=eR,QZ=tR;const hg=[{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"en",name:"English",flag:"🇺🇸"}];function JZ({language:e,onChange:t}){const{t:n}=Xe(),r=hg.find(o=>o.code===e)??hg[1];return p.jsxs(YZ,{children:[p.jsx(XZ,{asChild:!0,children:p.jsxs("button",{className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground p-1.5 rounded hover:bg-muted/50 transition-colors",title:n("a11y.changeLanguage"),"aria-label":n("a11y.changeLanguage"),children:[p.jsx(bz,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline text-sm",children:r.flag})]})}),p.jsx(qZ,{children:p.jsx(ZZ,{align:"end",sideOffset:4,className:"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",children:hg.map(o=>p.jsxs(QZ,{onSelect:()=>t(o.code),className:"relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground",children:[p.jsx("span",{children:o.flag}),p.jsx("span",{children:o.name}),e===o.code&&p.jsx("span",{className:"ml-auto text-primary",children:"✓"})]},o.code))})})]})}function Qs({icon:e,onClick:t,variant:n="secondary",disabled:r=!1,title:o,children:i}){const l=n==="primary"?"bg-primary text-primary-foreground hover:opacity-90":"bg-secondary text-secondary-foreground hover:bg-muted";return p.jsxs("button",{onClick:t,disabled:r,title:o,className:`inline-flex items-center gap-1.5 px-3 py-1 text-sm rounded border border-border transition-colors disabled:opacity-40 disabled:pointer-events-none ${l}`,children:[p.jsx(e,{className:"w-4 h-4"}),i]})}const eQ=[{id:"claude-opus-4-6",label:"Claude Opus 4.6",capabilities:["chat"]},{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",capabilities:["chat"]},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",capabilities:["chat"]}],Ti=new URLSearchParams(window.location.search).get("file"),tQ=e=>e.split(/[\\/]/).pop()??e,nQ=typeof window<"u"&&"showOpenFilePicker"in window,rQ=typeof window<"u"&&"showSaveFilePicker"in window,oQ=Ti?{kind:"path",path:Ti}:null,sQ=Ti?tQ(Ti):null,n1=[{description:"Workflow JSON",accept:{"application/json":[".json"]}}];function iQ(){const{t:e}=Xe(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(!1),o=m.useRef(!1),[i,l]=m.useState(!1),[c,d]=m.useState(!1),[f,g]=m.useState(!1),[h,v]=m.useState(()=>localStorage.getItem("fh-theme")==="light"?"light":"dark"),[x,S]=m.useState(()=>localStorage.getItem(xg)==="de"?"de":"en"),[w,E]=m.useState(oQ),[b,N]=m.useState(sQ);m.useEffect(()=>{document.documentElement.classList.toggle("light",h==="light"),localStorage.setItem("fh-theme",h)},[h]),m.useEffect(()=>{Tt.changeLanguage(x),localStorage.setItem(xg,x)},[x]),m.useEffect(()=>{const B=b??"Untitled.json";document.title=`${i?"• ":""}${B} — ForestHub Builder`},[b,i]),m.useEffect(()=>{o.current||!Ti||(o.current=!0,fetch(`/api/file?path=${encodeURIComponent(Ti)}`).then(async B=>{if(B.status===404)return null;if(!B.ok)throw new Error(`${B.status} ${await B.text()}`);return B.json()}).then(B=>{B&&(r.current=!0,t.current?.loadWorkflow(B),queueMicrotask(()=>{r.current=!1,l(!1)}))}).catch(B=>Gt({title:e("toast.loadFailed"),description:B.message,variant:"destructive"})))},[e]);const k=m.useCallback((B,G,_)=>{let O;try{O=JSON.parse(B)}catch{Gt({title:e("toast.loadFailed"),description:e("error.invalidJson"),variant:"destructive"});return}r.current=!0,t.current?.loadWorkflow(O),queueMicrotask(()=>{r.current=!1,l(!1),N(G),E(_)})},[e]),P=m.useCallback(async()=>{if(!(i&&!window.confirm(e("confirm.discard")))){if(nQ){try{const[B]=await window.showOpenFilePicker({types:n1});if(!B)return;const G=await B.getFile();k(await G.text(),B.name,{kind:"handle",handle:B})}catch(B){if(B instanceof DOMException&&B.name==="AbortError")return;Gt({title:e("toast.loadFailed"),description:B instanceof Error?B.message:String(B),variant:"destructive"})}return}n.current?.click()}},[i,e,k]),A=m.useCallback(B=>{const G=B.target.files?.[0];G&&(G.text().then(_=>k(_,G.name,null)).catch(_=>Gt({title:e("toast.loadFailed"),description:_.message,variant:"destructive"})),B.target.value="")},[k,e]),I=m.useCallback(async()=>{const B=t.current?.exportWorkflow();if(!B)return;const G=JSON.stringify(B,null,2);if(w?.kind==="path"){try{const z=await fetch(`/api/file?path=${encodeURIComponent(w.path)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:G});if(!z.ok)throw new Error(`${z.status} ${await z.text()}`);l(!1)}catch(z){Gt({title:e("toast.saveFailed"),description:z instanceof Error?z.message:String(z),variant:"destructive"})}return}if(w?.kind==="handle"){try{const z=await w.handle.createWritable();await z.write(G),await z.close(),l(!1)}catch(z){Gt({title:e("toast.saveFailed"),description:z instanceof Error?z.message:String(z),variant:"destructive"})}return}if(rQ){try{const z=await window.showSaveFilePicker({suggestedName:b??"workflow.json",types:n1}),H=await z.createWritable();await H.write(G),await H.close(),E({kind:"handle",handle:z}),N(z.name),l(!1)}catch(z){if(z instanceof DOMException&&z.name==="AbortError")return;Gt({title:e("toast.saveFailed"),description:z instanceof Error?z.message:String(z),variant:"destructive"})}return}const _=new Blob([G],{type:"application/json"}),O=URL.createObjectURL(_),M=document.createElement("a");M.href=O,M.download=b??`workflow-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,M.click(),URL.revokeObjectURL(O),l(!1)},[w,b,e]),R=m.useCallback(()=>{i&&!window.confirm(e("confirm.discard"))||(r.current=!0,t.current?.clear(),queueMicrotask(()=>{r.current=!1,l(!1),w?.kind!=="path"&&(E(null),N(null))}))},[i,w,e]),j=m.useCallback(()=>{t.current?.validate()},[]),L=m.useCallback(()=>{r.current||l(!0)},[]),U=m.useCallback(B=>{d(B.canUndo),g(B.canRedo)},[]),$=m.useCallback(B=>{Gt({title:e("toast.error"),description:B.message,variant:"destructive"})},[e]);return m.useEffect(()=>{const B=G=>{(G.metaKey||G.ctrlKey)&&!G.shiftKey&&G.key.toLowerCase()==="s"&&(G.preventDefault(),I())};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[I]),p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("header",{className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",children:[p.jsx(Qs,{icon:j1,onClick:R,children:e("toolbar.new")}),p.jsx(Qs,{icon:wz,onClick:P,children:e("toolbar.open")}),p.jsx(Qs,{icon:Iz,variant:"primary",onClick:I,children:e("toolbar.save")}),p.jsx(Qs,{icon:M1,onClick:j,children:e("toolbar.validate")}),p.jsx("div",{className:"mx-1 h-5 w-px bg-border","aria-hidden":!0}),p.jsx(Qs,{icon:Dz,onClick:()=>t.current?.undo(),disabled:!c,children:e("toolbar.undo")}),p.jsx(Qs,{icon:Pz,onClick:()=>t.current?.redo(),disabled:!f,children:e("toolbar.redo")}),p.jsxs("div",{className:"flex-1 min-w-0 flex items-center justify-center gap-1.5 text-sm font-mono text-muted-foreground",title:w?.kind==="path"?w.path:b??"no file",children:[p.jsx("span",{className:"truncate",children:b??"Untitled.json"}),p.jsx("span",{className:"shrink-0 w-2 text-center text-foreground","aria-hidden":!0,children:i?"•":""})]}),p.jsx(Pq,{theme:h,onToggle:()=>v(B=>B==="dark"?"light":"dark")}),p.jsx(JZ,{language:x,onChange:S}),p.jsx("input",{ref:n,type:"file",accept:"application/json,.json",className:"hidden","aria-label":e("toolbar.open"),onChange:A})]}),p.jsx("main",{className:"flex-1 min-h-0",children:p.jsx(Tq,{ref:t,models:eQ,language:x,onChange:L,onHistoryChange:U,onError:$})})]})}const nR=document.getElementById("root");if(!nR)throw new Error("#root not found");BI.createRoot(nR).render(p.jsx(m.StrictMode,{children:p.jsx(iQ,{})}));