@foresthubai/workflow-cli 0.4.5 → 0.4.6
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.
|
@@ -1,12 +1,12 @@
|
|
|
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(L){return L===null||typeof L!="object"?null:(L=h&&L[h]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,b={};function E(L,z,X){this.props=L,this.context=z,this.refs=b,this.updater=X||x}E.prototype.isReactComponent={},E.prototype.setState=function(L,z){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,z,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function w(){}w.prototype=E.prototype;function N(L,z,X){this.props=L,this.context=z,this.refs=b,this.updater=X||x}var k=N.prototype=new w;k.constructor=N,S(k,E.prototype),k.isPureReactComponent=!0;var P=Array.isArray,M=Object.prototype.hasOwnProperty,R={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function $(L,z,X){var Q,te={},ne=null,Z=null;if(z!=null)for(Q in z.ref!==void 0&&(Z=z.ref),z.key!==void 0&&(ne=""+z.key),z)M.call(z,Q)&&!_.hasOwnProperty(Q)&&(te[Q]=z[Q]);var K=arguments.length-2;if(K===1)te.children=X;else if(1<K){for(var re=Array(K),ce=0;ce<K;ce++)re[ce]=arguments[ce+2];te.children=re}if(L&&L.defaultProps)for(Q in K=L.defaultProps,K)te[Q]===void 0&&(te[Q]=K[Q]);return{$$typeof:e,type:L,key:ne,ref:Z,props:te,_owner:R.current}}function D(L,z){return{$$typeof:e,type:L.type,key:z,ref:L.ref,props:L.props,_owner:L._owner}}function H(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function j(L){var z={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(X){return z[X]})}var U=/\/+/g;function G(L,z){return typeof L=="object"&&L!==null&&L.key!=null?j(""+L.key):z.toString(36)}function I(L,z,X,Q,te){var ne=typeof L;(ne==="undefined"||ne==="boolean")&&(L=null);var Z=!1;if(L===null)Z=!0;else switch(ne){case"string":case"number":Z=!0;break;case"object":switch(L.$$typeof){case e:case t:Z=!0}}if(Z)return Z=L,te=te(Z),L=Q===""?"."+G(Z,0):Q,P(te)?(X="",L!=null&&(X=L.replace(U,"$&/")+"/"),I(te,z,X,"",function(ce){return ce})):te!=null&&(H(te)&&(te=D(te,X+(!te.key||Z&&Z.key===te.key?"":(""+te.key).replace(U,"$&/")+"/")+L)),z.push(te)),1;if(Z=0,Q=Q===""?".":Q+":",P(L))for(var K=0;K<L.length;K++){ne=L[K];var re=Q+G(ne,K);Z+=I(ne,z,X,re,te)}else if(re=v(L),typeof re=="function")for(L=re.call(L),K=0;!(ne=L.next()).done;)ne=ne.value,re=Q+G(ne,K++),Z+=I(ne,z,X,re,te);else if(ne==="object")throw z=String(L),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return Z}function B(L,z,X){if(L==null)return L;var Q=[],te=0;return I(L,Q,"","",function(ne){return z.call(X,ne,te++)}),Q}function A(L){if(L._status===-1){var z=L._result;z=z(),z.then(function(X){(L._status===0||L._status===-1)&&(L._status=1,L._result=X)},function(X){(L._status===0||L._status===-1)&&(L._status=2,L._result=X)}),L._status===-1&&(L._status=0,L._result=z)}if(L._status===1)return L._result.default;throw L._result}var V={current:null},F={transition:null},W={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:F,ReactCurrentOwner:R};function q(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:B,forEach:function(L,z,X){B(L,function(){z.apply(this,arguments)},X)},count:function(L){var z=0;return B(L,function(){z++}),z},toArray:function(L){return B(L,function(z){return z})||[]},only:function(L){if(!H(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},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=q,Ve.cloneElement=function(L,z,X){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var Q=S({},L.props),te=L.key,ne=L.ref,Z=L._owner;if(z!=null){if(z.ref!==void 0&&(ne=z.ref,Z=R.current),z.key!==void 0&&(te=""+z.key),L.type&&L.type.defaultProps)var K=L.type.defaultProps;for(re in z)M.call(z,re)&&!_.hasOwnProperty(re)&&(Q[re]=z[re]===void 0&&K!==void 0?K[re]:z[re])}var re=arguments.length-2;if(re===1)Q.children=X;else if(1<re){K=Array(re);for(var ce=0;ce<re;ce++)K[ce]=arguments[ce+2];Q.children=K}return{$$typeof:e,type:L.type,key:te,ref:ne,props:Q,_owner:Z}},Ve.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:i,_context:L},L.Consumer=L},Ve.createElement=$,Ve.createFactory=function(L){var z=$.bind(null,L);return z.type=L,z},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(L){return{$$typeof:c,render:L}},Ve.isValidElement=H,Ve.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:A}},Ve.memo=function(L,z){return{$$typeof:f,type:L,compare:z===void 0?null:z}},Ve.startTransition=function(L){var z=F.transition;F.transition={};try{L()}finally{F.transition=z}},Ve.unstable_act=q,Ve.useCallback=function(L,z){return V.current.useCallback(L,z)},Ve.useContext=function(L){return V.current.useContext(L)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(L){return V.current.useDeferredValue(L)},Ve.useEffect=function(L,z){return V.current.useEffect(L,z)},Ve.useId=function(){return V.current.useId()},Ve.useImperativeHandle=function(L,z,X){return V.current.useImperativeHandle(L,z,X)},Ve.useInsertionEffect=function(L,z){return V.current.useInsertionEffect(L,z)},Ve.useLayoutEffect=function(L,z){return V.current.useLayoutEffect(L,z)},Ve.useMemo=function(L,z){return V.current.useMemo(L,z)},Ve.useReducer=function(L,z,X){return V.current.useReducer(L,z,X)},Ve.useRef=function(L){return V.current.useRef(L)},Ve.useState=function(L){return V.current.useState(L)},Ve.useSyncExternalStore=function(L,z,X){return V.current.useSyncExternalStore(L,z,X)},Ve.useTransition=function(){return V.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 qe=lm(m),wd=jI({__proto__:null,default:qe},[m]);var su={},bh={exports:{}},Ut={},Sh={exports:{}},Ch={};var g0;function FI(){return g0||(g0=1,(function(e){function t(F,W){var q=F.length;F.push(W);e:for(;0<q;){var L=q-1>>>1,z=F[L];if(0<o(z,W))F[L]=W,F[q]=z,q=L;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var W=F[0],q=F.pop();if(q!==W){F[0]=q;e:for(var L=0,z=F.length,X=z>>>1;L<X;){var Q=2*(L+1)-1,te=F[Q],ne=Q+1,Z=F[ne];if(0>o(te,q))ne<z&&0>o(Z,te)?(F[L]=Z,F[ne]=q,L=ne):(F[L]=te,F[Q]=q,L=Q);else if(ne<z&&0>o(Z,q))F[L]=Z,F[ne]=q,L=ne;else break e}}return W}function o(F,W){var q=F.sortIndex-W.sortIndex;return q!==0?q:F.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,b=!1,E=typeof setTimeout=="function"?setTimeout:null,w=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(F){for(var W=n(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=F)r(f),W.sortIndex=W.expirationTime,t(d,W);else break;W=n(f)}}function P(F){if(b=!1,k(F),!S)if(n(d)!==null)S=!0,A(M);else{var W=n(f);W!==null&&V(P,W.startTime-F)}}function M(F,W){S=!1,b&&(b=!1,w($),$=-1),x=!0;var q=v;try{for(k(W),h=n(d);h!==null&&(!(h.expirationTime>W)||F&&!j());){var L=h.callback;if(typeof L=="function"){h.callback=null,v=h.priorityLevel;var z=L(h.expirationTime<=W);W=e.unstable_now(),typeof z=="function"?h.callback=z: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&&V(P,Q.startTime-W),X=!1}return X}finally{h=null,v=q,x=!1}}var R=!1,_=null,$=-1,D=5,H=-1;function j(){return!(e.unstable_now()-H<D)}function U(){if(_!==null){var F=e.unstable_now();H=F;var W=!0;try{W=_(!0,F)}finally{W?G():(R=!1,_=null)}}else R=!1}var G;if(typeof N=="function")G=function(){N(U)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,B=I.port2;I.port1.onmessage=U,G=function(){B.postMessage(null)}}else G=function(){E(U,0)};function A(F){_=F,R||(R=!0,G())}function V(F,W){$=E(function(){F(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(F){F.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,A(M))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(F){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var q=v;v=W;try{return F()}finally{v=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,W){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var q=v;v=F;try{return W()}finally{v=q}},e.unstable_scheduleCallback=function(F,W,q){var L=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?L+q:L):q=L,F){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=q+z,F={id:g++,callback:W,priorityLevel:F,startTime:q,expirationTime:z,sortIndex:-1},q>L?(F.sortIndex=q,t(f,F),n(d)===null&&F===n(f)&&(b?(w($),$=-1):b=!0,V(P,q-L))):(F.sortIndex=z,t(d,F),S||x||(S=!0,A(M))),F},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(F){var W=v;return function(){var q=v;v=W;try{return F.apply(this,arguments)}finally{v=q}}}})(Ch)),Ch}var m0;function zI(){return m0||(m0=1,Sh.exports=FI()),Sh.exports}var y0;function VI(){if(y0)return Ut;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 b(s,a,u,y,C,T,O){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=O}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){E[s]=new b(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 b(a,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){E[s]=new b(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){E[s]=new b(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 b(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){E[s]=new b(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){E[s]=new b(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){E[s]=new b(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){E[s]=new b(s,5,!1,s.toLowerCase(),null,!1,!1)});var w=/[\-:]([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(w,N);E[a]=new b(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(w,N);E[a]=new b(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(w,N);E[a]=new b(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){E[s]=new b(s,1,!1,s.toLowerCase(),null,!1,!1)}),E.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){E[s]=new b(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,M=Symbol.for("react.element"),R=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),H=Symbol.for("react.provider"),j=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),F=Symbol.iterator;function W(s){return s===null||typeof s!="object"?null:(s=F&&s[F]||s["@@iterator"],typeof s=="function"?s:null)}var q=Object.assign,L;function z(s){if(L===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);L=a&&a[1]||""}return`
|
|
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(L){return L===null||typeof L!="object"?null:(L=h&&L[h]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function E(L,z,X){this.props=L,this.context=z,this.refs=w,this.updater=X||x}E.prototype.isReactComponent={},E.prototype.setState=function(L,z){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,z,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function b(){}b.prototype=E.prototype;function N(L,z,X){this.props=L,this.context=z,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,M=Object.prototype.hasOwnProperty,R={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function $(L,z,X){var Q,te={},ne=null,Z=null;if(z!=null)for(Q in z.ref!==void 0&&(Z=z.ref),z.key!==void 0&&(ne=""+z.key),z)M.call(z,Q)&&!_.hasOwnProperty(Q)&&(te[Q]=z[Q]);var K=arguments.length-2;if(K===1)te.children=X;else if(1<K){for(var re=Array(K),ce=0;ce<K;ce++)re[ce]=arguments[ce+2];te.children=re}if(L&&L.defaultProps)for(Q in K=L.defaultProps,K)te[Q]===void 0&&(te[Q]=K[Q]);return{$$typeof:e,type:L,key:ne,ref:Z,props:te,_owner:R.current}}function D(L,z){return{$$typeof:e,type:L.type,key:z,ref:L.ref,props:L.props,_owner:L._owner}}function H(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function j(L){var z={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(X){return z[X]})}var U=/\/+/g;function Y(L,z){return typeof L=="object"&&L!==null&&L.key!=null?j(""+L.key):z.toString(36)}function I(L,z,X,Q,te){var ne=typeof L;(ne==="undefined"||ne==="boolean")&&(L=null);var Z=!1;if(L===null)Z=!0;else switch(ne){case"string":case"number":Z=!0;break;case"object":switch(L.$$typeof){case e:case t:Z=!0}}if(Z)return Z=L,te=te(Z),L=Q===""?"."+Y(Z,0):Q,P(te)?(X="",L!=null&&(X=L.replace(U,"$&/")+"/"),I(te,z,X,"",function(ce){return ce})):te!=null&&(H(te)&&(te=D(te,X+(!te.key||Z&&Z.key===te.key?"":(""+te.key).replace(U,"$&/")+"/")+L)),z.push(te)),1;if(Z=0,Q=Q===""?".":Q+":",P(L))for(var K=0;K<L.length;K++){ne=L[K];var re=Q+Y(ne,K);Z+=I(ne,z,X,re,te)}else if(re=v(L),typeof re=="function")for(L=re.call(L),K=0;!(ne=L.next()).done;)ne=ne.value,re=Q+Y(ne,K++),Z+=I(ne,z,X,re,te);else if(ne==="object")throw z=String(L),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return Z}function B(L,z,X){if(L==null)return L;var Q=[],te=0;return I(L,Q,"","",function(ne){return z.call(X,ne,te++)}),Q}function A(L){if(L._status===-1){var z=L._result;z=z(),z.then(function(X){(L._status===0||L._status===-1)&&(L._status=1,L._result=X)},function(X){(L._status===0||L._status===-1)&&(L._status=2,L._result=X)}),L._status===-1&&(L._status=0,L._result=z)}if(L._status===1)return L._result.default;throw L._result}var V={current:null},F={transition:null},W={ReactCurrentDispatcher:V,ReactCurrentBatchConfig:F,ReactCurrentOwner:R};function q(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:B,forEach:function(L,z,X){B(L,function(){z.apply(this,arguments)},X)},count:function(L){var z=0;return B(L,function(){z++}),z},toArray:function(L){return B(L,function(z){return z})||[]},only:function(L){if(!H(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},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=q,Ve.cloneElement=function(L,z,X){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var Q=S({},L.props),te=L.key,ne=L.ref,Z=L._owner;if(z!=null){if(z.ref!==void 0&&(ne=z.ref,Z=R.current),z.key!==void 0&&(te=""+z.key),L.type&&L.type.defaultProps)var K=L.type.defaultProps;for(re in z)M.call(z,re)&&!_.hasOwnProperty(re)&&(Q[re]=z[re]===void 0&&K!==void 0?K[re]:z[re])}var re=arguments.length-2;if(re===1)Q.children=X;else if(1<re){K=Array(re);for(var ce=0;ce<re;ce++)K[ce]=arguments[ce+2];Q.children=K}return{$$typeof:e,type:L.type,key:te,ref:ne,props:Q,_owner:Z}},Ve.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:i,_context:L},L.Consumer=L},Ve.createElement=$,Ve.createFactory=function(L){var z=$.bind(null,L);return z.type=L,z},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(L){return{$$typeof:c,render:L}},Ve.isValidElement=H,Ve.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:A}},Ve.memo=function(L,z){return{$$typeof:f,type:L,compare:z===void 0?null:z}},Ve.startTransition=function(L){var z=F.transition;F.transition={};try{L()}finally{F.transition=z}},Ve.unstable_act=q,Ve.useCallback=function(L,z){return V.current.useCallback(L,z)},Ve.useContext=function(L){return V.current.useContext(L)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(L){return V.current.useDeferredValue(L)},Ve.useEffect=function(L,z){return V.current.useEffect(L,z)},Ve.useId=function(){return V.current.useId()},Ve.useImperativeHandle=function(L,z,X){return V.current.useImperativeHandle(L,z,X)},Ve.useInsertionEffect=function(L,z){return V.current.useInsertionEffect(L,z)},Ve.useLayoutEffect=function(L,z){return V.current.useLayoutEffect(L,z)},Ve.useMemo=function(L,z){return V.current.useMemo(L,z)},Ve.useReducer=function(L,z,X){return V.current.useReducer(L,z,X)},Ve.useRef=function(L){return V.current.useRef(L)},Ve.useState=function(L){return V.current.useState(L)},Ve.useSyncExternalStore=function(L,z,X){return V.current.useSyncExternalStore(L,z,X)},Ve.useTransition=function(){return V.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 qe=lm(m),wd=jI({__proto__:null,default:qe},[m]);var su={},bh={exports:{}},Ut={},Sh={exports:{}},Ch={};var g0;function FI(){return g0||(g0=1,(function(e){function t(F,W){var q=F.length;F.push(W);e:for(;0<q;){var L=q-1>>>1,z=F[L];if(0<o(z,W))F[L]=W,F[q]=z,q=L;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var W=F[0],q=F.pop();if(q!==W){F[0]=q;e:for(var L=0,z=F.length,X=z>>>1;L<X;){var Q=2*(L+1)-1,te=F[Q],ne=Q+1,Z=F[ne];if(0>o(te,q))ne<z&&0>o(Z,te)?(F[L]=Z,F[ne]=q,L=ne):(F[L]=te,F[Q]=q,L=Q);else if(ne<z&&0>o(Z,q))F[L]=Z,F[ne]=q,L=ne;else break e}}return W}function o(F,W){var q=F.sortIndex-W.sortIndex;return q!==0?q:F.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(F){for(var W=n(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=F)r(f),W.sortIndex=W.expirationTime,t(d,W);else break;W=n(f)}}function P(F){if(w=!1,k(F),!S)if(n(d)!==null)S=!0,A(M);else{var W=n(f);W!==null&&V(P,W.startTime-F)}}function M(F,W){S=!1,w&&(w=!1,b($),$=-1),x=!0;var q=v;try{for(k(W),h=n(d);h!==null&&(!(h.expirationTime>W)||F&&!j());){var L=h.callback;if(typeof L=="function"){h.callback=null,v=h.priorityLevel;var z=L(h.expirationTime<=W);W=e.unstable_now(),typeof z=="function"?h.callback=z: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&&V(P,Q.startTime-W),X=!1}return X}finally{h=null,v=q,x=!1}}var R=!1,_=null,$=-1,D=5,H=-1;function j(){return!(e.unstable_now()-H<D)}function U(){if(_!==null){var F=e.unstable_now();H=F;var W=!0;try{W=_(!0,F)}finally{W?Y():(R=!1,_=null)}}else R=!1}var Y;if(typeof N=="function")Y=function(){N(U)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,B=I.port2;I.port1.onmessage=U,Y=function(){B.postMessage(null)}}else Y=function(){E(U,0)};function A(F){_=F,R||(R=!0,Y())}function V(F,W){$=E(function(){F(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(F){F.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,A(M))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(F){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var q=v;v=W;try{return F()}finally{v=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,W){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var q=v;v=F;try{return W()}finally{v=q}},e.unstable_scheduleCallback=function(F,W,q){var L=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?L+q:L):q=L,F){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=q+z,F={id:g++,callback:W,priorityLevel:F,startTime:q,expirationTime:z,sortIndex:-1},q>L?(F.sortIndex=q,t(f,F),n(d)===null&&F===n(f)&&(w?(b($),$=-1):w=!0,V(P,q-L))):(F.sortIndex=z,t(d,F),S||x||(S=!0,A(M))),F},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(F){var W=v;return function(){var q=v;v=W;try{return F.apply(this,arguments)}finally{v=q}}}})(Ch)),Ch}var m0;function zI(){return m0||(m0=1,Sh.exports=FI()),Sh.exports}var y0;function VI(){if(y0)return Ut;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,O){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=O}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,M=Symbol.for("react.element"),R=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),H=Symbol.for("react.provider"),j=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),F=Symbol.iterator;function W(s){return s===null||typeof s!="object"?null:(s=F&&s[F]||s["@@iterator"],typeof s=="function"?s:null)}var q=Object.assign,L;function z(s){if(L===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);L=a&&a[1]||""}return`
|
|
2
2
|
`+L+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
3
|
`),T=y.stack.split(`
|
|
4
|
-
`),O=C.length-1,
|
|
5
|
-
`+C[O].replace(" at new "," at ");return s.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",s.displayName)),J}while(1<=O&&0<=Y);break}}}finally{X=!1,Error.prepareStackTrace=u}return(s=s?s.displayName||s.name:"")?z(s):""}function te(s){switch(s.tag){case 5:return z(s.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("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 _:return"Fragment";case R:return"Portal";case D:return"Profiler";case $:return"StrictMode";case G:return"Suspense";case I:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case j:return(s.displayName||"Context")+".Consumer";case H:return(s._context.displayName||"Context")+".Provider";case U:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case B:return a=s.displayName||null,a!==null?a:ne(s.type)||"Memo";case A:a=s._payload,s=s._init;try{return ne(s(a))}catch{}}return null}function Z(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===$?"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 K(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function re(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ce(s){var a=re(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(O){y=""+O,T.call(this,O)}}),Object.defineProperty(s,a,{enumerable:u.enumerable}),{getValue:function(){return y},setValue:function(O){y=""+O},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function me(s){s._valueTracker||(s._valueTracker=ce(s))}function ge(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),y="";return s&&(y=re(s)?s.checked?"true":"false":s.value),s=y,s!==u?(a.setValue(s),!0):!1}function pe(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 Re(s,a){var u=a.checked;return q({},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=K(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 ze(s,a){a=a.checked,a!=null&&k(s,"checked",a,!1)}function le(s,a){ze(s,a);var u=K(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")?Oe(s,a.type,u):a.hasOwnProperty("defaultValue")&&Oe(s,a.type,K(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function we(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 Oe(s,a,u){(a!=="number"||pe(s.ownerDocument)!==s)&&(u==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+u&&(s.defaultValue=""+u))}var ot=Array.isArray;function Je(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=""+K(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 Ct(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return q({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ke(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(ot(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}s._wrapperState={initialValue:K(u)}}function ms(s,a){var u=K(a.value),y=K(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 bo(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function tr(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 nr(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?tr(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var So,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(So=So||document.createElement("div"),So.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=So.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function rr(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var Co={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(Co).forEach(function(s){Tf.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Co[a]=Co[s]})});function Bl(s,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||Co.hasOwnProperty(s)&&Co[s]?(""+a).trim():a+"px"}function Hl(s,a){s=s.style;for(var u in a)if(a.hasOwnProperty(u)){var y=u.indexOf("--")===0,C=Bl(u,a[u],y);u==="float"&&(u="cssFloat"),y?s.setProperty(u,C):s[u]=C}}var Pf=q({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 Bi(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 Hi=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,Ir=null,_r=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){Ir?_r?_r.push(s):_r=[s]:Ir=s}function Kl(){if(Ir){var s=Ir,a=_r;if(_r=Ir=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,(Ir!==null||_r!==null)&&(Yl(),Kl())}}function Eo(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 No={};Object.defineProperty(No,"passive",{get:function(){Gi=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{Gi=!1}function Rf(s,a,u,y,C,T,O,Y,J){var ie=Array.prototype.slice.call(arguments,3);try{a.apply(u,ie)}catch(fe){this.onError(fe)}}var ko=!1,ys=null,vs=!1,Yi=null,If={onError:function(s){ko=!0,ys=s}};function _f(s,a,u,y,C,T,O,Y,J){ko=!1,ys=null,Rf.apply(If,arguments)}function Af(s,a,u,y,C,T,O,Y,J){if(_f.apply(this,arguments),ko){if(ko){var ie=ys;ko=!1,ys=null}else throw Error(n(198));vs||(vs=!0,Yi=ie)}}function Ln(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(Ln(s)!==s)throw Error(n(188))}function Mf(s){var a=s.alternate;if(!a){if(a=Ln(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 O=!1,Y=C.child;Y;){if(Y===u){O=!0,u=C,y=T;break}if(Y===y){O=!0,y=C,u=T;break}Y=Y.sibling}if(!O){for(Y=T.child;Y;){if(Y===u){O=!0,u=T,y=C;break}if(Y===y){O=!0,y=T,u=C;break}Y=Y.sibling}if(!O)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,To=null,un=null;function $f(s){if(un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(To,s,void 0,(s.current.flags&128)===128)}catch{}}var qt=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 Ar(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,O=u&268435455;if(O!==0){var Y=O&~C;Y!==0?y=Ar(Y):(T&=O,T!==0&&(y=Ar(T)))}else O=u&~C,O!==0?y=Ar(O):T!==0&&(y=Ar(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-qt(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 O=31-qt(T),Y=1<<O,J=C[O];J===-1?((Y&u)===0||(Y&y)!==0)&&(C[O]=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 Po(s,a,u){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-qt(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-qt(u),T=1<<C;a[C]=0,y[C]=-1,s[C]=-1,u&=~T}}function Bf(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var y=31-qt(u),C=1<<y;C&a|s[y]&a&&(s[y]|=a),u&=~C}}var Ge=0;function Hy(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Wy,Hf,Uy,Ky,Gy,Wf=!1,sc=[],Mr=null,Dr=null,jr=null,ea=new Map,ta=new Map,Or=[],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":Mr=null;break;case"dragenter":case"dragleave":Dr=null;break;case"mouseover":case"mouseout":jr=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&&Hf(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 Mr=na(Mr,s,a,u,y,C),!0;case"dragenter":return Dr=na(Dr,s,a,u,y,C),!0;case"mouseover":return jr=na(jr,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=Ro(s.target);if(a!==null){var u=Ln(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);Hi=y,u.target.dispatchEvent(y),Hi=null}else return a=ma(u),a!==null&&Hf(a),s.blockedOn=u,!1;a.shift()}return!0}function qy(s,a,u){ic(s)&&u.delete(a)}function sR(){Wf=!1,Mr!==null&&ic(Mr)&&(Mr=null),Dr!==null&&ic(Dr)&&(Dr=null),jr!==null&&ic(jr)&&(jr=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(Mr!==null&&ra(Mr,s),Dr!==null&&ra(Dr,s),jr!==null&&ra(jr,s),ea.forEach(a),ta.forEach(a),u=0;u<Or.length;u++)y=Or[u],y.blockedOn===s&&(y.blockedOn=null);for(;0<Or.length&&(u=Or[0],u.blockedOn===null);)Xy(u),u.blockedOn===null&&Or.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=Ro(s),s!==null)if(a=Ln(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 $r=null,Gf=null,cc=null;function Qy(){if(cc)return cc;var s,a=Gf,u=a.length,y,C="value"in $r?$r.value:$r.textContent,T=C.length;for(s=0;s<u&&a[s]===C[s];s++);var O=u-s;for(y=1;y<=O&&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 Zt(s){function a(u,y,C,T,O){this._reactName=u,this._targetInst=C,this.type=y,this.nativeEvent=T,this.target=O,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 q(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=Zt(Ns),sa=q({},Ns,{view:0,detail:0}),lR=Zt(sa),Xf,qf,ia,fc=q({},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=Zt(fc),cR=q({},fc,{dataTransfer:0}),uR=Zt(cR),dR=q({},sa,{relatedTarget:0}),Zf=Zt(dR),fR=q({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),pR=Zt(fR),hR=q({},Ns,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),gR=Zt(hR),mR=q({},Ns,{data:0}),tv=Zt(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=q({},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=Zt(bR),CR=q({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nv=Zt(CR),ER=q({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qf}),NR=Zt(ER),kR=q({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),TR=Zt(kR),PR=q({},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=Zt(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=$r=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(ge(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 wn=typeof Object.is=="function"?Object.is:VR;function ua(s,a){if(wn(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)||!wn(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=pe();a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=pe(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 BR(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 O=gv(u,y);C&&O&&(s.rangeCount!==1||s.anchorNode!==C.node||s.anchorOffset!==C.offset||s.focusNode!==O.node||s.focusOffset!==O.offset)&&(a=a.createRange(),a.setStart(C.node,C.offset),s.removeAllRanges(),T>y?(s.addRange(a),s.extend(O.node,O.offset)):(a.setEnd(O.node,O.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 HR=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!==pe(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 Lr(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);Lr(WR,"on"+UR)}Lr(wv,"onAnimationEnd"),Lr(bv,"onAnimationIteration"),Lr(Sv,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(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 O=y.length-1;0<=O;O--){var Y=y[O],J=Y.instance,ie=Y.currentTarget;if(Y=Y.listener,J!==T&&C.isPropagationStopped())break e;kv(C,Y,ie),T=J}else for(O=0;O<y.length;O++){if(Y=y[O],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 et(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 O=y.tag;if(O===3||O===4){var Y=y.stateNode.containerInfo;if(Y===C||Y.nodeType===8&&Y.parentNode===C)break;if(O===4)for(O=y.return;O!==null;){var J=O.tag;if((J===3||J===4)&&(J=O.stateNode.containerInfo,J===C||J.nodeType===8&&J.parentNode===C))return;O=O.return}for(;Y!==null;){if(O=Ro(Y),O===null)return;if(J=O.tag,J===5||J===6){y=T=O;continue e}Y=Y.parentNode}}y=y.return}Xl(function(){var ie=T,fe=Wi(u),he=[];e:{var de=Ev.get(s);if(de!==void 0){var be=Yf,ke=s;switch(s){case"keypress":if(uc(u)===0)break e;case"keydown":case"keyup":be=SR;break;case"focusin":ke="focus",be=Zf;break;case"focusout":ke="blur",be=Zf;break;case"beforeblur":case"afterblur":be=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":be=ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=uR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=NR;break;case wv:case bv:case Sv:be=pR;break;case Cv:be=TR;break;case"scroll":be=lR;break;case"wheel":be=RR;break;case"copy":case"cut":case"paste":be=gR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=nv}var Te=(a&4)!==0,ft=!Te&&s==="scroll",oe=Te?de!==null?de+"Capture":null:de;Te=[];for(var ee=ie,se;ee!==null;){se=ee;var ye=se.stateNode;if(se.tag===5&&ye!==null&&(se=ye,oe!==null&&(ye=Eo(ee,oe),ye!=null&&Te.push(ha(ee,ye,se)))),ft)break;ee=ee.return}0<Te.length&&(de=new be(de,ke,null,u,fe),he.push({event:de,listeners:Te}))}}if((a&7)===0){e:{if(de=s==="mouseover"||s==="pointerover",be=s==="mouseout"||s==="pointerout",de&&u!==Hi&&(ke=u.relatedTarget||u.fromElement)&&(Ro(ke)||ke[or]))break e;if((be||de)&&(de=fe.window===fe?fe:(de=fe.ownerDocument)?de.defaultView||de.parentWindow:window,be?(ke=u.relatedTarget||u.toElement,be=ie,ke=ke?Ro(ke):null,ke!==null&&(ft=Ln(ke),ke!==ft||ke.tag!==5&&ke.tag!==6)&&(ke=null)):(be=null,ke=ie),be!==ke)){if(Te=ev,ye="onMouseLeave",oe="onMouseEnter",ee="mouse",(s==="pointerout"||s==="pointerover")&&(Te=nv,ye="onPointerLeave",oe="onPointerEnter",ee="pointer"),ft=be==null?de:_s(be),se=ke==null?de:_s(ke),de=new Te(ye,ee+"leave",be,u,fe),de.target=ft,de.relatedTarget=se,ye=null,Ro(fe)===ie&&(Te=new Te(oe,ee+"enter",ke,u,fe),Te.target=se,Te.relatedTarget=ft,ye=Te),ft=ye,be&&ke)t:{for(Te=be,oe=ke,ee=0,se=Te;se;se=Rs(se))ee++;for(se=0,ye=oe;ye;ye=Rs(ye))se++;for(;0<ee-se;)Te=Rs(Te),ee--;for(;0<se-ee;)oe=Rs(oe),se--;for(;ee--;){if(Te===oe||oe!==null&&Te===oe.alternate)break t;Te=Rs(Te),oe=Rs(oe)}Te=null}else Te=null;be!==null&&Rv(he,de,be,Te,!1),ke!==null&&ft!==null&&Rv(he,ft,ke,Te,!0)}}e:{if(de=ie?_s(ie):window,be=de.nodeName&&de.nodeName.toLowerCase(),be==="select"||be==="input"&&de.type==="file")var Pe=OR;else if(lv(de))if(uv)Pe=zR;else{Pe=LR;var Ie=$R}else(be=de.nodeName)&&be.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Pe=FR);if(Pe&&(Pe=Pe(s,ie))){cv(he,Pe,u,fe);break e}Ie&&Ie(s,de,ie),s==="focusout"&&(Ie=de._wrapperState)&&Ie.controlled&&de.type==="number"&&Oe(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(he,u,fe);break;case"selectionchange":if(HR)break;case"keydown":case"keyup":vv(he,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()):($r=fe,Gf="value"in $r?$r.value:$r.textContent,ks=!0)),Ie=yc(ie,Ae),0<Ie.length&&(Ae=new tv(Ae,s,null,u,fe),he.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),he.push({event:fe,listeners:ie}),fe.data=_e))}Tv(he,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=Eo(s,u),T!=null&&y.unshift(ha(s,T,C)),T=Eo(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,O=[];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=Eo(u,T),J!=null&&O.unshift(ha(u,J,Y))):C||(J=Eo(u,T),J!=null&&O.push(ha(u,J,Y)))),u=u.return}O.length!==0&&s.push({event:a,listeners:O})}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 Fr(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),Fn="__reactFiber$"+Is,ga="__reactProps$"+Is,or="__reactContainer$"+Is,gp="__reactEvents$"+Is,QR="__reactListeners$"+Is,JR="__reactHandles$"+Is;function Ro(s){var a=s[Fn];if(a)return a;for(var u=s.parentNode;u;){if(a=u[or]||u[Fn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=Av(s);s!==null;){if(u=s[Fn])return u;s=Av(s)}return a}s=u,u=s.parentNode}return null}function ma(s){return s=s[Fn]||s[or],!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 zr(s){return{current:s}}function tt(s){0>As||(s.current=mp[As],mp[As]=null,As--)}function Ze(s,a){As++,mp[As]=s.current,s.current=a}var Vr={},Rt=zr(Vr),zt=zr(!1),Io=Vr;function Ms(s,a){var u=s.type.contextTypes;if(!u)return Vr;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 Vt(s){return s=s.childContextTypes,s!=null}function bc(){tt(zt),tt(Rt)}function Mv(s,a,u){if(Rt.current!==Vr)throw Error(n(168));Ze(Rt,a),Ze(zt,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,Z(s)||"Unknown",C));return q({},u,y)}function Sc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Vr,Io=Rt.current,Ze(Rt,s),Ze(zt,zt.current),!0}function jv(s,a,u){var y=s.stateNode;if(!y)throw Error(n(169));u?(s=Dv(s,a,Io),y.__reactInternalMemoizedMergedChildContext=s,tt(zt),tt(Rt),Ze(Rt,s)):tt(zt),Ze(zt,u)}var sr=null,Cc=!1,yp=!1;function Ov(s){sr===null?sr=[s]:sr.push(s)}function eI(s){Cc=!0,Ov(s)}function Br(){if(!yp&&sr!==null){yp=!0;var s=0,a=Ge;try{var u=sr;for(Ge=1;s<u.length;s++){var y=u[s];do y=y(!0);while(y!==null)}sr=null,Cc=!1}catch(C){throw sr!==null&&(sr=sr.slice(s+1)),Ql(Zi,Br),C}finally{Ge=a,yp=!1}}return null}var Ds=[],js=0,Ec=null,Nc=0,dn=[],fn=0,_o=null,ir=1,ar="";function Ao(s,a){Ds[js++]=Nc,Ds[js++]=Ec,Ec=s,Nc=a}function $v(s,a,u){dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=_o,_o=s;var y=ir;s=ar;var C=32-qt(y)-1;y&=~(1<<C),u+=1;var T=32-qt(a)+C;if(30<T){var O=C-C%5;T=(y&(1<<O)-1).toString(32),y>>=O,C-=O,ir=1<<32-qt(a)+C|u<<C|y,ar=T+s}else ir=1<<T|u<<C|y,ar=s}function vp(s){s.return!==null&&(Ao(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===_o;)_o=dn[--fn],dn[fn]=null,ar=dn[--fn],dn[fn]=null,ir=dn[--fn],dn[fn]=null}var Qt=null,Jt=null,st=!1,bn=null;function Lv(s,a){var u=mn(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,Qt=s,Jt=Fr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Qt=s,Jt=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=_o!==null?{id:ir,overflow:ar}:null,s.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=mn(18,null,null,0),u.stateNode=a,u.return=s,s.child=u,Qt=s,Jt=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=Jt;if(a){var u=a;if(!Fv(s,a)){if(wp(s))throw Error(n(418));a=Fr(u.nextSibling);var y=Qt;a&&Fv(s,a)?Lv(y,u):(s.flags=s.flags&-4097|2,st=!1,Qt=s)}}else{if(wp(s))throw Error(n(418));s.flags=s.flags&-4097|2,st=!1,Qt=s}}}function zv(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Qt=s}function kc(s){if(s!==Qt)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=Jt)){if(wp(s))throw Vv(),Error(n(418));for(;a;)Lv(s,a),a=Fr(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){Jt=Fr(s.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}s=s.nextSibling}Jt=null}}else Jt=Qt?Fr(s.stateNode.nextSibling):null;return!0}function Vv(){for(var s=Jt;s;)s=Fr(s.nextSibling)}function Os(){Jt=Qt=null,st=!1}function Sp(s){bn===null?bn=[s]:bn.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(O){var Y=C.refs;O===null?delete Y[T]:Y[T]=O},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 Bv(s){var a=s._init;return a(s._payload)}function Hv(s){function a(oe,ee){if(s){var se=oe.deletions;se===null?(oe.deletions=[ee],oe.flags|=16):se.push(ee)}}function u(oe,ee){if(!s)return null;for(;ee!==null;)a(oe,ee),ee=ee.sibling;return null}function y(oe,ee){for(oe=new Map;ee!==null;)ee.key!==null?oe.set(ee.key,ee):oe.set(ee.index,ee),ee=ee.sibling;return oe}function C(oe,ee){return oe=qr(oe,ee),oe.index=0,oe.sibling=null,oe}function T(oe,ee,se){return oe.index=se,s?(se=oe.alternate,se!==null?(se=se.index,se<ee?(oe.flags|=2,ee):se):(oe.flags|=2,ee)):(oe.flags|=1048576,ee)}function O(oe){return s&&oe.alternate===null&&(oe.flags|=2),oe}function Y(oe,ee,se,ye){return ee===null||ee.tag!==6?(ee=ph(se,oe.mode,ye),ee.return=oe,ee):(ee=C(ee,se),ee.return=oe,ee)}function J(oe,ee,se,ye){var Pe=se.type;return Pe===_?fe(oe,ee,se.props.children,ye,se.key):ee!==null&&(ee.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Bv(Pe)===ee.type)?(ye=C(ee,se.props),ye.ref=ya(oe,ee,se),ye.return=oe,ye):(ye=Zc(se.type,se.key,se.props,null,oe.mode,ye),ye.ref=ya(oe,ee,se),ye.return=oe,ye)}function ie(oe,ee,se,ye){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=hh(se,oe.mode,ye),ee.return=oe,ee):(ee=C(ee,se.children||[]),ee.return=oe,ee)}function fe(oe,ee,se,ye,Pe){return ee===null||ee.tag!==7?(ee=zo(se,oe.mode,ye,Pe),ee.return=oe,ee):(ee=C(ee,se),ee.return=oe,ee)}function he(oe,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=ph(""+ee,oe.mode,se),ee.return=oe,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case M:return se=Zc(ee.type,ee.key,ee.props,null,oe.mode,se),se.ref=ya(oe,null,ee),se.return=oe,se;case R:return ee=hh(ee,oe.mode,se),ee.return=oe,ee;case A:var ye=ee._init;return he(oe,ye(ee._payload),se)}if(ot(ee)||W(ee))return ee=zo(ee,oe.mode,se,null),ee.return=oe,ee;Tc(oe,ee)}return null}function de(oe,ee,se,ye){var Pe=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Pe!==null?null:Y(oe,ee,""+se,ye);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return se.key===Pe?J(oe,ee,se,ye):null;case R:return se.key===Pe?ie(oe,ee,se,ye):null;case A:return Pe=se._init,de(oe,ee,Pe(se._payload),ye)}if(ot(se)||W(se))return Pe!==null?null:fe(oe,ee,se,ye,null);Tc(oe,se)}return null}function be(oe,ee,se,ye,Pe){if(typeof ye=="string"&&ye!==""||typeof ye=="number")return oe=oe.get(se)||null,Y(ee,oe,""+ye,Pe);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case M:return oe=oe.get(ye.key===null?se:ye.key)||null,J(ee,oe,ye,Pe);case R:return oe=oe.get(ye.key===null?se:ye.key)||null,ie(ee,oe,ye,Pe);case A:var Ie=ye._init;return be(oe,ee,se,Ie(ye._payload),Pe)}if(ot(ye)||W(ye))return oe=oe.get(se)||null,fe(ee,oe,ye,Pe,null);Tc(ee,ye)}return null}function ke(oe,ee,se,ye){for(var Pe=null,Ie=null,_e=ee,Ae=ee=0,St=null;_e!==null&&Ae<se.length;Ae++){_e.index>Ae?(St=_e,_e=null):St=_e.sibling;var Ue=de(oe,_e,se[Ae],ye);if(Ue===null){_e===null&&(_e=St);break}s&&_e&&Ue.alternate===null&&a(oe,_e),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue,_e=St}if(Ae===se.length)return u(oe,_e),st&&Ao(oe,Ae),Pe;if(_e===null){for(;Ae<se.length;Ae++)_e=he(oe,se[Ae],ye),_e!==null&&(ee=T(_e,ee,Ae),Ie===null?Pe=_e:Ie.sibling=_e,Ie=_e);return st&&Ao(oe,Ae),Pe}for(_e=y(oe,_e);Ae<se.length;Ae++)St=be(_e,oe,Ae,se[Ae],ye),St!==null&&(s&&St.alternate!==null&&_e.delete(St.key===null?Ae:St.key),ee=T(St,ee,Ae),Ie===null?Pe=St:Ie.sibling=St,Ie=St);return s&&_e.forEach(function(Zr){return a(oe,Zr)}),st&&Ao(oe,Ae),Pe}function Te(oe,ee,se,ye){var Pe=W(se);if(typeof Pe!="function")throw Error(n(150));if(se=Pe.call(se),se==null)throw Error(n(151));for(var Ie=Pe=null,_e=ee,Ae=ee=0,St=null,Ue=se.next();_e!==null&&!Ue.done;Ae++,Ue=se.next()){_e.index>Ae?(St=_e,_e=null):St=_e.sibling;var Zr=de(oe,_e,Ue.value,ye);if(Zr===null){_e===null&&(_e=St);break}s&&_e&&Zr.alternate===null&&a(oe,_e),ee=T(Zr,ee,Ae),Ie===null?Pe=Zr:Ie.sibling=Zr,Ie=Zr,_e=St}if(Ue.done)return u(oe,_e),st&&Ao(oe,Ae),Pe;if(_e===null){for(;!Ue.done;Ae++,Ue=se.next())Ue=he(oe,Ue.value,ye),Ue!==null&&(ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue);return st&&Ao(oe,Ae),Pe}for(_e=y(oe,_e);!Ue.done;Ae++,Ue=se.next())Ue=be(_e,oe,Ae,Ue.value,ye),Ue!==null&&(s&&Ue.alternate!==null&&_e.delete(Ue.key===null?Ae:Ue.key),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue);return s&&_e.forEach(function(DI){return a(oe,DI)}),st&&Ao(oe,Ae),Pe}function ft(oe,ee,se,ye){if(typeof se=="object"&&se!==null&&se.type===_&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case M:e:{for(var Pe=se.key,Ie=ee;Ie!==null;){if(Ie.key===Pe){if(Pe=se.type,Pe===_){if(Ie.tag===7){u(oe,Ie.sibling),ee=C(Ie,se.props.children),ee.return=oe,oe=ee;break e}}else if(Ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Bv(Pe)===Ie.type){u(oe,Ie.sibling),ee=C(Ie,se.props),ee.ref=ya(oe,Ie,se),ee.return=oe,oe=ee;break e}u(oe,Ie);break}else a(oe,Ie);Ie=Ie.sibling}se.type===_?(ee=zo(se.props.children,oe.mode,ye,se.key),ee.return=oe,oe=ee):(ye=Zc(se.type,se.key,se.props,null,oe.mode,ye),ye.ref=ya(oe,ee,se),ye.return=oe,oe=ye)}return O(oe);case R:e:{for(Ie=se.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){u(oe,ee.sibling),ee=C(ee,se.children||[]),ee.return=oe,oe=ee;break e}else{u(oe,ee);break}else a(oe,ee);ee=ee.sibling}ee=hh(se,oe.mode,ye),ee.return=oe,oe=ee}return O(oe);case A:return Ie=se._init,ft(oe,ee,Ie(se._payload),ye)}if(ot(se))return ke(oe,ee,se,ye);if(W(se))return Te(oe,ee,se,ye);Tc(oe,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,ee!==null&&ee.tag===6?(u(oe,ee.sibling),ee=C(ee,se),ee.return=oe,oe=ee):(u(oe,ee),ee=ph(se,oe.mode,ye),ee.return=oe,oe=ee),O(oe)):u(oe,ee)}return ft}var $s=Hv(!0),Wv=Hv(!1),Pc=zr(null),Rc=null,Ls=null,Cp=null;function Ep(){Cp=Ls=Rc=null}function Np(s){var a=Pc.current;tt(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 pn(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 Mo=null;function Tp(s){Mo===null?Mo=[s]:Mo.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,lr(s,y)}function lr(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 Hr=!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 cr(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Wr(s,a,u){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(We&2)!==0){var C=y.pending;return C===null?a.next=a:(a.next=C.next,C.next=a),y.pending=a,lr(s,u)}return C=y.interleaved,C===null?(a.next=a,Tp(y)):(a.next=C.next,C.next=a),y.interleaved=a,lr(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,Bf(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 O={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};T===null?C=T=O:T=T.next=O,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;Hr=!1;var T=C.firstBaseUpdate,O=C.lastBaseUpdate,Y=C.shared.pending;if(Y!==null){C.shared.pending=null;var J=Y,ie=J.next;J.next=null,O===null?T=ie:O.next=ie,O=J;var fe=s.alternate;fe!==null&&(fe=fe.updateQueue,Y=fe.lastBaseUpdate,Y!==O&&(Y===null?fe.firstBaseUpdate=ie:Y.next=ie,fe.lastBaseUpdate=J))}if(T!==null){var he=C.baseState;O=0,fe=ie=J=null,Y=T;do{var de=Y.lane,be=Y.eventTime;if((y&de)===de){fe!==null&&(fe=fe.next={eventTime:be,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var ke=s,Te=Y;switch(de=a,be=u,Te.tag){case 1:if(ke=Te.payload,typeof ke=="function"){he=ke.call(be,he,de);break e}he=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Te.payload,de=typeof ke=="function"?ke.call(be,he,de):ke,de==null)break e;he=q({},he,de);break e;case 2:Hr=!0}}Y.callback!==null&&Y.lane!==0&&(s.flags|=64,de=C.effects,de===null?C.effects=[Y]:de.push(Y))}else be={eventTime:be,lane:de,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},fe===null?(ie=fe=be,J=he):fe=fe.next=be,O|=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=he),C.baseState=J,C.firstBaseUpdate=ie,C.lastBaseUpdate=fe,a=C.shared.interleaved,a!==null){C=a;do O|=C.lane,C=C.next;while(C!==a)}else T===null&&(C.shared.lanes=0);Oo|=O,s.lanes=O,s.memoizedState=he}}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={},zn=zr(va),xa=zr(va),wa=zr(va);function Do(s){if(s===va)throw Error(n(174));return s}function Rp(s,a){switch(Ze(wa,a),Ze(xa,s),Ze(zn,va),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:nr(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=nr(a,s)}tt(zn),Ze(zn,a)}function zs(){tt(zn),tt(xa),tt(wa)}function Xv(s){Do(wa.current);var a=Do(zn.current),u=nr(a,s.type);a!==u&&(Ze(xa,s),Ze(zn,u))}function Ip(s){xa.current===s&&(tt(zn),tt(xa))}var lt=zr(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,jo=0,ct=null,yt=null,wt=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(!wn(s[u],a[u]))return!1;return!0}function jp(s,a,u,y,C,T){if(jo=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,wt=yt=null,a.updateQueue=null,Mc.current=lI,s=u(y,C)}while(ba)}if(Mc.current=$c,a=yt!==null&&yt.next!==null,jo=0,wt=yt=ct=null,Dc=!1,a)throw Error(n(300));return s}function Op(){var s=Sa!==0;return Sa=0,s}function Vn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?ct.memoizedState=wt=s:wt=wt.next=s,wt}function hn(){if(yt===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=yt.next;var a=wt===null?ct.memoizedState:wt.next;if(a!==null)wt=a,yt=s;else{if(s===null)throw Error(n(310));yt=s,s={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},wt===null?ct.memoizedState=wt=s:wt=wt.next=s}return wt}function Ca(s,a){return typeof a=="function"?a(s):a}function $p(s){var a=hn(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var y=yt,C=y.baseQueue,T=u.pending;if(T!==null){if(C!==null){var O=C.next;C.next=T.next,T.next=O}y.baseQueue=C=T,u.pending=null}if(C!==null){T=C.next,y=y.baseState;var Y=O=null,J=null,ie=T;do{var fe=ie.lane;if((jo&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 he={lane:fe,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};J===null?(Y=J=he,O=y):J=J.next=he,ct.lanes|=fe,Oo|=fe}ie=ie.next}while(ie!==null&&ie!==T);J===null?O=y:J.next=Y,wn(y,a.memoizedState)||(Bt=!0),a.memoizedState=y,a.baseState=O,a.baseQueue=J,u.lastRenderedState=y}if(s=u.interleaved,s!==null){C=s;do T=C.lane,ct.lanes|=T,Oo|=T,C=C.next;while(C!==s)}else C===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function Lp(s){var a=hn(),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 O=C=C.next;do T=s(T,O.action),O=O.next;while(O!==C);wn(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=hn(),C=a(),T=!wn(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||wt!==null&&wt.memoizedState.tag&1){if(u.flags|=2048,Ea(9,Jv.bind(null,u,y,C,a),void 0,null),bt===null)throw Error(n(349));(jo&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!wn(s,u)}catch{return!0}}function nx(s){var a=lr(s,1);a!==null&&Nn(a,s,1,-1)}function rx(s){var a=Vn();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 hn().memoizedState}function jc(s,a,u,y){var C=Vn();ct.flags|=s,C.memoizedState=Ea(1|a,u,void 0,y===void 0?null:y)}function Oc(s,a,u,y){var C=hn();y=y===void 0?null:y;var T=void 0;if(yt!==null){var O=yt.memoizedState;if(T=O.destroy,y!==null&&Dp(y,O.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=hn();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=hn();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(jo&21)===0?(s.baseState&&(s.baseState=!1,Bt=!0),s.memoizedState=u):(wn(u,a)||(u=Cs(),ct.lanes|=u,Oo|=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 hn().memoizedState}function oI(s,a,u){var y=Yr(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=jt();Nn(u,s,y,C),mx(u,a,y)}}function sI(s,a,u){var y=Yr(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 O=a.lastRenderedState,Y=T(O,u);if(C.hasEagerState=!0,C.eagerState=Y,wn(Y,O)){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=jt(),Nn(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,Bf(s,u)}}var $c={readContext:pn,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:pn,useCallback:function(s,a){return Vn().memoizedState=[s,a===void 0?null:a],s},useContext:pn,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=Vn();return a=a===void 0?null:a,s=s(),u.memoizedState=[s,a],s},useReducer:function(s,a,u){var y=Vn();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=Vn();return s={current:s},a.memoizedState=s},useState:rx,useDebugValue:zp,useDeferredValue:function(s){return Vn().memoizedState=s},useTransition:function(){var s=rx(!1),a=s[0];return s=rI.bind(null,s[1]),Vn().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,u){var y=ct,C=Vn();if(st){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),bt===null)throw Error(n(349));(jo&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=Vn(),a=bt.identifierPrefix;if(st){var u=ar,y=ir;u=(y&~(1<<32-qt(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:pn,useCallback:ux,useContext:pn,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=hn();return fx(a,yt.memoizedState,s)},useTransition:function(){var s=$p(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1},lI={readContext:pn,useCallback:ux,useContext:pn,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=hn();return yt===null?a.memoizedState=s:fx(a,yt.memoizedState,s)},useTransition:function(){var s=Lp(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1};function Sn(s,a){if(s&&s.defaultProps){a=q({},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:q({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Lc={isMounted:function(s){return(s=s._reactInternals)?Ln(s)===s:!1},enqueueSetState:function(s,a,u){s=s._reactInternals;var y=jt(),C=Yr(s),T=cr(y,C);T.payload=a,u!=null&&(T.callback=u),a=Wr(s,T,C),a!==null&&(Nn(a,s,C,y),Ic(a,s,C))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var y=jt(),C=Yr(s),T=cr(y,C);T.tag=1,T.payload=a,u!=null&&(T.callback=u),a=Wr(s,T,C),a!==null&&(Nn(a,s,C,y),Ic(a,s,C))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=jt(),y=Yr(s),C=cr(u,y);C.tag=2,a!=null&&(C.callback=a),a=Wr(s,C,y),a!==null&&(Nn(a,s,y,u),Ic(a,s,y))}};function yx(s,a,u,y,C,T,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,T,O):a.prototype&&a.prototype.isPureReactComponent?!ua(u,y)||!ua(C,T):!0}function vx(s,a,u){var y=!1,C=Vr,T=a.contextType;return typeof T=="object"&&T!==null?T=pn(T):(C=Vt(a)?Io:Rt.current,y=a.contextTypes,T=(y=y!=null)?Ms(s,C):Vr),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 Bp(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=pn(T):(T=Vt(a)?Io: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+=te(y),y=y.return;while(y);var C=u}catch(T){C=`
|
|
4
|
+
`),O=C.length-1,G=T.length-1;1<=O&&0<=G&&C[O]!==T[G];)G--;for(;1<=O&&0<=G;O--,G--)if(C[O]!==T[G]){if(O!==1||G!==1)do if(O--,G--,0>G||C[O]!==T[G]){var J=`
|
|
5
|
+
`+C[O].replace(" at new "," at ");return s.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",s.displayName)),J}while(1<=O&&0<=G);break}}}finally{X=!1,Error.prepareStackTrace=u}return(s=s?s.displayName||s.name:"")?z(s):""}function te(s){switch(s.tag){case 5:return z(s.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("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 _:return"Fragment";case R:return"Portal";case D:return"Profiler";case $:return"StrictMode";case Y:return"Suspense";case I:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case j:return(s.displayName||"Context")+".Consumer";case H:return(s._context.displayName||"Context")+".Provider";case U:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case B:return a=s.displayName||null,a!==null?a:ne(s.type)||"Memo";case A:a=s._payload,s=s._init;try{return ne(s(a))}catch{}}return null}function Z(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===$?"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 K(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function re(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ce(s){var a=re(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(O){y=""+O,T.call(this,O)}}),Object.defineProperty(s,a,{enumerable:u.enumerable}),{getValue:function(){return y},setValue:function(O){y=""+O},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function me(s){s._valueTracker||(s._valueTracker=ce(s))}function ge(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),y="";return s&&(y=re(s)?s.checked?"true":"false":s.value),s=y,s!==u?(a.setValue(s),!0):!1}function pe(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 Re(s,a){var u=a.checked;return q({},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=K(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 ze(s,a){a=a.checked,a!=null&&k(s,"checked",a,!1)}function le(s,a){ze(s,a);var u=K(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")?Oe(s,a.type,u):a.hasOwnProperty("defaultValue")&&Oe(s,a.type,K(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function we(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 Oe(s,a,u){(a!=="number"||pe(s.ownerDocument)!==s)&&(u==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+u&&(s.defaultValue=""+u))}var ot=Array.isArray;function Je(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=""+K(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 Ct(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return q({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Ke(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(ot(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}s._wrapperState={initialValue:K(u)}}function ms(s,a){var u=K(a.value),y=K(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 bo(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function tr(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 nr(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?tr(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var So,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(So=So||document.createElement("div"),So.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=So.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function rr(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var Co={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(Co).forEach(function(s){Tf.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Co[a]=Co[s]})});function Bl(s,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||Co.hasOwnProperty(s)&&Co[s]?(""+a).trim():a+"px"}function Hl(s,a){s=s.style;for(var u in a)if(a.hasOwnProperty(u)){var y=u.indexOf("--")===0,C=Bl(u,a[u],y);u==="float"&&(u="cssFloat"),y?s.setProperty(u,C):s[u]=C}}var Pf=q({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 Bi(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 Hi=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,Ir=null,_r=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){Ir?_r?_r.push(s):_r=[s]:Ir=s}function Kl(){if(Ir){var s=Ir,a=_r;if(_r=Ir=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,(Ir!==null||_r!==null)&&(Yl(),Kl())}}function Eo(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 No={};Object.defineProperty(No,"passive",{get:function(){Gi=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{Gi=!1}function Rf(s,a,u,y,C,T,O,G,J){var ie=Array.prototype.slice.call(arguments,3);try{a.apply(u,ie)}catch(fe){this.onError(fe)}}var ko=!1,ys=null,vs=!1,Yi=null,If={onError:function(s){ko=!0,ys=s}};function _f(s,a,u,y,C,T,O,G,J){ko=!1,ys=null,Rf.apply(If,arguments)}function Af(s,a,u,y,C,T,O,G,J){if(_f.apply(this,arguments),ko){if(ko){var ie=ys;ko=!1,ys=null}else throw Error(n(198));vs||(vs=!0,Yi=ie)}}function Ln(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(Ln(s)!==s)throw Error(n(188))}function Mf(s){var a=s.alternate;if(!a){if(a=Ln(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 O=!1,G=C.child;G;){if(G===u){O=!0,u=C,y=T;break}if(G===y){O=!0,y=C,u=T;break}G=G.sibling}if(!O){for(G=T.child;G;){if(G===u){O=!0,u=T,y=C;break}if(G===y){O=!0,y=T,u=C;break}G=G.sibling}if(!O)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,To=null,un=null;function $f(s){if(un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(To,s,void 0,(s.current.flags&128)===128)}catch{}}var qt=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 Ar(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,O=u&268435455;if(O!==0){var G=O&~C;G!==0?y=Ar(G):(T&=O,T!==0&&(y=Ar(T)))}else O=u&~C,O!==0?y=Ar(O):T!==0&&(y=Ar(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-qt(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 O=31-qt(T),G=1<<O,J=C[O];J===-1?((G&u)===0||(G&y)!==0)&&(C[O]=rc(G,a)):J<=a&&(s.expiredLanes|=G),T&=~G}}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 Po(s,a,u){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-qt(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-qt(u),T=1<<C;a[C]=0,y[C]=-1,s[C]=-1,u&=~T}}function Bf(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var y=31-qt(u),C=1<<y;C&a|s[y]&a&&(s[y]|=a),u&=~C}}var Ge=0;function Hy(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Wy,Hf,Uy,Ky,Gy,Wf=!1,sc=[],Mr=null,Dr=null,jr=null,ea=new Map,ta=new Map,Or=[],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":Mr=null;break;case"dragenter":case"dragleave":Dr=null;break;case"mouseover":case"mouseout":jr=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&&Hf(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 Mr=na(Mr,s,a,u,y,C),!0;case"dragenter":return Dr=na(Dr,s,a,u,y,C),!0;case"mouseover":return jr=na(jr,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=Ro(s.target);if(a!==null){var u=Ln(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);Hi=y,u.target.dispatchEvent(y),Hi=null}else return a=ma(u),a!==null&&Hf(a),s.blockedOn=u,!1;a.shift()}return!0}function qy(s,a,u){ic(s)&&u.delete(a)}function sR(){Wf=!1,Mr!==null&&ic(Mr)&&(Mr=null),Dr!==null&&ic(Dr)&&(Dr=null),jr!==null&&ic(jr)&&(jr=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(Mr!==null&&ra(Mr,s),Dr!==null&&ra(Dr,s),jr!==null&&ra(jr,s),ea.forEach(a),ta.forEach(a),u=0;u<Or.length;u++)y=Or[u],y.blockedOn===s&&(y.blockedOn=null);for(;0<Or.length&&(u=Or[0],u.blockedOn===null);)Xy(u),u.blockedOn===null&&Or.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=Ro(s),s!==null)if(a=Ln(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 $r=null,Gf=null,cc=null;function Qy(){if(cc)return cc;var s,a=Gf,u=a.length,y,C="value"in $r?$r.value:$r.textContent,T=C.length;for(s=0;s<u&&a[s]===C[s];s++);var O=u-s;for(y=1;y<=O&&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 Zt(s){function a(u,y,C,T,O){this._reactName=u,this._targetInst=C,this.type=y,this.nativeEvent=T,this.target=O,this.currentTarget=null;for(var G in s)s.hasOwnProperty(G)&&(u=s[G],this[G]=u?u(T):T[G]);return this.isDefaultPrevented=(T.defaultPrevented!=null?T.defaultPrevented:T.returnValue===!1)?dc:Jy,this.isPropagationStopped=Jy,this}return q(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=Zt(Ns),sa=q({},Ns,{view:0,detail:0}),lR=Zt(sa),Xf,qf,ia,fc=q({},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=Zt(fc),cR=q({},fc,{dataTransfer:0}),uR=Zt(cR),dR=q({},sa,{relatedTarget:0}),Zf=Zt(dR),fR=q({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),pR=Zt(fR),hR=q({},Ns,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),gR=Zt(hR),mR=q({},Ns,{data:0}),tv=Zt(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=q({},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=Zt(bR),CR=q({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nv=Zt(CR),ER=q({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qf}),NR=Zt(ER),kR=q({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),TR=Zt(kR),PR=q({},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=Zt(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=$r=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(ge(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 xn=typeof Object.is=="function"?Object.is:VR;function ua(s,a){if(xn(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)||!xn(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=pe();a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=pe(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 BR(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 O=gv(u,y);C&&O&&(s.rangeCount!==1||s.anchorNode!==C.node||s.anchorOffset!==C.offset||s.focusNode!==O.node||s.focusOffset!==O.offset)&&(a=a.createRange(),a.setStart(C.node,C.offset),s.removeAllRanges(),T>y?(s.addRange(a),s.extend(O.node,O.offset)):(a.setEnd(O.node,O.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 HR=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!==pe(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 Lr(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);Lr(WR,"on"+UR)}Lr(wv,"onAnimationEnd"),Lr(bv,"onAnimationIteration"),Lr(Sv,"onAnimationStart"),Lr("dblclick","onDoubleClick"),Lr("focusin","onFocus"),Lr("focusout","onBlur"),Lr(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 O=y.length-1;0<=O;O--){var G=y[O],J=G.instance,ie=G.currentTarget;if(G=G.listener,J!==T&&C.isPropagationStopped())break e;kv(C,G,ie),T=J}else for(O=0;O<y.length;O++){if(G=y[O],J=G.instance,ie=G.currentTarget,G=G.listener,J!==T&&C.isPropagationStopped())break e;kv(C,G,ie),T=J}}}if(vs)throw s=Yi,vs=!1,Yi=null,s}function et(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 O=y.tag;if(O===3||O===4){var G=y.stateNode.containerInfo;if(G===C||G.nodeType===8&&G.parentNode===C)break;if(O===4)for(O=y.return;O!==null;){var J=O.tag;if((J===3||J===4)&&(J=O.stateNode.containerInfo,J===C||J.nodeType===8&&J.parentNode===C))return;O=O.return}for(;G!==null;){if(O=Ro(G),O===null)return;if(J=O.tag,J===5||J===6){y=T=O;continue e}G=G.parentNode}}y=y.return}Xl(function(){var ie=T,fe=Wi(u),he=[];e:{var de=Ev.get(s);if(de!==void 0){var be=Yf,ke=s;switch(s){case"keypress":if(uc(u)===0)break e;case"keydown":case"keyup":be=SR;break;case"focusin":ke="focus",be=Zf;break;case"focusout":ke="blur",be=Zf;break;case"beforeblur":case"afterblur":be=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":be=ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=uR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=NR;break;case wv:case bv:case Sv:be=pR;break;case Cv:be=TR;break;case"scroll":be=lR;break;case"wheel":be=RR;break;case"copy":case"cut":case"paste":be=gR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=nv}var Te=(a&4)!==0,ft=!Te&&s==="scroll",oe=Te?de!==null?de+"Capture":null:de;Te=[];for(var ee=ie,se;ee!==null;){se=ee;var ye=se.stateNode;if(se.tag===5&&ye!==null&&(se=ye,oe!==null&&(ye=Eo(ee,oe),ye!=null&&Te.push(ha(ee,ye,se)))),ft)break;ee=ee.return}0<Te.length&&(de=new be(de,ke,null,u,fe),he.push({event:de,listeners:Te}))}}if((a&7)===0){e:{if(de=s==="mouseover"||s==="pointerover",be=s==="mouseout"||s==="pointerout",de&&u!==Hi&&(ke=u.relatedTarget||u.fromElement)&&(Ro(ke)||ke[or]))break e;if((be||de)&&(de=fe.window===fe?fe:(de=fe.ownerDocument)?de.defaultView||de.parentWindow:window,be?(ke=u.relatedTarget||u.toElement,be=ie,ke=ke?Ro(ke):null,ke!==null&&(ft=Ln(ke),ke!==ft||ke.tag!==5&&ke.tag!==6)&&(ke=null)):(be=null,ke=ie),be!==ke)){if(Te=ev,ye="onMouseLeave",oe="onMouseEnter",ee="mouse",(s==="pointerout"||s==="pointerover")&&(Te=nv,ye="onPointerLeave",oe="onPointerEnter",ee="pointer"),ft=be==null?de:_s(be),se=ke==null?de:_s(ke),de=new Te(ye,ee+"leave",be,u,fe),de.target=ft,de.relatedTarget=se,ye=null,Ro(fe)===ie&&(Te=new Te(oe,ee+"enter",ke,u,fe),Te.target=se,Te.relatedTarget=ft,ye=Te),ft=ye,be&&ke)t:{for(Te=be,oe=ke,ee=0,se=Te;se;se=Rs(se))ee++;for(se=0,ye=oe;ye;ye=Rs(ye))se++;for(;0<ee-se;)Te=Rs(Te),ee--;for(;0<se-ee;)oe=Rs(oe),se--;for(;ee--;){if(Te===oe||oe!==null&&Te===oe.alternate)break t;Te=Rs(Te),oe=Rs(oe)}Te=null}else Te=null;be!==null&&Rv(he,de,be,Te,!1),ke!==null&&ft!==null&&Rv(he,ft,ke,Te,!0)}}e:{if(de=ie?_s(ie):window,be=de.nodeName&&de.nodeName.toLowerCase(),be==="select"||be==="input"&&de.type==="file")var Pe=OR;else if(lv(de))if(uv)Pe=zR;else{Pe=LR;var Ie=$R}else(be=de.nodeName)&&be.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Pe=FR);if(Pe&&(Pe=Pe(s,ie))){cv(he,Pe,u,fe);break e}Ie&&Ie(s,de,ie),s==="focusout"&&(Ie=de._wrapperState)&&Ie.controlled&&de.type==="number"&&Oe(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(he,u,fe);break;case"selectionchange":if(HR)break;case"keydown":case"keyup":vv(he,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()):($r=fe,Gf="value"in $r?$r.value:$r.textContent,ks=!0)),Ie=yc(ie,Ae),0<Ie.length&&(Ae=new tv(Ae,s,null,u,fe),he.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),he.push({event:fe,listeners:ie}),fe.data=_e))}Tv(he,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=Eo(s,u),T!=null&&y.unshift(ha(s,T,C)),T=Eo(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,O=[];u!==null&&u!==y;){var G=u,J=G.alternate,ie=G.stateNode;if(J!==null&&J===y)break;G.tag===5&&ie!==null&&(G=ie,C?(J=Eo(u,T),J!=null&&O.unshift(ha(u,J,G))):C||(J=Eo(u,T),J!=null&&O.push(ha(u,J,G)))),u=u.return}O.length!==0&&s.push({event:a,listeners:O})}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 Fr(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),Fn="__reactFiber$"+Is,ga="__reactProps$"+Is,or="__reactContainer$"+Is,gp="__reactEvents$"+Is,QR="__reactListeners$"+Is,JR="__reactHandles$"+Is;function Ro(s){var a=s[Fn];if(a)return a;for(var u=s.parentNode;u;){if(a=u[or]||u[Fn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=Av(s);s!==null;){if(u=s[Fn])return u;s=Av(s)}return a}s=u,u=s.parentNode}return null}function ma(s){return s=s[Fn]||s[or],!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 zr(s){return{current:s}}function tt(s){0>As||(s.current=mp[As],mp[As]=null,As--)}function Ze(s,a){As++,mp[As]=s.current,s.current=a}var Vr={},Rt=zr(Vr),zt=zr(!1),Io=Vr;function Ms(s,a){var u=s.type.contextTypes;if(!u)return Vr;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 Vt(s){return s=s.childContextTypes,s!=null}function bc(){tt(zt),tt(Rt)}function Mv(s,a,u){if(Rt.current!==Vr)throw Error(n(168));Ze(Rt,a),Ze(zt,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,Z(s)||"Unknown",C));return q({},u,y)}function Sc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Vr,Io=Rt.current,Ze(Rt,s),Ze(zt,zt.current),!0}function jv(s,a,u){var y=s.stateNode;if(!y)throw Error(n(169));u?(s=Dv(s,a,Io),y.__reactInternalMemoizedMergedChildContext=s,tt(zt),tt(Rt),Ze(Rt,s)):tt(zt),Ze(zt,u)}var sr=null,Cc=!1,yp=!1;function Ov(s){sr===null?sr=[s]:sr.push(s)}function eI(s){Cc=!0,Ov(s)}function Br(){if(!yp&&sr!==null){yp=!0;var s=0,a=Ge;try{var u=sr;for(Ge=1;s<u.length;s++){var y=u[s];do y=y(!0);while(y!==null)}sr=null,Cc=!1}catch(C){throw sr!==null&&(sr=sr.slice(s+1)),Ql(Zi,Br),C}finally{Ge=a,yp=!1}}return null}var Ds=[],js=0,Ec=null,Nc=0,dn=[],fn=0,_o=null,ir=1,ar="";function Ao(s,a){Ds[js++]=Nc,Ds[js++]=Ec,Ec=s,Nc=a}function $v(s,a,u){dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=_o,_o=s;var y=ir;s=ar;var C=32-qt(y)-1;y&=~(1<<C),u+=1;var T=32-qt(a)+C;if(30<T){var O=C-C%5;T=(y&(1<<O)-1).toString(32),y>>=O,C-=O,ir=1<<32-qt(a)+C|u<<C|y,ar=T+s}else ir=1<<T|u<<C|y,ar=s}function vp(s){s.return!==null&&(Ao(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===_o;)_o=dn[--fn],dn[fn]=null,ar=dn[--fn],dn[fn]=null,ir=dn[--fn],dn[fn]=null}var Qt=null,Jt=null,st=!1,wn=null;function Lv(s,a){var u=mn(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,Qt=s,Jt=Fr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Qt=s,Jt=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=_o!==null?{id:ir,overflow:ar}:null,s.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=mn(18,null,null,0),u.stateNode=a,u.return=s,s.child=u,Qt=s,Jt=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=Jt;if(a){var u=a;if(!Fv(s,a)){if(wp(s))throw Error(n(418));a=Fr(u.nextSibling);var y=Qt;a&&Fv(s,a)?Lv(y,u):(s.flags=s.flags&-4097|2,st=!1,Qt=s)}}else{if(wp(s))throw Error(n(418));s.flags=s.flags&-4097|2,st=!1,Qt=s}}}function zv(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Qt=s}function kc(s){if(s!==Qt)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=Jt)){if(wp(s))throw Vv(),Error(n(418));for(;a;)Lv(s,a),a=Fr(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){Jt=Fr(s.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}s=s.nextSibling}Jt=null}}else Jt=Qt?Fr(s.stateNode.nextSibling):null;return!0}function Vv(){for(var s=Jt;s;)s=Fr(s.nextSibling)}function Os(){Jt=Qt=null,st=!1}function Sp(s){wn===null?wn=[s]:wn.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(O){var G=C.refs;O===null?delete G[T]:G[T]=O},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 Bv(s){var a=s._init;return a(s._payload)}function Hv(s){function a(oe,ee){if(s){var se=oe.deletions;se===null?(oe.deletions=[ee],oe.flags|=16):se.push(ee)}}function u(oe,ee){if(!s)return null;for(;ee!==null;)a(oe,ee),ee=ee.sibling;return null}function y(oe,ee){for(oe=new Map;ee!==null;)ee.key!==null?oe.set(ee.key,ee):oe.set(ee.index,ee),ee=ee.sibling;return oe}function C(oe,ee){return oe=qr(oe,ee),oe.index=0,oe.sibling=null,oe}function T(oe,ee,se){return oe.index=se,s?(se=oe.alternate,se!==null?(se=se.index,se<ee?(oe.flags|=2,ee):se):(oe.flags|=2,ee)):(oe.flags|=1048576,ee)}function O(oe){return s&&oe.alternate===null&&(oe.flags|=2),oe}function G(oe,ee,se,ye){return ee===null||ee.tag!==6?(ee=ph(se,oe.mode,ye),ee.return=oe,ee):(ee=C(ee,se),ee.return=oe,ee)}function J(oe,ee,se,ye){var Pe=se.type;return Pe===_?fe(oe,ee,se.props.children,ye,se.key):ee!==null&&(ee.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Bv(Pe)===ee.type)?(ye=C(ee,se.props),ye.ref=ya(oe,ee,se),ye.return=oe,ye):(ye=Zc(se.type,se.key,se.props,null,oe.mode,ye),ye.ref=ya(oe,ee,se),ye.return=oe,ye)}function ie(oe,ee,se,ye){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==se.containerInfo||ee.stateNode.implementation!==se.implementation?(ee=hh(se,oe.mode,ye),ee.return=oe,ee):(ee=C(ee,se.children||[]),ee.return=oe,ee)}function fe(oe,ee,se,ye,Pe){return ee===null||ee.tag!==7?(ee=zo(se,oe.mode,ye,Pe),ee.return=oe,ee):(ee=C(ee,se),ee.return=oe,ee)}function he(oe,ee,se){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=ph(""+ee,oe.mode,se),ee.return=oe,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case M:return se=Zc(ee.type,ee.key,ee.props,null,oe.mode,se),se.ref=ya(oe,null,ee),se.return=oe,se;case R:return ee=hh(ee,oe.mode,se),ee.return=oe,ee;case A:var ye=ee._init;return he(oe,ye(ee._payload),se)}if(ot(ee)||W(ee))return ee=zo(ee,oe.mode,se,null),ee.return=oe,ee;Tc(oe,ee)}return null}function de(oe,ee,se,ye){var Pe=ee!==null?ee.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Pe!==null?null:G(oe,ee,""+se,ye);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return se.key===Pe?J(oe,ee,se,ye):null;case R:return se.key===Pe?ie(oe,ee,se,ye):null;case A:return Pe=se._init,de(oe,ee,Pe(se._payload),ye)}if(ot(se)||W(se))return Pe!==null?null:fe(oe,ee,se,ye,null);Tc(oe,se)}return null}function be(oe,ee,se,ye,Pe){if(typeof ye=="string"&&ye!==""||typeof ye=="number")return oe=oe.get(se)||null,G(ee,oe,""+ye,Pe);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case M:return oe=oe.get(ye.key===null?se:ye.key)||null,J(ee,oe,ye,Pe);case R:return oe=oe.get(ye.key===null?se:ye.key)||null,ie(ee,oe,ye,Pe);case A:var Ie=ye._init;return be(oe,ee,se,Ie(ye._payload),Pe)}if(ot(ye)||W(ye))return oe=oe.get(se)||null,fe(ee,oe,ye,Pe,null);Tc(ee,ye)}return null}function ke(oe,ee,se,ye){for(var Pe=null,Ie=null,_e=ee,Ae=ee=0,St=null;_e!==null&&Ae<se.length;Ae++){_e.index>Ae?(St=_e,_e=null):St=_e.sibling;var Ue=de(oe,_e,se[Ae],ye);if(Ue===null){_e===null&&(_e=St);break}s&&_e&&Ue.alternate===null&&a(oe,_e),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue,_e=St}if(Ae===se.length)return u(oe,_e),st&&Ao(oe,Ae),Pe;if(_e===null){for(;Ae<se.length;Ae++)_e=he(oe,se[Ae],ye),_e!==null&&(ee=T(_e,ee,Ae),Ie===null?Pe=_e:Ie.sibling=_e,Ie=_e);return st&&Ao(oe,Ae),Pe}for(_e=y(oe,_e);Ae<se.length;Ae++)St=be(_e,oe,Ae,se[Ae],ye),St!==null&&(s&&St.alternate!==null&&_e.delete(St.key===null?Ae:St.key),ee=T(St,ee,Ae),Ie===null?Pe=St:Ie.sibling=St,Ie=St);return s&&_e.forEach(function(Zr){return a(oe,Zr)}),st&&Ao(oe,Ae),Pe}function Te(oe,ee,se,ye){var Pe=W(se);if(typeof Pe!="function")throw Error(n(150));if(se=Pe.call(se),se==null)throw Error(n(151));for(var Ie=Pe=null,_e=ee,Ae=ee=0,St=null,Ue=se.next();_e!==null&&!Ue.done;Ae++,Ue=se.next()){_e.index>Ae?(St=_e,_e=null):St=_e.sibling;var Zr=de(oe,_e,Ue.value,ye);if(Zr===null){_e===null&&(_e=St);break}s&&_e&&Zr.alternate===null&&a(oe,_e),ee=T(Zr,ee,Ae),Ie===null?Pe=Zr:Ie.sibling=Zr,Ie=Zr,_e=St}if(Ue.done)return u(oe,_e),st&&Ao(oe,Ae),Pe;if(_e===null){for(;!Ue.done;Ae++,Ue=se.next())Ue=he(oe,Ue.value,ye),Ue!==null&&(ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue);return st&&Ao(oe,Ae),Pe}for(_e=y(oe,_e);!Ue.done;Ae++,Ue=se.next())Ue=be(_e,oe,Ae,Ue.value,ye),Ue!==null&&(s&&Ue.alternate!==null&&_e.delete(Ue.key===null?Ae:Ue.key),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue);return s&&_e.forEach(function(DI){return a(oe,DI)}),st&&Ao(oe,Ae),Pe}function ft(oe,ee,se,ye){if(typeof se=="object"&&se!==null&&se.type===_&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case M:e:{for(var Pe=se.key,Ie=ee;Ie!==null;){if(Ie.key===Pe){if(Pe=se.type,Pe===_){if(Ie.tag===7){u(oe,Ie.sibling),ee=C(Ie,se.props.children),ee.return=oe,oe=ee;break e}}else if(Ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Bv(Pe)===Ie.type){u(oe,Ie.sibling),ee=C(Ie,se.props),ee.ref=ya(oe,Ie,se),ee.return=oe,oe=ee;break e}u(oe,Ie);break}else a(oe,Ie);Ie=Ie.sibling}se.type===_?(ee=zo(se.props.children,oe.mode,ye,se.key),ee.return=oe,oe=ee):(ye=Zc(se.type,se.key,se.props,null,oe.mode,ye),ye.ref=ya(oe,ee,se),ye.return=oe,oe=ye)}return O(oe);case R:e:{for(Ie=se.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===se.containerInfo&&ee.stateNode.implementation===se.implementation){u(oe,ee.sibling),ee=C(ee,se.children||[]),ee.return=oe,oe=ee;break e}else{u(oe,ee);break}else a(oe,ee);ee=ee.sibling}ee=hh(se,oe.mode,ye),ee.return=oe,oe=ee}return O(oe);case A:return Ie=se._init,ft(oe,ee,Ie(se._payload),ye)}if(ot(se))return ke(oe,ee,se,ye);if(W(se))return Te(oe,ee,se,ye);Tc(oe,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,ee!==null&&ee.tag===6?(u(oe,ee.sibling),ee=C(ee,se),ee.return=oe,oe=ee):(u(oe,ee),ee=ph(se,oe.mode,ye),ee.return=oe,oe=ee),O(oe)):u(oe,ee)}return ft}var $s=Hv(!0),Wv=Hv(!1),Pc=zr(null),Rc=null,Ls=null,Cp=null;function Ep(){Cp=Ls=Rc=null}function Np(s){var a=Pc.current;tt(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 pn(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 Mo=null;function Tp(s){Mo===null?Mo=[s]:Mo.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,lr(s,y)}function lr(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 Hr=!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 cr(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Wr(s,a,u){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(We&2)!==0){var C=y.pending;return C===null?a.next=a:(a.next=C.next,C.next=a),y.pending=a,lr(s,u)}return C=y.interleaved,C===null?(a.next=a,Tp(y)):(a.next=C.next,C.next=a),y.interleaved=a,lr(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,Bf(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 O={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};T===null?C=T=O:T=T.next=O,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;Hr=!1;var T=C.firstBaseUpdate,O=C.lastBaseUpdate,G=C.shared.pending;if(G!==null){C.shared.pending=null;var J=G,ie=J.next;J.next=null,O===null?T=ie:O.next=ie,O=J;var fe=s.alternate;fe!==null&&(fe=fe.updateQueue,G=fe.lastBaseUpdate,G!==O&&(G===null?fe.firstBaseUpdate=ie:G.next=ie,fe.lastBaseUpdate=J))}if(T!==null){var he=C.baseState;O=0,fe=ie=J=null,G=T;do{var de=G.lane,be=G.eventTime;if((y&de)===de){fe!==null&&(fe=fe.next={eventTime:be,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var ke=s,Te=G;switch(de=a,be=u,Te.tag){case 1:if(ke=Te.payload,typeof ke=="function"){he=ke.call(be,he,de);break e}he=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Te.payload,de=typeof ke=="function"?ke.call(be,he,de):ke,de==null)break e;he=q({},he,de);break e;case 2:Hr=!0}}G.callback!==null&&G.lane!==0&&(s.flags|=64,de=C.effects,de===null?C.effects=[G]:de.push(G))}else be={eventTime:be,lane:de,tag:G.tag,payload:G.payload,callback:G.callback,next:null},fe===null?(ie=fe=be,J=he):fe=fe.next=be,O|=de;if(G=G.next,G===null){if(G=C.shared.pending,G===null)break;de=G,G=de.next,de.next=null,C.lastBaseUpdate=de,C.shared.pending=null}}while(!0);if(fe===null&&(J=he),C.baseState=J,C.firstBaseUpdate=ie,C.lastBaseUpdate=fe,a=C.shared.interleaved,a!==null){C=a;do O|=C.lane,C=C.next;while(C!==a)}else T===null&&(C.shared.lanes=0);Oo|=O,s.lanes=O,s.memoizedState=he}}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={},zn=zr(va),xa=zr(va),wa=zr(va);function Do(s){if(s===va)throw Error(n(174));return s}function Rp(s,a){switch(Ze(wa,a),Ze(xa,s),Ze(zn,va),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:nr(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=nr(a,s)}tt(zn),Ze(zn,a)}function zs(){tt(zn),tt(xa),tt(wa)}function Xv(s){Do(wa.current);var a=Do(zn.current),u=nr(a,s.type);a!==u&&(Ze(xa,s),Ze(zn,u))}function Ip(s){xa.current===s&&(tt(zn),tt(xa))}var lt=zr(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,jo=0,ct=null,yt=null,wt=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(!xn(s[u],a[u]))return!1;return!0}function jp(s,a,u,y,C,T){if(jo=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,wt=yt=null,a.updateQueue=null,Mc.current=lI,s=u(y,C)}while(ba)}if(Mc.current=$c,a=yt!==null&&yt.next!==null,jo=0,wt=yt=ct=null,Dc=!1,a)throw Error(n(300));return s}function Op(){var s=Sa!==0;return Sa=0,s}function Vn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?ct.memoizedState=wt=s:wt=wt.next=s,wt}function hn(){if(yt===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=yt.next;var a=wt===null?ct.memoizedState:wt.next;if(a!==null)wt=a,yt=s;else{if(s===null)throw Error(n(310));yt=s,s={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},wt===null?ct.memoizedState=wt=s:wt=wt.next=s}return wt}function Ca(s,a){return typeof a=="function"?a(s):a}function $p(s){var a=hn(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var y=yt,C=y.baseQueue,T=u.pending;if(T!==null){if(C!==null){var O=C.next;C.next=T.next,T.next=O}y.baseQueue=C=T,u.pending=null}if(C!==null){T=C.next,y=y.baseState;var G=O=null,J=null,ie=T;do{var fe=ie.lane;if((jo&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 he={lane:fe,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null};J===null?(G=J=he,O=y):J=J.next=he,ct.lanes|=fe,Oo|=fe}ie=ie.next}while(ie!==null&&ie!==T);J===null?O=y:J.next=G,xn(y,a.memoizedState)||(Bt=!0),a.memoizedState=y,a.baseState=O,a.baseQueue=J,u.lastRenderedState=y}if(s=u.interleaved,s!==null){C=s;do T=C.lane,ct.lanes|=T,Oo|=T,C=C.next;while(C!==s)}else C===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function Lp(s){var a=hn(),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 O=C=C.next;do T=s(T,O.action),O=O.next;while(O!==C);xn(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=hn(),C=a(),T=!xn(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||wt!==null&&wt.memoizedState.tag&1){if(u.flags|=2048,Ea(9,Jv.bind(null,u,y,C,a),void 0,null),bt===null)throw Error(n(349));(jo&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!xn(s,u)}catch{return!0}}function nx(s){var a=lr(s,1);a!==null&&En(a,s,1,-1)}function rx(s){var a=Vn();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 hn().memoizedState}function jc(s,a,u,y){var C=Vn();ct.flags|=s,C.memoizedState=Ea(1|a,u,void 0,y===void 0?null:y)}function Oc(s,a,u,y){var C=hn();y=y===void 0?null:y;var T=void 0;if(yt!==null){var O=yt.memoizedState;if(T=O.destroy,y!==null&&Dp(y,O.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=hn();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=hn();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(jo&21)===0?(s.baseState&&(s.baseState=!1,Bt=!0),s.memoizedState=u):(xn(u,a)||(u=Cs(),ct.lanes|=u,Oo|=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 hn().memoizedState}function oI(s,a,u){var y=Yr(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=jt();En(u,s,y,C),mx(u,a,y)}}function sI(s,a,u){var y=Yr(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 O=a.lastRenderedState,G=T(O,u);if(C.hasEagerState=!0,C.eagerState=G,xn(G,O)){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=jt(),En(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,Bf(s,u)}}var $c={readContext:pn,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:pn,useCallback:function(s,a){return Vn().memoizedState=[s,a===void 0?null:a],s},useContext:pn,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=Vn();return a=a===void 0?null:a,s=s(),u.memoizedState=[s,a],s},useReducer:function(s,a,u){var y=Vn();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=Vn();return s={current:s},a.memoizedState=s},useState:rx,useDebugValue:zp,useDeferredValue:function(s){return Vn().memoizedState=s},useTransition:function(){var s=rx(!1),a=s[0];return s=rI.bind(null,s[1]),Vn().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,u){var y=ct,C=Vn();if(st){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),bt===null)throw Error(n(349));(jo&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=Vn(),a=bt.identifierPrefix;if(st){var u=ar,y=ir;u=(y&~(1<<32-qt(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:pn,useCallback:ux,useContext:pn,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=hn();return fx(a,yt.memoizedState,s)},useTransition:function(){var s=$p(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1},lI={readContext:pn,useCallback:ux,useContext:pn,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=hn();return yt===null?a.memoizedState=s:fx(a,yt.memoizedState,s)},useTransition:function(){var s=Lp(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:qv,useSyncExternalStore:Zv,useId:px,unstable_isNewReconciler:!1};function bn(s,a){if(s&&s.defaultProps){a=q({},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:q({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Lc={isMounted:function(s){return(s=s._reactInternals)?Ln(s)===s:!1},enqueueSetState:function(s,a,u){s=s._reactInternals;var y=jt(),C=Yr(s),T=cr(y,C);T.payload=a,u!=null&&(T.callback=u),a=Wr(s,T,C),a!==null&&(En(a,s,C,y),Ic(a,s,C))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var y=jt(),C=Yr(s),T=cr(y,C);T.tag=1,T.payload=a,u!=null&&(T.callback=u),a=Wr(s,T,C),a!==null&&(En(a,s,C,y),Ic(a,s,C))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=jt(),y=Yr(s),C=cr(u,y);C.tag=2,a!=null&&(C.callback=a),a=Wr(s,C,y),a!==null&&(En(a,s,y,u),Ic(a,s,y))}};function yx(s,a,u,y,C,T,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,T,O):a.prototype&&a.prototype.isPureReactComponent?!ua(u,y)||!ua(C,T):!0}function vx(s,a,u){var y=!1,C=Vr,T=a.contextType;return typeof T=="object"&&T!==null?T=pn(T):(C=Vt(a)?Io:Rt.current,y=a.contextTypes,T=(y=y!=null)?Ms(s,C):Vr),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 Bp(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=pn(T):(T=Vt(a)?Io: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+=te(y),y=y.return;while(y);var C=u}catch(T){C=`
|
|
7
7
|
Error generating stack: `+T.message+`
|
|
8
|
-
`+T.stack}return{value:s,source:a,stack:C,digest:null}}function Hp(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=cr(-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=cr(-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"&&(Kr===null?Kr=new Set([this]):Kr.add(this));var O=a.stack;this.componentDidCatch(a.value,{componentStack:O!==null?O:""})}),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=cr(-1,1),a.tag=2,Wr(u,a,1))),u.lanes|=1),s):(s.flags|=65536,s.lanes=C,s)}var uI=P.ReactCurrentOwner,Bt=!1;function Dt(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,ur(s,a,C)):(st&&u&&vp(a),a.flags|=1,Dt(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 O=T.memoizedProps;if(u=u.compare,u=u!==null?u:ua,u(O,y)&&s.ref===a.ref)return ur(s,a,C)}return a.flags|=1,s=qr(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,ur(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},Ze(Hs,en),en|=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,Ze(Hs,en),en|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=T!==null?T.baseLanes:u,Ze(Hs,en),en|=y}else T!==null?(y=T.baseLanes|u,a.memoizedState=null):y=u,Ze(Hs,en),en|=y;return Dt(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=Vt(u)?Io: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,ur(s,a,C)):(st&&y&&vp(a),a.flags|=1,Dt(s,a,u,C),a.child)}function Ix(s,a,u,y,C){if(Vt(u)){var T=!0;Sc(a)}else T=!1;if(Fs(a,C),a.stateNode===null)zc(s,a),vx(a,u,y),Bp(a,u,y,C),y=!0;else if(s===null){var O=a.stateNode,Y=a.memoizedProps;O.props=Y;var J=O.context,ie=u.contextType;typeof ie=="object"&&ie!==null?ie=pn(ie):(ie=Vt(u)?Io:Rt.current,ie=Ms(a,ie));var fe=u.getDerivedStateFromProps,he=typeof fe=="function"||typeof O.getSnapshotBeforeUpdate=="function";he||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(Y!==y||J!==ie)&&xx(a,O,y,ie),Hr=!1;var de=a.memoizedState;O.state=de,_c(a,y,O,C),J=a.memoizedState,Y!==y||de!==J||zt.current||Hr?(typeof fe=="function"&&(Vp(a,u,fe,y),J=a.memoizedState),(Y=Hr||yx(a,u,Y,y,de,J,ie))?(he||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(a.flags|=4194308)):(typeof O.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=y,a.memoizedState=J),O.props=y,O.state=J,O.context=ie,y=Y):(typeof O.componentDidMount=="function"&&(a.flags|=4194308),y=!1)}else{O=a.stateNode,Kv(s,a),Y=a.memoizedProps,ie=a.type===a.elementType?Y:Sn(a.type,Y),O.props=ie,he=a.pendingProps,de=O.context,J=u.contextType,typeof J=="object"&&J!==null?J=pn(J):(J=Vt(u)?Io:Rt.current,J=Ms(a,J));var be=u.getDerivedStateFromProps;(fe=typeof be=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(Y!==he||de!==J)&&xx(a,O,y,J),Hr=!1,de=a.memoizedState,O.state=de,_c(a,y,O,C);var ke=a.memoizedState;Y!==he||de!==ke||zt.current||Hr?(typeof be=="function"&&(Vp(a,u,be,y),ke=a.memoizedState),(ie=Hr||yx(a,u,ie,y,de,ke,J)||!1)?(fe||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(y,ke,J),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(y,ke,J)),typeof O.componentDidUpdate=="function"&&(a.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof O.componentDidUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=1024),a.memoizedProps=y,a.memoizedState=ke),O.props=y,O.state=ke,O.context=J,y=ie):(typeof O.componentDidUpdate!="function"||Y===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof O.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 O=(a.flags&128)!==0;if(!y&&!O)return C&&jv(a,u,!1),ur(s,a,T);y=a.stateNode,uI.current=a;var Y=O&&typeof u.getDerivedStateFromError!="function"?null:y.render();return a.flags|=1,s!==null&&O?(a.child=$s(a,s.child,null,T),a.child=$s(a,null,Y,T)):Dt(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,Dt(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,O=(a.flags&128)!==0,Y;if((Y=O)||(Y=s!==null&&s.memoizedState===null?!1:(C&2)!==0),Y?(T=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(C|=1),Ze(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):(O=y.children,s=y.fallback,T?(y=a.mode,T=a.child,O={mode:"hidden",children:O},(y&1)===0&&T!==null?(T.childLanes=0,T.pendingProps=O):T=Qc(O,y,0,null),s=zo(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,O));if(C=s.memoizedState,C!==null&&(Y=C.dehydrated,Y!==null))return dI(s,a,O,y,Y,C,u);if(T){T=y.fallback,O=a.mode,C=s.child,Y=C.sibling;var J={mode:"hidden",children:y.children};return(O&1)===0&&a.child!==C?(y=a.child,y.childLanes=0,y.pendingProps=J,a.deletions=null):(y=qr(C,J),y.subtreeFlags=C.subtreeFlags&14680064),Y!==null?T=qr(Y,T):(T=zo(T,O,u,null),T.flags|=2),T.return=a,y.return=a,y.sibling=T,a.child=y,y=T,T=a.child,O=s.child.memoizedState,O=O===null?Yp(u):{baseLanes:O.baseLanes|u,cachePool:null,transitions:O.transitions},T.memoizedState=O,T.childLanes=s.childLanes&~u,a.memoizedState=Gp,y}return T=s.child,s=T.sibling,y=qr(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,O){if(u)return a.flags&256?(a.flags&=-257,y=Hp(Error(n(422))),Fc(s,a,O,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=zo(T,C,O,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,O),a.child.memoizedState=Yp(O),a.memoizedState=Gp,T);if((a.mode&1)===0)return Fc(s,a,O,null);if(C.data==="$!"){if(y=C.nextSibling&&C.nextSibling.dataset,y)var Y=y.dgst;return y=Y,T=Error(n(419)),y=Hp(T,y,void 0),Fc(s,a,O,y)}if(Y=(O&s.childLanes)!==0,Bt||Y){if(y=bt,y!==null){switch(O&-O){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|O))!==0?0:C,C!==0&&C!==T.retryLane&&(T.retryLane=C,lr(s,C),Nn(y,s,C,-1))}return dh(),y=Hp(Error(n(421))),Fc(s,a,O,y)}return C.data==="$?"?(a.flags|=128,a.child=s.child,a=EI.bind(null,s),C._reactRetry=a,null):(s=T.treeContext,Jt=Fr(C.nextSibling),Qt=a,st=!0,bn=null,s!==null&&(dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=_o,ir=s.id,ar=s.overflow,_o=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(Dt(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(Ze(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 ur(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Oo|=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=qr(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=qr(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:Vt(a.type)&&Sc(a);break;case 4:Rp(a,a.stateNode.containerInfo);break;case 10:var y=a.type._context,C=a.memoizedProps.value;Ze(Pc,y._currentValue),y._currentValue=C;break;case 13:if(y=a.memoizedState,y!==null)return y.dehydrated!==null?(Ze(lt,lt.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Mx(s,a,u):(Ze(lt,lt.current&1),s=ur(s,a,u),s!==null?s.sibling:null);Ze(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),Ze(lt,lt.current),y)break;return null;case 22:case 23:return a.lanes=0,Px(s,a,u)}return ur(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,Do(zn.current);var T=null;switch(u){case"input":C=Re(s,C),y=Re(s,y),T=[];break;case"select":C=q({},C,{value:void 0}),y=q({},y,{value:void 0}),T=[];break;case"textarea":C=Ct(s,C),y=Ct(s,y),T=[];break;default:typeof C.onClick!="function"&&typeof y.onClick=="function"&&(s.onclick=xc)}Vi(u,y);var O;u=null;for(ie in C)if(!y.hasOwnProperty(ie)&&C.hasOwnProperty(ie)&&C[ie]!=null)if(ie==="style"){var Y=C[ie];for(O in Y)Y.hasOwnProperty(O)&&(u||(u={}),u[O]="")}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(O in Y)!Y.hasOwnProperty(O)||J&&J.hasOwnProperty(O)||(u||(u={}),u[O]="");for(O in J)J.hasOwnProperty(O)&&Y[O]!==J[O]&&(u||(u={}),u[O]=J[O])}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"&&et("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 Vt(a.type)&&bc(),_t(a),null;case 3:return y=a.stateNode,zs(),tt(zt),tt(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,bn!==null&&(lh(bn),bn=null))),Zp(s,a),_t(a),null;case 5:Ip(a);var C=Do(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=Do(zn.current),kc(a)){y=a.stateNode,u=a.type;var T=a.memoizedProps;switch(y[Fn]=a,y[ga]=T,s=(a.mode&1)!==0,u){case"dialog":et("cancel",y),et("close",y);break;case"iframe":case"object":case"embed":et("load",y);break;case"video":case"audio":for(C=0;C<fa.length;C++)et(fa[C],y);break;case"source":et("error",y);break;case"img":case"image":case"link":et("error",y),et("load",y);break;case"details":et("toggle",y);break;case"input":Le(y,T),et("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!T.multiple},et("invalid",y);break;case"textarea":Ke(y,T),et("invalid",y)}Vi(u,T),C=null;for(var O in T)if(T.hasOwnProperty(O)){var Y=T[O];O==="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(O)&&Y!=null&&O==="onScroll"&&et("scroll",y)}switch(u){case"input":me(y),we(y,T,!0);break;case"textarea":me(y),bo(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{O=C.nodeType===9?C:C.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=tr(u)),s==="http://www.w3.org/1999/xhtml"?u==="script"?(s=O.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof y.is=="string"?s=O.createElement(u,{is:y.is}):(s=O.createElement(u),u==="select"&&(O=s,y.multiple?O.multiple=!0:y.size&&(O.size=y.size))):s=O.createElementNS(s,u),s[Fn]=a,s[ga]=y,Ox(s,a,!1,!1),a.stateNode=s;e:{switch(O=Bi(u,y),u){case"dialog":et("cancel",s),et("close",s),C=y;break;case"iframe":case"object":case"embed":et("load",s),C=y;break;case"video":case"audio":for(C=0;C<fa.length;C++)et(fa[C],s);C=y;break;case"source":et("error",s),C=y;break;case"img":case"image":case"link":et("error",s),et("load",s),C=y;break;case"details":et("toggle",s),C=y;break;case"input":Le(s,y),C=Re(s,y),et("invalid",s);break;case"option":C=y;break;case"select":s._wrapperState={wasMultiple:!!y.multiple},C=q({},y,{value:void 0}),et("invalid",s);break;case"textarea":Ke(s,y),C=Ct(s,y),et("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"?Hl(s,J):T==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&Vl(s,J)):T==="children"?typeof J=="string"?(u!=="textarea"||J!=="")&&rr(s,J):typeof J=="number"&&rr(s,""+J):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(o.hasOwnProperty(T)?J!=null&&T==="onScroll"&&et("scroll",s):J!=null&&k(s,T,J,O))}switch(u){case"input":me(s),we(s,y,!1);break;case"textarea":me(s),bo(s);break;case"option":y.value!=null&&s.setAttribute("value",""+K(y.value));break;case"select":s.multiple=!!y.multiple,T=y.value,T!=null?Je(s,!!y.multiple,T,!1):y.defaultValue!=null&&Je(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=Do(wa.current),Do(zn.current),kc(a)){if(y=a.stateNode,u=a.memoizedProps,y[Fn]=a,(T=y.nodeValue!==u)&&(s=Qt,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[Fn]=a,a.stateNode=y}return _t(a),null;case 13:if(tt(lt),y=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(st&&Jt!==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[Fn]=a}else Os(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),T=!1}else bn!==null&&(lh(bn),bn=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?vt===0&&(vt=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 Vt(a.type)&&bc(),_t(a),null;case 19:if(tt(lt),T=a.memoizedState,T===null)return _t(a),null;if(y=(a.flags&128)!==0,O=T.rendering,O===null)if(y)Na(T,!1);else{if(vt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(O=Ac(s),O!==null){for(a.flags|=128,Na(T,!1),y=O.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,O=T.alternate,O===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=O.childLanes,T.lanes=O.lanes,T.child=O.child,T.subtreeFlags=0,T.deletions=null,T.memoizedProps=O.memoizedProps,T.memoizedState=O.memoizedState,T.updateQueue=O.updateQueue,T.type=O.type,s=O.dependencies,T.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),u=u.sibling;return Ze(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(O),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"&&!O.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?(O.sibling=a.child,a.child=O):(u=T.last,u!==null?u.sibling=O:a.child=O,T.last=O)}return T.tail!==null?(a=T.tail,T.rendering=a,T.tail=a.sibling,T.renderingStartTime=at(),a.sibling=null,u=lt.current,Ze(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?(en&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 Vt(a.type)&&bc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return zs(),tt(zt),tt(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(tt(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 tt(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,Ee=null;function Bs(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 O=0,Y=-1,J=-1,ie=0,fe=0,he=s,de=null;t:for(;;){for(var be;he!==u||C!==0&&he.nodeType!==3||(Y=O+C),he!==T||y!==0&&he.nodeType!==3||(J=O+y),he.nodeType===3&&(O+=he.nodeValue.length),(be=he.firstChild)!==null;)de=he,he=be;for(;;){if(he===s)break t;if(de===u&&++ie===C&&(Y=O),de===T&&++fe===y&&(J=O),(be=he.nextSibling)!==null)break;he=de,de=he.parentNode}he=be}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,Ee=a;Ee!==null;)if(a=Ee,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Ee=s;else for(;Ee!==null;){a=Ee;try{var ke=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(ke!==null){var Te=ke.memoizedProps,ft=ke.memoizedState,oe=a.stateNode,ee=oe.getSnapshotBeforeUpdate(a.elementType===a.type?Te:Sn(a.type,Te),ft);oe.__reactInternalSnapshotBeforeUpdate=ee}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(ye){ut(a,a.return,ye)}if(s=a.sibling,s!==null){s.return=a.return,Ee=s;break}Ee=a.return}return ke=Fx,Fx=!1,ke}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 Bc(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[Fn],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 Bx(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,Cn=!1;function Ur(s,a,u){for(u=u.child;u!==null;)Hx(s,a,u),u=u.sibling}function Hx(s,a,u){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(To,u)}catch{}switch(u.tag){case 5:At||Bs(u,a);case 6:var y=Et,C=Cn;Et=null,Ur(s,a,u),Et=y,Cn=C,Et!==null&&(Cn?(s=Et,u=u.stateNode,s.nodeType===8?s.parentNode.removeChild(u):s.removeChild(u)):Et.removeChild(u.stateNode));break;case 18:Et!==null&&(Cn?(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=Cn,Et=u.stateNode.containerInfo,Cn=!0,Ur(s,a,u),Et=y,Cn=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,O=T.destroy;T=T.tag,O!==void 0&&((T&2)!==0||(T&4)!==0)&&Qp(u,a,O),C=C.next}while(C!==y)}Ur(s,a,u);break;case 1:if(!At&&(Bs(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)}Ur(s,a,u);break;case 21:Ur(s,a,u);break;case 22:u.mode&1?(At=(y=At)||u.memoizedState!==null,Ur(s,a,u),At=y):Ur(s,a,u);break;default:Ur(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 En(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,O=a,Y=O;e:for(;Y!==null;){switch(Y.tag){case 5:Et=Y.stateNode,Cn=!1;break e;case 3:Et=Y.stateNode.containerInfo,Cn=!0;break e;case 4:Et=Y.stateNode.containerInfo,Cn=!0;break e}Y=Y.return}if(Et===null)throw Error(n(160));Hx(T,O,C),Et=null,Cn=!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(En(a,s),Bn(s),y&4){try{ka(3,s,s.return),Bc(3,s)}catch(Te){ut(s,s.return,Te)}try{ka(5,s,s.return)}catch(Te){ut(s,s.return,Te)}}break;case 1:En(a,s),Bn(s),y&512&&u!==null&&Bs(u,u.return);break;case 5:if(En(a,s),Bn(s),y&512&&u!==null&&Bs(u,u.return),s.flags&32){var C=s.stateNode;try{rr(C,"")}catch(Te){ut(s,s.return,Te)}}if(y&4&&(C=s.stateNode,C!=null)){var T=s.memoizedProps,O=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&&ze(C,T),Bi(Y,O);var ie=Bi(Y,T);for(O=0;O<J.length;O+=2){var fe=J[O],he=J[O+1];fe==="style"?Hl(C,he):fe==="dangerouslySetInnerHTML"?Vl(C,he):fe==="children"?rr(C,he):k(C,fe,he,ie)}switch(Y){case"input":le(C,T);break;case"textarea":ms(C,T);break;case"select":var de=C._wrapperState.wasMultiple;C._wrapperState.wasMultiple=!!T.multiple;var be=T.value;be!=null?Je(C,!!T.multiple,be,!1):de!==!!T.multiple&&(T.defaultValue!=null?Je(C,!!T.multiple,T.defaultValue,!0):Je(C,!!T.multiple,T.multiple?[]:"",!1))}C[ga]=T}catch(Te){ut(s,s.return,Te)}}break;case 6:if(En(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(Te){ut(s,s.return,Te)}}break;case 3:if(En(a,s),Bn(s),y&4&&u!==null&&u.memoizedState.isDehydrated)try{oa(a.containerInfo)}catch(Te){ut(s,s.return,Te)}break;case 4:En(a,s),Bn(s);break;case 13:En(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,En(a,s),At=ie):En(a,s),Bn(s),y&8192){if(ie=s.memoizedState!==null,(s.stateNode.isHidden=ie)&&!fe&&(s.mode&1)!==0)for(Ee=s,fe=s.child;fe!==null;){for(he=Ee=fe;Ee!==null;){switch(de=Ee,be=de.child,de.tag){case 0:case 11:case 14:case 15:ka(4,de,de.return);break;case 1:Bs(de,de.return);var ke=de.stateNode;if(typeof ke.componentWillUnmount=="function"){y=de,u=de.return;try{a=y,ke.props=a.memoizedProps,ke.state=a.memoizedState,ke.componentWillUnmount()}catch(Te){ut(y,u,Te)}}break;case 5:Bs(de,de.return);break;case 22:if(de.memoizedState!==null){Yx(he);continue}}be!==null?(be.return=de,Ee=be):Yx(he)}fe=fe.sibling}e:for(fe=null,he=s;;){if(he.tag===5){if(fe===null){fe=he;try{C=he.stateNode,ie?(T=C.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none"):(Y=he.stateNode,J=he.memoizedProps.style,O=J!=null&&J.hasOwnProperty("display")?J.display:null,Y.style.display=Bl("display",O))}catch(Te){ut(s,s.return,Te)}}}else if(he.tag===6){if(fe===null)try{he.stateNode.nodeValue=ie?"":he.memoizedProps}catch(Te){ut(s,s.return,Te)}}else if((he.tag!==22&&he.tag!==23||he.memoizedState===null||he===s)&&he.child!==null){he.child.return=he,he=he.child;continue}if(he===s)break e;for(;he.sibling===null;){if(he.return===null||he.return===s)break e;fe===he&&(fe=null),he=he.return}fe===he&&(fe=null),he.sibling.return=he.return,he=he.sibling}}break;case 19:En(a,s),Bn(s),y&4&&Wx(s);break;case 21:break;default:En(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&&(rr(C,""),y.flags&=-33);var T=Bx(s);th(s,T,C);break;case 3:case 4:var O=y.stateNode.containerInfo,Y=Bx(s);eh(s,Y,O);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){Ee=s,Kx(s)}function Kx(s,a,u){for(var y=(s.mode&1)!==0;Ee!==null;){var C=Ee,T=C.child;if(C.tag===22&&y){var O=C.memoizedState!==null||Vc;if(!O){var Y=C.alternate,J=Y!==null&&Y.memoizedState!==null||At;Y=Vc;var ie=At;if(Vc=O,(At=J)&&!ie)for(Ee=C;Ee!==null;)O=Ee,J=O.child,O.tag===22&&O.memoizedState!==null?Xx(C):J!==null?(J.return=O,Ee=J):Xx(C);for(;T!==null;)Ee=T,Kx(T),T=T.sibling;Ee=C,Vc=Y,At=ie}Gx(s)}else(C.subtreeFlags&8772)!==0&&T!==null?(T.return=C,Ee=T):Gx(s)}}function Gx(s){for(;Ee!==null;){var a=Ee;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||Bc(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:Sn(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 O=a.updateQueue;if(O!==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,O,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 he=fe.dehydrated;he!==null&&oa(he)}}}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){Ee=null;break}if(u=a.sibling,u!==null){u.return=a.return,Ee=u;break}Ee=a.return}}function Yx(s){for(;Ee!==null;){var a=Ee;if(a===s){Ee=null;break}var u=a.sibling;if(u!==null){u.return=a.return,Ee=u;break}Ee=a.return}}function Xx(s){for(;Ee!==null;){var a=Ee;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Bc(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 O=a.return;try{Jp(a)}catch(J){ut(a,O,J)}}}catch(J){ut(a,a.return,J)}if(a===s){Ee=null;break}var Y=a.sibling;if(Y!==null){Y.return=a.return,Ee=Y;break}Ee=a.return}}var vI=Math.ceil,Hc=P.ReactCurrentDispatcher,nh=P.ReactCurrentOwner,gn=P.ReactCurrentBatchConfig,We=0,bt=null,ht=null,Nt=0,en=0,Hs=zr(0),vt=0,Ta=null,Oo=0,Wc=0,rh=0,Pa=null,Ht=null,oh=0,Ws=1/0,dr=null,Uc=!1,sh=null,Kr=null,Kc=!1,Gr=null,Gc=0,Ra=0,ih=null,Yc=-1,Xc=0;function jt(){return(We&6)!==0?at():Yc!==-1?Yc:Yc=at()}function Yr(s){return(s.mode&1)===0?1:(We&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 Nn(s,a,u,y){if(50<Ra)throw Ra=0,ih=null,Error(n(185));Po(s,u,y),((We&2)===0||s!==bt)&&(s===bt&&((We&2)===0&&(Wc|=u),vt===4&&Xr(s,Nt)),Wt(s,y),u===1&&We===0&&(a.mode&1)===0&&(Ws=at()+500,Cc&&Br()))}function Wt(s,a){var u=s.callbackNode;Vf(s,a);var y=Ss(s,s===bt?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(){(We&6)===0&&Br()}),u=null;else{switch(Hy(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,(We&6)!==0)throw Error(n(327));var u=s.callbackNode;if(Us()&&s.callbackNode!==u)return null;var y=Ss(s,s===bt?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=We;We|=2;var T=Jx();(bt!==s||Nt!==a)&&(dr=null,Ws=at()+500,Lo(s,a));do try{bI();break}catch(Y){Qx(s,Y)}while(!0);Ep(),Hc.current=T,We=C,ht!==null?a=0:(bt=null,Nt=0,a=vt)}if(a!==0){if(a===2&&(C=Qi(s),C!==0&&(y=C,a=ah(s,C))),a===1)throw u=Ta,Lo(s,0),Xr(s,y),Wt(s,at()),u;if(a===6)Xr(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,Lo(s,0),Xr(s,y),Wt(s,at()),u;switch(s.finishedWork=C,s.finishedLanes=y,a){case 0:case 1:throw Error(n(345));case 2:Fo(s,Ht,dr);break;case 3:if(Xr(s,y),(y&130023424)===y&&(a=oh+500-at(),10<a)){if(Ss(s,0)!==0)break;if(C=s.suspendedLanes,(C&y)!==y){jt(),s.pingedLanes|=s.suspendedLanes&C;break}s.timeoutHandle=pp(Fo.bind(null,s,Ht,dr),a);break}Fo(s,Ht,dr);break;case 4:if(Xr(s,y),(y&4194240)===y)break;for(a=s.eventTimes,C=-1;0<y;){var O=31-qt(y);T=1<<O,O=a[O],O>C&&(C=O),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(Fo.bind(null,s,Ht,dr),y);break}Fo(s,Ht,dr);break;case 5:Fo(s,Ht,dr);break;default:throw Error(n(329))}}}return Wt(s,at()),s.callbackNode===u?qx.bind(null,s):null}function ah(s,a){var u=Pa;return s.current.memoizedState.isDehydrated&&(Lo(s,a).flags|=256),s=qc(s,a),s!==2&&(a=Ht,Ht=u,a!==null&&lh(a)),s}function lh(s){Ht===null?Ht=s:Ht.push.apply(Ht,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(!wn(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 Xr(s,a){for(a&=~rh,a&=~Wc,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var u=31-qt(a),y=1<<u;s[u]=-1,a&=~y}}function Zx(s){if((We&6)!==0)throw Error(n(327));Us();var a=Ss(s,0);if((a&1)===0)return Wt(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,Lo(s,0),Xr(s,a),Wt(s,at()),u;if(u===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,Fo(s,Ht,dr),Wt(s,at()),null}function ch(s,a){var u=We;We|=1;try{return s(a)}finally{We=u,We===0&&(Ws=at()+500,Cc&&Br())}}function $o(s){Gr!==null&&Gr.tag===0&&(We&6)===0&&Us();var a=We;We|=1;var u=gn.transition,y=Ge;try{if(gn.transition=null,Ge=1,s)return s()}finally{Ge=y,gn.transition=u,We=a,(We&6)===0&&Br()}}function uh(){en=Hs.current,tt(Hs)}function Lo(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(),tt(zt),tt(Rt),Ap();break;case 5:Ip(y);break;case 4:zs();break;case 13:tt(lt);break;case 19:tt(lt);break;case 10:Np(y.type._context);break;case 22:case 23:uh()}u=u.return}if(bt=s,ht=s=qr(s.current,null),Nt=en=a,vt=0,Ta=null,rh=Wc=Oo=0,Ht=Pa=null,Mo!==null){for(a=0;a<Mo.length;a++)if(u=Mo[a],y=u.interleaved,y!==null){u.interleaved=null;var C=y.next,T=u.pending;if(T!==null){var O=T.next;T.next=C,y.next=O}u.pending=y}Mo=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(jo=0,wt=yt=ct=null,ba=!1,Sa=0,nh.current=null,u===null||u.return===null){vt=1,Ta=a,ht=null;break}e:{var T=s,O=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,he=fe.tag;if((fe.mode&1)===0&&(he===0||he===11||he===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 be=Cx(O);if(be!==null){be.flags&=-257,Ex(be,O,Y,T,a),be.mode&1&&Sx(T,ie,a),a=be,J=ie;var ke=a.updateQueue;if(ke===null){var Te=new Set;Te.add(J),a.updateQueue=Te}else ke.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(O);if(ft!==null){(ft.flags&65536)===0&&(ft.flags|=256),Ex(ft,O,Y,T,a),Sp(Vs(J,Y));break e}}T=J=Vs(J,Y),vt!==4&&(vt=2),Pa===null?Pa=[T]:Pa.push(T),T=O;do{switch(T.tag){case 3:T.flags|=65536,a&=-a,T.lanes|=a;var oe=wx(T,J,a);Gv(T,oe);break e;case 1:Y=J;var ee=T.type,se=T.stateNode;if((T.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Kr===null||!Kr.has(se)))){T.flags|=65536,a&=-a,T.lanes|=a;var ye=bx(T,Y,a);Gv(T,ye);break e}}T=T.return}while(T!==null)}t0(u)}catch(Pe){a=Pe,ht===u&&u!==null&&(ht=u=u.return);continue}break}while(!0)}function Jx(){var s=Hc.current;return Hc.current=$c,s===null?$c:s}function dh(){(vt===0||vt===3||vt===2)&&(vt=4),bt===null||(Oo&268435455)===0&&(Wc&268435455)===0||Xr(bt,Nt)}function qc(s,a){var u=We;We|=2;var y=Jx();(bt!==s||Nt!==a)&&(dr=null,Lo(s,a));do try{wI();break}catch(C){Qx(s,C)}while(!0);if(Ep(),We=u,Hc.current=y,ht!==null)throw Error(n(261));return bt=null,Nt=0,vt}function wI(){for(;ht!==null;)e0(ht)}function bI(){for(;ht!==null&&!Df();)e0(ht)}function e0(s){var a=o0(s.alternate,s,en);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,en),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{vt=6,ht=null;return}}if(a=a.sibling,a!==null){ht=a;return}ht=a=s}while(a!==null);vt===0&&(vt=5)}function Fo(s,a,u){var y=Ge,C=gn.transition;try{gn.transition=null,Ge=1,SI(s,a,u,y)}finally{gn.transition=C,Ge=y}return null}function SI(s,a,u,y){do Us();while(Gr!==null);if((We&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===bt&&(ht=bt=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=gn.transition,gn.transition=null;var O=Ge;Ge=1;var Y=We;We|=4,nh.current=null,mI(s,u),Ux(u,s),BR(dp),ac=!!up,dp=up=null,s.current=u,yI(u),ec(),We=Y,Ge=O,gn.transition=T}else s.current=u;if(Kc&&(Kc=!1,Gr=s,Gc=C),T=s.pendingLanes,T===0&&(Kr=null),$f(u.stateNode),Wt(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(Gr!==null){var s=Hy(Gc),a=gn.transition,u=Ge;try{if(gn.transition=null,Ge=16>s?16:s,Gr===null)var y=!1;else{if(s=Gr,Gr=null,Gc=0,(We&6)!==0)throw Error(n(331));var C=We;for(We|=4,Ee=s.current;Ee!==null;){var T=Ee,O=T.child;if((Ee.flags&16)!==0){var Y=T.deletions;if(Y!==null){for(var J=0;J<Y.length;J++){var ie=Y[J];for(Ee=ie;Ee!==null;){var fe=Ee;switch(fe.tag){case 0:case 11:case 15:ka(8,fe,T)}var he=fe.child;if(he!==null)he.return=fe,Ee=he;else for(;Ee!==null;){fe=Ee;var de=fe.sibling,be=fe.return;if(zx(fe),fe===ie){Ee=null;break}if(de!==null){de.return=be,Ee=de;break}Ee=be}}}var ke=T.alternate;if(ke!==null){var Te=ke.child;if(Te!==null){ke.child=null;do{var ft=Te.sibling;Te.sibling=null,Te=ft}while(Te!==null)}}Ee=T}}if((T.subtreeFlags&2064)!==0&&O!==null)O.return=T,Ee=O;else e:for(;Ee!==null;){if(T=Ee,(T.flags&2048)!==0)switch(T.tag){case 0:case 11:case 15:ka(9,T,T.return)}var oe=T.sibling;if(oe!==null){oe.return=T.return,Ee=oe;break e}Ee=T.return}}var ee=s.current;for(Ee=ee;Ee!==null;){O=Ee;var se=O.child;if((O.subtreeFlags&2064)!==0&&se!==null)se.return=O,Ee=se;else e:for(O=ee;Ee!==null;){if(Y=Ee,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Bc(9,Y)}}catch(Pe){ut(Y,Y.return,Pe)}if(Y===O){Ee=null;break e}var ye=Y.sibling;if(ye!==null){ye.return=Y.return,Ee=ye;break e}Ee=Y.return}}if(We=C,Br(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(To,s)}catch{}y=!0}return y}finally{Ge=u,gn.transition=a}}return!1}function n0(s,a,u){a=Vs(u,a),a=wx(s,a,1),s=Wr(s,a,1),a=jt(),s!==null&&(Po(s,1,a),Wt(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"&&(Kr===null||!Kr.has(y))){s=Vs(u,s),s=bx(a,s,1),a=Wr(a,s,1),s=jt(),a!==null&&(Po(a,1,s),Wt(a,s));break}}a=a.return}}function CI(s,a,u){var y=s.pingCache;y!==null&&y.delete(a),a=jt(),s.pingedLanes|=s.suspendedLanes&u,bt===s&&(Nt&u)===u&&(vt===4||vt===3&&(Nt&130023424)===Nt&&500>at()-oh?Lo(s,0):rh|=u),Wt(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=jt();s=lr(s,a),s!==null&&(Po(s,a,u),Wt(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||zt.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,Vt(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,Bp(a,y,s,u),a=Kp(null,a,y,!0,T,u)):(a.tag=0,st&&T&&vp(a),Dt(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=Sn(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,Sn(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:Sn(y,C),Up(s,a,y,C,u);case 1:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Sn(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 O=a.memoizedState;if(y=O.element,T.isDehydrated)if(T={element:y,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.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(Jt=Fr(a.stateNode.containerInfo.firstChild),Qt=a,st=!0,bn=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=ur(s,a,u);break e}Dt(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,O=C.children,fp(y,C)?O=null:T!==null&&fp(y,T)&&(a.flags|=32),Rx(s,a),Dt(s,a,O,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):Dt(s,a,y,u),a.child;case 11:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:Sn(y,C),Nx(s,a,y,C,u);case 7:return Dt(s,a,a.pendingProps,u),a.child;case 8:return Dt(s,a,a.pendingProps.children,u),a.child;case 12:return Dt(s,a,a.pendingProps.children,u),a.child;case 10:e:{if(y=a.type._context,C=a.pendingProps,T=a.memoizedProps,O=C.value,Ze(Pc,y._currentValue),y._currentValue=O,T!==null)if(wn(T.value,O)){if(T.children===C.children&&!zt.current){a=ur(s,a,u);break e}}else for(T=a.child,T!==null&&(T.return=a);T!==null;){var Y=T.dependencies;if(Y!==null){O=T.child;for(var J=Y.firstContext;J!==null;){if(J.context===y){if(T.tag===1){J=cr(-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)O=T.type===a.type?null:T.child;else if(T.tag===18){if(O=T.return,O===null)throw Error(n(341));O.lanes|=u,Y=O.alternate,Y!==null&&(Y.lanes|=u),kp(O,u,a),O=T.sibling}else O=T.child;if(O!==null)O.return=T;else for(O=T;O!==null;){if(O===a){O=null;break}if(T=O.sibling,T!==null){T.return=O.return,O=T;break}O=O.return}T=O}Dt(s,a,C.children,u),a=a.child}return a;case 9:return C=a.type,y=a.pendingProps.children,Fs(a,u),C=pn(C),y=y(C),a.flags|=1,Dt(s,a,y,u),a.child;case 14:return y=a.type,C=Sn(y,a.pendingProps),C=Sn(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:Sn(y,C),zc(s,a),a.tag=1,Vt(y)?(s=!0,Sc(a)):s=!1,Fs(a,u),vx(a,y,C),Bp(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 mn(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===U)return 11;if(s===B)return 14}return 2}function qr(s,a){var u=s.alternate;return u===null?(u=mn(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 O=2;if(y=s,typeof s=="function")fh(s)&&(O=1);else if(typeof s=="string")O=5;else e:switch(s){case _:return zo(u.children,C,T,a);case $:O=8,C|=8;break;case D:return s=mn(12,u,a,C|2),s.elementType=D,s.lanes=T,s;case G:return s=mn(13,u,a,C),s.elementType=G,s.lanes=T,s;case I:return s=mn(19,u,a,C),s.elementType=I,s.lanes=T,s;case V:return Qc(u,C,T,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case H:O=10;break e;case j:O=9;break e;case U:O=11;break e;case B:O=14;break e;case A:O=16,y=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return a=mn(O,u,a,C),a.elementType=s,a.type=y,a.lanes=T,a}function zo(s,a,u,y){return s=mn(7,s,y,a),s.lanes=u,s}function Qc(s,a,u,y){return s=mn(22,s,y,a),s.elementType=V,s.lanes=u,s.stateNode={isHidden:!1},s}function ph(s,a,u){return s=mn(6,s,null,a),s.lanes=u,s}function hh(s,a,u){return a=mn(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,O,Y,J){return s=new PI(s,a,u,Y,J),a===1?(a=1,T===!0&&(a|=8)):a=0,T=mn(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:R,key:y==null?null:""+y,children:s,containerInfo:a,implementation:u}}function i0(s){if(!s)return Vr;s=s._reactInternals;e:{if(Ln(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(Vt(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(Vt(u))return Dv(s,u,a)}return a}function a0(s,a,u,y,C,T,O,Y,J){return s=gh(u,y,!0,s,C,T,O,Y,J),s.context=i0(null),u=s.current,y=jt(),C=Yr(u),T=cr(y,C),T.callback=a??null,Wr(u,T,C),s.current.lanes=C,Po(s,C,y),Wt(s,y),s}function Jc(s,a,u,y){var C=a.current,T=jt(),O=Yr(C);return u=i0(u),a.context===null?a.context=u:a.pendingContext=u,a=cr(T,O),a.payload={element:s},y=y===void 0?null:y,y!==null&&(a.callback=y),s=Wr(C,a,O),s!==null&&(Nn(s,C,O,T),Ic(s,C,O)),O}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;$o(function(){Jc(null,s,null,null)}),a[or]=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<Or.length&&a!==0&&a<Or[u].priority;u++);Or.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(O);T.call(ie)}}var O=a0(a,y,s,0,null,!1,!1,"",u0);return s._reactRootContainer=O,s[or]=O.current,pa(s.nodeType===8?s.parentNode:s),$o(),O}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[or]=J.current,pa(s.nodeType===8?s.parentNode:s),$o(function(){Jc(a,J,u,y)}),J}function ru(s,a,u,y,C){var T=u._reactRootContainer;if(T){var O=T;if(typeof C=="function"){var Y=C;C=function(){var J=eu(O);Y.call(J)}}Jc(a,O,s,C)}else O=_I(u,a,s,C,y);return eu(O)}Wy=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var u=Ar(a.pendingLanes);u!==0&&(Bf(a,u|1),Wt(a,at()),(We&6)===0&&(Ws=at()+500,Br()))}break;case 13:$o(function(){var y=lr(s,1);if(y!==null){var C=jt();Nn(y,s,1,C)}}),mh(s,1)}},Hf=function(s){if(s.tag===13){var a=lr(s,134217728);if(a!==null){var u=jt();Nn(a,s,134217728,u)}mh(s,134217728)}},Uy=function(s){if(s.tag===13){var a=Yr(s),u=lr(s,a);if(u!==null){var y=jt();Nn(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(le(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));ge(y),le(y,C)}}}break;case"textarea":ms(s,u);break;case"select":a=u.value,a!=null&&Je(s,!!u.multiple,a,!1)}},Gl=ch,Yl=$o;var AI={usingClientEntryPoint:!1,Events:[ma,_s,wc,Ul,Kl,ch]},Ia={findFiberByHostInstance:Ro,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{To=ou.inject(MI),un=ou}catch{}}return Ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AI,Ut.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)},Ut.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[or]=a.current,pa(s.nodeType===8?s.parentNode:s),new yh(a)},Ut.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},Ut.flushSync=function(s){return $o(s)},Ut.hydrate=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!0,u)},Ut.hydrateRoot=function(s,a,u){if(!vh(s))throw Error(n(405));var y=u!=null&&u.hydratedSources||null,C=!1,T="",O=c0;if(u!=null&&(u.unstable_strictMode===!0&&(C=!0),u.identifierPrefix!==void 0&&(T=u.identifierPrefix),u.onRecoverableError!==void 0&&(O=u.onRecoverableError)),a=a0(a,null,s,1,u??null,C,!1,T,O),s[or]=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)},Ut.render=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!1,u)},Ut.unmountComponentAtNode=function(s){if(!nu(s))throw Error(n(40));return s._reactRootContainer?($o(function(){ru(null,null,s,!1,function(){s._reactRootContainer=null,s[or]=null})}),!0):!1},Ut.unstable_batchedUpdates=ch,Ut.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)},Ut.version="18.3.1-next-f1338f8080-20240426",Ut}var v0;function o1(){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 BI(){if(x0)return su;x0=1;var e=o1();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var HI=BI(),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)},s1=(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]):s1(e[r],t[r],n):e[r]=t[r]);return e},Vo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var YI={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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 Bu{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 Bu(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Bu(this.logger,t)}}var Un=new Bu;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?s1(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 i1={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 a1=Symbol("i18next/PATH_KEY");function t_(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>(n?.revoke?.(),o===a1?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function si(e,t){const{[a1]: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 Hu 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=Un.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 b=x?.usedKey||c,E=x?.exactUsedKey||c,w=["[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),M=Hu.hasDefaultValue(o),R=P?this.pluralResolver.getSuffix(h,o.count,o):"",_=o.ordinal&&P?this.pluralResolver.getSuffix(h,o.count,{ordinal:!1}):"",$=P&&!o.ordinal&&o.count===0,D=$&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${R}`]||o[`defaultValue${_}`]||o.defaultValue;let H=S;k&&!S&&M&&(H=D);const j=Nh(H),U=Object.prototype.toString.apply(H);if(k&&H&&j&&w.indexOf(U)<0&&!(Me(N)&&Array.isArray(H))){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(b,H,{...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(H),I=G?[]:{},B=G?E:b;for(const A in H)if(Object.prototype.hasOwnProperty.call(H,A)){const V=`${B}${l}${A}`;M&&!S?I[A]=this.translate(V,{...o,defaultValue:Nh(D)?D[A]:void 0,joinArrays:!1,ns:d}):I[A]=this.translate(V,{...o,joinArrays:!1,ns:d}),I[A]===V&&(I[A]=H[A])}S=I}}else if(k&&Me(N)&&Array.isArray(S))S=S.join(N),S&&(S=this.extendTranslation(S,t,o,r));else{let G=!1,I=!1;!this.isValidLookup(S)&&M&&(G=!0,S=D),this.isValidLookup(S)||(I=!0,S=c);const A=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:S,V=M&&D!==S&&this.options.updateMissing;if(I||G||V){if(this.logger.log(V?"updateKey":"missingKey",h,f,c,V?D:S),l){const L=this.resolve(c,{...o,keySeparator:!1});L&&L.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 F=[];const W=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&W&&W[0])for(let L=0;L<W.length;L++)F.push(W[L]);else this.options.saveMissingTo==="all"?F=this.languageUtils.toResolveHierarchy(o.lng||this.language):F.push(o.lng||this.language);const q=(L,z,X)=>{const Q=M&&X!==S?X:A;this.options.missingKeyHandler?this.options.missingKeyHandler(L,f,z,Q,V,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(L,f,z,Q,V,o),this.emit("missingKey",L,f,z,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach(L=>{const z=this.pluralResolver.getSuffixes(L,o);$&&o[`defaultValue${this.options.pluralSeparator}zero`]&&z.indexOf(`${this.options.pluralSeparator}zero`)<0&&z.push(`${this.options.pluralSeparator}zero`),z.forEach(X=>{q([L],c+X,o[`defaultValue${X}`]||D)})}):q(F,c,D))}S=this.extendTranslation(S,t,o,x,r),I&&S===c&&this.options.appendNamespaceToMissingKey&&(S=`${f}${g}${c}`),(I||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=i1.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!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(E=>{this.isValidLookup(r)||(c=E,!N0[`${b[0]}-${E}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(N0[`${b[0]}-${E}`]=!0,this.logger.warn(`key "${o}" for languages "${b.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!!!")),b.forEach(w=>{if(this.isValidLookup(r))return;l=w;const N=[g];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(N,g,w,E,n);else{let P;v&&(P=this.pluralResolver.getSuffix(w,n.count,n));const M=`${this.options.pluralSeparator}zero`,R=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(n.ordinal&&P.indexOf(R)===0&&N.push(g+P.replace(R,this.options.pluralSeparator)),N.push(g+P),x&&N.push(g+M)),S){const _=`${g}${this.options.contextSeparator||"_"}${n.context}`;N.push(_),v&&(n.ordinal&&P.indexOf(R)===0&&N.push(_+P.replace(R,this.options.pluralSeparator)),N.push(_+P),x&&N.push(_+M))}}let k;for(;k=N.pop();)this.isValidLookup(r)||(i=k,r=this.getResource(w,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=Un.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=Un.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=Un.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:b,nestingOptionsSeparator:E,maxReplaces:w,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?Vo(i):l||"{{",this.suffix=c?Vo(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=g?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":g||"",this.nestingPrefix=v?Vo(v):x||Vo("$t("),this.nestingSuffix=S?Vo(S):b||Vo(")"),this.nestingOptionsSeparator=E||",",this.maxReplaces=w||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 w=R0(n,d,x,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(w,void 0,r,{...o,...n,interpolationkey:x}):w}const S=x.split(this.formatSeparator),b=S.shift().trim(),E=S.join(this.formatSeparator).trim();return this.format(R0(n,d,b,this.options.keySeparator,this.options.ignoreJSONStructure),E,r,{...o,...n,interpolationkey:b})};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 b=x.safeValue(l);if(t=t.replace(i[0],b),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(`${Vo(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(b){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,b),`${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=Un.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=Un.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))})},l1="__i18next_supportNoticeShown",c_=()=>!!(typeof globalThis<"u"&&globalThis[l1]||typeof process<"u"&&Eh&&Eh.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Eh),u_=()=>{typeof globalThis<"u"&&(globalThis[l1]=!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=Un,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?Un.init(o(this.modules.logger),this.options):Un.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=Un,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 Hu(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"&&i1.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 Hu(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);Yo(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)=>{Yo(n)&&M0[n]||(Yo(n)&&(M0[n]=new Date),f_(e,t,n,r))},c1=(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,c1(e,n))},D0=(e,t,n,r)=>{if(Yo(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,c1(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}}),Yo=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_={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},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 u1;const b_=e=>{u1=e},S_=()=>u1,C_={type:"3rdParty",init(e){x_(e.options.react),b_(e)}},d1=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},f1=(e,t,n,r)=>e.getFixedT(t,n,r),k_=(e,t,n,r)=>m.useCallback(f1(e,t,n,r),[e,t,n,r]),Xe=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:o}=m.useContext(d1)||{},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=(R,_)=>Yo(_)?_:h_(_)&&Yo(_.defaultValue)?_.defaultValue:Array.isArray(R)?R[R.length-1]:R,M=[P,{},!1];return M.t=P,M.i18n={},M.ready=!1,M}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=Yo(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=()=>f1(i,t.lng||null,l.nsMode==="fallback"?f:f[0],d),[S,b]=m.useState(v);let E=f.join();t.lng&&(E=`${t.lng}${E}`);const w=N_(E),N=m.useRef(!0);m.useEffect(()=>{const{bindI18n:P,bindI18nStore:M}=l;N.current=!0,!g&&!c&&(t.lng?D0(i,t.lng,f,()=>{N.current&&b(x)}):yg(i,f,()=>{N.current&&b(x)})),g&&w&&w!==E&&N.current&&b(x);const R=()=>{N.current&&b(x)};return P&&i?.on(P,R),M&&i?.store.on(M,R),()=>{N.current=!1,i&&P&&P?.split(" ").forEach(_=>i.off(_,R)),M&&i&&M.split(" ").forEach(_=>i.store.off(_,R))}},[i,E]),m.useEffect(()=>{N.current&&g&&b(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(d1.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||{}),Nr=(e=>(e.Network="Network",e.Pin="Pin",e.Serial="Serial",e))(Nr||{});const V_={type:"ReadPin",label:"Read Pin",category:xe.Input,tags:[Nr.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"}]}]},B_={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"}]}]},H_={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:[Nr.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:[Nr.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:[Nr.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:[Nr.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:[Nr.Serial],description:"Write string to serial port",parameters:[{id:"portReference",label:"Port",description:"Serial port or log channel to write to",type:"channelSelect",channelType:["UART","LOG"]},{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:[Nr.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:[Nr.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(B_),this.register(H_),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 $t=new aA;$t.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 p1(e){return lA[e]}function cm(e){return e==="control"||e==="agentTask"||e==="agentChoice"||e==="agentDelegate"}function h1(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 an(){return crypto.randomUUID()}function oo(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 yr(e){switch(e.srcId){case"declared":return Pi(e.varId);case"fnarg":return um(e.varId);default:return el(e.srcId,e.varId)}}function g1(e){return"uid"in e&&e.uid?e:{uid:an(),name:e.name,dataType:e.dataType}}function $0(e){return e.map(g1)}function Qo(e){return e.uid}function dm(e,t){const n=[],r={},o=new Set;for(const i of t)h1(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 kr(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 m1(e,t,n=!1){for(const r of t)(r.activationRules?.length&&!kr(r,e,n)||bl(e[r.id]))&&delete e[r.id]}function y1(e,t,n){if(e.fromReference){const r=t[e.fromReference];if(r?.varId){const o=n[yr(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 v1(e,t){return Ri(e.channelType,t)}function x1(e,t){return Ri(e.memoryType,t)}function w1(e,t){return Ri(e.modelType,t)}function b1(e,t){return Ri(e.dataType,t)}function Wu(e,t){return e[t]}function S1(e,t){const n=e.arguments;if(e.type==="FunctionCall")return Wu(n,t);const r=$t.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 Mn(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 C1(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=$t.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:b1(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=$t.getByType(e.type);if(!o?.outputs)return t;for(const i of o.outputs)if(i.type==="static")r(i.id,i.id,b1(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=Mn(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:Qo(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:Qo(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"?$t.getByType(e.type):void 0;r&&m1(n.arguments,r.parameters,t);const o=n.arguments;for(const i of Object.keys(o))o[i]===void 0&&delete o[i]}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:e.arguments.qos===void 0?void 0: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=yr(n),o=t[r];return o?{name:o.name,dataType:o.dataType}:null})}}function Jo(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=lo(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 lo(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;lo(r.test,t,n)!=="bool"&&n.push("Ternary condition must be boolean");const i=lo(r.consequent,t,n),l=lo(r.alternate,t,n);if(i&&l&&i!==l){if(Pn(i)&&Pn(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=lo(e.left,t,n),o=lo(e.right,t,n),i=e.operator;return!r||!o?null:i==="+"&&(r==="string"||o==="string")?"string":["+","-","*","/"].includes(i)?!Pn(r)||!Pn(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)?((!Pn(r)||!Pn(o))&&n.push(`Operator '${i}' requires numeric operands (got '${r}' and '${o}')`),"bool"):["==","!="].includes(i)?(r!==o&&!(Pn(r)&&Pn(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=lo(e.argument,t,n);return r?e.operator==="!"?(r!=="bool"&&n.push(`Logical NOT '!' requires boolean operand (got '${r}')`),"bool"):e.operator==="-"||e.operator==="+"?(Pn(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):(lo(e.arguments[0],t,n),i):(n.push(`Unknown function '${o}'. Available cast functions: int(), float(), bool(), str()`),null)}function Pn(e){return e==="int"||e==="float"}function EA(e,t){return!!(e===t||Pn(e)&&Pn(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 E1=["GPIOIN","GPIOOUT","ADC","PWM","DAC","UART","MQTT","LOG"],Ed={parameters:[{id:"type",label:"Type",description:"Channel type",type:"selection",default:"GPIOIN",options:E1.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"]}]},{id:"level",label:"Level",description:"Severity the engine records messages written to this channel at",type:"selection",default:"info",options:[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],activationRules:[{type:"parameterIn",parameterId:"type",values:["LOG"]}]},{id:"tag",label:"Tag",description:"Optional category stamped on each line so the backend can group workflow-emitted logs",type:"string",optional:!0,activationRules:[{type:"parameterIn",parameterId:"type",values:["LOG"]}]}]};function kA(e){const{id:t,label:n,type:r}=e,o={...e.arguments,type:r};switch(m1(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};case"LOG":return{type:r,id:t,label:n,level:o.level,tag:o.tag}}}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;case"LOG":o.level=e.level,o.tag=e.tag;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 He="main";function N1(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=Mn(r),b=Sd(r),E=tl(n,r,g);for(const R of o.parameters){if(!kr(R,b,E))continue;const _=b[R.id];if(Jo(_)&&_.expression){const $=Sl(_,i);R.type==="expression"&&($.expectedType=y1(R,b,i));const D=Cd($);D.isValid||x.push({severity:"error",category:"invalid-expression",canvasId:t,nodeId:n,paramId:R.id,message:`Invalid expression for "${R.label}": ${D.errors.join(", ")}`})}if(!R.optional){const $=Jo(_)&&!_.expression,D=R.type==="variableSelect"&&(!_||typeof _=="object"&&_!==null&&!_.varId);(bl(_)||$||D)&&x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,paramId:R.id,message:`Missing required parameter "${R.label}"`})}if(R.type==="variableSelect"&&_){const $=_;if($.varId){const D=yr($);i[D]||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted variable`})}}if(R.type==="channelSelect"&&_){const $=_,D=Object.values(l).find(H=>H.id===$);D?v1(R,b).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible channel type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted channel`})}if(R.type==="memory-refs"&&Array.isArray(_)&&c){const $=_,D=new Set(Object.values(c).filter(j=>j.type==="MemoryFile").map(j=>j.id)),H=$.filter(j=>!j.id||!D.has(j.id));H.length>0&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references ${H.length} deleted memory file${H.length===1?"":"s"}`})}if(R.type==="memorySelect"&&_&&c){const $=_,D=Object.values(c).find(H=>H.id===$);D?x1(R,b).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible memory type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted memory`})}if(R.type==="modelSelect"&&_&&d){const $=_,D=Object.values(d).find(H=>H.id===$);D?w1(R,b).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible model type`}):f&&!f.has($)&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted model`})}}if(!E){const R=C1(r);for(const $ of Object.keys(R)){const D=S1(r,$);if(!D||!D.active||D.mode!=="assign")continue;const H=R[$];if(!D.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H?.name??$}" has no variable selected`});continue}const j=yr(D.target),U=i[j];U?H&&U.dataType!==H.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H.name}" (${H.dataType}) cannot assign to "${U.name}" (${U.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H?.name??$}" assigns to a deleted variable`})}const _=(o.outputs??[]).filter($=>$.type==="list");for(const $ of _){const D=r.arguments[$.id]??[],H=new Map;D.forEach((j,U)=>{const G=H.get(j.name);G?G.push(U):H.set(j.name,[U])}),D.forEach((j,U)=>{const G=`${$.id}[${U}]`;if(!j.name||j.name.trim()===""?x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,outputId:G,message:`${$.label} entry #${U+1} has no name`}):(H.get(j.name)??[]).length>1&&x.push({severity:"error",category:"duplicate-output-name",canvasId:t,nodeId:n,outputId:G,message:`${$.label} entry #${U+1} has duplicate name "${j.name}"`}),j.mode!=="assign")return;if(!j.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${$.label} entry #${U+1} has no variable selected`});return}const I=yr(j.target),B=i[I];B?B.dataType!==j.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${$.label} entry #${U+1} (${j.dataType}) cannot assign to "${B.name}" (${B.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:G,message:`${$.label} entry #${U+1} assigns to a deleted variable`})})}}const w=S.input.filter(R=>R.type==="control"),N=S.input.filter(R=>R.type==="tool"),k=S.output.filter(R=>R.type==="control"),P=new Set(g.filter(R=>R.target===n).map(R=>R.targetHandle)),M=new Set(g.filter(R=>R.source===n).map(R=>R.sourceHandle));if(w.length>0)if(E)for(const R of N)P.has(R.id)||x.push({severity:"warning",category:"unconnected-input",canvasId:t,nodeId:n,message:"Node is not connected and will never run"});else for(const R of w)P.has(R.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(_=>P.has(_.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 R of k)M.has(R.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 k1(e){const{canvasId:t,edgeId:n,edgeType:r,edgeData:o,availableVariables:i,sourceControlEdgeCount:l}=e,c=[],d=p1(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(Jo(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 T1(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"||!kr(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 P1(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(!kr(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 R1(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(!kr(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 I1(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 I1(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:b,edges:E}=S,{lookup:w}=dm(S.variables,E),N=[];for(const M of b){const R=M;let _,$=!1,D=!1;if(R.type==="FunctionCall"){const j=R,U=r[j.functionInfo.id];D=!U,$=U?j.functionInfo.version!==U.version:!1,U?_=wg(U):_=wg(j.functionInfo)}else _=$t.getByType(R.type);const H=N1({canvasId:x,nodeId:M.id,nodeData:R,nodeDefinition:_,availableVariables:w,channels:o,memory:i,models:l,edges:E,isStale:$,isDeleted:D});N.push(...H)}const k=new Map;for(const M of E)cm(M.type)&&k.set(M.source,(k.get(M.source)??0)+1);for(const M of E){const R=M.type??"control",_=k1({canvasId:x,edgeId:M.id,edgeType:R,edgeData:M.data,availableVariables:w,sourceControlEdgeCount:k.get(M.source)??0});N.push(..._)}const P=n[x];if(P)for(const M of I1(P.outputs,w))N.push({...M,canvasId:x});if(N.length>0){const M=N.filter($=>$.severity==="error").length,R=N.filter($=>$.severity==="warning").length,_=x===He?"Main":n[x]?.name??x;c.push({canvasId:x,canvasLabel:_,diagnostics:N,errorCount:M,warningCount:R}),d+=M,f+=R}}const g=[];for(const x of Object.values(o))g.push(...T1(x));for(const x of g)x.severity==="error"?d++:f++;const h=[];for(const x of Object.values(i))h.push(...P1(x));for(const x of h)x.severity==="error"?d++:f++;const v=[];for(const x of Object.values(l))v.push(...R1(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 BA="Node-Bibliothek",HA="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",BM="Verfügbare Agenten",HM="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",BD="Name",HD="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",ej="Auto",tj="Version umbenennen",nj="Visuelle Vorschau kommt bald",rj="Lade Versionen...",oj="Keine Versionen vorhanden.",sj="Versionen sind schreibgeschützt und können nicht verändert werden.",ij="Dialoge laden…",aj="Versionen laden…",lj="Testdialog lädt…",cj="Aktuell",uj="Neue Funktion",dj="Ausdruck eingeben...",fj="{{type}}-Ausdruck eingeben...",pj="von {{node}}",hj="Funktion hinzufügen",gj="Wiederverwendbare Funktion erstellen",mj="Nodes hinzufügen, um deren Ausgabevariablen zu sehen",yj="Variable hinzufügen",vj="Mit Warnungen fortfahren",xj="Funktion erstellen",wj="Definierte Variablen",bj="Funktion löschen",Sj="Funktion löschen?",Cj="Fertig",Ej="Funktion bearbeiten",Nj="Ausdruck für",kj="Arg",Tj="Funktionsargumente",Pj="Funktionsnamen, Eingaben und Ausgaben konfigurieren.",Rj="Argumente, die beim Aufruf der Funktion übergeben werden",Ij="Werte, die die Funktion zurückgibt; jeder ist ein Ausdruck über ihre Eingaben und ihren Rumpf",_j="Funktionsname",Aj="Funktionsname eingeben...",Mj="Funktionen",Dj="Funktion öffnen",jj="Globale Variable",Oj="Anfangswert",$j="Eingaben",Lj="Node-Ausgabevariablen",Fj="Keine Kantenparameter",zj="Keine Funktionsinformationen verfügbar",Vj="Noch keine Funktionen",Bj="Keine Eingaben",Hj="Keine Probleme gefunden",Wj="Keine Ausgaben",Uj="Ausgaben",Kj="Rückgabewert-Zuweisungen",Gj="Ausdrücke den Funktions-Rückgabewerten zuweisen",Yj="Verbindung löschen",Xj="Projekt umbenennen",qj='Die Funktion "{{name}}" aufrufen',Zj="Wert für {{name}} eingeben",Qj="Name der Ausgabevariable für {{name}} eingeben",Jj="Diese Funktion und alle zugehörigen Knoten werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",e2="Knoten",t2="Keine Fehler oder Warnungen in Workflow",n2="Validierungsprobleme",r2="{{errorCount}} Fehler und {{warningCount}} Warnung(en) gefunden. Fehler müssen vor dem Export behoben werden.",o2="{{warningCount}} Warnung(en) gefunden. Sie können trotzdem fortfahren.",s2="Version gespeichert",i2="Version konnte nicht gespeichert werden",a2="Version wiederhergestellt",l2="Version konnte nicht wiederhergestellt werden",c2="Version umbenannt",u2="Version konnte nicht umbenannt werden",d2="Die Embedded-Firmware wurde erfolgreich generiert und heruntergeladen.",f2="C-Code generiert",p2="C-Code Generierung fehlgeschlagen",h2="Der C-Code konnte nicht generiert werden.",g2="Visueller Builder für Ihre Projekte.",m2="Projekt nicht gefunden",y2="Das ausgewählte Projekt existiert nicht.",v2="Deployment nicht gefunden",x2={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"},w2={input:"Eingang",output:"Ausgang",logic:"Logik",math:"Mathematik",ai:"KI",control:"Steuerung",sensor:"Sensor",actuator:"Aktor",communication:"Kommunikation",storage:"Speicher",custom:"Benutzerdefiniert"},b2="Hinzufügen",S2="Abbrechen",C2={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"}}}},E2={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"}},N2={nodeLibrary:BA,blockLibrary:HA,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:BM,comingSoon:HM,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:BD,outputType:HD,outputValue:WD,noNodeSelected:UD,selectNodeMessage:KD,importError:GD,invalidJson:YD,exportSuccess:XD,configDownloaded:qD,copied:ZD,configCopied:QD,autoVersionMessage:JD,autoVersionLabel:ej,"saveStatus.saved":"Gespeichert","saveStatus.saving":"Speichern...","saveStatus.unsaved":"Ungespeicherte Änderungen",versionRenameTooltip:tj,versionPreviewPlaceholder:nj,"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:rj,noVersions:oj,versionsReadOnly:sj,loadingDialogs:ij,loadingVersions:aj,loadingTest:lj,current:cj,newFunction:uj,enterExpression:dj,enterTypeExpression:fj,fromNode:pj,addFunction:hj,addFunctionHint:gj,addNodesForVariables:mj,addVariable:yj,continueWithWarnings:vj,createFunction:xj,definedVariables:wj,deleteFunction:bj,deleteFunctionTitle:Sj,done:Cj,editFunction:Ej,expressionFor:Nj,fnarg:kj,functionArguments:Tj,functionDialogDesc:Pj,functionInputsDesc:Rj,functionOutputsDesc:Ij,functionName:_j,functionNamePlaceholder:Aj,functions:Mj,openFunction:Dj,globalVariable:jj,initialValue:Oj,inputs:$j,nodeOutputVariables:Lj,noEdgeParams:Fj,noFunctionInfo:zj,noFunctions:Vj,noInputs:Bj,noIssuesFound:Hj,noOutputs:Wj,outputs:Uj,returnValueAssignments:Kj,returnValueAssignmentsDesc:Gj,deleteEdge:Yj,renameProject:Xj,functionCallDesc:qj,functionParamDesc:Zj,functionOutputDesc:Qj,deleteFunctionDesc:Jj,nodeLabel:e2,validationPassed:t2,validationIssues:n2,validationErrorsDesc:r2,validationWarningsDesc:o2,versionSaved:s2,versionSaveError:i2,versionRestored:a2,versionRestoreError:l2,versionRenamed:c2,versionRenameError:u2,codeGenSuccess:d2,codeGenTitle:f2,codeGenError:p2,codeGenErrorDesc:h2,seoDescription:g2,projectNotFound:m2,projectNotFoundDesc:y2,deploymentNotFound:v2,deployDialog:x2,blocks:w2,add:b2,cancel:S2,nodes:C2,edges:E2},k2="Export as JSON",T2="Node Library",P2="Node Library",R2="Diagnostics",I2="Function Definition",_2="Open",A2="Close",M2="Save",D2="Version History",j2="Test",O2="Run",$2="Stop",L2="Deploy",F2="Configure",z2="Add Node",V2="Delete Node",B2="Duplicate Node",H2="Connect Nodes",W2="Disconnect Nodes",U2="Zoom In",K2="Zoom Out",G2="Fit to View",Y2="Auto Layout",X2="Grid",q2="Show Grid",Z2="Snap to Grid",Q2="Undo",J2="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",BO="Text",HO="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.",B$="Versions are read-only and cannot be modified.",H$="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",BL="Memory file name",HL="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",BF="Embedded firmware was successfully generated and downloaded.",HF="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:k2,nodeLibrary:T2,blockLibrary:P2,diagnostics:R2,functionDefinition:I2,open:_2,close:A2,save:M2,versionHistory:D2,test:j2,run:O2,stop:$2,deploy:L2,configure:F2,addBlock:z2,deleteBlock:V2,duplicateBlock:B2,connectBlocks:H2,disconnectBlocks:W2,zoomIn:U2,zoomOut:K2,fitView:G2,autoLayout:Y2,grid:X2,showGrid:q2,snapToGrid:Z2,undo:Q2,redo:J2,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:BO,paramTypeNumber:HO,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:B$,loadingDialogs:H$,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:BL,memoryFileDescription:HL,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:BF,codeGenTitle:HF,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:N2},en:{translation:rz}},gr=Tt.createInstance();gr.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 Kt({...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:Kt,dismiss:n=>Xa({type:"DISMISS_TOAST",toastId:n})}}const uz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_1=(...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:_1("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:_1(`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 A1=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 M1=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 D1=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const j1=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 O1=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 es=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 $1=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 L1=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 go=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 B0=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 F1(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=F1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function z1(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=F1(e))&&(r&&(r+=" "),r+=t);return r}const H0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,W0=z1,mo=(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=H0(g)||H0(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[b,E]=S;return Array.isArray(E)?E.includes({...i,...c}[b]):{...i,...c}[b]===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(),V1(c,t)||Fz(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&r[l]?[...d,...r[l]]:d}}},V1=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?V1(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 Bz(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,Bz=(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,Hz=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)}}},B1="!",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 w=c[E];if(f===0){if(w===o&&(r||c.slice(E,E+i)===t)){d.push(c.slice(g,E)),g=E+i;continue}if(w==="/"){h=E;continue}}w==="["?f++:w==="]"&&f--}const v=d.length===0?c:c.substring(g),x=v.startsWith(B1),S=x?v.substring(1):v,b=h&&h>g?h-g:void 0;return{modifiers:d,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:b}};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:Hz(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,b=r(S?v.substring(0,x):v);if(!b){if(!S){c=f+(c.length>0?" "+c:c);continue}if(b=r(v),!b){c=f+(c.length>0?" "+c:c);continue}S=!1}const E=Uz(g).join(":"),w=h?E+B1:E,N=w+b;if(i.includes(N))continue;i.push(N);const k=o(b,S);for(let P=0;P<k.length;++P){const M=k[P];i.push(w+M)}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 nt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},W1=/^\[(?:([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)\(.+\)$/,fr=e=>ii(e)||Qz.has(e)||Zz.test(e),Qr=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=>W1.test(e),Jr=e=>Jz.test(e),s3=new Set(["length","size","percentage"]),i3=e=>_i(e,s3,U1),a3=e=>_i(e,"position",U1),l3=new Set(["image","url"]),c3=e=>_i(e,l3,p3),u3=e=>_i(e,"",f3),Da=()=>!0,_i=(e,t,n)=>{const r=W1.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),U1=()=>!1,f3=e=>n3.test(e),p3=e=>r3.test(e),h3=()=>{const e=nt("colors"),t=nt("spacing"),n=nt("blur"),r=nt("brightness"),o=nt("borderColor"),i=nt("borderRadius"),l=nt("borderSpacing"),c=nt("borderWidth"),d=nt("contrast"),f=nt("grayscale"),g=nt("hueRotate"),h=nt("invert"),v=nt("gap"),x=nt("gradientColorStops"),S=nt("gradientColorStopPositions"),b=nt("inset"),E=nt("margin"),w=nt("opacity"),N=nt("padding"),k=nt("saturate"),P=nt("scale"),M=nt("sepia"),R=nt("skew"),_=nt("space"),$=nt("translate"),D=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",$e,t],U=()=>[$e,t],G=()=>["",fr,Qr],I=()=>["auto",ii,$e],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",$e],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[ii,$e];return{cacheSize:500,separator:":",theme:{colors:[Da],spacing:[fr,Qr],blur:["none","",Jr,$e],brightness:L(),borderColor:[e],borderRadius:["none","","full",Jr,$e],borderSpacing:U(),borderWidth:G(),contrast:L(),grayscale:W(),hueRotate:L(),invert:W(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[o3,Qr],inset:j(),margin:j(),opacity:L(),padding:U(),saturate:L(),scale:L(),sepia:W(),skew:L(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[Jr]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:[...B(),$e]}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ma,$e]}],basis:[{basis:j()}],"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":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Da]}],"row-start-end":[{row:["auto",{span:[Ma,$e]},$e]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"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",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"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":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"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:[Jr]},Jr]}],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",Jr,Qr]}],"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",fr,$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":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,Qr]}],"underline-offset":[{"underline-offset":["auto",fr,$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:U()}],"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":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),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":[w]}],"border-style":[{border:[...A(),"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":[w]}],"divide-style":[{divide:A()}],"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:["",...A()]}],"outline-offset":[{"outline-offset":[fr,$e]}],"outline-w":[{outline:[fr,Qr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[fr,Qr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Jr,u3]}],"shadow-color":[{shadow:[Da]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Jr,$e]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[h]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"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":[w]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"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:L()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:L()}],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":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"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":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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:[fr,Qr,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(z1(e))}const m3=mo("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 uo({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 Yt(...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(Yt(...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 K1(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;K1(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(K1(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?Yt(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=mo("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 Lt(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,b=v?.[e]?.[d]||c,E=m.useMemo(()=>S,Object.values(S));return p.jsx(b.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 xt=globalThis?.document?m.useLayoutEffect:()=>{},T3=wd[" useId ".trim().toString()]||(()=>{}),P3=0;function kt(e){const[t,n]=m.useState(T3());return xt(()=>{n(r=>r??String(P3++))},[e]),t?`radix-${t}`:""}var R3=wd[" useInsertionEffect ".trim().toString()]||xt;function ln({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 ps=o1();const A3=lm(ps);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?Yt(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"],Ne=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&&ps.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",B3="dismissableLayer.pointerDownOutside",H3="dismissableLayer.focusOutside",Y0,G1=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(G1),[g,h]=m.useState(null),v=g?.ownerDocument??globalThis?.document,[,x]=m.useState({}),S=De(t,_=>h(_)),b=Array.from(f.layers),[E]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(E),N=g?b.indexOf(g):-1,k=f.layersWithOutsidePointerEventsDisabled.size>0,P=N>=w,M=U3(_=>{const $=_.target,D=[...f.branches].some(H=>H.contains($));!P||D||(o?.(_),l?.(_),_.defaultPrevented||c?.())},v),R=K3(_=>{const $=_.target;[...f.branches].some(H=>H.contains($))||(i?.(_),l?.(_),_.defaultPrevented||c?.())},v);return z3(_=>{N===f.layers.size-1&&(r?.(_),!_.defaultPrevented&&c&&(_.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 _=()=>x({});return document.addEventListener(Cg,_),()=>document.removeEventListener(Cg,_)},[]),p.jsx(Ne.div,{...d,ref:S,style:{pointerEvents:k?P?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,R.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,M.onPointerDownCapture)})});Ai.displayName=V3;var W3="DismissableLayerBranch",Y1=m.forwardRef((e,t)=>{const n=m.useContext(G1),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(Ne.div,{...e,ref:o})});Y1.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(){X1(B3,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&&X1(H3,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 X1(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=Y1,_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,b=>d(b)),x=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let b=function(k){if(x.paused||!c)return;const P=k.target;c.contains(P)?h.current=P:ro(h.current,{select:!0})},E=function(k){if(x.paused||!c)return;const P=k.relatedTarget;P!==null&&(c.contains(P)||ro(h.current,{select:!0}))},w=function(k){if(document.activeElement===document.body)for(const M of k)M.removedNodes.length>0&&ro(c)};document.addEventListener("focusin",b),document.addEventListener("focusout",E);const N=new MutationObserver(w);return c&&N.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",E),N.disconnect()}}},[r,c,x.paused]),m.useEffect(()=>{if(c){Q0.add(x);const b=document.activeElement;if(!c.contains(b)){const w=new CustomEvent(_h,q0);c.addEventListener(_h,f),c.dispatchEvent(w),w.defaultPrevented||(q3(t5(q1(c)),{select:!0}),document.activeElement===b&&ro(c))}return()=>{c.removeEventListener(_h,f),setTimeout(()=>{const w=new CustomEvent(Ah,q0);c.addEventListener(Ah,g),c.dispatchEvent(w),w.defaultPrevented||ro(b??document.body,{select:!0}),c.removeEventListener(Ah,g),Q0.remove(x)},0)}}},[c,f,g,x]);const S=m.useCallback(b=>{if(!n&&!r||x.paused)return;const E=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(E&&w){const N=b.currentTarget,[k,P]=Z3(N);k&&P?!b.shiftKey&&w===P?(b.preventDefault(),n&&ro(k,{select:!0})):b.shiftKey&&w===k&&(b.preventDefault(),n&&ro(P,{select:!0})):w===N&&b.preventDefault()}},[n,r,x.paused]);return p.jsx(Ne.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(ro(r,{select:t}),document.activeElement!==n)return}function Z3(e){const t=q1(e),n=Z0(t,e),r=Z0(t.reverse(),e);return[n,r]}function q1(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 ro(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);xt(()=>i(!0),[]);const l=n||o&&globalThis?.document?.body;return l?A3.createPortal(p.jsx(Ne.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]),xt(()=>{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]),xt(()=>{if(t){let f;const g=t.ownerDocument.defaultView??window,h=x=>{const b=au(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&b&&(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 Wn=function(){return Wn=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},Wn.apply(this,arguments)};function Z1(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=Wn({async:!0,ssr:!1},e),t}var Q1=function(e){var t=e.sideCar,n=Z1(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,Wn({},n))};Q1.isSideCarExport=!0;function g5(e,t){return e.useMedium(t),Q1}var J1=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,b=e.inert,E=e.allowPinchZoom,w=e.as,N=w===void 0?"div":w,k=e.gapMode,P=Z1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=v,R=d5([n,t]),_=Wn(Wn({},P),o);return m.createElement(m.Fragment,null,g&&m.createElement(M,{sideCar:J1,removeScrollBar:f,shards:h,noRelative:x,noIsolation:S,inert:b,setCallbacks:i,allowPinchZoom:!!E,lockRef:n,gapMode:k}),l?m.cloneElement(m.Children.only(c),Wn(Wn({},_),{ref:R})):m.createElement(N,Wn({},_,{className:d,ref:R}),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])}},eS=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=eS(),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"),`
|
|
8
|
+
`+T.stack}return{value:s,source:a,stack:C,digest:null}}function Hp(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=cr(-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=cr(-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"&&(Kr===null?Kr=new Set([this]):Kr.add(this));var O=a.stack;this.componentDidCatch(a.value,{componentStack:O!==null?O:""})}),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=cr(-1,1),a.tag=2,Wr(u,a,1))),u.lanes|=1),s):(s.flags|=65536,s.lanes=C,s)}var uI=P.ReactCurrentOwner,Bt=!1;function Dt(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,ur(s,a,C)):(st&&u&&vp(a),a.flags|=1,Dt(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 O=T.memoizedProps;if(u=u.compare,u=u!==null?u:ua,u(O,y)&&s.ref===a.ref)return ur(s,a,C)}return a.flags|=1,s=qr(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,ur(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},Ze(Hs,en),en|=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,Ze(Hs,en),en|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=T!==null?T.baseLanes:u,Ze(Hs,en),en|=y}else T!==null?(y=T.baseLanes|u,a.memoizedState=null):y=u,Ze(Hs,en),en|=y;return Dt(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=Vt(u)?Io: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,ur(s,a,C)):(st&&y&&vp(a),a.flags|=1,Dt(s,a,u,C),a.child)}function Ix(s,a,u,y,C){if(Vt(u)){var T=!0;Sc(a)}else T=!1;if(Fs(a,C),a.stateNode===null)zc(s,a),vx(a,u,y),Bp(a,u,y,C),y=!0;else if(s===null){var O=a.stateNode,G=a.memoizedProps;O.props=G;var J=O.context,ie=u.contextType;typeof ie=="object"&&ie!==null?ie=pn(ie):(ie=Vt(u)?Io:Rt.current,ie=Ms(a,ie));var fe=u.getDerivedStateFromProps,he=typeof fe=="function"||typeof O.getSnapshotBeforeUpdate=="function";he||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==y||J!==ie)&&xx(a,O,y,ie),Hr=!1;var de=a.memoizedState;O.state=de,_c(a,y,O,C),J=a.memoizedState,G!==y||de!==J||zt.current||Hr?(typeof fe=="function"&&(Vp(a,u,fe,y),J=a.memoizedState),(G=Hr||yx(a,u,G,y,de,J,ie))?(he||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(a.flags|=4194308)):(typeof O.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=y,a.memoizedState=J),O.props=y,O.state=J,O.context=ie,y=G):(typeof O.componentDidMount=="function"&&(a.flags|=4194308),y=!1)}else{O=a.stateNode,Kv(s,a),G=a.memoizedProps,ie=a.type===a.elementType?G:bn(a.type,G),O.props=ie,he=a.pendingProps,de=O.context,J=u.contextType,typeof J=="object"&&J!==null?J=pn(J):(J=Vt(u)?Io:Rt.current,J=Ms(a,J));var be=u.getDerivedStateFromProps;(fe=typeof be=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==he||de!==J)&&xx(a,O,y,J),Hr=!1,de=a.memoizedState,O.state=de,_c(a,y,O,C);var ke=a.memoizedState;G!==he||de!==ke||zt.current||Hr?(typeof be=="function"&&(Vp(a,u,be,y),ke=a.memoizedState),(ie=Hr||yx(a,u,ie,y,de,ke,J)||!1)?(fe||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(y,ke,J),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(y,ke,J)),typeof O.componentDidUpdate=="function"&&(a.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof O.componentDidUpdate!="function"||G===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||G===s.memoizedProps&&de===s.memoizedState||(a.flags|=1024),a.memoizedProps=y,a.memoizedState=ke),O.props=y,O.state=ke,O.context=J,y=ie):(typeof O.componentDidUpdate!="function"||G===s.memoizedProps&&de===s.memoizedState||(a.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||G===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 O=(a.flags&128)!==0;if(!y&&!O)return C&&jv(a,u,!1),ur(s,a,T);y=a.stateNode,uI.current=a;var G=O&&typeof u.getDerivedStateFromError!="function"?null:y.render();return a.flags|=1,s!==null&&O?(a.child=$s(a,s.child,null,T),a.child=$s(a,null,G,T)):Dt(s,a,G,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,Dt(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,O=(a.flags&128)!==0,G;if((G=O)||(G=s!==null&&s.memoizedState===null?!1:(C&2)!==0),G?(T=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(C|=1),Ze(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):(O=y.children,s=y.fallback,T?(y=a.mode,T=a.child,O={mode:"hidden",children:O},(y&1)===0&&T!==null?(T.childLanes=0,T.pendingProps=O):T=Qc(O,y,0,null),s=zo(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,O));if(C=s.memoizedState,C!==null&&(G=C.dehydrated,G!==null))return dI(s,a,O,y,G,C,u);if(T){T=y.fallback,O=a.mode,C=s.child,G=C.sibling;var J={mode:"hidden",children:y.children};return(O&1)===0&&a.child!==C?(y=a.child,y.childLanes=0,y.pendingProps=J,a.deletions=null):(y=qr(C,J),y.subtreeFlags=C.subtreeFlags&14680064),G!==null?T=qr(G,T):(T=zo(T,O,u,null),T.flags|=2),T.return=a,y.return=a,y.sibling=T,a.child=y,y=T,T=a.child,O=s.child.memoizedState,O=O===null?Yp(u):{baseLanes:O.baseLanes|u,cachePool:null,transitions:O.transitions},T.memoizedState=O,T.childLanes=s.childLanes&~u,a.memoizedState=Gp,y}return T=s.child,s=T.sibling,y=qr(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,O){if(u)return a.flags&256?(a.flags&=-257,y=Hp(Error(n(422))),Fc(s,a,O,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=zo(T,C,O,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,O),a.child.memoizedState=Yp(O),a.memoizedState=Gp,T);if((a.mode&1)===0)return Fc(s,a,O,null);if(C.data==="$!"){if(y=C.nextSibling&&C.nextSibling.dataset,y)var G=y.dgst;return y=G,T=Error(n(419)),y=Hp(T,y,void 0),Fc(s,a,O,y)}if(G=(O&s.childLanes)!==0,Bt||G){if(y=bt,y!==null){switch(O&-O){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|O))!==0?0:C,C!==0&&C!==T.retryLane&&(T.retryLane=C,lr(s,C),En(y,s,C,-1))}return dh(),y=Hp(Error(n(421))),Fc(s,a,O,y)}return C.data==="$?"?(a.flags|=128,a.child=s.child,a=EI.bind(null,s),C._reactRetry=a,null):(s=T.treeContext,Jt=Fr(C.nextSibling),Qt=a,st=!0,wn=null,s!==null&&(dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=_o,ir=s.id,ar=s.overflow,_o=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(Dt(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(Ze(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 ur(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Oo|=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=qr(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=qr(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:Vt(a.type)&&Sc(a);break;case 4:Rp(a,a.stateNode.containerInfo);break;case 10:var y=a.type._context,C=a.memoizedProps.value;Ze(Pc,y._currentValue),y._currentValue=C;break;case 13:if(y=a.memoizedState,y!==null)return y.dehydrated!==null?(Ze(lt,lt.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Mx(s,a,u):(Ze(lt,lt.current&1),s=ur(s,a,u),s!==null?s.sibling:null);Ze(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),Ze(lt,lt.current),y)break;return null;case 22:case 23:return a.lanes=0,Px(s,a,u)}return ur(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,Do(zn.current);var T=null;switch(u){case"input":C=Re(s,C),y=Re(s,y),T=[];break;case"select":C=q({},C,{value:void 0}),y=q({},y,{value:void 0}),T=[];break;case"textarea":C=Ct(s,C),y=Ct(s,y),T=[];break;default:typeof C.onClick!="function"&&typeof y.onClick=="function"&&(s.onclick=xc)}Vi(u,y);var O;u=null;for(ie in C)if(!y.hasOwnProperty(ie)&&C.hasOwnProperty(ie)&&C[ie]!=null)if(ie==="style"){var G=C[ie];for(O in G)G.hasOwnProperty(O)&&(u||(u={}),u[O]="")}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(G=C?.[ie],y.hasOwnProperty(ie)&&J!==G&&(J!=null||G!=null))if(ie==="style")if(G){for(O in G)!G.hasOwnProperty(O)||J&&J.hasOwnProperty(O)||(u||(u={}),u[O]="");for(O in J)J.hasOwnProperty(O)&&G[O]!==J[O]&&(u||(u={}),u[O]=J[O])}else u||(T||(T=[]),T.push(ie,u)),u=J;else ie==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,G=G?G.__html:void 0,J!=null&&G!==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"&&et("scroll",s),T||G===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 Vt(a.type)&&bc(),_t(a),null;case 3:return y=a.stateNode,zs(),tt(zt),tt(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,wn!==null&&(lh(wn),wn=null))),Zp(s,a),_t(a),null;case 5:Ip(a);var C=Do(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=Do(zn.current),kc(a)){y=a.stateNode,u=a.type;var T=a.memoizedProps;switch(y[Fn]=a,y[ga]=T,s=(a.mode&1)!==0,u){case"dialog":et("cancel",y),et("close",y);break;case"iframe":case"object":case"embed":et("load",y);break;case"video":case"audio":for(C=0;C<fa.length;C++)et(fa[C],y);break;case"source":et("error",y);break;case"img":case"image":case"link":et("error",y),et("load",y);break;case"details":et("toggle",y);break;case"input":Le(y,T),et("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!T.multiple},et("invalid",y);break;case"textarea":Ke(y,T),et("invalid",y)}Vi(u,T),C=null;for(var O in T)if(T.hasOwnProperty(O)){var G=T[O];O==="children"?typeof G=="string"?y.textContent!==G&&(T.suppressHydrationWarning!==!0&&vc(y.textContent,G,s),C=["children",G]):typeof G=="number"&&y.textContent!==""+G&&(T.suppressHydrationWarning!==!0&&vc(y.textContent,G,s),C=["children",""+G]):o.hasOwnProperty(O)&&G!=null&&O==="onScroll"&&et("scroll",y)}switch(u){case"input":me(y),we(y,T,!0);break;case"textarea":me(y),bo(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{O=C.nodeType===9?C:C.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=tr(u)),s==="http://www.w3.org/1999/xhtml"?u==="script"?(s=O.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof y.is=="string"?s=O.createElement(u,{is:y.is}):(s=O.createElement(u),u==="select"&&(O=s,y.multiple?O.multiple=!0:y.size&&(O.size=y.size))):s=O.createElementNS(s,u),s[Fn]=a,s[ga]=y,Ox(s,a,!1,!1),a.stateNode=s;e:{switch(O=Bi(u,y),u){case"dialog":et("cancel",s),et("close",s),C=y;break;case"iframe":case"object":case"embed":et("load",s),C=y;break;case"video":case"audio":for(C=0;C<fa.length;C++)et(fa[C],s);C=y;break;case"source":et("error",s),C=y;break;case"img":case"image":case"link":et("error",s),et("load",s),C=y;break;case"details":et("toggle",s),C=y;break;case"input":Le(s,y),C=Re(s,y),et("invalid",s);break;case"option":C=y;break;case"select":s._wrapperState={wasMultiple:!!y.multiple},C=q({},y,{value:void 0}),et("invalid",s);break;case"textarea":Ke(s,y),C=Ct(s,y),et("invalid",s);break;default:C=y}Vi(u,C),G=C;for(T in G)if(G.hasOwnProperty(T)){var J=G[T];T==="style"?Hl(s,J):T==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&Vl(s,J)):T==="children"?typeof J=="string"?(u!=="textarea"||J!=="")&&rr(s,J):typeof J=="number"&&rr(s,""+J):T!=="suppressContentEditableWarning"&&T!=="suppressHydrationWarning"&&T!=="autoFocus"&&(o.hasOwnProperty(T)?J!=null&&T==="onScroll"&&et("scroll",s):J!=null&&k(s,T,J,O))}switch(u){case"input":me(s),we(s,y,!1);break;case"textarea":me(s),bo(s);break;case"option":y.value!=null&&s.setAttribute("value",""+K(y.value));break;case"select":s.multiple=!!y.multiple,T=y.value,T!=null?Je(s,!!y.multiple,T,!1):y.defaultValue!=null&&Je(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=Do(wa.current),Do(zn.current),kc(a)){if(y=a.stateNode,u=a.memoizedProps,y[Fn]=a,(T=y.nodeValue!==u)&&(s=Qt,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[Fn]=a,a.stateNode=y}return _t(a),null;case 13:if(tt(lt),y=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(st&&Jt!==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[Fn]=a}else Os(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),T=!1}else wn!==null&&(lh(wn),wn=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?vt===0&&(vt=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 Vt(a.type)&&bc(),_t(a),null;case 19:if(tt(lt),T=a.memoizedState,T===null)return _t(a),null;if(y=(a.flags&128)!==0,O=T.rendering,O===null)if(y)Na(T,!1);else{if(vt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(O=Ac(s),O!==null){for(a.flags|=128,Na(T,!1),y=O.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,O=T.alternate,O===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=O.childLanes,T.lanes=O.lanes,T.child=O.child,T.subtreeFlags=0,T.deletions=null,T.memoizedProps=O.memoizedProps,T.memoizedState=O.memoizedState,T.updateQueue=O.updateQueue,T.type=O.type,s=O.dependencies,T.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),u=u.sibling;return Ze(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(O),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"&&!O.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?(O.sibling=a.child,a.child=O):(u=T.last,u!==null?u.sibling=O:a.child=O,T.last=O)}return T.tail!==null?(a=T.tail,T.rendering=a,T.tail=a.sibling,T.renderingStartTime=at(),a.sibling=null,u=lt.current,Ze(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?(en&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 Vt(a.type)&&bc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return zs(),tt(zt),tt(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(tt(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 tt(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,Ee=null;function Bs(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 O=0,G=-1,J=-1,ie=0,fe=0,he=s,de=null;t:for(;;){for(var be;he!==u||C!==0&&he.nodeType!==3||(G=O+C),he!==T||y!==0&&he.nodeType!==3||(J=O+y),he.nodeType===3&&(O+=he.nodeValue.length),(be=he.firstChild)!==null;)de=he,he=be;for(;;){if(he===s)break t;if(de===u&&++ie===C&&(G=O),de===T&&++fe===y&&(J=O),(be=he.nextSibling)!==null)break;he=de,de=he.parentNode}he=be}u=G===-1||J===-1?null:{start:G,end:J}}else u=null}u=u||{start:0,end:0}}else u=null;for(dp={focusedElem:s,selectionRange:u},ac=!1,Ee=a;Ee!==null;)if(a=Ee,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Ee=s;else for(;Ee!==null;){a=Ee;try{var ke=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(ke!==null){var Te=ke.memoizedProps,ft=ke.memoizedState,oe=a.stateNode,ee=oe.getSnapshotBeforeUpdate(a.elementType===a.type?Te:bn(a.type,Te),ft);oe.__reactInternalSnapshotBeforeUpdate=ee}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(ye){ut(a,a.return,ye)}if(s=a.sibling,s!==null){s.return=a.return,Ee=s;break}Ee=a.return}return ke=Fx,Fx=!1,ke}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 Bc(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[Fn],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 Bx(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,Sn=!1;function Ur(s,a,u){for(u=u.child;u!==null;)Hx(s,a,u),u=u.sibling}function Hx(s,a,u){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(To,u)}catch{}switch(u.tag){case 5:At||Bs(u,a);case 6:var y=Et,C=Sn;Et=null,Ur(s,a,u),Et=y,Sn=C,Et!==null&&(Sn?(s=Et,u=u.stateNode,s.nodeType===8?s.parentNode.removeChild(u):s.removeChild(u)):Et.removeChild(u.stateNode));break;case 18:Et!==null&&(Sn?(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=Sn,Et=u.stateNode.containerInfo,Sn=!0,Ur(s,a,u),Et=y,Sn=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,O=T.destroy;T=T.tag,O!==void 0&&((T&2)!==0||(T&4)!==0)&&Qp(u,a,O),C=C.next}while(C!==y)}Ur(s,a,u);break;case 1:if(!At&&(Bs(u,a),y=u.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=u.memoizedProps,y.state=u.memoizedState,y.componentWillUnmount()}catch(G){ut(u,a,G)}Ur(s,a,u);break;case 21:Ur(s,a,u);break;case 22:u.mode&1?(At=(y=At)||u.memoizedState!==null,Ur(s,a,u),At=y):Ur(s,a,u);break;default:Ur(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 Cn(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,O=a,G=O;e:for(;G!==null;){switch(G.tag){case 5:Et=G.stateNode,Sn=!1;break e;case 3:Et=G.stateNode.containerInfo,Sn=!0;break e;case 4:Et=G.stateNode.containerInfo,Sn=!0;break e}G=G.return}if(Et===null)throw Error(n(160));Hx(T,O,C),Et=null,Sn=!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(Cn(a,s),Bn(s),y&4){try{ka(3,s,s.return),Bc(3,s)}catch(Te){ut(s,s.return,Te)}try{ka(5,s,s.return)}catch(Te){ut(s,s.return,Te)}}break;case 1:Cn(a,s),Bn(s),y&512&&u!==null&&Bs(u,u.return);break;case 5:if(Cn(a,s),Bn(s),y&512&&u!==null&&Bs(u,u.return),s.flags&32){var C=s.stateNode;try{rr(C,"")}catch(Te){ut(s,s.return,Te)}}if(y&4&&(C=s.stateNode,C!=null)){var T=s.memoizedProps,O=u!==null?u.memoizedProps:T,G=s.type,J=s.updateQueue;if(s.updateQueue=null,J!==null)try{G==="input"&&T.type==="radio"&&T.name!=null&&ze(C,T),Bi(G,O);var ie=Bi(G,T);for(O=0;O<J.length;O+=2){var fe=J[O],he=J[O+1];fe==="style"?Hl(C,he):fe==="dangerouslySetInnerHTML"?Vl(C,he):fe==="children"?rr(C,he):k(C,fe,he,ie)}switch(G){case"input":le(C,T);break;case"textarea":ms(C,T);break;case"select":var de=C._wrapperState.wasMultiple;C._wrapperState.wasMultiple=!!T.multiple;var be=T.value;be!=null?Je(C,!!T.multiple,be,!1):de!==!!T.multiple&&(T.defaultValue!=null?Je(C,!!T.multiple,T.defaultValue,!0):Je(C,!!T.multiple,T.multiple?[]:"",!1))}C[ga]=T}catch(Te){ut(s,s.return,Te)}}break;case 6:if(Cn(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(Te){ut(s,s.return,Te)}}break;case 3:if(Cn(a,s),Bn(s),y&4&&u!==null&&u.memoizedState.isDehydrated)try{oa(a.containerInfo)}catch(Te){ut(s,s.return,Te)}break;case 4:Cn(a,s),Bn(s);break;case 13:Cn(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,Cn(a,s),At=ie):Cn(a,s),Bn(s),y&8192){if(ie=s.memoizedState!==null,(s.stateNode.isHidden=ie)&&!fe&&(s.mode&1)!==0)for(Ee=s,fe=s.child;fe!==null;){for(he=Ee=fe;Ee!==null;){switch(de=Ee,be=de.child,de.tag){case 0:case 11:case 14:case 15:ka(4,de,de.return);break;case 1:Bs(de,de.return);var ke=de.stateNode;if(typeof ke.componentWillUnmount=="function"){y=de,u=de.return;try{a=y,ke.props=a.memoizedProps,ke.state=a.memoizedState,ke.componentWillUnmount()}catch(Te){ut(y,u,Te)}}break;case 5:Bs(de,de.return);break;case 22:if(de.memoizedState!==null){Yx(he);continue}}be!==null?(be.return=de,Ee=be):Yx(he)}fe=fe.sibling}e:for(fe=null,he=s;;){if(he.tag===5){if(fe===null){fe=he;try{C=he.stateNode,ie?(T=C.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none"):(G=he.stateNode,J=he.memoizedProps.style,O=J!=null&&J.hasOwnProperty("display")?J.display:null,G.style.display=Bl("display",O))}catch(Te){ut(s,s.return,Te)}}}else if(he.tag===6){if(fe===null)try{he.stateNode.nodeValue=ie?"":he.memoizedProps}catch(Te){ut(s,s.return,Te)}}else if((he.tag!==22&&he.tag!==23||he.memoizedState===null||he===s)&&he.child!==null){he.child.return=he,he=he.child;continue}if(he===s)break e;for(;he.sibling===null;){if(he.return===null||he.return===s)break e;fe===he&&(fe=null),he=he.return}fe===he&&(fe=null),he.sibling.return=he.return,he=he.sibling}}break;case 19:Cn(a,s),Bn(s),y&4&&Wx(s);break;case 21:break;default:Cn(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&&(rr(C,""),y.flags&=-33);var T=Bx(s);th(s,T,C);break;case 3:case 4:var O=y.stateNode.containerInfo,G=Bx(s);eh(s,G,O);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){Ee=s,Kx(s)}function Kx(s,a,u){for(var y=(s.mode&1)!==0;Ee!==null;){var C=Ee,T=C.child;if(C.tag===22&&y){var O=C.memoizedState!==null||Vc;if(!O){var G=C.alternate,J=G!==null&&G.memoizedState!==null||At;G=Vc;var ie=At;if(Vc=O,(At=J)&&!ie)for(Ee=C;Ee!==null;)O=Ee,J=O.child,O.tag===22&&O.memoizedState!==null?Xx(C):J!==null?(J.return=O,Ee=J):Xx(C);for(;T!==null;)Ee=T,Kx(T),T=T.sibling;Ee=C,Vc=G,At=ie}Gx(s)}else(C.subtreeFlags&8772)!==0&&T!==null?(T.return=C,Ee=T):Gx(s)}}function Gx(s){for(;Ee!==null;){var a=Ee;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||Bc(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:bn(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 O=a.updateQueue;if(O!==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,O,u)}break;case 5:var G=a.stateNode;if(u===null&&a.flags&4){u=G;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 he=fe.dehydrated;he!==null&&oa(he)}}}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){Ee=null;break}if(u=a.sibling,u!==null){u.return=a.return,Ee=u;break}Ee=a.return}}function Yx(s){for(;Ee!==null;){var a=Ee;if(a===s){Ee=null;break}var u=a.sibling;if(u!==null){u.return=a.return,Ee=u;break}Ee=a.return}}function Xx(s){for(;Ee!==null;){var a=Ee;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Bc(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 O=a.return;try{Jp(a)}catch(J){ut(a,O,J)}}}catch(J){ut(a,a.return,J)}if(a===s){Ee=null;break}var G=a.sibling;if(G!==null){G.return=a.return,Ee=G;break}Ee=a.return}}var vI=Math.ceil,Hc=P.ReactCurrentDispatcher,nh=P.ReactCurrentOwner,gn=P.ReactCurrentBatchConfig,We=0,bt=null,ht=null,Nt=0,en=0,Hs=zr(0),vt=0,Ta=null,Oo=0,Wc=0,rh=0,Pa=null,Ht=null,oh=0,Ws=1/0,dr=null,Uc=!1,sh=null,Kr=null,Kc=!1,Gr=null,Gc=0,Ra=0,ih=null,Yc=-1,Xc=0;function jt(){return(We&6)!==0?at():Yc!==-1?Yc:Yc=at()}function Yr(s){return(s.mode&1)===0?1:(We&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 En(s,a,u,y){if(50<Ra)throw Ra=0,ih=null,Error(n(185));Po(s,u,y),((We&2)===0||s!==bt)&&(s===bt&&((We&2)===0&&(Wc|=u),vt===4&&Xr(s,Nt)),Wt(s,y),u===1&&We===0&&(a.mode&1)===0&&(Ws=at()+500,Cc&&Br()))}function Wt(s,a){var u=s.callbackNode;Vf(s,a);var y=Ss(s,s===bt?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(){(We&6)===0&&Br()}),u=null;else{switch(Hy(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,(We&6)!==0)throw Error(n(327));var u=s.callbackNode;if(Us()&&s.callbackNode!==u)return null;var y=Ss(s,s===bt?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=We;We|=2;var T=Jx();(bt!==s||Nt!==a)&&(dr=null,Ws=at()+500,Lo(s,a));do try{bI();break}catch(G){Qx(s,G)}while(!0);Ep(),Hc.current=T,We=C,ht!==null?a=0:(bt=null,Nt=0,a=vt)}if(a!==0){if(a===2&&(C=Qi(s),C!==0&&(y=C,a=ah(s,C))),a===1)throw u=Ta,Lo(s,0),Xr(s,y),Wt(s,at()),u;if(a===6)Xr(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,Lo(s,0),Xr(s,y),Wt(s,at()),u;switch(s.finishedWork=C,s.finishedLanes=y,a){case 0:case 1:throw Error(n(345));case 2:Fo(s,Ht,dr);break;case 3:if(Xr(s,y),(y&130023424)===y&&(a=oh+500-at(),10<a)){if(Ss(s,0)!==0)break;if(C=s.suspendedLanes,(C&y)!==y){jt(),s.pingedLanes|=s.suspendedLanes&C;break}s.timeoutHandle=pp(Fo.bind(null,s,Ht,dr),a);break}Fo(s,Ht,dr);break;case 4:if(Xr(s,y),(y&4194240)===y)break;for(a=s.eventTimes,C=-1;0<y;){var O=31-qt(y);T=1<<O,O=a[O],O>C&&(C=O),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(Fo.bind(null,s,Ht,dr),y);break}Fo(s,Ht,dr);break;case 5:Fo(s,Ht,dr);break;default:throw Error(n(329))}}}return Wt(s,at()),s.callbackNode===u?qx.bind(null,s):null}function ah(s,a){var u=Pa;return s.current.memoizedState.isDehydrated&&(Lo(s,a).flags|=256),s=qc(s,a),s!==2&&(a=Ht,Ht=u,a!==null&&lh(a)),s}function lh(s){Ht===null?Ht=s:Ht.push.apply(Ht,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(!xn(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 Xr(s,a){for(a&=~rh,a&=~Wc,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var u=31-qt(a),y=1<<u;s[u]=-1,a&=~y}}function Zx(s){if((We&6)!==0)throw Error(n(327));Us();var a=Ss(s,0);if((a&1)===0)return Wt(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,Lo(s,0),Xr(s,a),Wt(s,at()),u;if(u===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,Fo(s,Ht,dr),Wt(s,at()),null}function ch(s,a){var u=We;We|=1;try{return s(a)}finally{We=u,We===0&&(Ws=at()+500,Cc&&Br())}}function $o(s){Gr!==null&&Gr.tag===0&&(We&6)===0&&Us();var a=We;We|=1;var u=gn.transition,y=Ge;try{if(gn.transition=null,Ge=1,s)return s()}finally{Ge=y,gn.transition=u,We=a,(We&6)===0&&Br()}}function uh(){en=Hs.current,tt(Hs)}function Lo(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(),tt(zt),tt(Rt),Ap();break;case 5:Ip(y);break;case 4:zs();break;case 13:tt(lt);break;case 19:tt(lt);break;case 10:Np(y.type._context);break;case 22:case 23:uh()}u=u.return}if(bt=s,ht=s=qr(s.current,null),Nt=en=a,vt=0,Ta=null,rh=Wc=Oo=0,Ht=Pa=null,Mo!==null){for(a=0;a<Mo.length;a++)if(u=Mo[a],y=u.interleaved,y!==null){u.interleaved=null;var C=y.next,T=u.pending;if(T!==null){var O=T.next;T.next=C,y.next=O}u.pending=y}Mo=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(jo=0,wt=yt=ct=null,ba=!1,Sa=0,nh.current=null,u===null||u.return===null){vt=1,Ta=a,ht=null;break}e:{var T=s,O=u.return,G=u,J=a;if(a=Nt,G.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var ie=J,fe=G,he=fe.tag;if((fe.mode&1)===0&&(he===0||he===11||he===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 be=Cx(O);if(be!==null){be.flags&=-257,Ex(be,O,G,T,a),be.mode&1&&Sx(T,ie,a),a=be,J=ie;var ke=a.updateQueue;if(ke===null){var Te=new Set;Te.add(J),a.updateQueue=Te}else ke.add(J);break e}else{if((a&1)===0){Sx(T,ie,a),dh();break e}J=Error(n(426))}}else if(st&&G.mode&1){var ft=Cx(O);if(ft!==null){(ft.flags&65536)===0&&(ft.flags|=256),Ex(ft,O,G,T,a),Sp(Vs(J,G));break e}}T=J=Vs(J,G),vt!==4&&(vt=2),Pa===null?Pa=[T]:Pa.push(T),T=O;do{switch(T.tag){case 3:T.flags|=65536,a&=-a,T.lanes|=a;var oe=wx(T,J,a);Gv(T,oe);break e;case 1:G=J;var ee=T.type,se=T.stateNode;if((T.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Kr===null||!Kr.has(se)))){T.flags|=65536,a&=-a,T.lanes|=a;var ye=bx(T,G,a);Gv(T,ye);break e}}T=T.return}while(T!==null)}t0(u)}catch(Pe){a=Pe,ht===u&&u!==null&&(ht=u=u.return);continue}break}while(!0)}function Jx(){var s=Hc.current;return Hc.current=$c,s===null?$c:s}function dh(){(vt===0||vt===3||vt===2)&&(vt=4),bt===null||(Oo&268435455)===0&&(Wc&268435455)===0||Xr(bt,Nt)}function qc(s,a){var u=We;We|=2;var y=Jx();(bt!==s||Nt!==a)&&(dr=null,Lo(s,a));do try{wI();break}catch(C){Qx(s,C)}while(!0);if(Ep(),We=u,Hc.current=y,ht!==null)throw Error(n(261));return bt=null,Nt=0,vt}function wI(){for(;ht!==null;)e0(ht)}function bI(){for(;ht!==null&&!Df();)e0(ht)}function e0(s){var a=o0(s.alternate,s,en);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,en),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{vt=6,ht=null;return}}if(a=a.sibling,a!==null){ht=a;return}ht=a=s}while(a!==null);vt===0&&(vt=5)}function Fo(s,a,u){var y=Ge,C=gn.transition;try{gn.transition=null,Ge=1,SI(s,a,u,y)}finally{gn.transition=C,Ge=y}return null}function SI(s,a,u,y){do Us();while(Gr!==null);if((We&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===bt&&(ht=bt=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=gn.transition,gn.transition=null;var O=Ge;Ge=1;var G=We;We|=4,nh.current=null,mI(s,u),Ux(u,s),BR(dp),ac=!!up,dp=up=null,s.current=u,yI(u),ec(),We=G,Ge=O,gn.transition=T}else s.current=u;if(Kc&&(Kc=!1,Gr=s,Gc=C),T=s.pendingLanes,T===0&&(Kr=null),$f(u.stateNode),Wt(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(Gr!==null){var s=Hy(Gc),a=gn.transition,u=Ge;try{if(gn.transition=null,Ge=16>s?16:s,Gr===null)var y=!1;else{if(s=Gr,Gr=null,Gc=0,(We&6)!==0)throw Error(n(331));var C=We;for(We|=4,Ee=s.current;Ee!==null;){var T=Ee,O=T.child;if((Ee.flags&16)!==0){var G=T.deletions;if(G!==null){for(var J=0;J<G.length;J++){var ie=G[J];for(Ee=ie;Ee!==null;){var fe=Ee;switch(fe.tag){case 0:case 11:case 15:ka(8,fe,T)}var he=fe.child;if(he!==null)he.return=fe,Ee=he;else for(;Ee!==null;){fe=Ee;var de=fe.sibling,be=fe.return;if(zx(fe),fe===ie){Ee=null;break}if(de!==null){de.return=be,Ee=de;break}Ee=be}}}var ke=T.alternate;if(ke!==null){var Te=ke.child;if(Te!==null){ke.child=null;do{var ft=Te.sibling;Te.sibling=null,Te=ft}while(Te!==null)}}Ee=T}}if((T.subtreeFlags&2064)!==0&&O!==null)O.return=T,Ee=O;else e:for(;Ee!==null;){if(T=Ee,(T.flags&2048)!==0)switch(T.tag){case 0:case 11:case 15:ka(9,T,T.return)}var oe=T.sibling;if(oe!==null){oe.return=T.return,Ee=oe;break e}Ee=T.return}}var ee=s.current;for(Ee=ee;Ee!==null;){O=Ee;var se=O.child;if((O.subtreeFlags&2064)!==0&&se!==null)se.return=O,Ee=se;else e:for(O=ee;Ee!==null;){if(G=Ee,(G.flags&2048)!==0)try{switch(G.tag){case 0:case 11:case 15:Bc(9,G)}}catch(Pe){ut(G,G.return,Pe)}if(G===O){Ee=null;break e}var ye=G.sibling;if(ye!==null){ye.return=G.return,Ee=ye;break e}Ee=G.return}}if(We=C,Br(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(To,s)}catch{}y=!0}return y}finally{Ge=u,gn.transition=a}}return!1}function n0(s,a,u){a=Vs(u,a),a=wx(s,a,1),s=Wr(s,a,1),a=jt(),s!==null&&(Po(s,1,a),Wt(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"&&(Kr===null||!Kr.has(y))){s=Vs(u,s),s=bx(a,s,1),a=Wr(a,s,1),s=jt(),a!==null&&(Po(a,1,s),Wt(a,s));break}}a=a.return}}function CI(s,a,u){var y=s.pingCache;y!==null&&y.delete(a),a=jt(),s.pingedLanes|=s.suspendedLanes&u,bt===s&&(Nt&u)===u&&(vt===4||vt===3&&(Nt&130023424)===Nt&&500>at()-oh?Lo(s,0):rh|=u),Wt(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=jt();s=lr(s,a),s!==null&&(Po(s,a,u),Wt(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||zt.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,Vt(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,Bp(a,y,s,u),a=Kp(null,a,y,!0,T,u)):(a.tag=0,st&&T&&vp(a),Dt(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=bn(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,bn(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:bn(y,C),Up(s,a,y,C,u);case 1:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:bn(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 O=a.memoizedState;if(y=O.element,T.isDehydrated)if(T={element:y,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.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(Jt=Fr(a.stateNode.containerInfo.firstChild),Qt=a,st=!0,wn=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=ur(s,a,u);break e}Dt(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,O=C.children,fp(y,C)?O=null:T!==null&&fp(y,T)&&(a.flags|=32),Rx(s,a),Dt(s,a,O,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):Dt(s,a,y,u),a.child;case 11:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:bn(y,C),Nx(s,a,y,C,u);case 7:return Dt(s,a,a.pendingProps,u),a.child;case 8:return Dt(s,a,a.pendingProps.children,u),a.child;case 12:return Dt(s,a,a.pendingProps.children,u),a.child;case 10:e:{if(y=a.type._context,C=a.pendingProps,T=a.memoizedProps,O=C.value,Ze(Pc,y._currentValue),y._currentValue=O,T!==null)if(xn(T.value,O)){if(T.children===C.children&&!zt.current){a=ur(s,a,u);break e}}else for(T=a.child,T!==null&&(T.return=a);T!==null;){var G=T.dependencies;if(G!==null){O=T.child;for(var J=G.firstContext;J!==null;){if(J.context===y){if(T.tag===1){J=cr(-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),G.lanes|=u;break}J=J.next}}else if(T.tag===10)O=T.type===a.type?null:T.child;else if(T.tag===18){if(O=T.return,O===null)throw Error(n(341));O.lanes|=u,G=O.alternate,G!==null&&(G.lanes|=u),kp(O,u,a),O=T.sibling}else O=T.child;if(O!==null)O.return=T;else for(O=T;O!==null;){if(O===a){O=null;break}if(T=O.sibling,T!==null){T.return=O.return,O=T;break}O=O.return}T=O}Dt(s,a,C.children,u),a=a.child}return a;case 9:return C=a.type,y=a.pendingProps.children,Fs(a,u),C=pn(C),y=y(C),a.flags|=1,Dt(s,a,y,u),a.child;case 14:return y=a.type,C=bn(y,a.pendingProps),C=bn(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:bn(y,C),zc(s,a),a.tag=1,Vt(y)?(s=!0,Sc(a)):s=!1,Fs(a,u),vx(a,y,C),Bp(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 mn(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===U)return 11;if(s===B)return 14}return 2}function qr(s,a){var u=s.alternate;return u===null?(u=mn(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 O=2;if(y=s,typeof s=="function")fh(s)&&(O=1);else if(typeof s=="string")O=5;else e:switch(s){case _:return zo(u.children,C,T,a);case $:O=8,C|=8;break;case D:return s=mn(12,u,a,C|2),s.elementType=D,s.lanes=T,s;case Y:return s=mn(13,u,a,C),s.elementType=Y,s.lanes=T,s;case I:return s=mn(19,u,a,C),s.elementType=I,s.lanes=T,s;case V:return Qc(u,C,T,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case H:O=10;break e;case j:O=9;break e;case U:O=11;break e;case B:O=14;break e;case A:O=16,y=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return a=mn(O,u,a,C),a.elementType=s,a.type=y,a.lanes=T,a}function zo(s,a,u,y){return s=mn(7,s,y,a),s.lanes=u,s}function Qc(s,a,u,y){return s=mn(22,s,y,a),s.elementType=V,s.lanes=u,s.stateNode={isHidden:!1},s}function ph(s,a,u){return s=mn(6,s,null,a),s.lanes=u,s}function hh(s,a,u){return a=mn(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,O,G,J){return s=new PI(s,a,u,G,J),a===1?(a=1,T===!0&&(a|=8)):a=0,T=mn(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:R,key:y==null?null:""+y,children:s,containerInfo:a,implementation:u}}function i0(s){if(!s)return Vr;s=s._reactInternals;e:{if(Ln(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(Vt(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(Vt(u))return Dv(s,u,a)}return a}function a0(s,a,u,y,C,T,O,G,J){return s=gh(u,y,!0,s,C,T,O,G,J),s.context=i0(null),u=s.current,y=jt(),C=Yr(u),T=cr(y,C),T.callback=a??null,Wr(u,T,C),s.current.lanes=C,Po(s,C,y),Wt(s,y),s}function Jc(s,a,u,y){var C=a.current,T=jt(),O=Yr(C);return u=i0(u),a.context===null?a.context=u:a.pendingContext=u,a=cr(T,O),a.payload={element:s},y=y===void 0?null:y,y!==null&&(a.callback=y),s=Wr(C,a,O),s!==null&&(En(s,C,O,T),Ic(s,C,O)),O}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;$o(function(){Jc(null,s,null,null)}),a[or]=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<Or.length&&a!==0&&a<Or[u].priority;u++);Or.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(O);T.call(ie)}}var O=a0(a,y,s,0,null,!1,!1,"",u0);return s._reactRootContainer=O,s[or]=O.current,pa(s.nodeType===8?s.parentNode:s),$o(),O}for(;C=s.lastChild;)s.removeChild(C);if(typeof y=="function"){var G=y;y=function(){var ie=eu(J);G.call(ie)}}var J=gh(s,0,!1,null,null,!1,!1,"",u0);return s._reactRootContainer=J,s[or]=J.current,pa(s.nodeType===8?s.parentNode:s),$o(function(){Jc(a,J,u,y)}),J}function ru(s,a,u,y,C){var T=u._reactRootContainer;if(T){var O=T;if(typeof C=="function"){var G=C;C=function(){var J=eu(O);G.call(J)}}Jc(a,O,s,C)}else O=_I(u,a,s,C,y);return eu(O)}Wy=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var u=Ar(a.pendingLanes);u!==0&&(Bf(a,u|1),Wt(a,at()),(We&6)===0&&(Ws=at()+500,Br()))}break;case 13:$o(function(){var y=lr(s,1);if(y!==null){var C=jt();En(y,s,1,C)}}),mh(s,1)}},Hf=function(s){if(s.tag===13){var a=lr(s,134217728);if(a!==null){var u=jt();En(a,s,134217728,u)}mh(s,134217728)}},Uy=function(s){if(s.tag===13){var a=Yr(s),u=lr(s,a);if(u!==null){var y=jt();En(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(le(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));ge(y),le(y,C)}}}break;case"textarea":ms(s,u);break;case"select":a=u.value,a!=null&&Je(s,!!u.multiple,a,!1)}},Gl=ch,Yl=$o;var AI={usingClientEntryPoint:!1,Events:[ma,_s,wc,Ul,Kl,ch]},Ia={findFiberByHostInstance:Ro,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{To=ou.inject(MI),un=ou}catch{}}return Ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AI,Ut.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)},Ut.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[or]=a.current,pa(s.nodeType===8?s.parentNode:s),new yh(a)},Ut.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},Ut.flushSync=function(s){return $o(s)},Ut.hydrate=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!0,u)},Ut.hydrateRoot=function(s,a,u){if(!vh(s))throw Error(n(405));var y=u!=null&&u.hydratedSources||null,C=!1,T="",O=c0;if(u!=null&&(u.unstable_strictMode===!0&&(C=!0),u.identifierPrefix!==void 0&&(T=u.identifierPrefix),u.onRecoverableError!==void 0&&(O=u.onRecoverableError)),a=a0(a,null,s,1,u??null,C,!1,T,O),s[or]=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)},Ut.render=function(s,a,u){if(!nu(a))throw Error(n(200));return ru(null,s,a,!1,u)},Ut.unmountComponentAtNode=function(s){if(!nu(s))throw Error(n(40));return s._reactRootContainer?($o(function(){ru(null,null,s,!1,function(){s._reactRootContainer=null,s[or]=null})}),!0):!1},Ut.unstable_batchedUpdates=ch,Ut.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)},Ut.version="18.3.1-next-f1338f8080-20240426",Ut}var v0;function o1(){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 BI(){if(x0)return su;x0=1;var e=o1();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var HI=BI(),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)},s1=(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]):s1(e[r],t[r],n):e[r]=t[r]);return e},Vo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var YI={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};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 Bu{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 Bu(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Bu(this.logger,t)}}var Un=new Bu;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?s1(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 i1={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 a1=Symbol("i18next/PATH_KEY");function t_(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>(n?.revoke?.(),o===a1?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function si(e,t){const{[a1]: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 Hu 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=Un.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(Y=>typeof Y=="function"?si(Y,{...this.options,...o}):String(Y));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),M=Hu.hasDefaultValue(o),R=P?this.pluralResolver.getSuffix(h,o.count,o):"",_=o.ordinal&&P?this.pluralResolver.getSuffix(h,o.count,{ordinal:!1}):"",$=P&&!o.ordinal&&o.count===0,D=$&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${R}`]||o[`defaultValue${_}`]||o.defaultValue;let H=S;k&&!S&&M&&(H=D);const j=Nh(H),U=Object.prototype.toString.apply(H);if(k&&H&&j&&b.indexOf(U)<0&&!(Me(N)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,H,{...o,ns:d}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(x.res=Y,x.usedParams=this.getUsedParamsDetails(o),x):Y}if(l){const Y=Array.isArray(H),I=Y?[]:{},B=Y?E:w;for(const A in H)if(Object.prototype.hasOwnProperty.call(H,A)){const V=`${B}${l}${A}`;M&&!S?I[A]=this.translate(V,{...o,defaultValue:Nh(D)?D[A]:void 0,joinArrays:!1,ns:d}):I[A]=this.translate(V,{...o,joinArrays:!1,ns:d}),I[A]===V&&(I[A]=H[A])}S=I}}else if(k&&Me(N)&&Array.isArray(S))S=S.join(N),S&&(S=this.extendTranslation(S,t,o,r));else{let Y=!1,I=!1;!this.isValidLookup(S)&&M&&(Y=!0,S=D),this.isValidLookup(S)||(I=!0,S=c);const A=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:S,V=M&&D!==S&&this.options.updateMissing;if(I||Y||V){if(this.logger.log(V?"updateKey":"missingKey",h,f,c,V?D:S),l){const L=this.resolve(c,{...o,keySeparator:!1});L&&L.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 F=[];const W=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&W&&W[0])for(let L=0;L<W.length;L++)F.push(W[L]);else this.options.saveMissingTo==="all"?F=this.languageUtils.toResolveHierarchy(o.lng||this.language):F.push(o.lng||this.language);const q=(L,z,X)=>{const Q=M&&X!==S?X:A;this.options.missingKeyHandler?this.options.missingKeyHandler(L,f,z,Q,V,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(L,f,z,Q,V,o),this.emit("missingKey",L,f,z,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach(L=>{const z=this.pluralResolver.getSuffixes(L,o);$&&o[`defaultValue${this.options.pluralSeparator}zero`]&&z.indexOf(`${this.options.pluralSeparator}zero`)<0&&z.push(`${this.options.pluralSeparator}zero`),z.forEach(X=>{q([L],c+X,o[`defaultValue${X}`]||D)})}):q(F,c,D))}S=this.extendTranslation(S,t,o,x,r),I&&S===c&&this.options.appendNamespaceToMissingKey&&(S=`${f}${g}${c}`),(I||Y)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${g}${c}`:c,Y?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=i1.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 M=`${this.options.pluralSeparator}zero`,R=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(n.ordinal&&P.indexOf(R)===0&&N.push(g+P.replace(R,this.options.pluralSeparator)),N.push(g+P),x&&N.push(g+M)),S){const _=`${g}${this.options.contextSeparator||"_"}${n.context}`;N.push(_),v&&(n.ordinal&&P.indexOf(R)===0&&N.push(_+P.replace(R,this.options.pluralSeparator)),N.push(_+P),x&&N.push(_+M))}}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=Un.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=Un.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=Un.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?Vo(i):l||"{{",this.suffix=c?Vo(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=g?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":g||"",this.nestingPrefix=v?Vo(v):x||Vo("$t("),this.nestingSuffix=S?Vo(S):w||Vo(")"),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(`${Vo(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=Un.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=Un.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))})},l1="__i18next_supportNoticeShown",c_=()=>!!(typeof globalThis<"u"&&globalThis[l1]||typeof process<"u"&&Eh&&Eh.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Eh),u_=()=>{typeof globalThis<"u"&&(globalThis[l1]=!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=Un,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?Un.init(o(this.modules.logger),this.options):Un.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=Un,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 Hu(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"&&i1.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 Hu(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);Yo(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)=>{Yo(n)&&M0[n]||(Yo(n)&&(M0[n]=new Date),f_(e,t,n,r))},c1=(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,c1(e,n))},D0=(e,t,n,r)=>{if(Yo(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,c1(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}}),Yo=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_={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},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 u1;const b_=e=>{u1=e},S_=()=>u1,C_={type:"3rdParty",init(e){x_(e.options.react),b_(e)}},d1=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},f1=(e,t,n,r)=>e.getFixedT(t,n,r),k_=(e,t,n,r)=>m.useCallback(f1(e,t,n,r),[e,t,n,r]),Xe=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:o}=m.useContext(d1)||{},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=(R,_)=>Yo(_)?_:h_(_)&&Yo(_.defaultValue)?_.defaultValue:Array.isArray(R)?R[R.length-1]:R,M=[P,{},!1];return M.t=P,M.i18n={},M.ready=!1,M}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=Yo(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=()=>f1(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:M}=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 R=()=>{N.current&&w(x)};return P&&i?.on(P,R),M&&i?.store.on(M,R),()=>{N.current=!1,i&&P&&P?.split(" ").forEach(_=>i.off(_,R)),M&&i&&M.split(" ").forEach(_=>i.store.off(_,R))}},[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(d1.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||{}),Nr=(e=>(e.Network="Network",e.Pin="Pin",e.Serial="Serial",e))(Nr||{});const V_={type:"ReadPin",label:"Read Pin",category:xe.Input,tags:[Nr.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"}]}]},B_={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"}]}]},H_={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:[Nr.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:[Nr.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:[Nr.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:[Nr.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:[Nr.Serial],description:"Write string to serial port",parameters:[{id:"portReference",label:"Port",description:"Serial port or log channel to write to",type:"channelSelect",channelType:["UART","LOG"]},{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:[Nr.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:[Nr.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(B_),this.register(H_),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 $t=new aA;$t.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 p1(e){return lA[e]}function cm(e){return e==="control"||e==="agentTask"||e==="agentChoice"||e==="agentDelegate"}function h1(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 an(){return crypto.randomUUID()}function oo(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 yr(e){switch(e.srcId){case"declared":return Pi(e.varId);case"fnarg":return um(e.varId);default:return el(e.srcId,e.varId)}}function g1(e){return"uid"in e&&e.uid?e:{uid:an(),name:e.name,dataType:e.dataType}}function $0(e){return e.map(g1)}function Qo(e){return e.uid}function dm(e,t){const n=[],r={},o=new Set;for(const i of t)h1(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 kr(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 m1(e,t,n=!1){for(const r of t)(r.activationRules?.length&&!kr(r,e,n)||bl(e[r.id]))&&delete e[r.id]}function y1(e,t,n){if(e.fromReference){const r=t[e.fromReference];if(r?.varId){const o=n[yr(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 v1(e,t){return Ri(e.channelType,t)}function x1(e,t){return Ri(e.memoryType,t)}function w1(e,t){return Ri(e.modelType,t)}function b1(e,t){return Ri(e.dataType,t)}function Wu(e,t){return e[t]}function S1(e,t){const n=e.arguments;if(e.type==="FunctionCall")return Wu(n,t);const r=$t.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 An(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 C1(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=$t.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:b1(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=$t.getByType(e.type);if(!o?.outputs)return t;for(const i of o.outputs)if(i.type==="static")r(i.id,i.id,b1(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=An(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:Qo(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:Qo(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"?$t.getByType(e.type):void 0;r&&m1(n.arguments,r.parameters,t);const o=n.arguments;for(const i of Object.keys(o))o[i]===void 0&&delete o[i]}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:e.arguments.qos===void 0?void 0: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=yr(n),o=t[r];return o?{name:o.name,dataType:o.dataType}:null})}}function Jo(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=lo(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 lo(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;lo(r.test,t,n)!=="bool"&&n.push("Ternary condition must be boolean");const i=lo(r.consequent,t,n),l=lo(r.alternate,t,n);if(i&&l&&i!==l){if(Tn(i)&&Tn(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=lo(e.left,t,n),o=lo(e.right,t,n),i=e.operator;return!r||!o?null:i==="+"&&(r==="string"||o==="string")?"string":["+","-","*","/"].includes(i)?!Tn(r)||!Tn(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)?((!Tn(r)||!Tn(o))&&n.push(`Operator '${i}' requires numeric operands (got '${r}' and '${o}')`),"bool"):["==","!="].includes(i)?(r!==o&&!(Tn(r)&&Tn(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=lo(e.argument,t,n);return r?e.operator==="!"?(r!=="bool"&&n.push(`Logical NOT '!' requires boolean operand (got '${r}')`),"bool"):e.operator==="-"||e.operator==="+"?(Tn(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):(lo(e.arguments[0],t,n),i):(n.push(`Unknown function '${o}'. Available cast functions: int(), float(), bool(), str()`),null)}function Tn(e){return e==="int"||e==="float"}function EA(e,t){return!!(e===t||Tn(e)&&Tn(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 E1=["GPIOIN","GPIOOUT","ADC","PWM","DAC","UART","MQTT","LOG"],Ed={parameters:[{id:"type",label:"Type",description:"Channel type",type:"selection",default:"GPIOIN",options:E1.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"]}]},{id:"level",label:"Level",description:"Severity the engine records messages written to this channel at",type:"selection",default:"info",options:[{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}],activationRules:[{type:"parameterIn",parameterId:"type",values:["LOG"]}]},{id:"tag",label:"Tag",description:"Optional category stamped on each line so the backend can group workflow-emitted logs",type:"string",optional:!0,activationRules:[{type:"parameterIn",parameterId:"type",values:["LOG"]}]}]};function kA(e){const{id:t,label:n,type:r}=e,o={...e.arguments,type:r};switch(m1(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};case"LOG":return{type:r,id:t,label:n,level:o.level,tag:o.tag}}}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;case"LOG":o.level=e.level,o.tag=e.tag;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 He="main";function N1(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=An(r),w=Sd(r),E=tl(n,r,g);for(const R of o.parameters){if(!kr(R,w,E))continue;const _=w[R.id];if(Jo(_)&&_.expression){const $=Sl(_,i);R.type==="expression"&&($.expectedType=y1(R,w,i));const D=Cd($);D.isValid||x.push({severity:"error",category:"invalid-expression",canvasId:t,nodeId:n,paramId:R.id,message:`Invalid expression for "${R.label}": ${D.errors.join(", ")}`})}if(!R.optional){const $=Jo(_)&&!_.expression,D=R.type==="variableSelect"&&(!_||typeof _=="object"&&_!==null&&!_.varId);(bl(_)||$||D)&&x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,paramId:R.id,message:`Missing required parameter "${R.label}"`})}if(R.type==="variableSelect"&&_){const $=_;if($.varId){const D=yr($);i[D]||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted variable`})}}if(R.type==="channelSelect"&&_){const $=_,D=Object.values(l).find(H=>H.id===$);D?v1(R,w).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible channel type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted channel`})}if(R.type==="memory-refs"&&Array.isArray(_)&&c){const $=_,D=new Set(Object.values(c).filter(j=>j.type==="MemoryFile").map(j=>j.id)),H=$.filter(j=>!j.id||!D.has(j.id));H.length>0&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references ${H.length} deleted memory file${H.length===1?"":"s"}`})}if(R.type==="memorySelect"&&_&&c){const $=_,D=Object.values(c).find(H=>H.id===$);D?x1(R,w).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible memory type`}):x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted memory`})}if(R.type==="modelSelect"&&_&&d){const $=_,D=Object.values(d).find(H=>H.id===$);D?w1(R,w).includes(D.type)||x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references "${D.label}" (${D.type}), which is not a compatible model type`}):f&&!f.has($)&&x.push({severity:"error",category:"invalid-reference",canvasId:t,nodeId:n,paramId:R.id,message:`"${R.label}" references a deleted model`})}}if(!E){const R=C1(r);for(const $ of Object.keys(R)){const D=S1(r,$);if(!D||!D.active||D.mode!=="assign")continue;const H=R[$];if(!D.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H?.name??$}" has no variable selected`});continue}const j=yr(D.target),U=i[j];U?H&&U.dataType!==H.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H.name}" (${H.dataType}) cannot assign to "${U.name}" (${U.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:$,message:`Output "${H?.name??$}" assigns to a deleted variable`})}const _=(o.outputs??[]).filter($=>$.type==="list");for(const $ of _){const D=r.arguments[$.id]??[],H=new Map;D.forEach((j,U)=>{const Y=H.get(j.name);Y?Y.push(U):H.set(j.name,[U])}),D.forEach((j,U)=>{const Y=`${$.id}[${U}]`;if(!j.name||j.name.trim()===""?x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,outputId:Y,message:`${$.label} entry #${U+1} has no name`}):(H.get(j.name)??[]).length>1&&x.push({severity:"error",category:"duplicate-output-name",canvasId:t,nodeId:n,outputId:Y,message:`${$.label} entry #${U+1} has duplicate name "${j.name}"`}),j.mode!=="assign")return;if(!j.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:Y,message:`${$.label} entry #${U+1} has no variable selected`});return}const I=yr(j.target),B=i[I];B?B.dataType!==j.dataType&&x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:Y,message:`${$.label} entry #${U+1} (${j.dataType}) cannot assign to "${B.name}" (${B.dataType})`}):x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:Y,message:`${$.label} entry #${U+1} assigns to a deleted variable`})})}}const b=S.input.filter(R=>R.type==="control"),N=S.input.filter(R=>R.type==="tool"),k=S.output.filter(R=>R.type==="control"),P=new Set(g.filter(R=>R.target===n).map(R=>R.targetHandle)),M=new Set(g.filter(R=>R.source===n).map(R=>R.sourceHandle));if(b.length>0)if(E)for(const R of N)P.has(R.id)||x.push({severity:"warning",category:"unconnected-input",canvasId:t,nodeId:n,message:"Node is not connected and will never run"});else for(const R of b)P.has(R.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(_=>P.has(_.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 R of k)M.has(R.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 k1(e){const{canvasId:t,edgeId:n,edgeType:r,edgeData:o,availableVariables:i,sourceControlEdgeCount:l}=e,c=[],d=p1(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(Jo(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 T1(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"||!kr(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 P1(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(!kr(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 R1(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(!kr(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 I1(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 I1(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 M of w){const R=M;let _,$=!1,D=!1;if(R.type==="FunctionCall"){const j=R,U=r[j.functionInfo.id];D=!U,$=U?j.functionInfo.version!==U.version:!1,U?_=wg(U):_=wg(j.functionInfo)}else _=$t.getByType(R.type);const H=N1({canvasId:x,nodeId:M.id,nodeData:R,nodeDefinition:_,availableVariables:b,channels:o,memory:i,models:l,edges:E,isStale:$,isDeleted:D});N.push(...H)}const k=new Map;for(const M of E)cm(M.type)&&k.set(M.source,(k.get(M.source)??0)+1);for(const M of E){const R=M.type??"control",_=k1({canvasId:x,edgeId:M.id,edgeType:R,edgeData:M.data,availableVariables:b,sourceControlEdgeCount:k.get(M.source)??0});N.push(..._)}const P=n[x];if(P)for(const M of I1(P.outputs,b))N.push({...M,canvasId:x});if(N.length>0){const M=N.filter($=>$.severity==="error").length,R=N.filter($=>$.severity==="warning").length,_=x===He?"Main":n[x]?.name??x;c.push({canvasId:x,canvasLabel:_,diagnostics:N,errorCount:M,warningCount:R}),d+=M,f+=R}}const g=[];for(const x of Object.values(o))g.push(...T1(x));for(const x of g)x.severity==="error"?d++:f++;const h=[];for(const x of Object.values(i))h.push(...P1(x));for(const x of h)x.severity==="error"?d++:f++;const v=[];for(const x of Object.values(l))v.push(...R1(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 BA="Node-Bibliothek",HA="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",BM="Verfügbare Agenten",HM="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",BD="Name",HD="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",ej="Auto",tj="Version umbenennen",nj="Visuelle Vorschau kommt bald",rj="Lade Versionen...",oj="Keine Versionen vorhanden.",sj="Versionen sind schreibgeschützt und können nicht verändert werden.",ij="Dialoge laden…",aj="Versionen laden…",lj="Testdialog lädt…",cj="Aktuell",uj="Neue Funktion",dj="Ausdruck eingeben...",fj="{{type}}-Ausdruck eingeben...",pj="von {{node}}",hj="Funktion hinzufügen",gj="Wiederverwendbare Funktion erstellen",mj="Nodes hinzufügen, um deren Ausgabevariablen zu sehen",yj="Variable hinzufügen",vj="Mit Warnungen fortfahren",xj="Funktion erstellen",wj="Definierte Variablen",bj="Funktion löschen",Sj="Funktion löschen?",Cj="Fertig",Ej="Funktion bearbeiten",Nj="Ausdruck für",kj="Arg",Tj="Funktionsargumente",Pj="Funktionsnamen, Eingaben und Ausgaben konfigurieren.",Rj="Argumente, die beim Aufruf der Funktion übergeben werden",Ij="Werte, die die Funktion zurückgibt; jeder ist ein Ausdruck über ihre Eingaben und ihren Rumpf",_j="Funktionsname",Aj="Funktionsname eingeben...",Mj="Funktionen",Dj="Funktion öffnen",jj="Globale Variable",Oj="Anfangswert",$j="Eingaben",Lj="Node-Ausgabevariablen",Fj="Keine Kantenparameter",zj="Keine Funktionsinformationen verfügbar",Vj="Noch keine Funktionen",Bj="Keine Eingaben",Hj="Keine Probleme gefunden",Wj="Keine Ausgaben",Uj="Ausgaben",Kj="Rückgabewert-Zuweisungen",Gj="Ausdrücke den Funktions-Rückgabewerten zuweisen",Yj="Verbindung löschen",Xj="Projekt umbenennen",qj='Die Funktion "{{name}}" aufrufen',Zj="Wert für {{name}} eingeben",Qj="Name der Ausgabevariable für {{name}} eingeben",Jj="Diese Funktion und alle zugehörigen Knoten werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",e2="Knoten",t2="Keine Fehler oder Warnungen in Workflow",n2="Validierungsprobleme",r2="{{errorCount}} Fehler und {{warningCount}} Warnung(en) gefunden. Fehler müssen vor dem Export behoben werden.",o2="{{warningCount}} Warnung(en) gefunden. Sie können trotzdem fortfahren.",s2="Version gespeichert",i2="Version konnte nicht gespeichert werden",a2="Version wiederhergestellt",l2="Version konnte nicht wiederhergestellt werden",c2="Version umbenannt",u2="Version konnte nicht umbenannt werden",d2="Die Embedded-Firmware wurde erfolgreich generiert und heruntergeladen.",f2="C-Code generiert",p2="C-Code Generierung fehlgeschlagen",h2="Der C-Code konnte nicht generiert werden.",g2="Visueller Builder für Ihre Projekte.",m2="Projekt nicht gefunden",y2="Das ausgewählte Projekt existiert nicht.",v2="Deployment nicht gefunden",x2={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"},w2={input:"Eingang",output:"Ausgang",logic:"Logik",math:"Mathematik",ai:"KI",control:"Steuerung",sensor:"Sensor",actuator:"Aktor",communication:"Kommunikation",storage:"Speicher",custom:"Benutzerdefiniert"},b2="Hinzufügen",S2="Abbrechen",C2={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"}}}},E2={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"}},N2={nodeLibrary:BA,blockLibrary:HA,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:BM,comingSoon:HM,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:BD,outputType:HD,outputValue:WD,noNodeSelected:UD,selectNodeMessage:KD,importError:GD,invalidJson:YD,exportSuccess:XD,configDownloaded:qD,copied:ZD,configCopied:QD,autoVersionMessage:JD,autoVersionLabel:ej,"saveStatus.saved":"Gespeichert","saveStatus.saving":"Speichern...","saveStatus.unsaved":"Ungespeicherte Änderungen",versionRenameTooltip:tj,versionPreviewPlaceholder:nj,"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:rj,noVersions:oj,versionsReadOnly:sj,loadingDialogs:ij,loadingVersions:aj,loadingTest:lj,current:cj,newFunction:uj,enterExpression:dj,enterTypeExpression:fj,fromNode:pj,addFunction:hj,addFunctionHint:gj,addNodesForVariables:mj,addVariable:yj,continueWithWarnings:vj,createFunction:xj,definedVariables:wj,deleteFunction:bj,deleteFunctionTitle:Sj,done:Cj,editFunction:Ej,expressionFor:Nj,fnarg:kj,functionArguments:Tj,functionDialogDesc:Pj,functionInputsDesc:Rj,functionOutputsDesc:Ij,functionName:_j,functionNamePlaceholder:Aj,functions:Mj,openFunction:Dj,globalVariable:jj,initialValue:Oj,inputs:$j,nodeOutputVariables:Lj,noEdgeParams:Fj,noFunctionInfo:zj,noFunctions:Vj,noInputs:Bj,noIssuesFound:Hj,noOutputs:Wj,outputs:Uj,returnValueAssignments:Kj,returnValueAssignmentsDesc:Gj,deleteEdge:Yj,renameProject:Xj,functionCallDesc:qj,functionParamDesc:Zj,functionOutputDesc:Qj,deleteFunctionDesc:Jj,nodeLabel:e2,validationPassed:t2,validationIssues:n2,validationErrorsDesc:r2,validationWarningsDesc:o2,versionSaved:s2,versionSaveError:i2,versionRestored:a2,versionRestoreError:l2,versionRenamed:c2,versionRenameError:u2,codeGenSuccess:d2,codeGenTitle:f2,codeGenError:p2,codeGenErrorDesc:h2,seoDescription:g2,projectNotFound:m2,projectNotFoundDesc:y2,deploymentNotFound:v2,deployDialog:x2,blocks:w2,add:b2,cancel:S2,nodes:C2,edges:E2},k2="Export as JSON",T2="Node Library",P2="Node Library",R2="Diagnostics",I2="Function Definition",_2="Open",A2="Close",M2="Save",D2="Version History",j2="Test",O2="Run",$2="Stop",L2="Deploy",F2="Configure",z2="Add Node",V2="Delete Node",B2="Duplicate Node",H2="Connect Nodes",W2="Disconnect Nodes",U2="Zoom In",K2="Zoom Out",G2="Fit to View",Y2="Auto Layout",X2="Grid",q2="Show Grid",Z2="Snap to Grid",Q2="Undo",J2="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",BO="Text",HO="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.",B$="Versions are read-only and cannot be modified.",H$="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",BL="Memory file name",HL="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",BF="Embedded firmware was successfully generated and downloaded.",HF="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:k2,nodeLibrary:T2,blockLibrary:P2,diagnostics:R2,functionDefinition:I2,open:_2,close:A2,save:M2,versionHistory:D2,test:j2,run:O2,stop:$2,deploy:L2,configure:F2,addBlock:z2,deleteBlock:V2,duplicateBlock:B2,connectBlocks:H2,disconnectBlocks:W2,zoomIn:U2,zoomOut:K2,fitView:G2,autoLayout:Y2,grid:X2,showGrid:q2,snapToGrid:Z2,undo:Q2,redo:J2,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:BO,paramTypeNumber:HO,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:B$,loadingDialogs:H$,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:BL,memoryFileDescription:HL,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:BF,codeGenTitle:HF,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:N2},en:{translation:rz}},gr=Tt.createInstance();gr.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 Kt({...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:Kt,dismiss:n=>Xa({type:"DISMISS_TOAST",toastId:n})}}const uz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_1=(...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:_1("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:_1(`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 A1=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 M1=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 D1=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const j1=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 O1=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 es=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 $1=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 L1=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 go=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 B0=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 F1(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=F1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function z1(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=F1(e))&&(r&&(r+=" "),r+=t);return r}const H0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,W0=z1,mo=(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=H0(g)||H0(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(),V1(c,t)||Fz(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&r[l]?[...d,...r[l]]:d}}},V1=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?V1(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 Bz(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,Bz=(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,Hz=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)}}},B1="!",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(B1),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:Hz(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+B1: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 M=k[P];i.push(b+M)}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 nt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},W1=/^\[(?:([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)\(.+\)$/,fr=e=>ii(e)||Qz.has(e)||Zz.test(e),Qr=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=>W1.test(e),Jr=e=>Jz.test(e),s3=new Set(["length","size","percentage"]),i3=e=>_i(e,s3,U1),a3=e=>_i(e,"position",U1),l3=new Set(["image","url"]),c3=e=>_i(e,l3,p3),u3=e=>_i(e,"",f3),Da=()=>!0,_i=(e,t,n)=>{const r=W1.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),U1=()=>!1,f3=e=>n3.test(e),p3=e=>r3.test(e),h3=()=>{const e=nt("colors"),t=nt("spacing"),n=nt("blur"),r=nt("brightness"),o=nt("borderColor"),i=nt("borderRadius"),l=nt("borderSpacing"),c=nt("borderWidth"),d=nt("contrast"),f=nt("grayscale"),g=nt("hueRotate"),h=nt("invert"),v=nt("gap"),x=nt("gradientColorStops"),S=nt("gradientColorStopPositions"),w=nt("inset"),E=nt("margin"),b=nt("opacity"),N=nt("padding"),k=nt("saturate"),P=nt("scale"),M=nt("sepia"),R=nt("skew"),_=nt("space"),$=nt("translate"),D=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",$e,t],U=()=>[$e,t],Y=()=>["",fr,Qr],I=()=>["auto",ii,$e],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",$e],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[ii,$e];return{cacheSize:500,separator:":",theme:{colors:[Da],spacing:[fr,Qr],blur:["none","",Jr,$e],brightness:L(),borderColor:[e],borderRadius:["none","","full",Jr,$e],borderSpacing:U(),borderWidth:Y(),contrast:L(),grayscale:W(),hueRotate:L(),invert:W(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[o3,Qr],inset:j(),margin:j(),opacity:L(),padding:U(),saturate:L(),scale:L(),sepia:W(),skew:L(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[Jr]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:[...B(),$e]}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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:j()}],"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":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Da]}],"row-start-end":[{row:["auto",{span:[Ma,$e]},$e]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"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",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"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":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"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:[Jr]},Jr]}],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",Jr,Qr]}],"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",fr,$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:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,Qr]}],"underline-offset":[{"underline-offset":["auto",fr,$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:U()}],"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:[...B(),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:[...A(),"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:A()}],"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:["",...A()]}],"outline-offset":[{"outline-offset":[fr,$e]}],"outline-w":[{outline:[fr,Qr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[fr,Qr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Jr,u3]}],"shadow-color":[{shadow:[Da]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Jr,$e]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[h]}],saturate:[{saturate:[k]}],sepia:[{sepia:[M]}],"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":[M]}],"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:L()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:L()}],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":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"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":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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:[fr,Qr,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(z1(e))}const m3=mo("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 uo({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 Yt(...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(Yt(...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 K1(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;K1(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(K1(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?Yt(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=mo("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 Lt(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 xt=globalThis?.document?m.useLayoutEffect:()=>{},T3=wd[" useId ".trim().toString()]||(()=>{}),P3=0;function kt(e){const[t,n]=m.useState(T3());return xt(()=>{n(r=>r??String(P3++))},[e]),t?`radix-${t}`:""}var R3=wd[" useInsertionEffect ".trim().toString()]||xt;function ln({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 ps=o1();const A3=lm(ps);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?Yt(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"],Ne=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&&ps.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",B3="dismissableLayer.pointerDownOutside",H3="dismissableLayer.focusOutside",Y0,G1=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(G1),[g,h]=m.useState(null),v=g?.ownerDocument??globalThis?.document,[,x]=m.useState({}),S=De(t,_=>h(_)),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,M=U3(_=>{const $=_.target,D=[...f.branches].some(H=>H.contains($));!P||D||(o?.(_),l?.(_),_.defaultPrevented||c?.())},v),R=K3(_=>{const $=_.target;[...f.branches].some(H=>H.contains($))||(i?.(_),l?.(_),_.defaultPrevented||c?.())},v);return z3(_=>{N===f.layers.size-1&&(r?.(_),!_.defaultPrevented&&c&&(_.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 _=()=>x({});return document.addEventListener(Cg,_),()=>document.removeEventListener(Cg,_)},[]),p.jsx(Ne.div,{...d,ref:S,style:{pointerEvents:k?P?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,R.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,M.onPointerDownCapture)})});Ai.displayName=V3;var W3="DismissableLayerBranch",Y1=m.forwardRef((e,t)=>{const n=m.useContext(G1),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(Ne.div,{...e,ref:o})});Y1.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(){X1(B3,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&&X1(H3,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 X1(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=Y1,_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:ro(h.current,{select:!0})},E=function(k){if(x.paused||!c)return;const P=k.relatedTarget;P!==null&&(c.contains(P)||ro(h.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const M of k)M.removedNodes.length>0&&ro(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(q1(c)),{select:!0}),document.activeElement===w&&ro(c))}return()=>{c.removeEventListener(_h,f),setTimeout(()=>{const b=new CustomEvent(Ah,q0);c.addEventListener(Ah,g),c.dispatchEvent(b),b.defaultPrevented||ro(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&&ro(k,{select:!0})):w.shiftKey&&b===k&&(w.preventDefault(),n&&ro(P,{select:!0})):b===N&&w.preventDefault()}},[n,r,x.paused]);return p.jsx(Ne.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(ro(r,{select:t}),document.activeElement!==n)return}function Z3(e){const t=q1(e),n=Z0(t,e),r=Z0(t.reverse(),e);return[n,r]}function q1(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 ro(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);xt(()=>i(!0),[]);const l=n||o&&globalThis?.document?.body;return l?A3.createPortal(p.jsx(Ne.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]),xt(()=>{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]),xt(()=>{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 Wn=function(){return Wn=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},Wn.apply(this,arguments)};function Z1(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=Wn({async:!0,ssr:!1},e),t}var Q1=function(e){var t=e.sideCar,n=Z1(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,Wn({},n))};Q1.isSideCarExport=!0;function g5(e,t){return e.useMedium(t),Q1}var J1=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=Z1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=v,R=d5([n,t]),_=Wn(Wn({},P),o);return m.createElement(m.Fragment,null,g&&m.createElement(M,{sideCar:J1,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),Wn(Wn({},_),{ref:R})):m.createElement(N,Wn({},_,{className:d,ref:R}),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])}},eS=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=eS(),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
10
|
.`.concat(a5,` {
|
|
11
11
|
overflow: hidden `).concat(r,`;
|
|
12
12
|
padding-right: `).concat(c,"px ").concat(r,`;
|
|
@@ -43,20 +43,20 @@ Error generating stack: `+T.message+`
|
|
|
43
43
|
body[`).concat(ai,`] {
|
|
44
44
|
`).concat(l5,": ").concat(c,`px;
|
|
45
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"},tS=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 tS(e,"overflowY")},_5=function(e){return tS(e,"overflowX")},rw=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=nS(e,r);if(o){var i=rS(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]},nS=function(e,t){return e==="v"?I5(t):_5(t)},rS=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=rS(e,c),S=x[0],
|
|
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"},tS=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 tS(e,"overflowY")},_5=function(e){return tS(e,"overflowX")},rw=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=nS(e,r);if(o){var i=rS(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]},nS=function(e,t){return e==="v"?I5(t):_5(t)},rS=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=rS(e,c),S=x[0],w=x[1],E=x[2],b=w-E-i*S;(S||b)&&nS(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
47
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
48
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(eS)[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 b=i5([e.lockRef.current],(e.shards||[]).map(sw),!0).filter(Boolean);return b.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=m.useCallback(function(b,E){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var w=cu(b),N=n.current,k="deltaX"in b?b.deltaX:N[0]-w[0],P="deltaY"in b?b.deltaY:N[1]-w[1],M,R=b.target,_=Math.abs(k)>Math.abs(P)?"h":"v";if("touches"in b&&_==="h"&&R.type==="range")return!1;var $=window.getSelection(),D=$&&$.anchorNode,H=D?D===R||D.contains(R):!1;if(H)return!1;var j=rw(_,R);if(!j)return!0;if(j?M=_:(M=_==="v"?"h":"v",j=rw(_,R)),!j)return!1;if(!r.current&&"changedTouches"in b&&(k||P)&&(r.current=M),!M)return!0;var U=r.current||M;return j5(U,E,b,U==="h"?k:P)},[]),d=m.useCallback(function(b){var E=b;if(!(!Gs.length||Gs[Gs.length-1]!==i)){var w="deltaY"in E?ow(E):cu(E),N=t.current.filter(function(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&O5(M.delta,w)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(l.current.shards||[]).map(sw).filter(Boolean).filter(function(M){return M.contains(E.target)}),P=k.length>0?c(E,k[0]):!l.current.noIsolation;P&&E.cancelable&&E.preventDefault()}}},[]),f=m.useCallback(function(b,E,w,N){var k={name:b,delta:E,target:w,should:N,shadowParent:z5(w)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(P){return P!==k})},1)},[]),g=m.useCallback(function(b){n.current=cu(b),r.current=void 0},[]),h=m.useCallback(function(b){f(b.type,ow(b),b.target,c(b,e.lockRef.current))},[]),v=m.useCallback(function(b){f(b.type,cu(b),b.target,c(b,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(b){return b!==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(J1,F5);var Ad=m.forwardRef(function(e,t){return m.createElement(_d,Wn({},e,{ref:t,sideCar:V5}))});Ad.classNames=_d.classNames;var B5=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,oS=function(e){return e&&(e.host||oS(e.parentNode))},H5=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=oS(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=H5(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",b=(Ys.get(v)||0)+1,E=(i.get(v)||0)+1;Ys.set(v,b),i.set(v,E),l.push(v),b===1&&S&&uu.set(v,!0),E===1&&v.setAttribute(n,"true"),S||v.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",v,w)}})};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=B5(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?Yt(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",[sS,iS]=Lt(Md),[Z5,On]=sS(Md),aS=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]=ln({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})};aS.displayName=Md;var lS="DialogTrigger",cS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(lS,n),i=De(t,o.triggerRef);return p.jsx(Ne.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)})});cS.displayName=lS;var vm="DialogPortal",[Q5,uS]=sS(vm,{forceMount:void 0}),dS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=On(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})}))})};dS.displayName=vm;var Yu="DialogOverlay",fS=m.forwardRef((e,t)=>{const n=uS(Yu,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=On(Yu,e.__scopeDialog);return i.modal?p.jsx(Pt,{present:r||i.open,children:p.jsx(e4,{...o,ref:t})}):null});fS.displayName=Yu;var J5=U5("DialogOverlay.RemoveScroll"),e4=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(Yu,n);return p.jsx(Ad,{as:J5,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(Ne.div,{"data-state":wm(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ts="DialogContent",pS=m.forwardRef((e,t)=>{const n=uS(ts,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=On(ts,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})})});pS.displayName=ts;var t4=m.forwardRef((e,t)=>{const n=On(ts,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(hS,{...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=On(ts,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return p.jsx(hS,{...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()}})}),hS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=e,c=On(ts,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",gS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(xm,n);return p.jsx(Ne.h2,{id:o.titleId,...r,ref:t})});gS.displayName=xm;var mS="DialogDescription",yS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(mS,n);return p.jsx(Ne.p,{id:o.descriptionId,...r,ref:t})});yS.displayName=mS;var vS="DialogClose",xS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=On(vS,n);return p.jsx(Ne.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});xS.displayName=vS;function wm(e){return e?"open":"closed"}var wS="DialogTitleWarning",[r4,bS]=N3(wS,{contentName:ts,titleName:xm,docsSlug:"dialog"}),o4=({titleId:e})=>{const t=bS(wS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
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(eS)[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],M,R=w.target,_=Math.abs(k)>Math.abs(P)?"h":"v";if("touches"in w&&_==="h"&&R.type==="range")return!1;var $=window.getSelection(),D=$&&$.anchorNode,H=D?D===R||D.contains(R):!1;if(H)return!1;var j=rw(_,R);if(!j)return!0;if(j?M=_:(M=_==="v"?"h":"v",j=rw(_,R)),!j)return!1;if(!r.current&&"changedTouches"in w&&(k||P)&&(r.current=M),!M)return!0;var U=r.current||M;return j5(U,E,w,U==="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(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&O5(M.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(M){return M.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(J1,F5);var Ad=m.forwardRef(function(e,t){return m.createElement(_d,Wn({},e,{ref:t,sideCar:V5}))});Ad.classNames=_d.classNames;var B5=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,oS=function(e){return e&&(e.host||oS(e.parentNode))},H5=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=oS(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=H5(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=B5(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?Yt(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",[sS,iS]=Lt(Md),[Z5,jn]=sS(Md),aS=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]=ln({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})};aS.displayName=Md;var lS="DialogTrigger",cS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(lS,n),i=De(t,o.triggerRef);return p.jsx(Ne.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)})});cS.displayName=lS;var vm="DialogPortal",[Q5,uS]=sS(vm,{forceMount:void 0}),dS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=jn(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})}))})};dS.displayName=vm;var Yu="DialogOverlay",fS=m.forwardRef((e,t)=>{const n=uS(Yu,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=jn(Yu,e.__scopeDialog);return i.modal?p.jsx(Pt,{present:r||i.open,children:p.jsx(e4,{...o,ref:t})}):null});fS.displayName=Yu;var J5=U5("DialogOverlay.RemoveScroll"),e4=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(Yu,n);return p.jsx(Ad,{as:J5,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(Ne.div,{"data-state":wm(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ts="DialogContent",pS=m.forwardRef((e,t)=>{const n=uS(ts,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=jn(ts,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})})});pS.displayName=ts;var t4=m.forwardRef((e,t)=>{const n=jn(ts,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(hS,{...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=jn(ts,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return p.jsx(hS,{...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()}})}),hS=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=e,c=jn(ts,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",gS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(xm,n);return p.jsx(Ne.h2,{id:o.titleId,...r,ref:t})});gS.displayName=xm;var mS="DialogDescription",yS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(mS,n);return p.jsx(Ne.p,{id:o.descriptionId,...r,ref:t})});yS.displayName=mS;var vS="DialogClose",xS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(vS,n);return p.jsx(Ne.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});xS.displayName=vS;function wm(e){return e?"open":"closed"}var wS="DialogTitleWarning",[r4,bS]=N3(wS,{contentName:ts,titleName:xm,docsSlug:"dialog"}),o4=({titleId:e})=>{const t=bS(wS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
50
50
|
|
|
51
51
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
52
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 {${bS(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=aS,a4=cS,Sm=dS,Dd=fS,jd=pS,Cm=gS,Em=yS,Nm=xS;const SS=bm,l4=Sm,CS=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}));CS.displayName=Dd.displayName;const km=m.forwardRef(({className:e,children:t,variant:n="surface",...r},o)=>p.jsxs(l4,{children:[p.jsx(CS,{}),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 ES=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ES.displayName="DialogHeader";const NS=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});NS.displayName="DialogFooter";const kS=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}));kS.displayName=Cm.displayName;const TS=m.forwardRef(({className:e,...t},n)=>p.jsx(Em,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));TS.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(SS,{open:e,onOpenChange:t,children:p.jsxs(km,{className:"max-w-lg max-h-[80vh] flex flex-col",children:[p.jsxs(ES,{children:[p.jsxs(kS,{className:"flex items-center gap-2",children:[l?p.jsx(go,{className:"w-5 h-5 text-destructive"}):p.jsx(Pd,{className:"w-5 h-5 text-warning"}),i("validationIssues")]}),p.jsx(TS,{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(NS,{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(uo,{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(uo,{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(go,{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,Xo=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 PS({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",...b}){const E=m.useContext(Od);if(E===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:w,expandPanel:N,getPanelSize:k,getPanelStyle:P,groupId:M,isPanelCollapsed:R,reevaluatePanelConstraints:_,registerPanel:$,resizePanel:D,unregisterPanel:H}=E,j=Pm(l),U=m.useRef({callbacks:{onCollapse:f,onExpand:g,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:c,minSize:d},id:j,idIsFromProps:l!==void 0,order:v});m.useRef({didLogMissingDefaultSizeWarning:!1}),Xo(()=>{const{callbacks:I,constraints:B}=U.current,A={...B};U.current.id=j,U.current.idIsFromProps=l!==void 0,U.current.order=v,I.onCollapse=f,I.onExpand=g,I.onResize=h,B.collapsedSize=n,B.collapsible=r,B.defaultSize=o,B.maxSize=c,B.minSize=d,(A.collapsedSize!==B.collapsedSize||A.collapsible!==B.collapsible||A.maxSize!==B.maxSize||A.minSize!==B.minSize)&&_(U.current,A)}),Xo(()=>{const I=U.current;return $(I),()=>{H(I)}},[v,j,$,H]),m.useImperativeHandle(i,()=>({collapse:()=>{w(U.current)},expand:I=>{N(U.current,I)},getId(){return j},getSize(){return k(U.current)},isCollapsed(){return R(U.current)},isExpanded(){return!R(U.current)},resize:I=>{D(U.current,I)}}),[w,N,k,R,j,D]);const G=P(U.current,o);return m.createElement(S,{...b,children:e,className:t,id:j,style:{...G,...x},[dt.groupId]:M,[dt.panel]:"",[dt.panelCollapsible]:r||void 0,[dt.panelId]:j,[dt.panelSize]:parseFloat(""+G.flexGrow).toFixed(1)})}const RS=m.forwardRef((e,t)=>m.createElement(PS,{...e,forwardedRef:t}));PS.displayName="Panel";RS.displayName="forwardRef(Panel)";let Ng=null,Du=-1,so=null;function f4(e,t){if(t){const n=(t&DS)!==0,r=(t&jS)!==0,o=(t&OS)!==0,i=(t&$S)!==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(){so!==null&&(document.head.removeChild(so),Ng=null,so=null,Du=-1)}function Lh(e,t){var n,r;const o=f4(e,t);if(Ng!==o){if(Ng=o,so===null&&(so=document.createElement("style"),document.head.appendChild(so)),Du>=0){var i;(i=so.sheet)===null||i===void 0||i.removeRule(Du)}Du=(n=(r=so.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function IS(e){return e.type==="keydown"}function _S(e){return e.type.startsWith("pointer")}function AS(e){return e.type.startsWith("mouse")}function $d(e){if(_S(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(AS(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;Fe(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=MS(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(Fe(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=MS(e);return t}function MS(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const DS=1,jS=2,OS=4,$S=8,w4=h4()==="coarse";let An=[],li=!1,Uo=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=Uo.get(l))!==null&&i!==void 0?i:0;return Uo.set(l,d+1),rl.add(c),Xu(),function(){var g;Ld.delete(e),rl.delete(c);const h=(g=Uo.get(l))!==null&&g!==void 0?g:1;if(Uo.set(l,h-1),Xu(),h===1&&Uo.delete(l),An.includes(c)){const v=An.indexOf(c);v>=0&&An.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(),An.length>0&&(qu("down",e),e.preventDefault(),LS(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(),An.length>0&&e.preventDefault()}function zh(e){const{target:t}=e,{x:n,y:r}=$d(e);Ld.clear(),li=!1,An.length>0&&(e.preventDefault(),LS(t)||e.stopImmediatePropagation()),qu("up",e),Rm({target:t,x:n,y:r}),Im(),Xu()}function LS(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}){An.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,b=!1;for(;S&&!S.contains(i);){if(g4(S.getBoundingClientRect(),c)){b=!0;break}S=S.parentElement}if(b)return}An.push(o)}})}function Vh(e,t){Ld.set(e,t)}function Im(){let e=!1,t=!1;An.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 Bh=new AbortController;function Xu(){Bh.abort(),Bh=new AbortController;const e={capture:!0,signal:Bh.signal};rl.size&&(li?(An.length>0&&Uo.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)):Uo.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=An.includes(n);r(e,o,t)})}function C4(){const[e,t]=m.useState(0);return m.useCallback(()=>t(n=>n+1),[])}function Fe(e,t){if(!e)throw console.error(t),Error(t)}function ns(e,t,n=Tm){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function hr(e,t,n=Tm){return ns(e,t,n)===0}function tn(e,t,n){return ns(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(!tn(o,i,n))return!1}return!0}function ni({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Fe(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:l=100,minSize:c=0}=r;if(ns(n,c)<0)if(i){const d=(o+c)/2;ns(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(tn(e,0))return t;const l=[...t],[c,d]=r;Fe(c!=null,"Invalid first pivot index"),Fe(d!=null,"Invalid second pivot index");let f=0;if(i==="keyboard"){{const h=e<0?d:c,v=n[h];Fe(v,`Panel constraints not found for index ${h}`);const{collapsedSize:x=0,collapsible:S,minSize:b=0}=v;if(S){const E=t[h];if(Fe(E!=null,`Previous layout not found for panel index ${h}`),tn(E,x)){const w=b-E;ns(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}{const h=e<0?c:d,v=n[h];Fe(v,`No panel constraints found for index ${h}`);const{collapsedSize:x=0,collapsible:S,minSize:b=0}=v;if(S){const E=t[h];if(Fe(E!=null,`Previous layout not found for panel index ${h}`),tn(E,b)){const w=E-x;ns(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}}{const h=e<0?1:-1;let v=e<0?d:c,x=0;for(;;){const b=t[v];Fe(b!=null,`Previous layout not found for panel index ${v}`);const w=ni({panelConstraints:n,panelIndex:v,size:100})-b;if(x+=w,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];Fe(S!=null,`Previous layout not found for panel index ${v}`);const b=S-x,E=ni({panelConstraints:n,panelIndex:v,size:b});if(!tn(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];Fe(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,!tn(S,x)){let b=x-S,w=e<0?d:c;for(;w>=0&&w<n.length;){const N=l[w];Fe(N!=null,`Previous layout not found for panel index ${w}`);const k=N+b,P=ni({panelConstraints:n,panelIndex:w,size:k});if(tn(N,P)||(b-=P-N,l[w]=P),tn(b,0))break;e>0?w--:w++}}}const g=l.reduce((h,v)=>v+h,0);return tn(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];Fe(c!=null,"No pivot index found"),t.forEach((h,v)=>{const{constraints:x}=h,{maxSize:S=100,minSize:b=0}=x;v===c?(r=b,o=S):(i+=b,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 FS(e,t,n=document){const o=ol(e,n).findIndex(i=>i.getAttribute(dt.resizeHandleId)===t);return o??null}function zS(e,t,n){const r=FS(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function VS(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}),Xo(()=>{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];Fe(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;Fe(c,"Eager values not found");const{panelDataArray:d}=c,f=VS(n,i);Fe(f!=null,`No group found for id "${n}"`);const g=ol(n,i);Fe(g,`No resize handles found for group id "${n}"`);const h=g.map(v=>{const x=v.getAttribute(dt.resizeHandleId);Fe(x,"Resize handle element has no handle id attribute");const[S,b]=k4(n,x,d,i);if(S==null||b==null)return()=>{};const E=w=>{if(!w.defaultPrevented)switch(w.key){case"Enter":{w.preventDefault();const N=d.findIndex(k=>k.id===S);if(N>=0){const k=d[N];Fe(k,`No panel data found for index ${N}`);const P=r[N],{collapsedSize:M=0,collapsible:R,minSize:_=0}=k.constraints;if(P!=null&&R){const $=za({delta:tn(P,M)?_-M:M-P,initialLayout:r,panelConstraints:d.map(D=>D.constraints),pivotIndices:zS(n,x,i),prevLayout:r,trigger:"keyboard"});r!==$&&l($)}}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 BS(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);Fe(l,`No resize handle element found for id "${t}"`);const c=l.getAttribute(dt.groupId);Fe(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=r;const f=BS(n,e),g=VS(c,o);Fe(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(IS(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];Fe(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];Fe(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];Fe(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||hr(h,f))&&!hr(r,f)&&x(),v&&(h==null||!hr(h,f))&&hr(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 WS(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 US(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=US(e,n))!==null&&r!==void 0?r:{},l=WS(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=WS(t),d=(i=US(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(!tn(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const l=n[i];Fe(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];Fe(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(!tn(o,0))for(let i=0;i<t.length;i++){const l=n[i];Fe(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,tn(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 KS({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,b]=m.useState(null),[E,w]=m.useState([]),N=C4(),k=m.useRef({}),P=m.useRef(new Map),M=m.useRef(0),R=m.useRef({autoSaveId:e,direction:r,dragState:S,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),_=m.useRef({layout:E,panelDataArray:[],panelDataArrayChanged:!1});m.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),m.useImperativeHandle(o,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:X}=_.current;return X},setLayout:X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=_.current,Z=fw({layout:X,panelConstraints:ne.map(K=>K.constraints)});uw(te,Z)||(w(Z),_.current.layout=Z,Q&&Q(Z),Xs(ne,Z,k.current))}}),[]),Xo(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=S,R.current.id=v,R.current.onLayout=l,R.current.storage=d}),T4({committedValuesRef:R,eagerValuesRef:_,groupId:v,layout:E,panelDataArray:_.current.panelDataArray,setLayout:w,panelGroupElement:x.current}),m.useEffect(()=>{const{panelDataArray:X}=_.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 te=[...X],ne=new Map(P.current);Q(e,te,ne,E,d)}},[e,E,d]),m.useEffect(()=>{});const $=m.useCallback(X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=_.current;if(X.constraints.collapsible){const Z=ne.map(me=>me.constraints),{collapsedSize:K=0,panelSize:re,pivotIndices:ce}=Bo(ne,X,te);if(Fe(re!=null,`Panel size not found for panel "${X.id}"`),!hr(re,K)){P.current.set(X.id,re);const ge=Js(ne,X)===ne.length-1?re-K:K-re,pe=za({delta:ge,initialLayout:te,panelConstraints:Z,pivotIndices:ce,prevLayout:te,trigger:"imperative-api"});pu(te,pe)||(w(pe),_.current.layout=pe,Q&&Q(pe),Xs(ne,pe,k.current))}}},[]),D=m.useCallback((X,Q)=>{const{onLayout:te}=R.current,{layout:ne,panelDataArray:Z}=_.current;if(X.constraints.collapsible){const K=Z.map(Re=>Re.constraints),{collapsedSize:re=0,panelSize:ce=0,minSize:me=0,pivotIndices:ge}=Bo(Z,X,ne),pe=Q??me;if(hr(ce,re)){const Re=P.current.get(X.id),Le=Re!=null&&Re>=pe?Re:pe,le=Js(Z,X)===Z.length-1?ce-Le:Le-ce,we=za({delta:le,initialLayout:ne,panelConstraints:K,pivotIndices:ge,prevLayout:ne,trigger:"imperative-api"});pu(ne,we)||(w(we),_.current.layout=we,te&&te(we),Xs(Z,we,k.current))}}},[]),H=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{panelSize:ne}=Bo(te,X,Q);return Fe(ne!=null,`Panel size not found for panel "${X.id}"`),ne},[]),j=m.useCallback((X,Q)=>{const{panelDataArray:te}=_.current,ne=Js(te,X);return _4({defaultSize:Q,dragState:S,layout:E,panelData:te,panelIndex:ne})},[S,E]),U=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Bo(te,X,Q);return Fe(K!=null,`Panel size not found for panel "${X.id}"`),Z===!0&&hr(K,ne)},[]),G=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Bo(te,X,Q);return Fe(K!=null,`Panel size not found for panel "${X.id}"`),!Z||ns(K,ne)>0},[]),I=m.useCallback(X=>{const{panelDataArray:Q}=_.current;Q.push(X),Q.sort((te,ne)=>{const Z=te.order,K=ne.order;return Z==null&&K==null?0:Z==null?-1:K==null?1:Z-K}),_.current.panelDataArrayChanged=!0,N()},[N]);Xo(()=>{if(_.current.panelDataArrayChanged){_.current.panelDataArrayChanged=!1;const{autoSaveId:X,onLayout:Q,storage:te}=R.current,{layout:ne,panelDataArray:Z}=_.current;let K=null;if(X){const ce=M4(X,Z,te);ce&&(P.current=new Map(Object.entries(ce.expandToSizes)),K=ce.layout)}K==null&&(K=I4({panelDataArray:Z}));const re=fw({layout:K,panelConstraints:Z.map(ce=>ce.constraints)});uw(ne,re)||(w(re),_.current.layout=re,Q&&Q(re),Xs(Z,re,k.current))}}),Xo(()=>{const X=_.current;return()=>{X.layout=[]}},[]);const B=m.useCallback(X=>{let Q=!1;const te=x.current;return te&&window.getComputedStyle(te,null).getPropertyValue("direction")==="rtl"&&(Q=!0),function(Z){Z.preventDefault();const K=x.current;if(!K)return()=>null;const{direction:re,dragState:ce,id:me,keyboardResizeBy:ge,onLayout:pe}=R.current,{layout:Re,panelDataArray:Le}=_.current,{initialLayout:ze}=ce??{},le=zS(me,X,K);let we=R4(Z,X,re,ce,ge,K);const Oe=re==="horizontal";Oe&&Q&&(we=-we);const ot=Le.map(Ke=>Ke.constraints),Je=za({delta:we,initialLayout:ze??Re,panelConstraints:ot,pivotIndices:le,prevLayout:Re,trigger:IS(Z)?"keyboard":"mouse-or-touch"}),Ct=!pu(Re,Je);(_S(Z)||AS(Z))&&M.current!=we&&(M.current=we,!Ct&&we!==0?Oe?Vh(X,we<0?DS:jS):Vh(X,we<0?OS:$S):Vh(X,0)),Ct&&(w(Je),_.current.layout=Je,pe&&pe(Je),Xs(Le,Je,k.current))}},[]),A=m.useCallback((X,Q)=>{const{onLayout:te}=R.current,{layout:ne,panelDataArray:Z}=_.current,K=Z.map(Re=>Re.constraints),{panelSize:re,pivotIndices:ce}=Bo(Z,X,ne);Fe(re!=null,`Panel size not found for panel "${X.id}"`);const ge=Js(Z,X)===Z.length-1?re-Q:Q-re,pe=za({delta:ge,initialLayout:ne,panelConstraints:K,pivotIndices:ce,prevLayout:ne,trigger:"imperative-api"});pu(ne,pe)||(w(pe),_.current.layout=pe,te&&te(pe),Xs(Z,pe,k.current))},[]),V=m.useCallback((X,Q)=>{const{layout:te,panelDataArray:ne}=_.current,{collapsedSize:Z=0,collapsible:K}=Q,{collapsedSize:re=0,collapsible:ce,maxSize:me=100,minSize:ge=0}=X.constraints,{panelSize:pe}=Bo(ne,X,te);pe!=null&&(K&&ce&&hr(pe,Z)?hr(Z,re)||A(X,re):pe<ge?A(X,ge):pe>me&&A(X,me))},[A]),F=m.useCallback((X,Q)=>{const{direction:te}=R.current,{layout:ne}=_.current;if(!x.current)return;const Z=Fd(X,x.current);Fe(Z,`Drag handle element not found for id "${X}"`);const K=BS(te,Q);b({dragHandleId:X,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:K,initialLayout:ne})},[]),W=m.useCallback(()=>{b(null)},[]),q=m.useCallback(X=>{const{panelDataArray:Q}=_.current,te=Js(Q,X);te>=0&&(Q.splice(te,1),delete k.current[X.id],_.current.panelDataArrayChanged=!0,N())},[N]),L=m.useMemo(()=>({collapsePanel:$,direction:r,dragState:S,expandPanel:D,getPanelSize:H,getPanelStyle:j,groupId:v,isPanelCollapsed:U,isPanelExpanded:G,reevaluatePanelConstraints:V,registerPanel:I,registerResizeHandle:B,resizePanel:A,startDragging:F,stopDragging:W,unregisterPanel:q,panelGroupElement:x.current}),[$,S,r,D,H,j,v,U,G,V,I,B,A,F,W,q]),z={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return m.createElement(Od.Provider,{value:L},m.createElement(g,{...h,children:t,className:n,id:i,ref:x,style:{...z,...f},[dt.group]:"",[dt.groupDirection]:r,[dt.groupId]:v}))}const GS=m.forwardRef((e,t)=>m.createElement(KS,{...e,forwardedRef:t}));KS.displayName="PanelGroup";GS.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);Fe(c,`No group element found for id "${c}"`);const d=ol(c,r),f=FS(c,t,r);Fe(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 YS({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 b,E;const w=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:M,registerResizeHandle:R,startDragging:_,stopDragging:$,panelGroupElement:D}=k,H=Pm(o),[j,U]=m.useState("inactive"),[G,I]=m.useState(!1),[B,A]=m.useState(null),V=m.useRef({state:j});Xo(()=>{V.current.state=j}),m.useEffect(()=>{if(n)A(null);else{const L=R(H);A(()=>L)}},[n,H,R]);const F=(b=r?.coarse)!==null&&b!==void 0?b:15,W=(E=r?.fine)!==null&&E!==void 0?E:5;m.useEffect(()=>{if(n||B==null)return;const L=w.current;Fe(L,"Element ref not attached");let z=!1;return b4(H,L,P,{coarse:F,fine:W},(Q,te,ne)=>{if(!te){U("inactive");return}switch(Q){case"down":{U("drag"),z=!1,Fe(ne,'Expected event to be defined for "down" action'),_(H,ne);const{onDragging:Z,onPointerDown:K}=N.current;Z?.(!0),K?.();break}case"move":{const{state:Z}=V.current;z=!0,Z!=="drag"&&U("hover"),Fe(ne,'Expected event to be defined for "move" action'),B(ne);break}case"up":{U("hover"),$();const{onClick:Z,onDragging:K,onPointerUp:re}=N.current;K?.(!1),re?.(),z||Z?.();break}}})},[F,P,n,W,R,H,B,_,$]),O4({disabled:n,handleId:H,resizeHandler:B,panelGroupElement:D});const q={touchAction:"none",userSelect:"none"};return m.createElement(x,{...S,children:e,className:t,id:o,onBlur:()=>{I(!1),i?.()},onFocus:()=>{I(!0),d?.()},ref:w,role:"separator",style:{...q,...h},tabIndex:v,[dt.groupDirection]:P,[dt.groupId]:M,[dt.resizeHandle]:"",[dt.resizeHandleActive]:j==="drag"?"pointer":G?"keyboard":void 0,[dt.resizeHandleEnabled]:!n,[dt.resizeHandleId]:H,[dt.resizeHandleState]:j})}YS.displayName="PanelResizeHandle";const $4=({className:e,...t})=>p.jsx(GS,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),hw=RS,L4=({withHandle:e,className:t,...n})=>p.jsx(YS,{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",[XS]=Lt(_m),[V4,vn]=XS(_m),qS=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),[b,E]=m.useState(null),[w,N]=m.useState(0),[k,P]=m.useState(0),[M,R]=m.useState(!1),[_,$]=m.useState(!1),D=De(t,j=>d(j)),H=Nl(o);return p.jsx(V4,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:c,viewport:f,onViewportChange:g,content:h,onContentChange:v,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:M,onScrollbarXEnabledChange:R,scrollbarY:b,onScrollbarYChange:E,scrollbarYEnabled:_,onScrollbarYEnabledChange:$,onCornerWidthChange:N,onCornerHeightChange:P,children:p.jsx(Ne.div,{dir:H,...l,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});qS.displayName=_m;var ZS="ScrollAreaViewport",QS=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,l=vn(ZS,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(Ne.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})})]})});QS.displayName=ZS;var Qn="ScrollAreaScrollbar",Am=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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(B4,{...r,ref:t,forceMount:n}):o.type==="scroll"?p.jsx(H4,{...r,ref:t,forceMount:n}):o.type==="auto"?p.jsx(JS,{...r,ref:t,forceMount:n}):o.type==="always"?p.jsx(Mm,{...r,ref:t}):null});Am.displayName=Qn;var B4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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(JS,{"data-state":i?"visible":"hidden",...r,ref:t})})}),H4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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"))})})}),JS=m.forwardRef((e,t)=>{const n=vn(Qn,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=vn(Qn,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=oC(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=vn(Qn,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(tC,{"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),iC(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=vn(Qn,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(tC,{"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),iC(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,eC]=XS(Qn),tC=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=vn(Qn,n),[S,b]=m.useState(null),E=De(t,D=>b(D)),w=m.useRef(null),N=m.useRef(""),k=x.viewport,P=r.content-r.viewport,M=pt(g),R=pt(d),_=Vd(h,10);function $(D){if(w.current){const H=D.clientX-w.current.left,j=D.clientY-w.current.top;f({x:H,y:j})}}return m.useEffect(()=>{const D=H=>{const j=H.target;S?.contains(j)&&M(H,P)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[k,S,P,M]),m.useEffect(R,[r,R]),pi(S,_),pi(x.content,_),p.jsx(K4,{scope:n,scrollbar:S,hasThumb:o,onThumbChange:pt(i),onThumbPointerUp:pt(l),onThumbPositionChange:R,onThumbPointerDown:pt(c),children:p.jsx(Ne.div,{...v,ref:E,style:{position:"absolute",...v.style},onPointerDown:ve(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),w.current=S.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),$(D))}),onPointerMove:ve(e.onPointerMove,$),onPointerUp:ve(e.onPointerUp,D=>{const H=D.target;H.hasPointerCapture(D.pointerId)&&H.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),w.current=null})})})}),Zu="ScrollAreaThumb",nC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=eC(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=vn(Zu,n),l=eC(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(Ne.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,b=h.clientY-x.top;l.onThumbPointerDown({x:S,y:b})}),onPointerUp:ve(e.onPointerUp,l.onThumbPointerUp)})});nC.displayName=Zu;var Dm="ScrollAreaCorner",rC=m.forwardRef((e,t)=>{const n=vn(Dm,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(Y4,{...e,ref:t}):null});rC.displayName=Dm;var Y4=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=vn(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(Ne.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 oC(e,t){const n=e/t;return isNaN(n)?0:n}function zd(e){const t=oC(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 sC([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 sC([0,l],[0,c])(f)}function sC(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 iC(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);xt(()=>{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 aC=qS,Z4=QS,Q4=rC;const Di=m.forwardRef(({className:e,children:t,viewportRef:n,viewportClassName:r,type:o="hover",...i},l)=>p.jsxs(aC,{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=aC.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(nC,{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"],fo=Math.min,nn=Math.max,Ju=Math.round,hu=Math.floor,Gn=e=>({x:e,y:e}),eV={left:"right",right:"left",bottom:"top",top:"bottom"};function Pg(e,t,n){return nn(e,fo(t,n))}function Sr(e,t){return typeof e=="function"?e(t):e}function Cr(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 Kn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $m(e){return jm(Kn(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(Cr(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=Cr(e);return eV[t]+e.slice(t.length)}function aV(e){return{top:0,right:0,bottom:0,left:0,...e}}function lC(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=Kn(t),l=$m(t),c=Om(l),d=Cr(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}=Sr(t,e),S=lC(x),E=c[v?h==="floating"?"reference":"floating":h],w=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},M=td(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:k,strategy:d}):N);return{top:(w.top-M.top+S.top)/P.y,bottom:(M.bottom-w.bottom+S.bottom)/P.y,left:(w.left-M.left+S.left)/P.x,right:(M.right-w.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 b=0;b<i.length;b++){const E=i[b];if(!E)continue;const{name:w,fn:N}=E,{x:k,y:P,data:M,reset:R}=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[w]={...S[w],...M},R&&x<cV&&(x++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(f=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:g,y:h}=vw(f,v,d)),b=-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}=Sr(e,t)||{};if(f==null)return{};const h=lC(g),v={x:n,y:r},x=$m(o),S=Om(x),b=await l.getDimensions(f),E=x==="y",w=E?"top":"left",N=E?"bottom":"right",k=E?"clientHeight":"clientWidth",P=i.reference[S]+i.reference[x]-v[x]-i.floating[S],M=v[x]-i.reference[x],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let _=R?R[k]:0;(!_||!await(l.isElement==null?void 0:l.isElement(R)))&&(_=c.floating[k]||i.floating[S]);const $=P/2-M/2,D=_/2-b[S]/2-1,H=fo(h[w],D),j=fo(h[N],D),U=H,G=_-b[S]-j,I=_/2-b[S]/2+$,B=Pg(U,I,G),A=!d.arrow&&ji(o)!=null&&I!==B&&i.reference[S]/2-(I<U?H:j)-b[S]/2<0,V=A?I<U?I-U:I-G:0;return{[x]:v[x]+V,data:{[x]:B,centerOffset:I-B-V,...A&&{alignmentOffset:V}},reset:A}}}),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:b=!0,...E}=Sr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Cr(o),N=Kn(c),k=Cr(c)===c,P=await(d.isRTL==null?void 0:d.isRTL(f.floating)),M=v||(k||!b?[ed(c)]:nV(c)),R=S!=="none";!v&&R&&M.push(...iV(c,b,S,P));const _=[c,...M],$=await d.detectOverflow(t,E),D=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(g&&D.push($[w]),h){const I=tV(o,l,P);D.push($[I[0]],$[I[1]])}if(H=[...H,{placement:o,overflows:D}],!D.every(I=>I<=0)){var j,U;const I=(((j=i.flip)==null?void 0:j.index)||0)+1,B=_[I];if(B&&(!(h==="alignment"?N!==Kn(B):!1)||H.every(F=>Kn(F.placement)===N?F.overflows[0]>0:!0)))return{data:{index:I,overflows:H},reset:{placement:B}};let A=(U=H.filter(V=>V.overflows[0]<=0).sort((V,F)=>V.overflows[1]-F.overflows[1])[0])==null?void 0:U.placement;if(!A)switch(x){case"bestFit":{var G;const V=(G=H.filter(F=>{if(R){const W=Kn(F.placement);return W===N||W==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(W=>W>0).reduce((W,q)=>W+q,0)]).sort((F,W)=>F[1]-W[1])[0])==null?void 0:G[0];V&&(A=V);break}case"initialPlacement":A=c;break}if(o!==A)return{reset:{placement:A}}}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}=Sr(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{}}}}},cC=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=Cr(n),c=ji(n),d=Kn(n)==="y",f=cC.has(l)?-1:1,g=i&&d?-1:1,h=Sr(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:w=>{let{x:N,y:k}=w;return{x:N,y:k}}},...f}=Sr(e,t),g={x:n,y:r},h=await i.detectOverflow(t,f),v=Kn(Cr(o)),x=jm(v);let S=g[x],b=g[v];if(l){const w=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=S+h[w],P=S-h[N];S=Pg(k,S,P)}if(c){const w=v==="y"?"top":"left",N=v==="y"?"bottom":"right",k=b+h[w],P=b-h[N];b=Pg(k,b,P)}const E=d.fn({...t,[x]:S,[v]:b});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}=Sr(e,t),g={x:n,y:r},h=Kn(o),v=jm(h);let x=g[v],S=g[h];const b=Sr(c,t),E=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const k=v==="y"?"height":"width",P=i.reference[v]-i.floating[k]+E.mainAxis,M=i.reference[v]+i.reference[k]-E.mainAxis;x<P?x=P:x>M&&(x=M)}if(f){var w,N;const k=v==="y"?"width":"height",P=cC.has(Cr(o)),M=i.reference[h]-i.floating[k]+(P&&((w=l.offset)==null?void 0:w[h])||0)+(P?0:E.crossAxis),R=i.reference[h]+i.reference[k]+(P?0:((N=l.offset)==null?void 0:N[h])||0)-(P?E.crossAxis:0);S<M?S=M:S>R&&(S=R)}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}=Sr(e,t),g=await l.detectOverflow(t,f),h=Cr(o),v=ji(o),x=Kn(o)==="y",{width:S,height:b}=i.floating;let E,w;h==="top"||h==="bottom"?(E=h,w=v===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(w=h,E=v==="end"?"top":"bottom");const N=b-g.top-g.bottom,k=S-g.left-g.right,P=fo(b-g[E],N),M=fo(S-g[w],k),R=!t.middlewareData.shift;let _=P,$=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=N),R&&!v){const H=nn(g.left,0),j=nn(g.right,0),U=nn(g.top,0),G=nn(g.bottom,0);x?$=S-2*(H!==0||j!==0?H+j:nn(g.left,g.right)):_=b-2*(U!==0||G!==0?U+G:nn(g.top,g.bottom))}await d({...t,availableWidth:$,availableHeight:_});const D=await l.getDimensions(c.floating);return S!==D.width||b!==D.height?{reset:{rects:!0}}:{}}}};function Bd(){return typeof window<"u"}function Oi(e){return uC(e)?(e.nodeName||"").toLowerCase():"#document"}function on(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Jn(e){var t;return(t=(uC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uC(e){return Bd()?e instanceof Node||e instanceof on(e).Node:!1}function Dn(e){return Bd()?e instanceof Element||e instanceof on(e).Element:!1}function Tr(e){return Bd()?e instanceof HTMLElement||e instanceof on(e).HTMLElement:!1}function bw(e){return!Bd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof on(e).ShadowRoot}function kl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=jn(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 Hd(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/,Ho=e=>!!e&&e!=="none";let Hh;function Lm(e){const t=Dn(e)?jn(e):e;return Ho(t.transform)||Ho(t.translate)||Ho(t.scale)||Ho(t.rotate)||Ho(t.perspective)||!Fm()&&(Ho(t.backdropFilter)||Ho(t.filter))||wV.test(t.willChange||"")||bV.test(t.contain||"")}function SV(e){let t=po(e);for(;Tr(t)&&!hi(t);){if(Lm(t))return t;if(Hd(t))return null;t=po(t)}return null}function Fm(){return Hh==null&&(Hh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hh}function hi(e){return/^(html|body|#document)$/.test(Oi(e))}function jn(e){return on(e).getComputedStyle(e)}function Wd(e){return Dn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function po(e){if(Oi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bw(e)&&e.host||Jn(e);return bw(t)?t.host:t}function dC(e){const t=po(e);return hi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tr(t)&&kl(t)?t:dC(t)}function sl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=dC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=on(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 fC(e){const t=jn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Tr(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 Dn(e)?e:e.contextElement}function ci(e){const t=zm(e);if(!Tr(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fC(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=Gn(0);function pC(e){const t=on(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!==on(e)?!1:t}function rs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zm(e);let l=Gn(1);t&&(r?Dn(r)&&(l=ci(r)):l=ci(e));const c=EV(i,n,r)?pC(i):Gn(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=on(i),x=r&&Dn(r)?on(r):r;let S=v,b=Ig(S);for(;b&&r&&x!==S;){const E=ci(b),w=b.getBoundingClientRect(),N=jn(b),k=w.left+(b.clientLeft+parseFloat(N.paddingLeft))*E.x,P=w.top+(b.clientTop+parseFloat(N.paddingTop))*E.y;d*=E.x,f*=E.y,g*=E.x,h*=E.y,d+=k,f+=P,S=on(b),b=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:rs(Jn(e)).left+n}function hC(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=Jn(r),c=t?Hd(t.floating):!1;if(r===l||c&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Gn(1);const g=Gn(0),h=Tr(r);if((h||!h&&!i)&&((Oi(r)!=="body"||kl(l))&&(d=Wd(r)),h)){const x=rs(r);f=ci(r),g.x=x.x+r.clientLeft,g.y=x.y+r.clientTop}const v=l&&!h&&!i?hC(l,d):Gn(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=Jn(e),n=Wd(e),r=e.ownerDocument.body,o=nn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ud(e);const c=-n.scrollTop;return jn(r).direction==="rtl"&&(l+=nn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}const Sw=25;function PV(e,t){const n=on(e),r=Jn(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=rs(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Tr(e)?ci(e):Gn(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(Jn(e));else if(Dn(t))r=RV(t,n);else{const o=pC(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return td(r)}function gC(e,t){const n=po(e);return n===t||!Dn(n)||hi(n)?!1:jn(n).position==="fixed"||gC(n,t)}function IV(e,t){const n=t.get(e);if(n)return n;let r=sl(e,[],!1).filter(c=>Dn(c)&&Oi(c)!=="body"),o=null;const i=jn(e).position==="fixed";let l=i?po(e):e;for(;Dn(l)&&!hi(l);){const c=jn(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&&gC(e,l))?r=r.filter(g=>g!==l):o=c,l=po(l)}return t.set(e,r),r}function _V(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?Hd(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=nn(x.top,d),f=fo(x.right,f),g=fo(x.bottom,g),h=nn(x.left,h)}return{width:f-h,height:g-d,x:h,y:d}}function AV(e){const{width:t,height:n}=fC(e);return{width:t,height:n}}function MV(e,t,n){const r=Tr(t),o=Jn(t),i=n==="fixed",l=rs(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Gn(0);function f(){d.x=Ud(o)}if(r||!r&&!i)if((Oi(t)!=="body"||kl(o))&&(c=Wd(t)),r){const x=rs(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?hC(o,c):Gn(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 jn(e).position==="static"}function Ew(e,t){if(!Tr(e)||jn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Jn(e)===n&&(n=n.ownerDocument.body),n}function mC(e,t){const n=on(e);if(Hd(e))return n;if(!Tr(e)){let o=po(e);for(;o&&!hi(o);){if(Dn(o)&&!Wh(o))return o;o=po(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||mC,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 jn(e).direction==="rtl"}const OV={convertOffsetParentRelativeRectToViewportRelativeRect:NV,getDocumentElement:Jn,getClippingRect:_V,getOffsetParent:mC,getElementRects:DV,getClientRects:kV,getDimensions:AV,getScale:ci,isElement:Dn,isRTL:jV};function yC(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=Jn(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),b=hu(o.clientWidth-(g+v)),E=hu(o.clientHeight-(h+x)),w=hu(g),k={rootMargin:-S+"px "+-b+"px "+-E+"px "+-w+"px",threshold:nn(0,fo(1,d))||1};let P=!0;function M(R){const _=R[0].intersectionRatio;if(_!==d){if(!P)return l();_?l(!1,_):r=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!yC(f,e.getBoundingClientRect())&&l(),P=!1}try{n=new IntersectionObserver(M,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,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(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const h=f&&c?$V(f,n):null;let v=-1,x=null;l&&(x=new ResizeObserver(w=>{let[N]=w;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,b=d?rs(e):null;d&&E();function E(){const w=rs(e);b&&!yC(b,w)&&n(),b=w,S=requestAnimationFrame(E)}return n(),()=>{var w;g.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h?.(),(w=x)==null||w.disconnect(),x=null,d&&cancelAnimationFrame(S)}}const FV=gV,zV=mV,VV=fV,BV=vV,HV=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 vC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kw(e,t){const n=vC(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,b]=m.useState(null),[E,w]=m.useState(null),N=m.useCallback(F=>{F!==R.current&&(R.current=F,b(F))},[]),k=m.useCallback(F=>{F!==_.current&&(_.current=F,w(F))},[]),P=i||S,M=l||E,R=m.useRef(null),_=m.useRef(null),$=m.useRef(g),D=d!=null,H=Uh(d),j=Uh(o),U=Uh(f),G=m.useCallback(()=>{if(!R.current||!_.current)return;const F={placement:t,strategy:n,middleware:v};j.current&&(F.platform=j.current),UV(R.current,_.current,F).then(W=>{const q={...W,isPositioned:U.current!==!1};I.current&&!nd($.current,q)&&($.current=q,ps.flushSync(()=>{h(q)}))})},[v,t,n,j,U]);ju(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[f]);const I=m.useRef(!1);ju(()=>(I.current=!0,()=>{I.current=!1}),[]),ju(()=>{if(P&&(R.current=P),M&&(_.current=M),P&&M){if(H.current)return H.current(P,M,G);G()}},[P,M,G,H,D]);const B=m.useMemo(()=>({reference:R,floating:_,setReference:N,setFloating:k}),[N,k]),A=m.useMemo(()=>({reference:P,floating:M}),[P,M]),V=m.useMemo(()=>{const F={position:n,left:0,top:0};if(!A.floating)return F;const W=kw(A.floating,g.x),q=kw(A.floating,g.y);return c?{...F,transform:"translate("+W+"px, "+q+"px)",...vC(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:q}},[n,c,A.floating,g.x,g.y]);return m.useMemo(()=>({...g,update:G,refs:B,elements:A,floatingStyles:V}),[g,G,B,A,V])}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]}},eB=(e,t)=>{const n=BV(e);return{name:n.name,fn:n.fn,options:[e,t]}},tB=(e,t)=>{const n=HV(e);return{name:n.name,fn:n.fn,options:[e,t]}},nB=(e,t)=>{const n=XV(e);return{name:n.name,fn:n.fn,options:[e,t]}};var rB="Arrow",xC=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(Ne.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"})})});xC.displayName=rB;var oB=xC;function Vm(e){const[t,n]=m.useState(void 0);return xt(()=>{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 Bm="Popper",[wC,$i]=Lt(Bm),[sB,bC]=wC(Bm),SC=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return p.jsx(sB,{scope:t,anchor:r,onAnchorChange:o,children:n})};SC.displayName=Bm;var CC="PopperAnchor",EC=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=bC(CC,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(Ne.div,{...o,ref:c})});EC.displayName=CC;var Hm="PopperContent",[iB,aB]=wC(Hm),NC=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,...b}=e,E=bC(Hm,n),[w,N]=m.useState(null),k=De(t,Z=>N(Z)),[P,M]=m.useState(null),R=Vm(P),_=R?.width??0,$=R?.height??0,D=r+(i!=="center"?"-"+i:""),H=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},j=Array.isArray(f)?f:[f],U=j.length>0,G={padding:H,boundary:j.filter(cB),altBoundary:U},{refs:I,floatingStyles:B,placement:A,isPositioned:V,middlewareData:F}=YV({strategy:"fixed",placement:D,whileElementsMounted:(...Z)=>LV(...Z,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[qV({mainAxis:o+$,alignmentAxis:l}),d&&ZV({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?QV():void 0,...G}),d&&JV({...G}),eB({...G,apply:({elements:Z,rects:K,availableWidth:re,availableHeight:ce})=>{const{width:me,height:ge}=K.reference,pe=Z.floating.style;pe.setProperty("--radix-popper-available-width",`${re}px`),pe.setProperty("--radix-popper-available-height",`${ce}px`),pe.setProperty("--radix-popper-anchor-width",`${me}px`),pe.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),P&&nB({element:P,padding:c}),uB({arrowWidth:_,arrowHeight:$}),v&&tB({strategy:"referenceHidden",...G})]}),[W,q]=PC(A),L=pt(S);xt(()=>{V&&L?.()},[V,L]);const z=F.arrow?.x,X=F.arrow?.y,Q=F.arrow?.centerOffset!==0,[te,ne]=m.useState();return xt(()=>{w&&ne(window.getComputedStyle(w).zIndex)},[w]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(iB,{scope:n,placedSide:W,onArrowChange:M,arrowX:z,arrowY:X,shouldHideArrow:Q,children:p.jsx(Ne.div,{"data-side":W,"data-align":q,...b,ref:k,style:{...b.style,animation:V?void 0:"none"}})})})});NC.displayName=Hm;var kC="PopperArrow",lB={top:"bottom",right:"left",bottom:"top",left:"right"},TC=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=aB(kC,r),l=lB[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(oB,{...o,ref:n,style:{...o.style,display:"block"}})})});TC.displayName=kC;function cB(e){return e!==null}var uB=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]=PC(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="",b="";return f==="bottom"?(S=l?h:`${v}px`,b=`${-d}px`):f==="top"?(S=l?h:`${v}px`,b=`${r.floating.height+d}px`):f==="right"?(S=`${-d}px`,b=l?h:`${x}px`):f==="left"&&(S=`${r.floating.width+d}px`,b=l?h:`${x}px`),{data:{x:S,y:b}}}});function PC(e){const[t,n="center"]=e.split("-");return[t,n]}var Wm=SC,Um=EC,Km=NC,Gm=TC,dB=Symbol("radix.slottable");function fB(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=dB,t}var RC=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"}),pB="VisuallyHidden",Kd=m.forwardRef((e,t)=>p.jsx(Ne.span,{...e,ref:t,style:{...RC,...e.style}}));Kd.displayName=pB;var hB=Kd,[Gd]=Lt("Tooltip",[$i]),Yd=$i(),IC="TooltipProvider",gB=700,_g="tooltip.open",[mB,Ym]=Gd(IC),_C=e=>{const{__scopeTooltip:t,delayDuration:n=gB,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(mB,{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})};_C.displayName=IC;var il="Tooltip",[yB,Tl]=Gd(il),AC=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,b=c??d.delayDuration,E=m.useRef(!1),[w,N]=ln({prop:r,defaultProp:o??!1,onChange:_=>{_?(d.onOpen(),document.dispatchEvent(new CustomEvent(_g))):d.onClose(),i?.(_)},caller:il}),k=m.useMemo(()=>w?E.current?"delayed-open":"instant-open":"closed",[w]),P=m.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,N(!0)},[N]),M=m.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),R=m.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,N(!0),x.current=0},b)},[b,N]);return m.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),p.jsx(Wm,{...f,children:p.jsx(yB,{scope:t,contentId:v,open:w,stateAttribute:k,trigger:g,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{d.isOpenDelayedRef.current?R():P()},[d.isOpenDelayedRef,R,P]),onTriggerLeave:m.useCallback(()=>{S?M():(window.clearTimeout(x.current),x.current=0)},[M,S]),onOpen:P,onClose:M,disableHoverableContent:S,children:n})})};AC.displayName=il;var Ag="TooltipTrigger",MC=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(Ne.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)})})});MC.displayName=Ag;var Xm="TooltipPortal",[vB,xB]=Gd(Xm,{forceMount:void 0}),DC=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Tl(Xm,t);return p.jsx(vB,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(Mi,{asChild:!0,container:o,children:r})})})};DC.displayName=Xm;var gi="TooltipContent",jC=m.forwardRef((e,t)=>{const n=xB(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(OC,{side:o,...i,ref:t}):p.jsx(wB,{side:o,...i,ref:t})})}),wB=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,b)=>{const E=S.currentTarget,w={x:S.clientX,y:S.clientY},N=NB(w,E.getBoundingClientRect()),k=kB(w,N),P=TB(b.getBoundingClientRect()),M=RB([...k,...P]);c(M),h(!0)},[h]);return m.useEffect(()=>()=>v(),[v]),m.useEffect(()=>{if(d&&g){const S=E=>x(E,g),b=E=>x(E,d);return d.addEventListener("pointerleave",S),g.addEventListener("pointerleave",b),()=>{d.removeEventListener("pointerleave",S),g.removeEventListener("pointerleave",b)}}},[d,g,x,v]),m.useEffect(()=>{if(l){const S=b=>{const E=b.target,w={x:b.clientX,y:b.clientY},N=d?.contains(E)||g?.contains(E),k=!PB(w,l);N?v():k&&(v(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[d,g,l,f,v]),p.jsx(OC,{...e,ref:i})}),[bB,SB]=Gd(il,{isInside:!1}),CB=fB("TooltipContent"),OC=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(CB,{children:r}),p.jsx(bB,{scope:n,isInside:!0,children:p.jsx(hB,{id:d.contentId,role:"tooltip",children:o||r})})]})})});jC.displayName=gi;var $C="TooltipArrow",EB=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Yd(n);return SB($C,n).isInside?null:p.jsx(Gm,{...o,...r,ref:t})});EB.displayName=$C;function NB(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 kB(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 TB(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 PB(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 RB(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),IB(t)}function IB(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 _B=_C,AB=AC,MB=MC,DB=DC,LC=jC;const FC=_B,al=AB,ll=MB,mi=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(DB,{children:p.jsx(LC,{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=LC.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},jB=(e=>e?Tw(e):Tw),OB=e=>e;function $B(e,t=OB){const n=qe.useSyncExternalStore(e.subscribe,qe.useCallback(()=>t(e.getState()),[e,t]),qe.useCallback(()=>t(e.getInitialState()),[e,t]));return qe.useDebugValue(n),n}const Pw=e=>{const t=jB(e),n=r=>$B(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}})})),LB=(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}))}})},ao=1,qa=1,FB=[];function zB(e){const t=new Map;for(const n of e){if(!Number.isInteger(n.from)||n.from<qa||n.from>=ao)throw new Error(`[migration] from must be an integer in [${qa}, ${ao}), 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<ao;n++)if(!t.has(n))throw new Error(`[migration] missing migration from ${n} -> ${n+1}`);return t}const VB=zB(FB);function BB(e){const t=e.schemaVersion;return typeof t=="number"&&Number.isInteger(t)&&t>=qa?t:qa}function HB(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=BB(t);if(n>ao)throw new Error(`[migration] schemaVersion ${n} is newer than this build supports (${ao})`);for(let r=n;r<ao;r++)t=VB.get(r).migrate(t);return t.schemaVersion=ao,t}const WB=new Set(E1);function UB(e){const t=e.canvases[He];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:ao,nodes:n,edges:r,functions:i,declaredVariables:o,channels:l,memory:c,models:d}}function KB(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[He]={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)),b=h.edges.map(O0);t[x.id]={nodes:S,edges:b,variables:Rw(S,x.arguments,h.declaredVariables??[])}}const d={};for(const h of e.channels??[]){if(!WB.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 GB(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 YB=50,Mg=new Set;function Zd(){Mg.forEach(e=>e())}function _w(e){return Mg.add(e),()=>Mg.delete(e)}const vr=new Map;vr.set(He,qm());function qm(){const e=Xd(LB({limit:YB,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 vr.get(e)}function Qe(e){if(!vr.has(e)){const t=qm();if(e!==He){const n=an(),r={id:n,type:xe.Trigger,position:{x:100,y:100},data:{id:n,type:"OnFunctionCall",arguments:{}}};t.getState().initialize([r],[])}vr.set(e,t)}return vr.get(e)}function Qm(){const e={};return vr.forEach((t,n)=>{e[n]=t}),e}function XB(e){e!==He&&(vr.delete(e),Zd())}function Aw(){vr.clear(),vr.set(He,qm()),Zd()}const ja={kind:"none"};function qs(e){Zm(e)?.getState().setRFselect([],[])}const ue=Xd((e,t)=>({activeCanvasId:He,builderMode:{type:"edit"},selection:ja,activeSidebarTab:"nodes",channels:{},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}),Qe(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,gr.t.bind(gr))}const ey=()=>{const e=$t.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 $t.getByType(l.type)},[n]),o=m.useCallback(l=>{const c=$t.getByCategory(l);return l===xe.Function?[...c,...n]:c},[n]),i=m.useCallback(()=>{const l=$t.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}},qB=({canvasId:e,onSelectNode:t,onSelectEdge:n})=>{const{t:r}=Xe(),{getNodeDefinition:o}=ey(),i=Ye(h=>h.byNodeId),l=Ye(h=>h.byEdgeId),c=Qe(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,b=x?.data?.label||S?.label||h;g.push({entityId:h,entityType:"node",label:b,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(M=>M.id===h),S=x?d.find(M=>M.id===x.source):void 0,b=x?d.find(M=>M.id===x.target):void 0,E=S?o(S.data):void 0,w=b?o(b.data):void 0,N=S?.data?.label||E?.label||"?",k=b?.data?.label||w?.label||"?",P=`${N} → ${k}`;g.push({entityId:h,entityType:"edge",label:P,diagnostics:v,errorCount:v.filter(M=>M.severity==="error").length,warningCount:v.filter(M=>M.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 b=h.entityType==="node"?0:1,E=v.entityType==="node"?0:1;return b!==E?b-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(D1,{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(ZB,{group:h,onSelect:()=>h.entityType==="node"?t(h.entityId):n(h.entityId)},`${h.entityType}-${h.entityId}`))})};function ZB({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(uo,{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(uo,{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(go,{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 os=m.forwardRef(({icon:e=es,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]}));os.displayName="AddButton";function xn(e){return e.type!=="edit"}function Jd({items:e,selectedId:t,onSelect:n,diagnosticsSlot:r,badge:o,emptyIcon:i,emptyText:l,emptyHint:c,addActions:d}){const f=ue(h=>xn(h.builderMode)),g=p.jsx("div",{className:"flex flex-col gap-1.5",children:d.map(({label:h,icon:v,onAdd:x})=>p.jsx(os,{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(go,{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 QB=({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:L1,emptyText:n("noFunctions"),emptyHint:n("addFunctionHint"),addActions:[{label:n("addFunction"),icon:es,onAdd:()=>t()}]})};var ef="Collapsible",[JB]=Lt(ef),[eH,ty]=JB(ef),zC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...c}=e,[d,f]=ln({prop:r,defaultProp:o??!1,onChange:l,caller:ef});return p.jsx(eH,{scope:n,disabled:i,contentId:kt(),open:d,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),children:p.jsx(Ne.div,{"data-state":ry(d),"data-disabled":i?"":void 0,...c,ref:t})})});zC.displayName=ef;var VC="CollapsibleTrigger",BC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ty(VC,n);return p.jsx(Ne.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)})});BC.displayName=VC;var ny="CollapsibleContent",HC=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(tH,{...r,ref:t,present:i})})});HC.displayName=ny;var tH=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,b=l.open||c,E=m.useRef(b),w=m.useRef(void 0);return m.useEffect(()=>{const N=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(N)},[]),xt(()=>{const N=f.current;if(N){w.current=w.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=w.current.transitionDuration,N.style.animationName=w.current.animationName),d(r)}},[l.open,r]),p.jsx(Ne.div,{"data-state":ry(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!b,...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:b&&o})});function ry(e){return e?"open":"closed"}var nH=zC;const rH=nH,oH=BC,sH=HC,iH=mo("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(iH({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},aH={[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 lH(e,t,n){return n.description?e(`${t}.params.${n.id}.description`,{defaultValue:n.description}):""}function cH(e,t,n){return e(`edges.${n}.description`,{defaultValue:t.description})}const uH=e=>{switch(e){case"string":return B0;case"number":case"int":case"float":return Cz;case"boolean":case"bool":return Mz;case"dropdown":case"selection":return Ii;default:return B0}},dH=(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}},fH=({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=uH(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(uo,{variant:"secondary",className:"text-xs",children:t("optional")}):p.jsx(uo,{variant:"destructive",className:"text-xs",children:t("required")})]}),p.jsxs("div",{className:"text-xs text-muted-foreground pl-5",children:[t("typeLabel")," ",dH(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)})]}),pH=({onAddNode:e,nodeDefinitions:t,getAllCategories:n,functions:r,isFunctionCanvas:o})=>{const{t:i}=Xe(),l=ue(w=>xn(w.builderMode)),[c,d]=m.useState(""),[f,g]=m.useState(new Set),h=c.toLowerCase(),v=t.filter(w=>!w.isUnremovable&&!(o&&w.category===xe.Trigger)&&(w.label.toLowerCase().includes(h)||w.category.toLowerCase().includes(h)||(w.tags??[]).some(N=>N.toLowerCase().includes(h)))),x=new Set(v.map(w=>w.category)),S=w=>{const N=new Set(f);N.has(w)?N.delete(w):N.add(w),g(N)},b=w=>c.trim()&&x.has(w)?!0:f.has(w),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($1,{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:w=>d(w.target.value),className:"pl-10 h-9 rounded-lg"})]}),p.jsx(Di,{className:"flex-1 mt-3",children:p.jsx(FC,{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(w=>{const N=v.filter(R=>R.category===w);if(N.length===0)return null;const k=b(w),P=oy[w],M=aH[w]??"bg-muted text-muted-foreground border-border";return p.jsxs(rH,{open:k,onOpenChange:()=>S(w),children:[p.jsxs(oH,{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:w}),p.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:N.length})]}),p.jsx(sH,{children:p.jsx("div",{className:"grid grid-cols-2 gap-1.5 px-1 pt-1.5 pb-2",children:N.map(R=>{const _=R.parameters,$=`${R.type}-${"functionInfo"in R?R.functionInfo.id:""}`,D=_.length>0,H=WC(i,R),j=R.tags?.[0],U=p.jsxs("button",{type:"button",draggable:!l,onDragStart:l?void 0:I=>{const B={nodeDef:R};I.dataTransfer.setData("application/json",JSON.stringify(B)),I.dataTransfer.effectAllowed="copy"},onClick:l?void 0:()=>e(R),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 ${M}`,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:R.label}),j&&p.jsx(uo,{variant:"secondary",className:"absolute top-1 right-1 text-[9px] h-3.5 px-1 font-normal leading-none",children:j})]});return H||D?p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:U}),p.jsx(mi,{side:"right",className:"max-w-sm pointer-events-none",children:p.jsxs("div",{className:"space-y-2",children:[H&&p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:H}),D&&p.jsx(fH,{parameters:_,t:i})]})})]},$):p.jsx(qe.Fragment,{children:U},$)})})})]},w)})]})})})]})};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&&!kr(r,t,!1)||"default"in r&&r.default!==void 0&&(n[r.id]=r.default));return n}function hH(e="GPIOIN"){const t=an(),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 gH(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 mH=()=>{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:j1,emptyText:e("noChannels"),emptyHint:e("noChannelsHint"),addActions:[{label:e("addChannel"),icon:es,onAdd:()=>r(hH("GPIOIN").id)}]})},yH={MemoryFile:"memory",VectorDatabase:"vectordb"};function vH(e){const t=an(),n=Object.values(ue.getState().memory).map(o=>o.label),r={id:t,label:yi(yH[e],n),type:e,arguments:UC(Nd.getByType(e)?.parameters??[])};return ue.getState().setMemory(o=>({...o,[t]:r})),r}function Mw(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 xH(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 wH={MemoryFile:"File",VectorDatabase:"Vector"},bH=()=>{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(vH(l).id);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="memory"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:l=>wH[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:O1,onAdd:()=>i("MemoryFile")},{label:e("addVectorDatabase","Add Vector Database"),icon:bg,onAdd:()=>i("VectorDatabase")}]})},SH={LLMModel:"model"};function CH(e){const t=an(),n=Object.values(ue.getState().models).map(o=>o.label),r={id:t,label:yi(SH[e],n),type:e,arguments:UC(kd.getByType(e)?.parameters??[])};return ue.getState().setModels(o=>({...o,[t]:r})),r}function Dw(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 EH(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 NH=()=>{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:A1,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:es,onAdd:()=>r(CH("LLMModel").id)}]})},Li=(e=He)=>{const t=Qe(e),n=t(o=>o.variables),r=t(o=>o.edges);return m.useMemo(()=>dm(n,r),[n,r])};function kH(e){let t=1;for(;e.includes(`var${t}`);)t++;return`var${t}`}function TH(e){const t=Qe(e);t.takeCheckpoint();const n=Object.values(t.getState().variables).filter(i=>i.kind==="declared").map(i=>i.name),r=an(),o={kind:"declared",uid:r,name:kH(n),dataType:"int"};return t.getState().setVariables(i=>({...i,[Pi(r)]:o})),r}function Ba(e,t,n){const r=Qe(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 PH(e,t,n){Ba(e,t,{dataType:n,initialValue:void 0})}function RH(e,t){const n=Qe(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 IH=({canvasId:e,onSelectNode:t})=>{const n=ue(w=>xn(w.builderMode)),{t:r}=Xe(),{list:o}=Li(e),i=ue(w=>w.selection),l=ue(w=>w.selectVariable),d=Qe(e)(w=>w.variables),f=e===He,g=qe.useMemo(()=>{const w=[];for(const N of Object.values(d))N.kind==="declared"&&w.push({uid:N.uid,var:N});return w},[d]),h=()=>{const w=TH(e);l(w)},v=o.filter(w=>w.kind==="fnarg"),x=o.filter(w=>w.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(os,{onClick:h,children:r("addVariable")})})]});const b=(w,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:w.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:w.dataType})]})},w.kind==="node"?`${w.nodeId}-${w.outputId}`:w.kind==="declared"?`declared-${w.uid}`:`fnarg-${w.uid}`)},E=({title:w})=>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:w})});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(w=>b(w))})]}),x.length>0&&p.jsxs("div",{children:[p.jsx(E,{title:r("nodeOutputVariables")}),p.jsx("div",{className:"space-y-1.5",children:x.map(w=>b(w,w.kind==="node"?()=>t(w.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:w,var:N})=>b(N,n?void 0:()=>l(w),i.kind==="variable"&&i.uid===w)),!n&&p.jsx(os,{onClick:h,children:r("addVariable")})]})]})]})};var _H=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AH=_H.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}},{}),MH="Label",GC=m.forwardRef((e,t)=>p.jsx(AH.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=MH;var YC=GC;const DH=mo("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(DH(),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",[jH]=Lt(tf),[OH,$H]=jH(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)),b=m.useRef(!1),E=v?g||!!v.closest("form"):!0,[w,N]=ln({prop:o,defaultProp:i??!1,onChange:f,caller:tf});return p.jsxs(OH,{scope:n,checked:w,disabled:c,children:[p.jsx(Ne.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":JC(w),"data-disabled":c?"":void 0,disabled:c,value:d,...h,ref:S,onClick:ve(e.onClick,k=>{N(P=>!P),E&&(b.current=k.isPropagationStopped(),b.current||k.stopPropagation())})}),E&&p.jsx(QC,{control:v,bubbles:!b.current,name:r,value:d,checked:w,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=$H(qC,n);return p.jsx(Ne.span,{"data-state":JC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});ZC.displayName=qC;var LH="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=LH;function JC(e){return e?"checked":"unchecked"}var eE=XC,FH=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(FH,{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 ss=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 zH(){const e=Qe(He).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 VH=()=>{const{t:e}=Xe(),t=ss(o=>o.context),n=ss(o=>o.updateContextVar),r=zH();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)})})},BH=({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:j1,label:x("channels")},{id:"memory",icon:bg,label:x("memoryFiles","Memory")},{id:"models",icon:A1,label:x("models","AI Models")},{id:"functions",icon:mz,label:x("functions")},{id:"diagnostics",icon:go,label:x("diagnostics")}],[x]),b=m.useMemo(()=>[{id:"debug-context",icon:vz,label:x("debug.context")}],[x]),E=Ye(I=>{let B=0;for(const A of Object.values(I.byNodeId))for(const V of A)V.severity==="error"&&B++;for(const A of Object.values(I.byEdgeId))for(const V of A)V.severity==="error"&&B++;return B}),w=Ye(I=>{let B=0;for(const A of Object.values(I.byNodeId))for(const V of A)V.severity==="warning"&&B++;for(const A of Object.values(I.byEdgeId))for(const V of A)V.severity==="warning"&&B++;return B}),N=Ye(I=>{let B=0;for(const A of Object.values(I.byChannelId))for(const V of A)V.severity==="error"&&B++;return B}),k=Ye(I=>{let B=0;for(const A of Object.values(I.byChannelId))for(const V of A)V.severity==="warning"&&B++;return B}),P=Ye(I=>{let B=0;for(const A of Object.values(I.byMemoryId))for(const V of A)V.severity==="error"&&B++;return B}),M=Ye(I=>{let B=0;for(const A of Object.values(I.byMemoryId))for(const V of A)V.severity==="warning"&&B++;return B}),R=Ye(I=>{let B=0;for(const A of Object.values(I.byModelId))for(const V of A)V.severity==="error"&&B++;return B}),_=Ye(I=>{let B=0;for(const A of Object.values(I.byModelId))for(const V of A)V.severity==="warning"&&B++;return B}),$=Ye(I=>{let B=0;for(const A of Object.values(I.byFunctionId))for(const V of A)V.severity==="error"&&B++;return B}),D=Ye(I=>{let B=0;for(const A of Object.values(I.byFunctionId))for(const V of A)V.severity==="warning"&&B++;return B}),H=m.useMemo(()=>v?b:S,[v,b,S]),j=I=>{n(t===I?null:I)},U=()=>{switch(t){case"nodes":return p.jsx(pH,{onAddNode:r,nodeDefinitions:o,getAllCategories:i,functions:f,isFunctionCanvas:!!d});case"variables":return p.jsx(IH,{canvasId:e,onSelectNode:l});case"channels":return p.jsx(mH,{});case"memory":return p.jsx(bH,{});case"models":return p.jsx(NH,{});case"functions":return p.jsx(QB,{onOpenFunction:g,onCreateFunction:h});case"diagnostics":return p.jsx(qB,{canvasId:e,onSelectNode:l,onSelectEdge:c});case"debug-context":return p.jsx(VH,{});default:return null}},G=I=>H.find(A=>A.id===I)?.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:H.map(I=>{const B=I.icon,A=t===I.id;let V=0,F=0;I.id==="diagnostics"?(V=E,F=w):I.id==="channels"?(V=N,F=k):I.id==="memory"?(V=P,F=M):I.id==="models"?(V=R,F=_):I.id==="functions"&&(V=$,F=D);const W=V+F,q=W>0,L=q&&!A?V>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:z=>{z.detail!==0&&z.currentTarget.blur(),j(I.id)},className:Ce("w-10 h-10 transition-all duration-200 relative",A?"bg-accent text-primary shadow-sm":L??"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:[p.jsx(B,{className:"w-5 h-5"}),q&&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",V>0?"bg-destructive text-destructive-foreground":"bg-warning text-warning-foreground"),children:W})]})}),p.jsx(mi,{side:"right",sideOffset:8,children:I.label})]},I.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:U()})]})})]})},HH=({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 b=l.current;if(!b)return;const E=w=>{w.deltaY!==0&&(b.scrollWidth<=b.clientWidth||(w.preventDefault(),b.scrollLeft+=w.deltaY))};return b.addEventListener("wheel",E,{passive:!1}),()=>b.removeEventListener("wheel",E)},[]);const[d,f]=m.useState(null),[g,h]=m.useState(null),v=b=>e[b]?.id===He,x=m.useCallback(()=>{c.current=null,f(null),h(null)},[]),S=m.useCallback((b,E)=>{if(c.current===null||!i.current||e[E]?.id===He)return;b.preventDefault(),b.stopPropagation(),b.dataTransfer.dropEffect="move";const w=b.currentTarget.getBoundingClientRect(),N=i.current.getBoundingClientRect(),k=w.left+w.width/2,P=b.clientX<k,M=P?E:E+1,R=P?w.left-N.left:w.right-N.left,_=Math.round(Math.max(0,Math.min(R,i.current.clientWidth-2)));f(M),h(_)},[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:b=>{c.current===null||!i.current||(b.preventDefault(),b.dataTransfer.dropEffect="move")},onDrop:b=>{if(b.preventDefault(),c.current!==null&&d!==null){const E=c.current,w=d>E?d-1:d;w>0&&w!==E&&o(E,w)}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((b,E)=>{const w=!v(E);return p.jsxs(qe.Fragment,{children:[E>0&&p.jsx("div",{className:"w-px bg-border/70 shrink-0"}),p.jsxs("div",{draggable:w,onDragStart:N=>{w&&(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===b.id?"bg-field text-foreground":"text-muted-foreground hover:text-foreground",w?"cursor-grab active:cursor-grabbing":"select-none"),onClick:()=>n(b.id),children:[v(E)?p.jsx(jz,{className:"w-3.5 h-3.5 shrink-0"}):p.jsx(L1,{className:"w-3.5 h-3.5 shrink-0"}),p.jsx("span",{className:"truncate max-w-[120px] py-1",children:b.label}),b.id!==He?p.jsx("button",{type:"button","aria-label":`Close tab ${b.label}`,title:`Close tab ${b.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(b.id)},children:p.jsx(Rd,{className:"w-3.5 h-3.5"})}):p.jsx("span",{className:"w-1 shrink-0"})]})]},b.id)})]})})};function tE(e,t,n){const r=Mn(t);return n.some(o=>o.target===e&&r.input.some(i=>i.type==="tool"&&i.id===o.targetHandle))}function WH(e,t,n){const r=Mn(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){const o=Mn(e).output.find(i=>i.id===t);return!(!o||o.type==="control"&&!$t.getByType(e.type)?.canBranch&&n.some(i=>i.source===e.id&&i.sourceHandle===t)||o.type==="control"&&tE(e.id,e,n))}function UH(e,t,n,r,o,i){const l=n.find(g=>g.id===e);if(!l)return[];const d=Mn(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:Mn({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(l.data,n,i))return!1;const d=Mn(l.data),f=Mn(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"&&WH(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 KH={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 GH(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=GH(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((o=(e=r[i]).type)&&(o=YH(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]=jw(n[o],e.name,t);else if(t==null)for(o in n)n[o]=jw(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 YH(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function jw(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=KH,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 Ow={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)),Ow.hasOwnProperty(t)?{space:Ow[t],local:e}:e}function XH(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 qH(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rE(e){var t=of(e);return(t.local?qH:XH)(t)}function ZH(){}function iy(e){return e==null?ZH:function(){return this.querySelector(e)}}function QH(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 cn(r,this._parents)}function JH(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function e8(){return[]}function oE(e){return e==null?e8:function(){return this.querySelectorAll(e)}}function t8(e){return function(){return JH(e.apply(this,arguments))}}function n8(e){typeof e=="function"?e=t8(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 cn(r,o)}function sE(e){return function(){return this.matches(e)}}function iE(e){return function(t){return t.matches(e)}}var r8=Array.prototype.find;function o8(e){return function(){return r8.call(this.children,e)}}function s8(){return this.firstElementChild}function i8(e){return this.select(e==null?s8:o8(typeof e=="function"?e:iE(e)))}var a8=Array.prototype.filter;function l8(){return Array.from(this.children)}function c8(e){return function(){return a8.call(this.children,e)}}function u8(e){return this.selectAll(e==null?l8:c8(typeof e=="function"?e:iE(e)))}function d8(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 cn(r,this._parents)}function aE(e){return new Array(e.length)}function f8(){return new cn(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 p8(e){return function(){return e}}function h8(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 g8(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 m8(e){return e.__data__}function y8(e,t){if(!arguments.length)return Array.from(this,m8);var n=t?g8:h8,r=this._parents,o=this._groups;typeof e!="function"&&(e=p8(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=v8(e.call(g,g&&g.__data__,f,r)),S=x.length,b=c[f]=new Array(S),E=l[f]=new Array(S),w=d[f]=new Array(v);n(g,h,b,E,w,x,t);for(var N=0,k=0,P,M;N<S;++N)if(P=b[N]){for(N>=k&&(k=N+1);!(M=E[k])&&++k<S;);P._next=M||null}}return l=new cn(l,r),l._enter=c,l._exit=d,l}function v8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function x8(){return new cn(this._exit||this._groups.map(aE),this._parents)}function w8(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 b8(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 cn(c,this._parents)}function S8(){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 C8(e){e||(e=E8);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 cn(o,this._parents).order()}function E8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function N8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function k8(){return Array.from(this)}function T8(){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 P8(){let e=0;for(const t of this)++e;return e}function R8(){return!this.node()}function I8(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 _8(e){return function(){this.removeAttribute(e)}}function A8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M8(e,t){return function(){this.setAttribute(e,t)}}function D8(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function j8(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function O8(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 $8(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?A8:_8:typeof t=="function"?n.local?O8:j8:n.local?D8:M8)(n,t))}function lE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function L8(e){return function(){this.style.removeProperty(e)}}function F8(e,t,n){return function(){this.style.setProperty(e,t,n)}}function z8(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function V8(e,t,n){return arguments.length>1?this.each((t==null?L8:typeof t=="function"?z8:F8)(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 H8(e,t){return function(){this[e]=t}}function W8(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function U8(e,t){return arguments.length>1?this.each((t==null?B8:typeof t=="function"?W8:H8)(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 K8(e){return function(){dE(this,e)}}function G8(e){return function(){fE(this,e)}}function Y8(e,t){return function(){(t.apply(this,arguments)?dE:fE)(this,e)}}function X8(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"?Y8:t?K8:G8)(n,t))}function q8(){this.textContent=""}function Z8(e){return function(){this.textContent=e}}function Q8(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function J8(e){return arguments.length?this.each(e==null?q8:(typeof e=="function"?Q8:Z8)(e)):this.node().textContent}function e6(){this.innerHTML=""}function t6(e){return function(){this.innerHTML=e}}function n6(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function r6(e){return arguments.length?this.each(e==null?e6:(typeof e=="function"?n6:t6)(e)):this.node().innerHTML}function o6(){this.nextSibling&&this.parentNode.appendChild(this)}function s6(){return this.each(o6)}function i6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a6(){return this.each(i6)}function l6(e){var t=typeof e=="function"?e:rE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function c6(){return null}function u6(e,t){var n=typeof e=="function"?e:rE(e),r=t==null?c6:typeof t=="function"?t:iy(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function d6(){var e=this.parentNode;e&&e.removeChild(this)}function f6(){return this.each(d6)}function p6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function h6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function g6(e){return this.select(e?h6:p6)}function m6(e){return arguments.length?this.property("__data__",e):this.node().__data__}function y6(e){return function(t){e.call(this,t,this.__data__)}}function v6(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 x6(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 w6(e,t,n){return function(){var r=this.__on,o,i=y6(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 b6(e,t,n){var r=v6(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?w6:x6,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 S6(e,t){return function(){return pE(this,e,t)}}function C6(e,t){return function(){return pE(this,e,t.apply(this,arguments))}}function E6(e,t){return this.each((typeof t=="function"?C6:S6)(e,t))}function*N6(){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 cn(e,t){this._groups=e,this._parents=t}function Pl(){return new cn([[document.documentElement]],hE)}function k6(){return this}cn.prototype=Pl.prototype={constructor:cn,select:QH,selectAll:n8,selectChild:i8,selectChildren:u8,filter:d8,data:y8,enter:f8,exit:x8,join:w8,merge:b8,selection:k6,order:S8,sort:C8,call:N8,nodes:k8,node:T8,size:P8,empty:R8,each:I8,attr:$8,style:V8,property:U8,classed:X8,text:J8,html:r6,raise:s6,lower:a6,append:l6,insert:u6,remove:f6,clone:g6,datum:m6,on:b6,dispatch:E6,[Symbol.iterator]:N6};function rn(e){return typeof e=="string"?new cn([[document.querySelector(e)]],[document.documentElement]):new cn([[e]],hE)}function T6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Tn(e,t){if(e=T6(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 P6={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=rn(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=rn(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 R6(e){return!e.ctrlKey&&!e.button}function I6(){return this.parentNode}function _6(e,t){return t??{x:e.x,y:e.y}}function A6(){return navigator.maxTouchPoints||"ontouchstart"in this}function yE(){var e=R6,t=I6,n=_6,r=A6,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",w,P6).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(P,M){if(!(g||!e.call(this,P,M))){var R=k(this,t.call(this,P,M),P,M,"mouse");R&&(rn(P.view).on("mousemove.drag",S,cl).on("mouseup.drag",b,cl),gE(P.view),Gh(P),f=!1,c=P.clientX,d=P.clientY,R("start",P))}}function S(P){if(ui(P),!f){var M=P.clientX-c,R=P.clientY-d;f=M*M+R*R>h}o.mouse("drag",P)}function b(P){rn(P.view).on("mousemove.drag mouseup.drag",null),mE(P.view,f),ui(P),o.mouse("end",P)}function E(P,M){if(e.call(this,P,M)){var R=P.changedTouches,_=t.call(this,P,M),$=R.length,D,H;for(D=0;D<$;++D)(H=k(this,_,P,M,R[D].identifier,R[D]))&&(Gh(P),H("start",P,R[D]))}}function w(P){var M=P.changedTouches,R=M.length,_,$;for(_=0;_<R;++_)($=o[M[_].identifier])&&(ui(P),$("drag",P,M[_]))}function N(P){var M=P.changedTouches,R=M.length,_,$;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),_=0;_<R;++_)($=o[M[_].identifier])&&(Gh(P),$("end",P,M[_]))}function k(P,M,R,_,$,D){var H=i.copy(),j=Tn(D||R,M),U,G,I;if((I=n.call(P,new Og("beforestart",{sourceEvent:R,target:v,identifier:$,active:l,x:j[0],y:j[1],dx:0,dy:0,dispatch:H}),_))!=null)return U=I.x-j[0]||0,G=I.y-j[1]||0,function B(A,V,F){var W=j,q;switch(A){case"start":o[$]=B,q=l++;break;case"end":delete o[$],--l;case"drag":j=Tn(F||V,M),q=l;break}H.call(A,P,new Og(A,{sourceEvent:V,subject:I,target:v,identifier:$,active:q,x:j[0]+U,y:j[1]+G,dx:j[0]-W[0],dy:j[1]-W[1],dispatch:H}),_)}}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*",Yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",M6=/^#([0-9a-f]{3,8})$/,D6=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),j6=new RegExp(`^rgb\\(${Yn},${Yn},${Yn}\\)$`),O6=new RegExp(`^rgba\\(${di},${di},${di},${dl}\\)$`),$6=new RegExp(`^rgba\\(${Yn},${Yn},${Yn},${dl}\\)$`),L6=new RegExp(`^hsl\\(${dl},${Yn},${Yn}\\)$`),F6=new RegExp(`^hsla\\(${dl},${Yn},${Yn},${dl}\\)$`),$w={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,is,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lw,formatHex:Lw,formatHex8:z6,formatHsl:V6,formatRgb:Fw,toString:Fw});function Lw(){return this.rgb().formatHex()}function z6(){return this.rgb().formatHex8()}function V6(){return xE(this).formatHsl()}function Fw(){return this.rgb().formatRgb()}function is(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=M6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?zw(t):n===3?new Gt(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=D6.exec(e))?new Gt(t[1],t[2],t[3],1):(t=j6.exec(e))?new Gt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=O6.exec(e))?mu(t[1],t[2],t[3],t[4]):(t=$6.exec(e))?mu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=L6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,1):(t=F6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,t[4]):$w.hasOwnProperty(e)?zw($w[e]):e==="transparent"?new Gt(NaN,NaN,NaN,0):null}function zw(e){return new Gt(e>>16&255,e>>8&255,e&255,1)}function mu(e,t,n,r){return r<=0&&(e=t=n=NaN),new Gt(e,t,n,r)}function B6(e){return e instanceof Rl||(e=is(e)),e?(e=e.rgb(),new Gt(e.r,e.g,e.b,e.opacity)):new Gt}function $g(e,t,n,r){return arguments.length===1?B6(e):new Gt(e,t,n,r??1)}function Gt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ly(Gt,$g,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gt(qo(this.r),qo(this.g),qo(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:Vw,formatHex:Vw,formatHex8:H6,formatRgb:Bw,toString:Bw}));function Vw(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}`}function H6(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}${Ko((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bw(){const e=sd(this.opacity);return`${e===1?"rgb(":"rgba("}${qo(this.r)}, ${qo(this.g)}, ${qo(this.b)}${e===1?")":`, ${e})`}`}function sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ko(e){return e=qo(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 Rn(e,t,n,r)}function xE(e){if(e instanceof Rn)return new Rn(e.h,e.s,e.l,e.opacity);if(e instanceof Rl||(e=is(e)),!e)return new Rn;if(e instanceof Rn)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 Rn(l,c,d,e.opacity)}function W6(e,t,n,r){return arguments.length===1?xE(e):new Rn(e,t,n,r??1)}function Rn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ly(Rn,W6,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new Rn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new Rn(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 Gt(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 Rn(Ww(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("}${Ww(this.h)}, ${yu(this.s)*100}%, ${yu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ww(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 U6(e,t){return function(n){return e+n*t}}function K6(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 G6(e){return(e=+e)==1?wE:function(t,n){return n-t?K6(t,n,e):cy(isNaN(t)?n:t)}}function wE(e,t){var n=t-e;return n?U6(e,n):cy(isNaN(e)?t:e)}const id=(function e(t){var n=G6(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 Y6(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 X6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function q6(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 Z6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Hn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Q6(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 J6(e){return function(){return e}}function eW(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:Hn(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]?eW(d[0].x):J6(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"?Hn:n==="string"?(r=is(t))?(t=r,id):bE:t instanceof is?id:t instanceof Date?Z6:X6(t)?Y6:Array.isArray(t)?q6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Q6:Hn)(e,t)}var Uw=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)*Uw,skewX:Math.atan(d)*Uw,scaleX:l,scaleY:c}}var vu;function tW(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 nW(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 b=x.push("translate(",null,t,null,n);S.push({i:b-4,x:Hn(f,h)},{i:b-2,x:Hn(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:Hn(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:Hn(f,g)}):g&&h.push(o(h)+"skewX("+g+r)}function d(f,g,h,v,x,S){if(f!==h||g!==v){var b=x.push(o(x)+"scale(",null,",",null,")");S.push({i:b-4,x:Hn(f,h)},{i:b-2,x:Hn(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,b=v.length,E;++S<b;)h[(E=v[S]).i]=E.x(x);return h.join("")}}}var rW=CE(tW,"px, ","px)","deg)"),oW=CE(nW,", ",")",")"),sW=1e-12;function Kw(e){return((e=Math.exp(e))+1/e)/2}function iW(e){return((e=Math.exp(e))-1/e)/2}function aW(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,b=x*x+S*S,E,w;if(b<sW)w=Math.log(v/f)/t,E=function(_){return[c+_*x,d+_*S,f*Math.exp(t*_*w)]};else{var N=Math.sqrt(b),k=(v*v-f*f+r*b)/(2*f*n*N),P=(v*v-f*f-r*b)/(2*v*n*N),M=Math.log(Math.sqrt(k*k+1)-k),R=Math.log(Math.sqrt(P*P+1)-P);w=(R-M)/t,E=function(_){var $=_*w,D=Kw(M),H=f/(n*N)*(D*aW(t*$+M)-iW(M));return[c+H*x,d+H*S,f*D/Kw(t*$+M)]}}return E.duration=w*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,Ha=0,Oa=0,EE=1e3,ad,Wa,ld=0,as=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 as||(NE(lW),as=fl.now()+sf)}function lW(){as=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 cW(){uy(),++wi;for(var e=ad,t;e;)(t=as-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wi}function Gw(){as=(ld=fl.now())+sf,wi=Ha=0;try{cW()}finally{wi=0,dW(),as=0}}function uW(){var e=fl.now(),t=e-ld;t>EE&&(sf-=t,ld=e)}function dW(){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){Ha&&(Ha=clearTimeout(Ha));var t=e-as;t>24?(e<1/0&&(Ha=setTimeout(Gw,e-fl.now()-sf)),Oa&&(Oa=clearInterval(Oa))):(Oa||(ld=fl.now(),Oa=setInterval(uW,EE)),wi=1,NE(Gw))}}function Yw(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 fW=rf("start","end","cancel","interrupt"),pW=[],TE=0,Xw=1,Vg=2,Lu=3,qw=4,Bg=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;hW(e,n,{name:t,index:r,group:o,on:fW,tween:pW,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:TE})}function dy(e,t){var n=$n(e,t);if(n.state>TE)throw new Error("too late; already scheduled");return n}function er(e,t){var n=$n(e,t);if(n.state>Lu)throw new Error("too late; already running");return n}function $n(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hW(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=kE(i,0,n.time);function i(f){n.state=Xw,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!==Xw)return d();for(g in r)if(x=r[g],x.name===n.name){if(x.state===Lu)return Yw(l);x.state===qw?(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(Yw(function(){n.state===Lu&&(n.state=qw,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=Bg,1),h=-1,v=o.length;++h<v;)o[h].call(e,g);n.state===Bg&&(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<Bg,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 gW(e){return this.each(function(){zu(this,e)})}function mW(e,t){var n,r;return function(){var o=er(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 yW(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=er(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 vW(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=$n(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?mW:yW)(n,e,t))}function fy(e,t,n){var r=e._id;return e.each(function(){var o=er(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return $n(o,r).value[t]}}function PE(e,t){var n;return(typeof t=="number"?Hn:t instanceof is?id:(n=is(t))?(t=n,id):bE)(e,t)}function xW(e){return function(){this.removeAttribute(e)}}function wW(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bW(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 SW(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 CW(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 EW(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 NW(e,t){var n=of(e),r=n==="transform"?oW:PE;return this.attrTween(e,typeof t=="function"?(n.local?EW:CW)(n,r,fy(this,"attr."+e,t)):t==null?(n.local?wW:xW)(n):(n.local?SW:bW)(n,r,t))}function kW(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function TW(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function PW(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 RW(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&kW(e,i)),n}return o._value=t,o}function IW(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?PW:RW)(r,t))}function _W(e,t){return function(){dy(this,e).delay=+t.apply(this,arguments)}}function AW(e,t){return t=+t,function(){dy(this,e).delay=t}}function MW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_W:AW)(t,e)):$n(this.node(),t).delay}function DW(e,t){return function(){er(this,e).duration=+t.apply(this,arguments)}}function jW(e,t){return t=+t,function(){er(this,e).duration=t}}function OW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?DW:jW)(t,e)):$n(this.node(),t).duration}function $W(e,t){if(typeof t!="function")throw new Error;return function(){er(this,e).ease=t}}function LW(e){var t=this._id;return arguments.length?this.each($W(t,e)):$n(this.node(),t).ease}function FW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;er(this,e).ease=n}}function zW(e){if(typeof e!="function")throw new Error;return this.each(FW(this._id,e))}function VW(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 Er(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 Er(l,this._parents,this._name,this._id)}function HW(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 WW(e,t,n){var r,o,i=HW(t)?dy:er;return function(){var l=i(this,e),c=l.on;c!==r&&(o=(r=c).copy()).on(t,n),l.on=o}}function UW(e,t){var n=this._id;return arguments.length<2?$n(this.node(),n).on.on(e):this.each(WW(n,e,t))}function KW(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function GW(){return this.on("end.remove",KW(this._id))}function YW(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,$n(g,n)));return new Er(i,this._parents,t,n)}function XW(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=$n(g,n),b=0,E=v.length;b<E;++b)(x=v[b])&&af(x,t,n,b,v,S);i.push(v),l.push(g)}return new Er(i,l,t,n)}var qW=Pl.prototype.constructor;function ZW(){return new qW(this._groups,this._parents)}function QW(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 JW(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 eU(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 tU(e,t){var n,r,o,i="style."+t,l="end."+i,c;return function(){var d=er(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 nU(e,t,n){var r=(e+="")=="transform"?rW:PE;return t==null?this.styleTween(e,QW(e,r)).on("end.style."+e,RE(e)):typeof t=="function"?this.styleTween(e,eU(e,r,fy(this,"style."+e,t))).each(tU(this._id,e)):this.styleTween(e,JW(e,r,t),n).on("end.style."+e,null)}function rU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function oU(e,t,n){var r,o;function i(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&rU(e,l,n)),r}return i._value=t,i}function sU(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,oU(e,t,n??""))}function iU(e){return function(){this.textContent=e}}function aU(e){return function(){var t=e(this);this.textContent=t??""}}function lU(e){return this.tween("text",typeof e=="function"?aU(fy(this,"text",e)):iU(e==null?"":e+""))}function cU(e){return function(t){this.textContent=e.call(this,t)}}function uU(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&cU(o)),t}return r._value=e,r}function dU(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,uU(e))}function fU(){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=$n(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 Er(r,this._parents,e,n)}function pU(){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=er(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 hU=0;function Er(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function IE(){return++hU}var pr=Pl.prototype;Er.prototype={constructor:Er,select:YW,selectAll:XW,selectChild:pr.selectChild,selectChildren:pr.selectChildren,filter:VW,merge:BW,selection:ZW,transition:fU,call:pr.call,nodes:pr.nodes,node:pr.node,size:pr.size,empty:pr.empty,each:pr.each,on:UW,attr:NW,attrTween:IW,style:nU,styleTween:sU,text:lU,textTween:dU,remove:GW,tween:vW,delay:MW,duration:OW,ease:LW,easeVarying:zW,end:pU,[Symbol.iterator]:pr[Symbol.iterator]};function gU(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mU={time:null,delay:0,duration:250,ease:gU};function yU(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 vU(e){var t,n;e instanceof Er?(t=e._id,e=e._name):(t=IE(),(n=mU).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||yU(d,t));return new Er(r,this._parents,e,t)}Pl.prototype.interrupt=gW;Pl.prototype.transition=vU;const xu=e=>()=>e;function xU(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 mr(e,t,n){this.k=e,this.x=t,this.y=n}mr.prototype={constructor:mr,scale:function(e){return e===1?this:new mr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new mr(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 mr(1,0,0);_E.prototype=mr.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 wU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bU(){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 Zw(){return this.__zoom||lf}function SU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function CU(){return navigator.maxTouchPoints||"ontouchstart"in this}function EU(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=wU,t=bU,n=EU,r=SU,o=CU,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,b=0,E=10;function w(I){I.property("__zoom",Zw).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",H).filter(o).on("touchstart.zoom",j).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(I,B,A,V){var F=I.selection?I.selection():I;F.property("__zoom",Zw),I!==F?M(I,B,A,V):F.interrupt().each(function(){R(this,arguments).event(V).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},w.scaleBy=function(I,B,A,V){w.scaleTo(I,function(){var F=this.__zoom.k,W=typeof B=="function"?B.apply(this,arguments):B;return F*W},A,V)},w.scaleTo=function(I,B,A,V){w.transform(I,function(){var F=t.apply(this,arguments),W=this.__zoom,q=A==null?P(F):typeof A=="function"?A.apply(this,arguments):A,L=W.invert(q),z=typeof B=="function"?B.apply(this,arguments):B;return n(k(N(W,z),q,L),F,l)},A,V)},w.translateBy=function(I,B,A,V){w.transform(I,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),l)},null,V)},w.translateTo=function(I,B,A,V,F){w.transform(I,function(){var W=t.apply(this,arguments),q=this.__zoom,L=V==null?P(W):typeof V=="function"?V.apply(this,arguments):V;return n(lf.translate(L[0],L[1]).scale(q.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof A=="function"?-A.apply(this,arguments):-A),W,l)},V,F)};function N(I,B){return B=Math.max(i[0],Math.min(i[1],B)),B===I.k?I:new mr(B,I.x,I.y)}function k(I,B,A){var V=B[0]-A[0]*I.k,F=B[1]-A[1]*I.k;return V===I.x&&F===I.y?I:new mr(I.k,V,F)}function P(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function M(I,B,A,V){I.on("start.zoom",function(){R(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(V).end()}).tween("zoom",function(){var F=this,W=arguments,q=R(F,W).event(V),L=t.apply(F,W),z=A==null?P(L):typeof A=="function"?A.apply(F,W):A,X=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),Q=F.__zoom,te=typeof B=="function"?B.apply(F,W):B,ne=d(Q.invert(z).concat(X/Q.k),te.invert(z).concat(X/te.k));return function(Z){if(Z===1)Z=te;else{var K=ne(Z),re=X/K[2];Z=new mr(re,z[0]-K[0]*re,z[1]-K[1]*re)}q.zoom(null,Z)}})}function R(I,B,A){return!A&&I.__zooming||new _(I,B)}function _(I,B){this.that=I,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,B),this.taps=0}_.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,B){return this.mouse&&I!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var B=rn(this.that).datum();f.call(I,this.that,new xU(I,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:f}),B)}};function $(I,...B){if(!e.apply(this,arguments))return;var A=R(this,B).event(I),V=this.__zoom,F=Math.max(i[0],Math.min(i[1],V.k*Math.pow(2,r.apply(this,arguments)))),W=Tn(I);if(A.wheel)(A.mouse[0][0]!==W[0]||A.mouse[0][1]!==W[1])&&(A.mouse[1]=V.invert(A.mouse[0]=W)),clearTimeout(A.wheel);else{if(V.k===F)return;A.mouse=[W,V.invert(W)],zu(this),A.start()}$a(I),A.wheel=setTimeout(q,S),A.zoom("mouse",n(k(N(V,F),A.mouse[0],A.mouse[1]),A.extent,l));function q(){A.wheel=null,A.end()}}function D(I,...B){if(v||!e.apply(this,arguments))return;var A=I.currentTarget,V=R(this,B,!0).event(I),F=rn(I.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",X,!0),W=Tn(I,A),q=I.clientX,L=I.clientY;gE(I.view),qh(I),V.mouse=[W,this.__zoom.invert(W)],zu(this),V.start();function z(Q){if($a(Q),!V.moved){var te=Q.clientX-q,ne=Q.clientY-L;V.moved=te*te+ne*ne>b}V.event(Q).zoom("mouse",n(k(V.that.__zoom,V.mouse[0]=Tn(Q,A),V.mouse[1]),V.extent,l))}function X(Q){F.on("mousemove.zoom mouseup.zoom",null),mE(Q.view,V.moved),$a(Q),V.event(Q).end()}}function H(I,...B){if(e.apply(this,arguments)){var A=this.__zoom,V=Tn(I.changedTouches?I.changedTouches[0]:I,this),F=A.invert(V),W=A.k*(I.shiftKey?.5:2),q=n(k(N(A,W),V,F),t.apply(this,B),l);$a(I),c>0?rn(this).transition().duration(c).call(M,q,V,I):rn(this).call(w.transform,q,V,I)}}function j(I,...B){if(e.apply(this,arguments)){var A=I.touches,V=A.length,F=R(this,B,I.changedTouches.length===V).event(I),W,q,L,z;for(qh(I),q=0;q<V;++q)L=A[q],z=Tn(L,this),z=[z,this.__zoom.invert(z),L.identifier],F.touch0?!F.touch1&&F.touch0[2]!==z[2]&&(F.touch1=z,F.taps=0):(F.touch0=z,W=!0,F.taps=1+!!g);g&&(g=clearTimeout(g)),W&&(F.taps<2&&(h=z[0],g=setTimeout(function(){g=null},x)),zu(this),F.start())}}function U(I,...B){if(this.__zooming){var A=R(this,B).event(I),V=I.changedTouches,F=V.length,W,q,L,z;for($a(I),W=0;W<F;++W)q=V[W],L=Tn(q,this),A.touch0&&A.touch0[2]===q.identifier?A.touch0[0]=L:A.touch1&&A.touch1[2]===q.identifier&&(A.touch1[0]=L);if(q=A.that.__zoom,A.touch1){var X=A.touch0[0],Q=A.touch0[1],te=A.touch1[0],ne=A.touch1[1],Z=(Z=te[0]-X[0])*Z+(Z=te[1]-X[1])*Z,K=(K=ne[0]-Q[0])*K+(K=ne[1]-Q[1])*K;q=N(q,Math.sqrt(Z/K)),L=[(X[0]+te[0])/2,(X[1]+te[1])/2],z=[(Q[0]+ne[0])/2,(Q[1]+ne[1])/2]}else if(A.touch0)L=A.touch0[0],z=A.touch0[1];else return;A.zoom("touch",n(k(q,L,z),A.extent,l))}}function G(I,...B){if(this.__zooming){var A=R(this,B).event(I),V=I.changedTouches,F=V.length,W,q;for(qh(I),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),W=0;W<F;++W)q=V[W],A.touch0&&A.touch0[2]===q.identifier?delete A.touch0:A.touch1&&A.touch1[2]===q.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(q=Tn(q,this),Math.hypot(h[0]-q[0],h[1]-q[1])<E)){var L=rn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return w.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:xu(+I),w):r},w.filter=function(I){return arguments.length?(e=typeof I=="function"?I:xu(!!I),w):e},w.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:xu(!!I),w):o},w.extent=function(I){return arguments.length?(t=typeof I=="function"?I:xu([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),w):t},w.scaleExtent=function(I){return arguments.length?(i[0]=+I[0],i[1]=+I[1],w):[i[0],i[1]]},w.translateExtent=function(I){return arguments.length?(l[0][0]=+I[0][0],l[1][0]=+I[1][0],l[0][1]=+I[0][1],l[1][1]=+I[1][1],w):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},w.constrain=function(I){return arguments.length?(n=I,w):n},w.duration=function(I){return arguments.length?(c=+I,w):c},w.interpolate=function(I){return arguments.length?(d=I,w):d},w.on=function(){var I=f.on.apply(f,arguments);return I===f?w:I},w.clickDistance=function(I){return arguments.length?(b=(I=+I)*I,w):Math.sqrt(b)},w.tapDistance=function(I){return arguments.length?(E=+I,w):E},w}const Zn={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 Zo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Zo||(Zo={}));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 io;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(io||(io={}));var ud;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ud||(ud={}));var Se;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Se||(Se={}));const Qw={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top};function OE(e){return e===null?null:e?"valid":"invalid"}const $E=e=>"id"in e&&"source"in e&&"target"in e,NU=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}=Pr(e),o=e.origin??t,i=n*o[0],l=r*o[1];return{x:e.position.x-i,y:e.position.y-l}},kU=(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,b=hl(c,Ei(f)),E=(x??0)*(S??0),w=i&&b>0;(!f.internals.handleBounds||w||b>=E||f.dragging)&&d.push(f)}return d},TU=(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 PU(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 RU({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},l){if(e.size===0)return Promise.resolve(!0);const c=PU(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",Zn.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)?ls(t,h,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&i?.("015",Zn.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 IU({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(b=>b.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=TU(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),ls=(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}=Pr(n),{x:i,y:l}=n.internals.positionAbsolute;return ls(e,[[i,l],[i+r,l+o]],t)}const Jw=(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=Jw(e.x,r,t.width-r)*n,i=Jw(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)}),Hg=({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(Hg(e),Hg(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)},eb=e=>In(e.width)&&In(e.height)&&In(e.x)&&In(e.y),In=e=>!isNaN(e)&&isFinite(e),_U=(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 AU(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 MU(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=AU(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,b=MU(e,x,S,g,t,n),E={left:Math.min(b.left-l.left,0),top:Math.min(b.top-l.top,0),right:Math.min(b.right-l.right,0),bottom:Math.min(b.bottom-l.bottom,0)};return{x: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 Pr(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 BE(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 tb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function DU(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function jU(e){return{...DE,...e||{}}}function Qa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:l}=_n(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}),HE=e=>e?.getRootNode?.()||window?.document,OU=["INPUT","SELECT","TEXTAREA"];function WE(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:OU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const UE=e=>"clientX"in e,_n=(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)}},nb=(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 rb({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Se.Left:return[t-wu(t-r,i),n];case Se.Right:return[t+wu(r-t,i),n];case Se.Top:return[t,n-wu(n-o,i)];case Se.Bottom:return[t,n+wu(o-n,i)]}}function pd({sourceX:e,sourceY:t,sourcePosition:n=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top,curvature:l=.25}){const[c,d]=rb({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[f,g]=rb({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 $U({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 LU({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 FU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,zU=(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||FU;let o;return $E(e)?o={...e}:o={...e,id:r(e)},zU(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 ob={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}},VU=({source:e,sourcePosition:t=Se.Bottom,target:n})=>t===Se.Left||t===Se.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},sb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function BU({source:e,sourcePosition:t=Se.Bottom,target:n,targetPosition:r=Se.Top,center:o,offset:i,stepPosition:l}){const c=ob[t],d=ob[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=VU({source:f,sourcePosition:t,target:g}),v=h.x!==0?"x":"y",x=h[v];let S=[],b,E;const w={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"?(b=o.x??f.x+(g.x-f.x)*l,E=o.y??(f.y+g.y)/2):(b=o.x??(f.x+g.x)/2,E=o.y??f.y+(g.y-f.y)*l);const $=[{x:b,y:f.y},{x:b,y:g.y}],D=[{x:f.x,y:E},{x:g.x,y:E}];c[v]===x?S=v==="x"?$:D:S=v==="x"?D:$}else{const $=[{x:f.x,y:g.y}],D=[{x:g.x,y:f.y}];if(v==="x"?S=c.x===x?D:$:S=c.y===x?$:D,t===r){const I=Math.abs(e[v]-n[v]);if(I<=i){const B=Math.min(i-1,i-I);c[v]===x?w[v]=(f[v]>e[v]?-1:1)*B:N[v]=(g[v]>n[v]?-1:1)*B}}if(t!==r){const I=v==="x"?"y":"x",B=c[v]===d[I],A=f[I]>g[I],V=f[I]<g[I];(c[v]===1&&(!B&&A||B&&V)||c[v]!==1&&(!B&&V||B&&A))&&(S=v==="x"?$:D)}const H={x:f.x+w.x,y:f.y+w.y},j={x:g.x+N.x,y:g.y+N.y},U=Math.max(Math.abs(H.x-S[0].x),Math.abs(j.x-S[0].x)),G=Math.max(Math.abs(H.y-S[0].y),Math.abs(j.y-S[0].y));U>=G?(b=(H.x+j.x)/2,E=S[0].y):(b=S[0].x,E=(H.y+j.y)/2)}const M={x:f.x+w.x,y:f.y+w.y},R={x:g.x+N.x,y:g.y+N.y};return[[e,...M.x!==S[0].x||M.y!==S[0].y?[M]:[],...S,...R.x!==S[S.length-1].x||R.y!==S[S.length-1].y?[R]:[],n],b,E,k,P]}function HU(e,t,n,r){const o=Math.min(sb(e,t)/2,sb(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=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top,borderRadius:l=5,centerX:c,centerY:d,offset:f=20,stepPosition:g=.5}){const[h,v,x,S,b]=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 w=1;w<h.length-1;w++)E+=HU(h[w-1],h[w],h[w+1],l);return E+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[E,v,x,S,b]}function ib(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function WU(e){const{sourceNode:t,targetNode:n}=e;if(!ib(t)||!ib(n))return null;const r=t.internals.handleBounds||ab(t.handles),o=n.internals.handleBounds||ab(n.handles),i=lb(r?.source??[],e.sourceHandle),l=lb(e.connectionMode===bi.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!l)return e.onError?.("008",Zn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||Se.Bottom,d=l?.position||Se.Top,f=cs(t,i,c),g=cs(n,l,d);return{sourceX:f.x,sourceY:f.y,targetX:g.x,targetY:g.y,sourcePosition:c,targetPosition:d}}function ab(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 cs(e,t,n=Se.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??Pr(e);if(r)return{x:o+l/2,y:i+c/2};switch(t?.position??n){case Se.Top:return{x:o+l/2,y:i};case Se.Right:return{x:o+l,y:i+c/2};case Se.Bottom:return{x:o+l/2,y:i+c};case Se.Left:return{x:o,y:i+c/2}}}function lb(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 UU(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,KU=10,vy={nodeOrigin:[0,0],nodeExtent:pl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},GU={...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 YU(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=ls(i,l,Pr(o));o.internals.positionAbsolute=c}}function XU(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(GU,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=ls(v,x,Pr(g));h={...o.defaults,...g,measured:{width:g.measured?.width,height:g.measured?.height},internals:{positionAbsolute:S,handleBounds:XU(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 qU(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}qU(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*KU),o&&g.internals.rootParentIndex!==void 0&&(o.i=g.internals.rootParentIndex);const h=i&&!wy(d)?qE:0,{x:v,y:x,z:S}=ZU(e,g,l,c,h,d),{positionAbsolute:b}=e.internals,E=v!==b.x||x!==b.y;(E||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:v,y:x}:b,z:S}})}function ZE(e,t,n){const r=In(e.zIndex)?e.zIndex:0;return wy(n)?r:r+(e.selected?t:0)}function ZU(e,t,n,r,o,i){const{x:l,y:c}=t.internals.positionAbsolute,d=Pr(e),f=Il(e,n),g=Ni(e.extent)?ls(f,e.extent,d):f;let h=ls({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=Pr(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)),b=Math.max(g.height,Math.round(l.height)),E=(S-g.width)*h[0],w=(b-g.height)*h[1];(v>0||x>0||E||w)&&(o.push({id:d,type:"position",position:{x:c.position.x-v+E,y:c.position.y-x+w}}),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:b+(x?h[1]*x-w:0)}})}),o}function QU(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 b=yy(x.nodeElement),E=S.measured.width!==b.width||S.measured.height!==b.height;if(!!(b.width&&b.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,b,t.get(S.parentId)):k&&(P=ls(P,k,b));const M={...S,measured:b,internals:{...S.internals,positionAbsolute:P,handleBounds:{source:nb("source",x.nodeElement,N,h,S.id),target:nb("target",x.nodeElement,N,h,S.id)}}};t.set(S.id,M),S.parentId&&by(M,t,n,{nodeOrigin:o,zIndexMode:l}),d=!0,E&&(f.push({id:S.id,type:"dimensions",dimensions:b}),S.expandParent&&S.parentId&&v.push({id:S.id,parentId:S.parentId,rect:Ei(M,o)}))}}if(v.length>0){const x=Sy(v,t,n,o);f.push(...x)}return{changes:f,updatedInternals:d}}async function JU({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 cb(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}`;cb("source",d,g,e,o,l),cb("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 ub(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 e9(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 t9({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 n9({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,b=null;function E({noDragClassName:N,handleSelector:k,domNode:P,isSelectable:M,nodeId:R,nodeClickDistance:_=0}){v=rn(P);function $({x:U,y:G}){const{nodeLookup:I,nodeExtent:B,snapGrid:A,snapToGrid:V,nodeOrigin:F,onNodeDrag:W,onSelectionDrag:q,onError:L,updateNodePositions:z}=t();i={x:U,y:G};let X=!1;const Q=c.size>1,te=Q&&B?Hg(_l(c)):null,ne=Q&&V?t9({dragItems:c,snapGrid:A,x:U,y:G}):null;for(const[Z,K]of c){if(!I.has(Z))continue;let re={x:U-K.distance.x,y:G-K.distance.y};V&&(re=ne?{x:Math.round(re.x+ne.x),y:Math.round(re.y+ne.y)}:Al(re,A));let ce=null;if(Q&&B&&!K.extent&&te){const{positionAbsolute:pe}=K.internals,Re=pe.x-te.x+B[0][0],Le=pe.x+K.measured.width-te.x2+B[1][0],ze=pe.y-te.y+B[0][1],le=pe.y+K.measured.height-te.y2+B[1][1];ce=[[Re,ze],[Le,le]]}const{position:me,positionAbsolute:ge}=LE({nodeId:Z,nextPosition:re,nodeLookup:I,nodeExtent:ce||B,nodeOrigin:F,onError:L});X=X||K.position.x!==me.x||K.position.y!==me.y,K.position=me,K.internals.positionAbsolute=ge}if(S=S||X,!!X&&(z(c,!0),b&&(r||W||!R&&q))){const[Z,K]=Zh({nodeId:R,dragItems:c,nodeLookup:I});r?.(b,c,Z,K),W?.(b,Z,K),R||q?.(b,K)}}async function D(){if(!g)return;const{transform:U,panBy:G,autoPanSpeed:I,autoPanOnNodeDrag:B}=t();if(!B){d=!1,cancelAnimationFrame(l);return}const[A,V]=zE(f,g,I);(A!==0||V!==0)&&(i.x=(i.x??0)-A/U[2],i.y=(i.y??0)-V/U[2],await G({x:A,y:V})&&$(i)),l=requestAnimationFrame(D)}function H(U){const{nodeLookup:G,multiSelectionActive:I,nodesDraggable:B,transform:A,snapGrid:V,snapToGrid:F,selectNodesOnDrag:W,onNodeDragStart:q,onSelectionDragStart:L,unselectNodesAndEdges:z}=t();h=!0,(!W||!M)&&!I&&R&&(G.get(R)?.selected||z()),M&&W&&R&&e?.(R);const X=Qa(U.sourceEvent,{transform:A,snapGrid:V,snapToGrid:F,containerBounds:g});if(i=X,c=e9(G,B,X,R),c.size>0&&(n||q||!R&&L)){const[Q,te]=Zh({nodeId:R,dragItems:c,nodeLookup:G});n?.(U.sourceEvent,c,Q,te),q?.(U.sourceEvent,Q,te),R||L?.(U.sourceEvent,te)}}const j=yE().clickDistance(_).on("start",U=>{const{domNode:G,nodeDragThreshold:I,transform:B,snapGrid:A,snapToGrid:V}=t();g=G?.getBoundingClientRect()||null,x=!1,S=!1,b=U.sourceEvent,I===0&&H(U),i=Qa(U.sourceEvent,{transform:B,snapGrid:A,snapToGrid:V,containerBounds:g}),f=_n(U.sourceEvent,g)}).on("drag",U=>{const{autoPanOnNodeDrag:G,transform:I,snapGrid:B,snapToGrid:A,nodeDragThreshold:V,nodeLookup:F}=t(),W=Qa(U.sourceEvent,{transform:I,snapGrid:B,snapToGrid:A,containerBounds:g});if(b=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||R&&!F.has(R))&&(x=!0),!x){if(!d&&G&&h&&(d=!0,D()),!h){const q=_n(U.sourceEvent,g),L=q.x-f.x,z=q.y-f.y;Math.sqrt(L*L+z*z)>V&&H(U)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&c&&h&&(f=_n(U.sourceEvent,g),$(W))}}).on("end",U=>{if(!(!h||x)&&(d=!1,h=!1,cancelAnimationFrame(l),c.size>0)){const{nodeLookup:G,updateNodePositions:I,onNodeDragStop:B,onSelectionDragStop:A}=t();if(S&&(I(c,!1),S=!1),o||B||!R&&A){const[V,F]=Zh({nodeId:R,dragItems:c,nodeLookup:G,dragging:!1});o?.(U.sourceEvent,c,V,F),B?.(U.sourceEvent,V,F),R||A?.(U.sourceEvent,F)}}}).filter(U=>{const G=U.target;return!U.button&&(!N||!ub(G,`.${N}`,P))&&(!k||ub(G,k,P))});v.call(j)}function w(){v?.on(".drag",null)}return{update:E,destroy:w}}function r9(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 o9=250;function s9(e,t,n,r){let o=[],i=1/0;const l=r9(e,n,t+o9);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}=cs(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,...cs(l,d,d.position,!0)}:d}function tN(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function i9(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const nN=()=>!0;function a9(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:b,onConnectEnd:E,isValidConnection:w=nN,onReconnectEnd:N,updateConnection:k,getTransform:P,getFromHandle:M,autoPanSpeed:R,dragThreshold:_=1,handleDomNode:$}){const D=HE(e.target);let H=0,j;const{x:U,y:G}=_n(e),I=tN(i,$),B=c?.getBoundingClientRect();let A=!1;if(!B||!I)return;const V=eN(o,I,r,d,t);if(!V)return;let F=_n(e,B),W=!1,q=null,L=!1,z=null;function X(){if(!g||!B)return;const[me,ge]=zE(F,B,R);v({x:me,y:ge}),H=requestAnimationFrame(X)}const Q={...V,nodeId:o,type:I,position:V.position},te=d.get(o);let Z={inProgress:!0,isValid:null,from:cs(te,Q,Se.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:te,to:F,toHandle:null,toPosition:Qw[Q.position],toNode:null,pointer:F};function K(){A=!0,k(Z),S?.(e,{nodeId:o,handleId:r,handleType:I})}_===0&&K();function re(me){if(!A){const{x:le,y:we}=_n(me),Oe=le-U,ot=we-G;if(!(Oe*Oe+ot*ot>_*_))return;K()}if(!M()||!Q){ce(me);return}const ge=P();F=_n(me,B),j=s9(Ml(F,ge,!1,[1,1]),n,d,Q),W||(X(),W=!0);const pe=rN(me,{handle:j,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:l?"target":"source",isValidConnection:w,doc:D,lib:f,flowId:h,nodeLookup:d});z=pe.handleDomNode,q=pe.connection,L=i9(!!j,pe.isValid);const Re=d.get(o),Le=Re?cs(Re,Q,Se.Left,!0):Z.from,ze={...Z,from:Le,isValid:L,to:pe.toHandle&&L?fd({x:pe.toHandle.x,y:pe.toHandle.y},ge):F,toHandle:pe.toHandle,toPosition:L&&pe.toHandle?pe.toHandle.position:Qw[Q.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:F};k(ze),Z=ze}function ce(me){if(!("touches"in me&&me.touches.length>0)){if(A){(j||z)&&q&&L&&b?.(q);const{inProgress:ge,...pe}=Z,Re={...pe,toPosition:Z.toHandle?Z.toPosition:null};E?.(me,Re),i&&N?.(me,Re)}x(),cancelAnimationFrame(H),W=!1,L=!1,q=null,z=null,D.removeEventListener("mousemove",re),D.removeEventListener("mouseup",ce),D.removeEventListener("touchmove",re),D.removeEventListener("touchend",ce)}}D.addEventListener("mousemove",re),D.addEventListener("mouseup",ce),D.addEventListener("touchmove",re),D.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}=_n(e),b=l.elementFromPoint(x,S),E=b?.classList.contains(`${c}-flow__handle`)?b:v,w={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"),M=E.classList.contains("connectable"),R=E.classList.contains("connectableend");if(!k||!N)return w;const _={source:h?k:r,sourceHandle:h?P:o,target:h?r:k,targetHandle:h?o:P};w.connection=_;const D=M&&R&&(n===bi.Strict?h&&N==="source"||!h&&N==="target":k!==r||P!==o);w.isValid=D&&f(_),w.toHandle=eN(k,N,P,g,n,!0)}return w}const Gg={onPointerDown:a9,isValid:rN};function l9({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=rn(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(),M=k.sourceEvent.ctrlKey&&gl()?10:1,R=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*g,_=P[2]*Math.pow(2,R*M);t.scaleTo(_)};let b=[0,0];const E=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(b=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},w=k=>{const P=n();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const M=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],R=[M[0]-b[0],M[1]-b[1]];b=M;const _=r()*Math.max(P[2],Math.log(P[2]))*(x?-1:1),$={x:P[0]-R[0]*_,y:P[1]-R[1]*_},D=[[0,0],[d,f]];t.setViewportConstrained({x:$.x,y:$.y,zoom:P[2]},D,c)},N=AE().on("start",E).on("zoom",h?w:null).on("zoom.wheel",v?S:null);o.call(N,{})}function l(){o.on("zoom",null)}return{update:i,destroy:l,pointer:Tn}}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),c9=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jh=(e,t=0,n=c9,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 u9({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=Tn(g),w=sN(g),N=h*Math.pow(2,w);r.scaleTo(n,N,E,g);return}const v=g.deltaMode===1?20:1;let x=o===Zo.Vertical?0:g.deltaX*v,S=o===Zo.Horizontal?0:g.deltaY*v;!gl()&&g.shiftKey&&o!==Zo.Vertical&&(x=g.deltaY*v,S=0),r.translateBy(n,-(x/h)*i,-(S/h)*i,{internal:!0});const b=df(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d?.(g,b),e.panScrollTimeout=setTimeout(()=>{f?.(g,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(g,b))}}function d9({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 f9({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 p9({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 h9({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 g9({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 b=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||S)&&b}}function m9({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=rn(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 b(j,U){return v?new Promise(G=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).transform(Jh(v,U?.duration,U?.ease,()=>G(!0)),j)}):Promise.resolve(!1)}function E({noWheelClassName:j,noPanClassName:U,onPaneContextMenu:G,userSelectionActive:I,panOnScroll:B,panOnDrag:A,panOnScrollMode:V,panOnScrollSpeed:F,preventScrolling:W,zoomOnPinch:q,zoomOnScroll:L,zoomOnDoubleClick:z,zoomActivationKeyPressed:X,lib:Q,onTransformChange:te,connectionInProgress:ne,paneClickDistance:Z,selectionOnDrag:K}){I&&!f.isZoomingOrPanning&&w();const re=B&&!X&&!I;h.clickDistance(K?1/0:!In(Z)||Z<0?0:Z);const ce=re?u9({zoomPanValues:f,noWheelClassName:j,d3Selection:v,d3Zoom:h,panOnScrollMode:V,panOnScrollSpeed:F,zoomOnPinch:q,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):d9({noWheelClassName:j,preventScrolling:W,d3ZoomHandler:x});if(v.on("wheel.zoom",ce,{passive:!1}),!I){const ge=f9({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});h.on("start",ge);const pe=p9({zoomPanValues:f,panOnDrag:A,onPaneContextMenu:!!G,onPanZoom:i,onTransformChange:te});h.on("zoom",pe);const Re=h9({zoomPanValues:f,panOnDrag:A,panOnScroll:B,onPaneContextMenu:G,onPanZoomEnd:c,onDraggingChange:d});h.on("end",Re)}const me=g9({zoomActivationKeyPressed:X,panOnDrag:A,zoomOnScroll:L,panOnScroll:B,zoomOnDoubleClick:z,zoomOnPinch:q,userSelectionActive:I,noPanClassName:U,noWheelClassName:j,lib:Q,connectionInProgress:ne});h.filter(me),z?v.on("dblclick.zoom",S):v.on("dblclick.zoom",null)}function w(){h.on("zoom",null)}async function N(j,U,G){const I=Qh(j),B=h?.constrain()(I,U,G);return B&&await b(B),new Promise(A=>A(B))}async function k(j,U){const G=Qh(j);return await b(G,U),new Promise(I=>I(G))}function P(j){if(v){const U=Qh(j),G=v.property("__zoom");(G.k!==j.zoom||G.x!==j.x||G.y!==j.y)&&h?.transform(v,U,null,{sync:!0})}}function M(){const j=v?_E(v.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}function R(j,U){return v?new Promise(G=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).scaleTo(Jh(v,U?.duration,U?.ease,()=>G(!0)),j)}):Promise.resolve(!1)}function _(j,U){return v?new Promise(G=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).scaleBy(Jh(v,U?.duration,U?.ease,()=>G(!0)),j)}):Promise.resolve(!1)}function $(j){h?.scaleExtent(j)}function D(j){h?.translateExtent(j)}function H(j){const U=!In(j)||j<0?0:j;h?.clickDistance(U)}return{update:E,destroy:w,setViewport:k,setViewportConstrained:N,getViewport:M,scaleTo:R,scaleBy:_,setScaleExtent:$,setTranslateExtent:D,syncViewport:P,setClickDistance:H}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function y9({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 db(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 eo(e,t){return Math.max(0,t-e)}function to(e,t){return Math.max(0,e-t)}function bu(e,t,n){return Math.max(0,t-e,e-n)}function fb(e,t){return e?!t:t}function v9(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:b,maxWidth:E,minHeight:w,maxHeight:N}=r,{x:k,y:P,width:M,height:R,aspectRatio:_}=e;let $=Math.floor(g?x-e.pointerX:0),D=Math.floor(h?S-e.pointerY:0);const H=M+(d?-$:$),j=R+(f?-D:D),U=-i[0]*M,G=-i[1]*R;let I=bu(H,b,E),B=bu(j,w,N);if(l){let F=0,W=0;d&&$<0?F=eo(k+$+U,l[0][0]):!d&&$>0&&(F=to(k+H+U,l[1][0])),f&&D<0?W=eo(P+D+G,l[0][1]):!f&&D>0&&(W=to(P+j+G,l[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(c){let F=0,W=0;d&&$>0?F=to(k+$,c[0][0]):!d&&$<0&&(F=eo(k+H,c[1][0])),f&&D>0?W=to(P+D,c[0][1]):!f&&D<0&&(W=eo(P+j,c[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(o){if(g){const F=bu(H/_,w,N)*_;if(I=Math.max(I,F),l){let W=0;!d&&!f||d&&!f&&v?W=to(P+G+H/_,l[1][1])*_:W=eo(P+G+(d?$:-$)/_,l[0][1])*_,I=Math.max(I,W)}if(c){let W=0;!d&&!f||d&&!f&&v?W=eo(P+H/_,c[1][1])*_:W=to(P+(d?$:-$)/_,c[0][1])*_,I=Math.max(I,W)}}if(h){const F=bu(j*_,b,E)/_;if(B=Math.max(B,F),l){let W=0;!d&&!f||f&&!d&&v?W=to(k+j*_+U,l[1][0])/_:W=eo(k+(f?D:-D)*_+U,l[0][0])/_,B=Math.max(B,W)}if(c){let W=0;!d&&!f||f&&!d&&v?W=eo(k+j*_,c[1][0])/_:W=to(k+(f?D:-D)*_,c[0][0])/_,B=Math.max(B,W)}}}D=D+(D<0?B:-B),$=$+($<0?I:-I),o&&(v?H>j*_?D=(fb(d,f)?-$:$)/_:$=(fb(d,f)?-D:D)*_:g?(D=$/_,f=d):($=D*_,d=f));const A=d?k+$:k,V=f?P+D:P;return{width:M+(d?-$:$),height:R+(f?-D:D),x:i[0]*$*(d?-1:1)+A,y:i[1]*D*(f?-1:1)+V}}const iN={width:0,height:0,x:0,y:0},x9={...iN,pointerX:0,pointerY:0,aspectRatio:1};function w9(e){return[[0,0],[e.measured.width,e.measured.height]]}function b9(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 S9({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=rn(e);let l={controlDirection:db("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:b,shouldResize:E}){let w={...iN},N={...x9};l={boundaries:g,resizeDirection:v,keepAspectRatio:h,controlDirection:db(f)};let k,P=null,M=[],R,_,$,D=!1;const H=yE().on("start",j=>{const{nodeLookup:U,transform:G,snapGrid:I,snapToGrid:B,nodeOrigin:A,paneDomNode:V}=n();if(k=U.get(t),!k)return;P=V?.getBoundingClientRect()??null;const{xSnapped:F,ySnapped:W}=Qa(j.sourceEvent,{transform:G,snapGrid:I,snapToGrid:B,containerBounds:P});w={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},N={...w,pointerX:F,pointerY:W,aspectRatio:w.width/w.height},R=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(R=U.get(k.parentId),_=R&&k.extent==="parent"?w9(R):void 0),M=[],$=void 0;for(const[q,L]of U)if(L.parentId===t&&(M.push({id:q,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const z=b9(L,k,L.origin??A);$?$=[[Math.min(z[0][0],$[0][0]),Math.min(z[0][1],$[0][1])],[Math.max(z[1][0],$[1][0]),Math.max(z[1][1],$[1][1])]]:$=z}x?.(j,{...w})}).on("drag",j=>{const{transform:U,snapGrid:G,snapToGrid:I,nodeOrigin:B}=n(),A=Qa(j.sourceEvent,{transform:U,snapGrid:G,snapToGrid:I,containerBounds:P}),V=[];if(!k)return;const{x:F,y:W,width:q,height:L}=w,z={},X=k.origin??B,{width:Q,height:te,x:ne,y:Z}=v9(N,l.controlDirection,A,l.boundaries,l.keepAspectRatio,X,_,$),K=Q!==q,re=te!==L,ce=ne!==F&&K,me=Z!==W&&re;if(!ce&&!me&&!K&&!re)return;if((ce||me||X[0]===1||X[1]===1)&&(z.x=ce?ne:w.x,z.y=me?Z:w.y,w.x=z.x,w.y=z.y,M.length>0)){const Le=ne-F,ze=Z-W;for(const le of M)le.position={x:le.position.x-Le+X[0]*(Q-q),y:le.position.y-ze+X[1]*(te-L)},V.push(le)}if((K||re)&&(z.width=K&&(!l.resizeDirection||l.resizeDirection==="horizontal")?Q:w.width,z.height=re&&(!l.resizeDirection||l.resizeDirection==="vertical")?te:w.height,w.width=z.width,w.height=z.height),R&&k.expandParent){const Le=X[0]*(z.width??0);z.x&&z.x<Le&&(w.x=Le,N.x=N.x-(z.x-Le));const ze=X[1]*(z.height??0);z.y&&z.y<ze&&(w.y=ze,N.y=N.y-(z.y-ze))}const ge=y9({width:w.width,prevWidth:q,height:w.height,prevHeight:L,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),pe={...w,direction:ge};E?.(j,pe)!==!1&&(D=!0,S?.(j,pe),r(z,V))}).on("end",j=>{D&&(b?.(j,{...w}),o?.({...w}),D=!1)});i.call(H)}function d(){i.on(".drag",null)}return{update:c,destroy:d}}var eg={exports:{}},tg={},ng={exports:{}},rg={};var pb;function C9(){if(pb)return rg;pb=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}}),b=S[0].inst,E=S[1];return i(function(){b.value=x,b.getSnapshot=v,d(b)&&E({inst:b})},[h,x,v]),o(function(){return d(b)&&E({inst:b}),h(function(){d(b)&&E({inst:b})})},[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 hb;function E9(){return hb||(hb=1,ng.exports=C9()),ng.exports}var gb;function N9(){if(gb)return tg;gb=1;var e=wl(),t=E9();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 b={hasValue:!1,value:null};S.current=b}else b=S.current;S=c(function(){function w(R){if(!N){if(N=!0,k=R,R=v(R),x!==void 0&&b.hasValue){var _=b.value;if(x(_,R))return P=_}return P=R}if(_=P,r(k,R))return _;var $=v(R);return x!==void 0&&x(_,$)?(k=R,_):(k=R,P=$)}var N=!1,k,P,M=h===void 0?null:h;return[function(){return w(g())},M===null?void 0:function(){return w(M())}]},[g,h,v,x]);var E=o(f,S[0],S[1]);return l(function(){b.hasValue=!0,b.value=E},[E]),d(E),E},tg}var mb;function k9(){return mb||(mb=1,eg.exports=N9()),eg.exports}var T9=k9();const P9=lm(T9),R9={},yb=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:()=>{(R9?"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},I9=e=>e?yb(e):yb,{useDebugValue:_9}=qe,{useSyncExternalStoreWithSelector:A9}=P9,M9=e=>e;function aN(e,t=M9,n){const r=A9(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _9(r),r}const vb=(e,t)=>{const n=I9(e),r=(o,i=t)=>aN(n,o,i);return Object.assign(r,n),r},D9=(e,t)=>e?vb(e,t):vb;function rt(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),j9=ff.Provider,lN=Zn.error001();function Be(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 xb={display:"none"},O9={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",$9="react-flow__aria-live",L9=e=>e.ariaLiveMessage,F9=e=>e.ariaLabelConfig;function z9({rfId:e}){const t=Be(L9);return p.jsx("div",{id:`${$9}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O9,children:t})}function V9({rfId:e,disableKeyboardA11y:t}){const n=Be(F9);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${cN}-${e}`,style:xb,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${uN}-${e}`,style:xb,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(z9,{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 H9=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 W9(e,t){return rt(e.selectedNodes.map(Su),t.selectedNodes.map(Su))&&rt(e.selectedEdges.map(Su),t.selectedEdges.map(Su))}function U9({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:r}=Be(H9,W9);return m.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const K9=e=>!!e.onSelectionChangeHandlers;function G9({onSelectionChange:e}){const t=Be(K9);return e||t?p.jsx(U9,{onSelectionChange:e}):null}const Yg=typeof window<"u"?m.useLayoutEffect:m.useEffect,dN=[0,0],Y9={x:0,y:0,zoom:1},X9=["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"],wb=[...X9,"rfId"],q9=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}),bb={translateExtent:pl,nodeOrigin:dN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Z9(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:d}=Be(q9,rt),f=it();Yg(()=>(d(e.defaultNodes,e.defaultEdges),()=>{g.current=bb,c()}),[]);const g=m.useRef(bb);return Yg(()=>{for(const h of wb){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:jU(v)}):h==="fitView"?f.setState({fitViewQueued:v}):h==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[h]:v})))}g.current=e},wb.map(h=>e[h])),null}function Sb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Q9(e){const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=Sb(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:Sb()?.matches?"dark":"light"}const Cb=typeof document<"u"?document:null;function ml(e=null,t={target:Cb,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("+",`
|
|
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 {${bS(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=aS,a4=cS,Sm=dS,Dd=fS,jd=pS,Cm=gS,Em=yS,Nm=xS;const SS=bm,l4=Sm,CS=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}));CS.displayName=Dd.displayName;const km=m.forwardRef(({className:e,children:t,variant:n="surface",...r},o)=>p.jsxs(l4,{children:[p.jsx(CS,{}),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 ES=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ES.displayName="DialogHeader";const NS=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});NS.displayName="DialogFooter";const kS=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}));kS.displayName=Cm.displayName;const TS=m.forwardRef(({className:e,...t},n)=>p.jsx(Em,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));TS.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(SS,{open:e,onOpenChange:t,children:p.jsxs(km,{className:"max-w-lg max-h-[80vh] flex flex-col",children:[p.jsxs(ES,{children:[p.jsxs(kS,{className:"flex items-center gap-2",children:[l?p.jsx(go,{className:"w-5 h-5 text-destructive"}):p.jsx(Pd,{className:"w-5 h-5 text-warning"}),i("validationIssues")]}),p.jsx(TS,{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(NS,{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(uo,{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(uo,{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(go,{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,Xo=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 PS({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:M,isPanelCollapsed:R,reevaluatePanelConstraints:_,registerPanel:$,resizePanel:D,unregisterPanel:H}=E,j=Pm(l),U=m.useRef({callbacks:{onCollapse:f,onExpand:g,onResize:h},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:c,minSize:d},id:j,idIsFromProps:l!==void 0,order:v});m.useRef({didLogMissingDefaultSizeWarning:!1}),Xo(()=>{const{callbacks:I,constraints:B}=U.current,A={...B};U.current.id=j,U.current.idIsFromProps=l!==void 0,U.current.order=v,I.onCollapse=f,I.onExpand=g,I.onResize=h,B.collapsedSize=n,B.collapsible=r,B.defaultSize=o,B.maxSize=c,B.minSize=d,(A.collapsedSize!==B.collapsedSize||A.collapsible!==B.collapsible||A.maxSize!==B.maxSize||A.minSize!==B.minSize)&&_(U.current,A)}),Xo(()=>{const I=U.current;return $(I),()=>{H(I)}},[v,j,$,H]),m.useImperativeHandle(i,()=>({collapse:()=>{b(U.current)},expand:I=>{N(U.current,I)},getId(){return j},getSize(){return k(U.current)},isCollapsed(){return R(U.current)},isExpanded(){return!R(U.current)},resize:I=>{D(U.current,I)}}),[b,N,k,R,j,D]);const Y=P(U.current,o);return m.createElement(S,{...w,children:e,className:t,id:j,style:{...Y,...x},[dt.groupId]:M,[dt.panel]:"",[dt.panelCollapsible]:r||void 0,[dt.panelId]:j,[dt.panelSize]:parseFloat(""+Y.flexGrow).toFixed(1)})}const RS=m.forwardRef((e,t)=>m.createElement(PS,{...e,forwardedRef:t}));PS.displayName="Panel";RS.displayName="forwardRef(Panel)";let Ng=null,Du=-1,so=null;function f4(e,t){if(t){const n=(t&DS)!==0,r=(t&jS)!==0,o=(t&OS)!==0,i=(t&$S)!==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(){so!==null&&(document.head.removeChild(so),Ng=null,so=null,Du=-1)}function Lh(e,t){var n,r;const o=f4(e,t);if(Ng!==o){if(Ng=o,so===null&&(so=document.createElement("style"),document.head.appendChild(so)),Du>=0){var i;(i=so.sheet)===null||i===void 0||i.removeRule(Du)}Du=(n=(r=so.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function IS(e){return e.type==="keydown"}function _S(e){return e.type.startsWith("pointer")}function AS(e){return e.type.startsWith("mouse")}function $d(e){if(_S(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(AS(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;Fe(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=MS(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(Fe(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=MS(e);return t}function MS(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const DS=1,jS=2,OS=4,$S=8,w4=h4()==="coarse";let _n=[],li=!1,Uo=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=Uo.get(l))!==null&&i!==void 0?i:0;return Uo.set(l,d+1),rl.add(c),Xu(),function(){var g;Ld.delete(e),rl.delete(c);const h=(g=Uo.get(l))!==null&&g!==void 0?g:1;if(Uo.set(l,h-1),Xu(),h===1&&Uo.delete(l),_n.includes(c)){const v=_n.indexOf(c);v>=0&&_n.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(),_n.length>0&&(qu("down",e),e.preventDefault(),LS(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(),_n.length>0&&e.preventDefault()}function zh(e){const{target:t}=e,{x:n,y:r}=$d(e);Ld.clear(),li=!1,_n.length>0&&(e.preventDefault(),LS(t)||e.stopImmediatePropagation()),qu("up",e),Rm({target:t,x:n,y:r}),Im(),Xu()}function LS(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}){_n.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}_n.push(o)}})}function Vh(e,t){Ld.set(e,t)}function Im(){let e=!1,t=!1;_n.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 Bh=new AbortController;function Xu(){Bh.abort(),Bh=new AbortController;const e={capture:!0,signal:Bh.signal};rl.size&&(li?(_n.length>0&&Uo.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)):Uo.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=_n.includes(n);r(e,o,t)})}function C4(){const[e,t]=m.useState(0);return m.useCallback(()=>t(n=>n+1),[])}function Fe(e,t){if(!e)throw console.error(t),Error(t)}function ns(e,t,n=Tm){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function hr(e,t,n=Tm){return ns(e,t,n)===0}function tn(e,t,n){return ns(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(!tn(o,i,n))return!1}return!0}function ni({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Fe(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:l=100,minSize:c=0}=r;if(ns(n,c)<0)if(i){const d=(o+c)/2;ns(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(tn(e,0))return t;const l=[...t],[c,d]=r;Fe(c!=null,"Invalid first pivot index"),Fe(d!=null,"Invalid second pivot index");let f=0;if(i==="keyboard"){{const h=e<0?d:c,v=n[h];Fe(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(Fe(E!=null,`Previous layout not found for panel index ${h}`),tn(E,x)){const b=w-E;ns(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const h=e<0?c:d,v=n[h];Fe(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(Fe(E!=null,`Previous layout not found for panel index ${h}`),tn(E,w)){const b=E-x;ns(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];Fe(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];Fe(S!=null,`Previous layout not found for panel index ${v}`);const w=S-x,E=ni({panelConstraints:n,panelIndex:v,size:w});if(!tn(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];Fe(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,!tn(S,x)){let w=x-S,b=e<0?d:c;for(;b>=0&&b<n.length;){const N=l[b];Fe(N!=null,`Previous layout not found for panel index ${b}`);const k=N+w,P=ni({panelConstraints:n,panelIndex:b,size:k});if(tn(N,P)||(w-=P-N,l[b]=P),tn(w,0))break;e>0?b--:b++}}}const g=l.reduce((h,v)=>v+h,0);return tn(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];Fe(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 FS(e,t,n=document){const o=ol(e,n).findIndex(i=>i.getAttribute(dt.resizeHandleId)===t);return o??null}function zS(e,t,n){const r=FS(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function VS(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}),Xo(()=>{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];Fe(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;Fe(c,"Eager values not found");const{panelDataArray:d}=c,f=VS(n,i);Fe(f!=null,`No group found for id "${n}"`);const g=ol(n,i);Fe(g,`No resize handles found for group id "${n}"`);const h=g.map(v=>{const x=v.getAttribute(dt.resizeHandleId);Fe(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];Fe(k,`No panel data found for index ${N}`);const P=r[N],{collapsedSize:M=0,collapsible:R,minSize:_=0}=k.constraints;if(P!=null&&R){const $=za({delta:tn(P,M)?_-M:M-P,initialLayout:r,panelConstraints:d.map(D=>D.constraints),pivotIndices:zS(n,x,i),prevLayout:r,trigger:"keyboard"});r!==$&&l($)}}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 BS(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);Fe(l,`No resize handle element found for id "${t}"`);const c=l.getAttribute(dt.groupId);Fe(c,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=r;const f=BS(n,e),g=VS(c,o);Fe(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(IS(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];Fe(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];Fe(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];Fe(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||hr(h,f))&&!hr(r,f)&&x(),v&&(h==null||!hr(h,f))&&hr(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 WS(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 US(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=US(e,n))!==null&&r!==void 0?r:{},l=WS(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=WS(t),d=(i=US(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(!tn(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const l=n[i];Fe(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];Fe(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(!tn(o,0))for(let i=0;i<t.length;i++){const l=n[i];Fe(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,tn(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 KS({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),M=m.useRef(0),R=m.useRef({autoSaveId:e,direction:r,dragState:S,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),_=m.useRef({layout:E,panelDataArray:[],panelDataArrayChanged:!1});m.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),m.useImperativeHandle(o,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:X}=_.current;return X},setLayout:X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=_.current,Z=fw({layout:X,panelConstraints:ne.map(K=>K.constraints)});uw(te,Z)||(b(Z),_.current.layout=Z,Q&&Q(Z),Xs(ne,Z,k.current))}}),[]),Xo(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=S,R.current.id=v,R.current.onLayout=l,R.current.storage=d}),T4({committedValuesRef:R,eagerValuesRef:_,groupId:v,layout:E,panelDataArray:_.current.panelDataArray,setLayout:b,panelGroupElement:x.current}),m.useEffect(()=>{const{panelDataArray:X}=_.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 te=[...X],ne=new Map(P.current);Q(e,te,ne,E,d)}},[e,E,d]),m.useEffect(()=>{});const $=m.useCallback(X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=_.current;if(X.constraints.collapsible){const Z=ne.map(me=>me.constraints),{collapsedSize:K=0,panelSize:re,pivotIndices:ce}=Bo(ne,X,te);if(Fe(re!=null,`Panel size not found for panel "${X.id}"`),!hr(re,K)){P.current.set(X.id,re);const ge=Js(ne,X)===ne.length-1?re-K:K-re,pe=za({delta:ge,initialLayout:te,panelConstraints:Z,pivotIndices:ce,prevLayout:te,trigger:"imperative-api"});pu(te,pe)||(b(pe),_.current.layout=pe,Q&&Q(pe),Xs(ne,pe,k.current))}}},[]),D=m.useCallback((X,Q)=>{const{onLayout:te}=R.current,{layout:ne,panelDataArray:Z}=_.current;if(X.constraints.collapsible){const K=Z.map(Re=>Re.constraints),{collapsedSize:re=0,panelSize:ce=0,minSize:me=0,pivotIndices:ge}=Bo(Z,X,ne),pe=Q??me;if(hr(ce,re)){const Re=P.current.get(X.id),Le=Re!=null&&Re>=pe?Re:pe,le=Js(Z,X)===Z.length-1?ce-Le:Le-ce,we=za({delta:le,initialLayout:ne,panelConstraints:K,pivotIndices:ge,prevLayout:ne,trigger:"imperative-api"});pu(ne,we)||(b(we),_.current.layout=we,te&&te(we),Xs(Z,we,k.current))}}},[]),H=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{panelSize:ne}=Bo(te,X,Q);return Fe(ne!=null,`Panel size not found for panel "${X.id}"`),ne},[]),j=m.useCallback((X,Q)=>{const{panelDataArray:te}=_.current,ne=Js(te,X);return _4({defaultSize:Q,dragState:S,layout:E,panelData:te,panelIndex:ne})},[S,E]),U=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Bo(te,X,Q);return Fe(K!=null,`Panel size not found for panel "${X.id}"`),Z===!0&&hr(K,ne)},[]),Y=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=_.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Bo(te,X,Q);return Fe(K!=null,`Panel size not found for panel "${X.id}"`),!Z||ns(K,ne)>0},[]),I=m.useCallback(X=>{const{panelDataArray:Q}=_.current;Q.push(X),Q.sort((te,ne)=>{const Z=te.order,K=ne.order;return Z==null&&K==null?0:Z==null?-1:K==null?1:Z-K}),_.current.panelDataArrayChanged=!0,N()},[N]);Xo(()=>{if(_.current.panelDataArrayChanged){_.current.panelDataArrayChanged=!1;const{autoSaveId:X,onLayout:Q,storage:te}=R.current,{layout:ne,panelDataArray:Z}=_.current;let K=null;if(X){const ce=M4(X,Z,te);ce&&(P.current=new Map(Object.entries(ce.expandToSizes)),K=ce.layout)}K==null&&(K=I4({panelDataArray:Z}));const re=fw({layout:K,panelConstraints:Z.map(ce=>ce.constraints)});uw(ne,re)||(b(re),_.current.layout=re,Q&&Q(re),Xs(Z,re,k.current))}}),Xo(()=>{const X=_.current;return()=>{X.layout=[]}},[]);const B=m.useCallback(X=>{let Q=!1;const te=x.current;return te&&window.getComputedStyle(te,null).getPropertyValue("direction")==="rtl"&&(Q=!0),function(Z){Z.preventDefault();const K=x.current;if(!K)return()=>null;const{direction:re,dragState:ce,id:me,keyboardResizeBy:ge,onLayout:pe}=R.current,{layout:Re,panelDataArray:Le}=_.current,{initialLayout:ze}=ce??{},le=zS(me,X,K);let we=R4(Z,X,re,ce,ge,K);const Oe=re==="horizontal";Oe&&Q&&(we=-we);const ot=Le.map(Ke=>Ke.constraints),Je=za({delta:we,initialLayout:ze??Re,panelConstraints:ot,pivotIndices:le,prevLayout:Re,trigger:IS(Z)?"keyboard":"mouse-or-touch"}),Ct=!pu(Re,Je);(_S(Z)||AS(Z))&&M.current!=we&&(M.current=we,!Ct&&we!==0?Oe?Vh(X,we<0?DS:jS):Vh(X,we<0?OS:$S):Vh(X,0)),Ct&&(b(Je),_.current.layout=Je,pe&&pe(Je),Xs(Le,Je,k.current))}},[]),A=m.useCallback((X,Q)=>{const{onLayout:te}=R.current,{layout:ne,panelDataArray:Z}=_.current,K=Z.map(Re=>Re.constraints),{panelSize:re,pivotIndices:ce}=Bo(Z,X,ne);Fe(re!=null,`Panel size not found for panel "${X.id}"`);const ge=Js(Z,X)===Z.length-1?re-Q:Q-re,pe=za({delta:ge,initialLayout:ne,panelConstraints:K,pivotIndices:ce,prevLayout:ne,trigger:"imperative-api"});pu(ne,pe)||(b(pe),_.current.layout=pe,te&&te(pe),Xs(Z,pe,k.current))},[]),V=m.useCallback((X,Q)=>{const{layout:te,panelDataArray:ne}=_.current,{collapsedSize:Z=0,collapsible:K}=Q,{collapsedSize:re=0,collapsible:ce,maxSize:me=100,minSize:ge=0}=X.constraints,{panelSize:pe}=Bo(ne,X,te);pe!=null&&(K&&ce&&hr(pe,Z)?hr(Z,re)||A(X,re):pe<ge?A(X,ge):pe>me&&A(X,me))},[A]),F=m.useCallback((X,Q)=>{const{direction:te}=R.current,{layout:ne}=_.current;if(!x.current)return;const Z=Fd(X,x.current);Fe(Z,`Drag handle element not found for id "${X}"`);const K=BS(te,Q);w({dragHandleId:X,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:K,initialLayout:ne})},[]),W=m.useCallback(()=>{w(null)},[]),q=m.useCallback(X=>{const{panelDataArray:Q}=_.current,te=Js(Q,X);te>=0&&(Q.splice(te,1),delete k.current[X.id],_.current.panelDataArrayChanged=!0,N())},[N]),L=m.useMemo(()=>({collapsePanel:$,direction:r,dragState:S,expandPanel:D,getPanelSize:H,getPanelStyle:j,groupId:v,isPanelCollapsed:U,isPanelExpanded:Y,reevaluatePanelConstraints:V,registerPanel:I,registerResizeHandle:B,resizePanel:A,startDragging:F,stopDragging:W,unregisterPanel:q,panelGroupElement:x.current}),[$,S,r,D,H,j,v,U,Y,V,I,B,A,F,W,q]),z={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return m.createElement(Od.Provider,{value:L},m.createElement(g,{...h,children:t,className:n,id:i,ref:x,style:{...z,...f},[dt.group]:"",[dt.groupDirection]:r,[dt.groupId]:v}))}const GS=m.forwardRef((e,t)=>m.createElement(KS,{...e,forwardedRef:t}));KS.displayName="PanelGroup";GS.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);Fe(c,`No group element found for id "${c}"`);const d=ol(c,r),f=FS(c,t,r);Fe(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 YS({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:M,registerResizeHandle:R,startDragging:_,stopDragging:$,panelGroupElement:D}=k,H=Pm(o),[j,U]=m.useState("inactive"),[Y,I]=m.useState(!1),[B,A]=m.useState(null),V=m.useRef({state:j});Xo(()=>{V.current.state=j}),m.useEffect(()=>{if(n)A(null);else{const L=R(H);A(()=>L)}},[n,H,R]);const F=(w=r?.coarse)!==null&&w!==void 0?w:15,W=(E=r?.fine)!==null&&E!==void 0?E:5;m.useEffect(()=>{if(n||B==null)return;const L=b.current;Fe(L,"Element ref not attached");let z=!1;return b4(H,L,P,{coarse:F,fine:W},(Q,te,ne)=>{if(!te){U("inactive");return}switch(Q){case"down":{U("drag"),z=!1,Fe(ne,'Expected event to be defined for "down" action'),_(H,ne);const{onDragging:Z,onPointerDown:K}=N.current;Z?.(!0),K?.();break}case"move":{const{state:Z}=V.current;z=!0,Z!=="drag"&&U("hover"),Fe(ne,'Expected event to be defined for "move" action'),B(ne);break}case"up":{U("hover"),$();const{onClick:Z,onDragging:K,onPointerUp:re}=N.current;K?.(!1),re?.(),z||Z?.();break}}})},[F,P,n,W,R,H,B,_,$]),O4({disabled:n,handleId:H,resizeHandler:B,panelGroupElement:D});const q={touchAction:"none",userSelect:"none"};return m.createElement(x,{...S,children:e,className:t,id:o,onBlur:()=>{I(!1),i?.()},onFocus:()=>{I(!0),d?.()},ref:b,role:"separator",style:{...q,...h},tabIndex:v,[dt.groupDirection]:P,[dt.groupId]:M,[dt.resizeHandle]:"",[dt.resizeHandleActive]:j==="drag"?"pointer":Y?"keyboard":void 0,[dt.resizeHandleEnabled]:!n,[dt.resizeHandleId]:H,[dt.resizeHandleState]:j})}YS.displayName="PanelResizeHandle";const $4=({className:e,...t})=>p.jsx(GS,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),hw=RS,L4=({withHandle:e,className:t,...n})=>p.jsx(YS,{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",[XS]=Lt(_m),[V4,vn]=XS(_m),qS=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),[M,R]=m.useState(!1),[_,$]=m.useState(!1),D=De(t,j=>d(j)),H=Nl(o);return p.jsx(V4,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:c,viewport:f,onViewportChange:g,content:h,onContentChange:v,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:M,onScrollbarXEnabledChange:R,scrollbarY:w,onScrollbarYChange:E,scrollbarYEnabled:_,onScrollbarYEnabledChange:$,onCornerWidthChange:N,onCornerHeightChange:P,children:p.jsx(Ne.div,{dir:H,...l,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});qS.displayName=_m;var ZS="ScrollAreaViewport",QS=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,l=vn(ZS,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(Ne.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})})]})});QS.displayName=ZS;var Qn="ScrollAreaScrollbar",Am=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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(B4,{...r,ref:t,forceMount:n}):o.type==="scroll"?p.jsx(H4,{...r,ref:t,forceMount:n}):o.type==="auto"?p.jsx(JS,{...r,ref:t,forceMount:n}):o.type==="always"?p.jsx(Mm,{...r,ref:t}):null});Am.displayName=Qn;var B4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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(JS,{"data-state":i?"visible":"hidden",...r,ref:t})})}),H4=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vn(Qn,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"))})})}),JS=m.forwardRef((e,t)=>{const n=vn(Qn,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=vn(Qn,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=oC(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=vn(Qn,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(tC,{"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),iC(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=vn(Qn,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(tC,{"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),iC(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,eC]=XS(Qn),tC=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=vn(Qn,n),[S,w]=m.useState(null),E=De(t,D=>w(D)),b=m.useRef(null),N=m.useRef(""),k=x.viewport,P=r.content-r.viewport,M=pt(g),R=pt(d),_=Vd(h,10);function $(D){if(b.current){const H=D.clientX-b.current.left,j=D.clientY-b.current.top;f({x:H,y:j})}}return m.useEffect(()=>{const D=H=>{const j=H.target;S?.contains(j)&&M(H,P)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[k,S,P,M]),m.useEffect(R,[r,R]),pi(S,_),pi(x.content,_),p.jsx(K4,{scope:n,scrollbar:S,hasThumb:o,onThumbChange:pt(i),onThumbPointerUp:pt(l),onThumbPositionChange:R,onThumbPointerDown:pt(c),children:p.jsx(Ne.div,{...v,ref:E,style:{position:"absolute",...v.style},onPointerDown:ve(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),b.current=S.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),$(D))}),onPointerMove:ve(e.onPointerMove,$),onPointerUp:ve(e.onPointerUp,D=>{const H=D.target;H.hasPointerCapture(D.pointerId)&&H.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),Zu="ScrollAreaThumb",nC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=eC(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=vn(Zu,n),l=eC(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(Ne.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)})});nC.displayName=Zu;var Dm="ScrollAreaCorner",rC=m.forwardRef((e,t)=>{const n=vn(Dm,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(Y4,{...e,ref:t}):null});rC.displayName=Dm;var Y4=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=vn(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(Ne.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 oC(e,t){const n=e/t;return isNaN(n)?0:n}function zd(e){const t=oC(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 sC([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 sC([0,l],[0,c])(f)}function sC(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 iC(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);xt(()=>{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 aC=qS,Z4=QS,Q4=rC;const Di=m.forwardRef(({className:e,children:t,viewportRef:n,viewportClassName:r,type:o="hover",...i},l)=>p.jsxs(aC,{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=aC.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(nC,{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"],fo=Math.min,nn=Math.max,Ju=Math.round,hu=Math.floor,Gn=e=>({x:e,y:e}),eV={left:"right",right:"left",bottom:"top",top:"bottom"};function Pg(e,t,n){return nn(e,fo(t,n))}function Sr(e,t){return typeof e=="function"?e(t):e}function Cr(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 Kn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $m(e){return jm(Kn(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(Cr(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=Cr(e);return eV[t]+e.slice(t.length)}function aV(e){return{top:0,right:0,bottom:0,left:0,...e}}function lC(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=Kn(t),l=$m(t),c=Om(l),d=Cr(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}=Sr(t,e),S=lC(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},M=td(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:k,strategy:d}):N);return{top:(b.top-M.top+S.top)/P.y,bottom:(M.bottom-b.bottom+S.bottom)/P.y,left:(b.left-M.left+S.left)/P.x,right:(M.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:M,reset:R}=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],...M},R&&x<cV&&(x++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(f=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):R.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}=Sr(e,t)||{};if(f==null)return{};const h=lC(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],M=v[x]-i.reference[x],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let _=R?R[k]:0;(!_||!await(l.isElement==null?void 0:l.isElement(R)))&&(_=c.floating[k]||i.floating[S]);const $=P/2-M/2,D=_/2-w[S]/2-1,H=fo(h[b],D),j=fo(h[N],D),U=H,Y=_-w[S]-j,I=_/2-w[S]/2+$,B=Pg(U,I,Y),A=!d.arrow&&ji(o)!=null&&I!==B&&i.reference[S]/2-(I<U?H:j)-w[S]/2<0,V=A?I<U?I-U:I-Y:0;return{[x]:v[x]+V,data:{[x]:B,centerOffset:I-B-V,...A&&{alignmentOffset:V}},reset:A}}}),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}=Sr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Cr(o),N=Kn(c),k=Cr(c)===c,P=await(d.isRTL==null?void 0:d.isRTL(f.floating)),M=v||(k||!w?[ed(c)]:nV(c)),R=S!=="none";!v&&R&&M.push(...iV(c,w,S,P));const _=[c,...M],$=await d.detectOverflow(t,E),D=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(g&&D.push($[b]),h){const I=tV(o,l,P);D.push($[I[0]],$[I[1]])}if(H=[...H,{placement:o,overflows:D}],!D.every(I=>I<=0)){var j,U;const I=(((j=i.flip)==null?void 0:j.index)||0)+1,B=_[I];if(B&&(!(h==="alignment"?N!==Kn(B):!1)||H.every(F=>Kn(F.placement)===N?F.overflows[0]>0:!0)))return{data:{index:I,overflows:H},reset:{placement:B}};let A=(U=H.filter(V=>V.overflows[0]<=0).sort((V,F)=>V.overflows[1]-F.overflows[1])[0])==null?void 0:U.placement;if(!A)switch(x){case"bestFit":{var Y;const V=(Y=H.filter(F=>{if(R){const W=Kn(F.placement);return W===N||W==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(W=>W>0).reduce((W,q)=>W+q,0)]).sort((F,W)=>F[1]-W[1])[0])==null?void 0:Y[0];V&&(A=V);break}case"initialPlacement":A=c;break}if(o!==A)return{reset:{placement:A}}}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}=Sr(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{}}}}},cC=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=Cr(n),c=ji(n),d=Kn(n)==="y",f=cC.has(l)?-1:1,g=i&&d?-1:1,h=Sr(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}=Sr(e,t),g={x:n,y:r},h=await i.detectOverflow(t,f),v=Kn(Cr(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}=Sr(e,t),g={x:n,y:r},h=Kn(o),v=jm(h);let x=g[v],S=g[h];const w=Sr(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,M=i.reference[v]+i.reference[k]-E.mainAxis;x<P?x=P:x>M&&(x=M)}if(f){var b,N;const k=v==="y"?"width":"height",P=cC.has(Cr(o)),M=i.reference[h]-i.floating[k]+(P&&((b=l.offset)==null?void 0:b[h])||0)+(P?0:E.crossAxis),R=i.reference[h]+i.reference[k]+(P?0:((N=l.offset)==null?void 0:N[h])||0)-(P?E.crossAxis:0);S<M?S=M:S>R&&(S=R)}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}=Sr(e,t),g=await l.detectOverflow(t,f),h=Cr(o),v=ji(o),x=Kn(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=fo(w-g[E],N),M=fo(S-g[b],k),R=!t.middlewareData.shift;let _=P,$=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=N),R&&!v){const H=nn(g.left,0),j=nn(g.right,0),U=nn(g.top,0),Y=nn(g.bottom,0);x?$=S-2*(H!==0||j!==0?H+j:nn(g.left,g.right)):_=w-2*(U!==0||Y!==0?U+Y:nn(g.top,g.bottom))}await d({...t,availableWidth:$,availableHeight:_});const D=await l.getDimensions(c.floating);return S!==D.width||w!==D.height?{reset:{rects:!0}}:{}}}};function Bd(){return typeof window<"u"}function Oi(e){return uC(e)?(e.nodeName||"").toLowerCase():"#document"}function on(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Jn(e){var t;return(t=(uC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uC(e){return Bd()?e instanceof Node||e instanceof on(e).Node:!1}function Mn(e){return Bd()?e instanceof Element||e instanceof on(e).Element:!1}function Tr(e){return Bd()?e instanceof HTMLElement||e instanceof on(e).HTMLElement:!1}function bw(e){return!Bd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof on(e).ShadowRoot}function kl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Dn(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 Hd(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/,Ho=e=>!!e&&e!=="none";let Hh;function Lm(e){const t=Mn(e)?Dn(e):e;return Ho(t.transform)||Ho(t.translate)||Ho(t.scale)||Ho(t.rotate)||Ho(t.perspective)||!Fm()&&(Ho(t.backdropFilter)||Ho(t.filter))||wV.test(t.willChange||"")||bV.test(t.contain||"")}function SV(e){let t=po(e);for(;Tr(t)&&!hi(t);){if(Lm(t))return t;if(Hd(t))return null;t=po(t)}return null}function Fm(){return Hh==null&&(Hh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hh}function hi(e){return/^(html|body|#document)$/.test(Oi(e))}function Dn(e){return on(e).getComputedStyle(e)}function Wd(e){return Mn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function po(e){if(Oi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bw(e)&&e.host||Jn(e);return bw(t)?t.host:t}function dC(e){const t=po(e);return hi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tr(t)&&kl(t)?t:dC(t)}function sl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=dC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=on(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 fC(e){const t=Dn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Tr(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 Mn(e)?e:e.contextElement}function ci(e){const t=zm(e);if(!Tr(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fC(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=Gn(0);function pC(e){const t=on(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!==on(e)?!1:t}function rs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zm(e);let l=Gn(1);t&&(r?Mn(r)&&(l=ci(r)):l=ci(e));const c=EV(i,n,r)?pC(i):Gn(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=on(i),x=r&&Mn(r)?on(r):r;let S=v,w=Ig(S);for(;w&&r&&x!==S;){const E=ci(w),b=w.getBoundingClientRect(),N=Dn(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=on(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:rs(Jn(e)).left+n}function hC(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=Jn(r),c=t?Hd(t.floating):!1;if(r===l||c&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Gn(1);const g=Gn(0),h=Tr(r);if((h||!h&&!i)&&((Oi(r)!=="body"||kl(l))&&(d=Wd(r)),h)){const x=rs(r);f=ci(r),g.x=x.x+r.clientLeft,g.y=x.y+r.clientTop}const v=l&&!h&&!i?hC(l,d):Gn(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=Jn(e),n=Wd(e),r=e.ownerDocument.body,o=nn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ud(e);const c=-n.scrollTop;return Dn(r).direction==="rtl"&&(l+=nn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}const Sw=25;function PV(e,t){const n=on(e),r=Jn(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=rs(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Tr(e)?ci(e):Gn(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(Jn(e));else if(Mn(t))r=RV(t,n);else{const o=pC(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return td(r)}function gC(e,t){const n=po(e);return n===t||!Mn(n)||hi(n)?!1:Dn(n).position==="fixed"||gC(n,t)}function IV(e,t){const n=t.get(e);if(n)return n;let r=sl(e,[],!1).filter(c=>Mn(c)&&Oi(c)!=="body"),o=null;const i=Dn(e).position==="fixed";let l=i?po(e):e;for(;Mn(l)&&!hi(l);){const c=Dn(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&&gC(e,l))?r=r.filter(g=>g!==l):o=c,l=po(l)}return t.set(e,r),r}function _V(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?Hd(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=nn(x.top,d),f=fo(x.right,f),g=fo(x.bottom,g),h=nn(x.left,h)}return{width:f-h,height:g-d,x:h,y:d}}function AV(e){const{width:t,height:n}=fC(e);return{width:t,height:n}}function MV(e,t,n){const r=Tr(t),o=Jn(t),i=n==="fixed",l=rs(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Gn(0);function f(){d.x=Ud(o)}if(r||!r&&!i)if((Oi(t)!=="body"||kl(o))&&(c=Wd(t)),r){const x=rs(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?hC(o,c):Gn(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 Dn(e).position==="static"}function Ew(e,t){if(!Tr(e)||Dn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Jn(e)===n&&(n=n.ownerDocument.body),n}function mC(e,t){const n=on(e);if(Hd(e))return n;if(!Tr(e)){let o=po(e);for(;o&&!hi(o);){if(Mn(o)&&!Wh(o))return o;o=po(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||mC,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 Dn(e).direction==="rtl"}const OV={convertOffsetParentRelativeRectToViewportRelativeRect:NV,getDocumentElement:Jn,getClippingRect:_V,getOffsetParent:mC,getElementRects:DV,getClientRects:kV,getDimensions:AV,getScale:ci,isElement:Mn,isRTL:jV};function yC(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=Jn(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:nn(0,fo(1,d))||1};let P=!0;function M(R){const _=R[0].intersectionRatio;if(_!==d){if(!P)return l();_?l(!1,_):r=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!yC(f,e.getBoundingClientRect())&&l(),P=!1}try{n=new IntersectionObserver(M,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,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?rs(e):null;d&&E();function E(){const b=rs(e);w&&!yC(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,BV=vV,HV=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 vC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kw(e,t){const n=vC(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(F=>{F!==R.current&&(R.current=F,w(F))},[]),k=m.useCallback(F=>{F!==_.current&&(_.current=F,b(F))},[]),P=i||S,M=l||E,R=m.useRef(null),_=m.useRef(null),$=m.useRef(g),D=d!=null,H=Uh(d),j=Uh(o),U=Uh(f),Y=m.useCallback(()=>{if(!R.current||!_.current)return;const F={placement:t,strategy:n,middleware:v};j.current&&(F.platform=j.current),UV(R.current,_.current,F).then(W=>{const q={...W,isPositioned:U.current!==!1};I.current&&!nd($.current,q)&&($.current=q,ps.flushSync(()=>{h(q)}))})},[v,t,n,j,U]);ju(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[f]);const I=m.useRef(!1);ju(()=>(I.current=!0,()=>{I.current=!1}),[]),ju(()=>{if(P&&(R.current=P),M&&(_.current=M),P&&M){if(H.current)return H.current(P,M,Y);Y()}},[P,M,Y,H,D]);const B=m.useMemo(()=>({reference:R,floating:_,setReference:N,setFloating:k}),[N,k]),A=m.useMemo(()=>({reference:P,floating:M}),[P,M]),V=m.useMemo(()=>{const F={position:n,left:0,top:0};if(!A.floating)return F;const W=kw(A.floating,g.x),q=kw(A.floating,g.y);return c?{...F,transform:"translate("+W+"px, "+q+"px)",...vC(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:q}},[n,c,A.floating,g.x,g.y]);return m.useMemo(()=>({...g,update:Y,refs:B,elements:A,floatingStyles:V}),[g,Y,B,A,V])}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]}},eB=(e,t)=>{const n=BV(e);return{name:n.name,fn:n.fn,options:[e,t]}},tB=(e,t)=>{const n=HV(e);return{name:n.name,fn:n.fn,options:[e,t]}},nB=(e,t)=>{const n=XV(e);return{name:n.name,fn:n.fn,options:[e,t]}};var rB="Arrow",xC=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(Ne.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"})})});xC.displayName=rB;var oB=xC;function Vm(e){const[t,n]=m.useState(void 0);return xt(()=>{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 Bm="Popper",[wC,$i]=Lt(Bm),[sB,bC]=wC(Bm),SC=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return p.jsx(sB,{scope:t,anchor:r,onAnchorChange:o,children:n})};SC.displayName=Bm;var CC="PopperAnchor",EC=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=bC(CC,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(Ne.div,{...o,ref:c})});EC.displayName=CC;var Hm="PopperContent",[iB,aB]=wC(Hm),NC=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=bC(Hm,n),[b,N]=m.useState(null),k=De(t,Z=>N(Z)),[P,M]=m.useState(null),R=Vm(P),_=R?.width??0,$=R?.height??0,D=r+(i!=="center"?"-"+i:""),H=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},j=Array.isArray(f)?f:[f],U=j.length>0,Y={padding:H,boundary:j.filter(cB),altBoundary:U},{refs:I,floatingStyles:B,placement:A,isPositioned:V,middlewareData:F}=YV({strategy:"fixed",placement:D,whileElementsMounted:(...Z)=>LV(...Z,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[qV({mainAxis:o+$,alignmentAxis:l}),d&&ZV({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?QV():void 0,...Y}),d&&JV({...Y}),eB({...Y,apply:({elements:Z,rects:K,availableWidth:re,availableHeight:ce})=>{const{width:me,height:ge}=K.reference,pe=Z.floating.style;pe.setProperty("--radix-popper-available-width",`${re}px`),pe.setProperty("--radix-popper-available-height",`${ce}px`),pe.setProperty("--radix-popper-anchor-width",`${me}px`),pe.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),P&&nB({element:P,padding:c}),uB({arrowWidth:_,arrowHeight:$}),v&&tB({strategy:"referenceHidden",...Y})]}),[W,q]=PC(A),L=pt(S);xt(()=>{V&&L?.()},[V,L]);const z=F.arrow?.x,X=F.arrow?.y,Q=F.arrow?.centerOffset!==0,[te,ne]=m.useState();return xt(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(iB,{scope:n,placedSide:W,onArrowChange:M,arrowX:z,arrowY:X,shouldHideArrow:Q,children:p.jsx(Ne.div,{"data-side":W,"data-align":q,...w,ref:k,style:{...w.style,animation:V?void 0:"none"}})})})});NC.displayName=Hm;var kC="PopperArrow",lB={top:"bottom",right:"left",bottom:"top",left:"right"},TC=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=aB(kC,r),l=lB[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(oB,{...o,ref:n,style:{...o.style,display:"block"}})})});TC.displayName=kC;function cB(e){return e!==null}var uB=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]=PC(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 PC(e){const[t,n="center"]=e.split("-");return[t,n]}var Wm=SC,Um=EC,Km=NC,Gm=TC,dB=Symbol("radix.slottable");function fB(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=dB,t}var RC=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"}),pB="VisuallyHidden",Kd=m.forwardRef((e,t)=>p.jsx(Ne.span,{...e,ref:t,style:{...RC,...e.style}}));Kd.displayName=pB;var hB=Kd,[Gd]=Lt("Tooltip",[$i]),Yd=$i(),IC="TooltipProvider",gB=700,_g="tooltip.open",[mB,Ym]=Gd(IC),_C=e=>{const{__scopeTooltip:t,delayDuration:n=gB,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(mB,{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})};_C.displayName=IC;var il="Tooltip",[yB,Tl]=Gd(il),AC=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]=ln({prop:r,defaultProp:o??!1,onChange:_=>{_?(d.onOpen(),document.dispatchEvent(new CustomEvent(_g))):d.onClose(),i?.(_)},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]),M=m.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),R=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(yB,{scope:t,contentId:v,open:b,stateAttribute:k,trigger:g,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{d.isOpenDelayedRef.current?R():P()},[d.isOpenDelayedRef,R,P]),onTriggerLeave:m.useCallback(()=>{S?M():(window.clearTimeout(x.current),x.current=0)},[M,S]),onOpen:P,onClose:M,disableHoverableContent:S,children:n})})};AC.displayName=il;var Ag="TooltipTrigger",MC=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(Ne.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)})})});MC.displayName=Ag;var Xm="TooltipPortal",[vB,xB]=Gd(Xm,{forceMount:void 0}),DC=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Tl(Xm,t);return p.jsx(vB,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(Mi,{asChild:!0,container:o,children:r})})})};DC.displayName=Xm;var gi="TooltipContent",jC=m.forwardRef((e,t)=>{const n=xB(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(OC,{side:o,...i,ref:t}):p.jsx(wB,{side:o,...i,ref:t})})}),wB=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=NB(b,E.getBoundingClientRect()),k=kB(b,N),P=TB(w.getBoundingClientRect()),M=RB([...k,...P]);c(M),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=!PB(b,l);N?v():k&&(v(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[d,g,l,f,v]),p.jsx(OC,{...e,ref:i})}),[bB,SB]=Gd(il,{isInside:!1}),CB=fB("TooltipContent"),OC=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(CB,{children:r}),p.jsx(bB,{scope:n,isInside:!0,children:p.jsx(hB,{id:d.contentId,role:"tooltip",children:o||r})})]})})});jC.displayName=gi;var $C="TooltipArrow",EB=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Yd(n);return SB($C,n).isInside?null:p.jsx(Gm,{...o,...r,ref:t})});EB.displayName=$C;function NB(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 kB(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 TB(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 PB(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 RB(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),IB(t)}function IB(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 _B=_C,AB=AC,MB=MC,DB=DC,LC=jC;const FC=_B,al=AB,ll=MB,mi=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(DB,{children:p.jsx(LC,{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=LC.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},jB=(e=>e?Tw(e):Tw),OB=e=>e;function $B(e,t=OB){const n=qe.useSyncExternalStore(e.subscribe,qe.useCallback(()=>t(e.getState()),[e,t]),qe.useCallback(()=>t(e.getInitialState()),[e,t]));return qe.useDebugValue(n),n}const Pw=e=>{const t=jB(e),n=r=>$B(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}})})),LB=(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}))}})},ao=1,qa=1,FB=[];function zB(e){const t=new Map;for(const n of e){if(!Number.isInteger(n.from)||n.from<qa||n.from>=ao)throw new Error(`[migration] from must be an integer in [${qa}, ${ao}), 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<ao;n++)if(!t.has(n))throw new Error(`[migration] missing migration from ${n} -> ${n+1}`);return t}const VB=zB(FB);function BB(e){const t=e.schemaVersion;return typeof t=="number"&&Number.isInteger(t)&&t>=qa?t:qa}function HB(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=BB(t);if(n>ao)throw new Error(`[migration] schemaVersion ${n} is newer than this build supports (${ao})`);for(let r=n;r<ao;r++)t=VB.get(r).migrate(t);return t.schemaVersion=ao,t}const WB=new Set(E1);function UB(e){const t=e.canvases[He];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:ao,nodes:n,edges:r,functions:i,declaredVariables:o,channels:l,memory:c,models:d}}function KB(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[He]={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(!WB.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 GB(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 YB=50,Mg=new Set;function Zd(){Mg.forEach(e=>e())}function _w(e){return Mg.add(e),()=>Mg.delete(e)}const vr=new Map;vr.set(He,qm());function qm(){const e=Xd(LB({limit:YB,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 vr.get(e)}function Qe(e){if(!vr.has(e)){const t=qm();if(e!==He){const n=an(),r={id:n,type:xe.Trigger,position:{x:100,y:100},data:{id:n,type:"OnFunctionCall",arguments:{}}};t.getState().initialize([r],[])}vr.set(e,t)}return vr.get(e)}function Qm(){const e={};return vr.forEach((t,n)=>{e[n]=t}),e}function XB(e){e!==He&&(vr.delete(e),Zd())}function Aw(){vr.clear(),vr.set(He,qm()),Zd()}const ja={kind:"none"};function qs(e){Zm(e)?.getState().setRFselect([],[])}const ue=Xd((e,t)=>({activeCanvasId:He,builderMode:{type:"edit"},selection:ja,activeSidebarTab:"nodes",channels:{},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}),Qe(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,gr.t.bind(gr))}const ey=()=>{const e=$t.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 $t.getByType(l.type)},[n]),o=m.useCallback(l=>{const c=$t.getByCategory(l);return l===xe.Function?[...c,...n]:c},[n]),i=m.useCallback(()=>{const l=$t.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}},qB=({canvasId:e,onSelectNode:t,onSelectEdge:n})=>{const{t:r}=Xe(),{getNodeDefinition:o}=ey(),i=Ye(h=>h.byNodeId),l=Ye(h=>h.byEdgeId),c=Qe(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(M=>M.id===h),S=x?d.find(M=>M.id===x.source):void 0,w=x?d.find(M=>M.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(M=>M.severity==="error").length,warningCount:v.filter(M=>M.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(D1,{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(ZB,{group:h,onSelect:()=>h.entityType==="node"?t(h.entityId):n(h.entityId)},`${h.entityType}-${h.entityId}`))})};function ZB({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(uo,{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(uo,{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(go,{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 os=m.forwardRef(({icon:e=es,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]}));os.displayName="AddButton";function On(e){return e.type!=="edit"}function Jd({items:e,selectedId:t,onSelect:n,diagnosticsSlot:r,badge:o,emptyIcon:i,emptyText:l,emptyHint:c,addActions:d}){const f=ue(h=>On(h.builderMode)),g=p.jsx("div",{className:"flex flex-col gap-1.5",children:d.map(({label:h,icon:v,onAdd:x})=>p.jsx(os,{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(go,{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 QB=({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:L1,emptyText:n("noFunctions"),emptyHint:n("addFunctionHint"),addActions:[{label:n("addFunction"),icon:es,onAdd:()=>t()}]})};var ef="Collapsible",[JB]=Lt(ef),[eH,ty]=JB(ef),zC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:l,...c}=e,[d,f]=ln({prop:r,defaultProp:o??!1,onChange:l,caller:ef});return p.jsx(eH,{scope:n,disabled:i,contentId:kt(),open:d,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),children:p.jsx(Ne.div,{"data-state":ry(d),"data-disabled":i?"":void 0,...c,ref:t})})});zC.displayName=ef;var VC="CollapsibleTrigger",BC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ty(VC,n);return p.jsx(Ne.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)})});BC.displayName=VC;var ny="CollapsibleContent",HC=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(tH,{...r,ref:t,present:i})})});HC.displayName=ny;var tH=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)},[]),xt(()=>{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(Ne.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 nH=zC;const rH=nH,oH=BC,sH=HC,iH=mo("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(iH({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},aH={[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 lH(e,t,n){return n.description?e(`${t}.params.${n.id}.description`,{defaultValue:n.description}):""}function cH(e,t,n){return e(`edges.${n}.description`,{defaultValue:t.description})}const uH=e=>{switch(e){case"string":return B0;case"number":case"int":case"float":return Cz;case"boolean":case"bool":return Mz;case"dropdown":case"selection":return Ii;default:return B0}},dH=(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}},fH=({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=uH(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(uo,{variant:"secondary",className:"text-xs",children:t("optional")}):p.jsx(uo,{variant:"destructive",className:"text-xs",children:t("required")})]}),p.jsxs("div",{className:"text-xs text-muted-foreground pl-5",children:[t("typeLabel")," ",dH(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)})]}),pH=({onAddNode:e,nodeDefinitions:t,getAllCategories:n,functions:r,isFunctionCanvas:o})=>{const{t:i}=Xe(),l=ue(b=>On(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($1,{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(FC,{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(R=>R.category===b);if(N.length===0)return null;const k=w(b),P=oy[b],M=aH[b]??"bg-muted text-muted-foreground border-border";return p.jsxs(rH,{open:k,onOpenChange:()=>S(b),children:[p.jsxs(oH,{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(sH,{children:p.jsx("div",{className:"grid grid-cols-2 gap-1.5 px-1 pt-1.5 pb-2",children:N.map(R=>{const _=R.parameters,$=`${R.type}-${"functionInfo"in R?R.functionInfo.id:""}`,D=_.length>0,H=WC(i,R),j=R.tags?.[0],U=p.jsxs("button",{type:"button",draggable:!l,onDragStart:l?void 0:I=>{const B={nodeDef:R};I.dataTransfer.setData("application/json",JSON.stringify(B)),I.dataTransfer.effectAllowed="copy"},onClick:l?void 0:()=>e(R),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 ${M}`,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:R.label}),j&&p.jsx(uo,{variant:"secondary",className:"absolute top-1 right-1 text-[9px] h-3.5 px-1 font-normal leading-none",children:j})]});return H||D?p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:U}),p.jsx(mi,{side:"right",className:"max-w-sm pointer-events-none",children:p.jsxs("div",{className:"space-y-2",children:[H&&p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:H}),D&&p.jsx(fH,{parameters:_,t:i})]})})]},$):p.jsx(qe.Fragment,{children:U},$)})})})]},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&&!kr(r,t,!1)||"default"in r&&r.default!==void 0&&(n[r.id]=r.default));return n}function hH(e="GPIOIN"){const t=an(),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 gH(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 mH=()=>{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:j1,emptyText:e("noChannels"),emptyHint:e("noChannelsHint"),addActions:[{label:e("addChannel"),icon:es,onAdd:()=>r(hH("GPIOIN").id)}]})},yH={MemoryFile:"memory",VectorDatabase:"vectordb"};function vH(e){const t=an(),n=Object.values(ue.getState().memory).map(o=>o.label),r={id:t,label:yi(yH[e],n),type:e,arguments:UC(Nd.getByType(e)?.parameters??[])};return ue.getState().setMemory(o=>({...o,[t]:r})),r}function Mw(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 xH(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 wH={MemoryFile:"File",VectorDatabase:"Vector"},bH=()=>{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(vH(l).id);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="memory"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:l=>wH[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:O1,onAdd:()=>i("MemoryFile")},{label:e("addVectorDatabase","Add Vector Database"),icon:bg,onAdd:()=>i("VectorDatabase")}]})},SH={LLMModel:"model"};function CH(e){const t=an(),n=Object.values(ue.getState().models).map(o=>o.label),r={id:t,label:yi(SH[e],n),type:e,arguments:UC(kd.getByType(e)?.parameters??[])};return ue.getState().setModels(o=>({...o,[t]:r})),r}function Dw(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 EH(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 NH=()=>{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:A1,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:es,onAdd:()=>r(CH("LLMModel").id)}]})},Li=(e=He)=>{const t=Qe(e),n=t(o=>o.variables),r=t(o=>o.edges);return m.useMemo(()=>dm(n,r),[n,r])};function kH(e){let t=1;for(;e.includes(`var${t}`);)t++;return`var${t}`}function TH(e){const t=Qe(e);t.takeCheckpoint();const n=Object.values(t.getState().variables).filter(i=>i.kind==="declared").map(i=>i.name),r=an(),o={kind:"declared",uid:r,name:kH(n),dataType:"int"};return t.getState().setVariables(i=>({...i,[Pi(r)]:o})),r}function Ba(e,t,n){const r=Qe(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 PH(e,t,n){Ba(e,t,{dataType:n,initialValue:void 0})}function RH(e,t){const n=Qe(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 IH=({canvasId:e,onSelectNode:t})=>{const n=ue(b=>On(b.builderMode)),{t:r}=Xe(),{list:o}=Li(e),i=ue(b=>b.selection),l=ue(b=>b.selectVariable),d=Qe(e)(b=>b.variables),f=e===He,g=qe.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=TH(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(os,{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(os,{onClick:h,children:r("addVariable")})]})]})]})};var _H=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AH=_H.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}},{}),MH="Label",GC=m.forwardRef((e,t)=>p.jsx(AH.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=MH;var YC=GC;const DH=mo("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(DH(),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",[jH]=Lt(tf),[OH,$H]=jH(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]=ln({prop:o,defaultProp:i??!1,onChange:f,caller:tf});return p.jsxs(OH,{scope:n,checked:b,disabled:c,children:[p.jsx(Ne.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=$H(qC,n);return p.jsx(Ne.span,{"data-state":JC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});ZC.displayName=qC;var LH="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=LH;function JC(e){return e?"checked":"unchecked"}var eE=XC,FH=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(FH,{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 ss=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 zH(){const e=Qe(He).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 VH=()=>{const{t:e}=Xe(),t=ss(o=>o.context),n=ss(o=>o.updateContextVar),r=zH();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)})})},BH=({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:j1,label:x("channels")},{id:"memory",icon:bg,label:x("memoryFiles","Memory")},{id:"models",icon:A1,label:x("models","AI Models")},{id:"functions",icon:mz,label:x("functions")},{id:"diagnostics",icon:go,label:x("diagnostics")}],[x]),w=m.useMemo(()=>[{id:"debug-context",icon:vz,label:x("debug.context")}],[x]),E=Ye(I=>{let B=0;for(const A of Object.values(I.byNodeId))for(const V of A)V.severity==="error"&&B++;for(const A of Object.values(I.byEdgeId))for(const V of A)V.severity==="error"&&B++;return B}),b=Ye(I=>{let B=0;for(const A of Object.values(I.byNodeId))for(const V of A)V.severity==="warning"&&B++;for(const A of Object.values(I.byEdgeId))for(const V of A)V.severity==="warning"&&B++;return B}),N=Ye(I=>{let B=0;for(const A of Object.values(I.byChannelId))for(const V of A)V.severity==="error"&&B++;return B}),k=Ye(I=>{let B=0;for(const A of Object.values(I.byChannelId))for(const V of A)V.severity==="warning"&&B++;return B}),P=Ye(I=>{let B=0;for(const A of Object.values(I.byMemoryId))for(const V of A)V.severity==="error"&&B++;return B}),M=Ye(I=>{let B=0;for(const A of Object.values(I.byMemoryId))for(const V of A)V.severity==="warning"&&B++;return B}),R=Ye(I=>{let B=0;for(const A of Object.values(I.byModelId))for(const V of A)V.severity==="error"&&B++;return B}),_=Ye(I=>{let B=0;for(const A of Object.values(I.byModelId))for(const V of A)V.severity==="warning"&&B++;return B}),$=Ye(I=>{let B=0;for(const A of Object.values(I.byFunctionId))for(const V of A)V.severity==="error"&&B++;return B}),D=Ye(I=>{let B=0;for(const A of Object.values(I.byFunctionId))for(const V of A)V.severity==="warning"&&B++;return B}),H=m.useMemo(()=>v?w:S,[v,w,S]),j=I=>{n(t===I?null:I)},U=()=>{switch(t){case"nodes":return p.jsx(pH,{onAddNode:r,nodeDefinitions:o,getAllCategories:i,functions:f,isFunctionCanvas:!!d});case"variables":return p.jsx(IH,{canvasId:e,onSelectNode:l});case"channels":return p.jsx(mH,{});case"memory":return p.jsx(bH,{});case"models":return p.jsx(NH,{});case"functions":return p.jsx(QB,{onOpenFunction:g,onCreateFunction:h});case"diagnostics":return p.jsx(qB,{canvasId:e,onSelectNode:l,onSelectEdge:c});case"debug-context":return p.jsx(VH,{});default:return null}},Y=I=>H.find(A=>A.id===I)?.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:H.map(I=>{const B=I.icon,A=t===I.id;let V=0,F=0;I.id==="diagnostics"?(V=E,F=b):I.id==="channels"?(V=N,F=k):I.id==="memory"?(V=P,F=M):I.id==="models"?(V=R,F=_):I.id==="functions"&&(V=$,F=D);const W=V+F,q=W>0,L=q&&!A?V>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:z=>{z.detail!==0&&z.currentTarget.blur(),j(I.id)},className:Ce("w-10 h-10 transition-all duration-200 relative",A?"bg-accent text-primary shadow-sm":L??"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:[p.jsx(B,{className:"w-5 h-5"}),q&&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",V>0?"bg-destructive text-destructive-foreground":"bg-warning text-warning-foreground"),children:W})]})}),p.jsx(mi,{side:"right",sideOffset:8,children:I.label})]},I.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:Y(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:U()})]})})]})},HH=({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===He,x=m.useCallback(()=>{c.current=null,f(null),h(null)},[]),S=m.useCallback((w,E)=>{if(c.current===null||!i.current||e[E]?.id===He)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,M=P?E:E+1,R=P?b.left-N.left:b.right-N.left,_=Math.round(Math.max(0,Math.min(R,i.current.clientWidth-2)));f(M),h(_)},[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(qe.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(L1,{className:"w-3.5 h-3.5 shrink-0"}),p.jsx("span",{className:"truncate max-w-[120px] py-1",children:w.label}),w.id!==He?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=An(t);return n.some(o=>o.target===e&&r.input.some(i=>i.type==="tool"&&i.id===o.targetHandle))}function WH(e,t,n){const r=An(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){const o=An(e).output.find(i=>i.id===t);return!(!o||o.type==="control"&&!$t.getByType(e.type)?.canBranch&&n.some(i=>i.source===e.id&&i.sourceHandle===t)||o.type==="control"&&tE(e.id,e,n))}function UH(e,t,n,r,o,i){const l=n.find(g=>g.id===e);if(!l)return[];const d=An(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:An({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(l.data,n,i))return!1;const d=An(l.data),f=An(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"&&WH(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 KH={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 GH(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=GH(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((o=(e=r[i]).type)&&(o=YH(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]=jw(n[o],e.name,t);else if(t==null)for(o in n)n[o]=jw(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 YH(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function jw(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=KH,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 Ow={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)),Ow.hasOwnProperty(t)?{space:Ow[t],local:e}:e}function XH(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 qH(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rE(e){var t=of(e);return(t.local?qH:XH)(t)}function ZH(){}function iy(e){return e==null?ZH:function(){return this.querySelector(e)}}function QH(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 cn(r,this._parents)}function JH(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function e8(){return[]}function oE(e){return e==null?e8:function(){return this.querySelectorAll(e)}}function t8(e){return function(){return JH(e.apply(this,arguments))}}function n8(e){typeof e=="function"?e=t8(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 cn(r,o)}function sE(e){return function(){return this.matches(e)}}function iE(e){return function(t){return t.matches(e)}}var r8=Array.prototype.find;function o8(e){return function(){return r8.call(this.children,e)}}function s8(){return this.firstElementChild}function i8(e){return this.select(e==null?s8:o8(typeof e=="function"?e:iE(e)))}var a8=Array.prototype.filter;function l8(){return Array.from(this.children)}function c8(e){return function(){return a8.call(this.children,e)}}function u8(e){return this.selectAll(e==null?l8:c8(typeof e=="function"?e:iE(e)))}function d8(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 cn(r,this._parents)}function aE(e){return new Array(e.length)}function f8(){return new cn(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 p8(e){return function(){return e}}function h8(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 g8(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 m8(e){return e.__data__}function y8(e,t){if(!arguments.length)return Array.from(this,m8);var n=t?g8:h8,r=this._parents,o=this._groups;typeof e!="function"&&(e=p8(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=v8(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,M;N<S;++N)if(P=w[N]){for(N>=k&&(k=N+1);!(M=E[k])&&++k<S;);P._next=M||null}}return l=new cn(l,r),l._enter=c,l._exit=d,l}function v8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function x8(){return new cn(this._exit||this._groups.map(aE),this._parents)}function w8(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 b8(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 cn(c,this._parents)}function S8(){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 C8(e){e||(e=E8);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 cn(o,this._parents).order()}function E8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function N8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function k8(){return Array.from(this)}function T8(){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 P8(){let e=0;for(const t of this)++e;return e}function R8(){return!this.node()}function I8(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 _8(e){return function(){this.removeAttribute(e)}}function A8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M8(e,t){return function(){this.setAttribute(e,t)}}function D8(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function j8(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function O8(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 $8(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?A8:_8:typeof t=="function"?n.local?O8:j8:n.local?D8:M8)(n,t))}function lE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function L8(e){return function(){this.style.removeProperty(e)}}function F8(e,t,n){return function(){this.style.setProperty(e,t,n)}}function z8(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function V8(e,t,n){return arguments.length>1?this.each((t==null?L8:typeof t=="function"?z8:F8)(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 H8(e,t){return function(){this[e]=t}}function W8(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function U8(e,t){return arguments.length>1?this.each((t==null?B8:typeof t=="function"?W8:H8)(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 K8(e){return function(){dE(this,e)}}function G8(e){return function(){fE(this,e)}}function Y8(e,t){return function(){(t.apply(this,arguments)?dE:fE)(this,e)}}function X8(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"?Y8:t?K8:G8)(n,t))}function q8(){this.textContent=""}function Z8(e){return function(){this.textContent=e}}function Q8(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function J8(e){return arguments.length?this.each(e==null?q8:(typeof e=="function"?Q8:Z8)(e)):this.node().textContent}function e6(){this.innerHTML=""}function t6(e){return function(){this.innerHTML=e}}function n6(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function r6(e){return arguments.length?this.each(e==null?e6:(typeof e=="function"?n6:t6)(e)):this.node().innerHTML}function o6(){this.nextSibling&&this.parentNode.appendChild(this)}function s6(){return this.each(o6)}function i6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a6(){return this.each(i6)}function l6(e){var t=typeof e=="function"?e:rE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function c6(){return null}function u6(e,t){var n=typeof e=="function"?e:rE(e),r=t==null?c6:typeof t=="function"?t:iy(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function d6(){var e=this.parentNode;e&&e.removeChild(this)}function f6(){return this.each(d6)}function p6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function h6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function g6(e){return this.select(e?h6:p6)}function m6(e){return arguments.length?this.property("__data__",e):this.node().__data__}function y6(e){return function(t){e.call(this,t,this.__data__)}}function v6(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 x6(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 w6(e,t,n){return function(){var r=this.__on,o,i=y6(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 b6(e,t,n){var r=v6(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?w6:x6,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 S6(e,t){return function(){return pE(this,e,t)}}function C6(e,t){return function(){return pE(this,e,t.apply(this,arguments))}}function E6(e,t){return this.each((typeof t=="function"?C6:S6)(e,t))}function*N6(){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 cn(e,t){this._groups=e,this._parents=t}function Pl(){return new cn([[document.documentElement]],hE)}function k6(){return this}cn.prototype=Pl.prototype={constructor:cn,select:QH,selectAll:n8,selectChild:i8,selectChildren:u8,filter:d8,data:y8,enter:f8,exit:x8,join:w8,merge:b8,selection:k6,order:S8,sort:C8,call:N8,nodes:k8,node:T8,size:P8,empty:R8,each:I8,attr:$8,style:V8,property:U8,classed:X8,text:J8,html:r6,raise:s6,lower:a6,append:l6,insert:u6,remove:f6,clone:g6,datum:m6,on:b6,dispatch:E6,[Symbol.iterator]:N6};function rn(e){return typeof e=="string"?new cn([[document.querySelector(e)]],[document.documentElement]):new cn([[e]],hE)}function T6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kn(e,t){if(e=T6(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 P6={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=rn(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=rn(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 R6(e){return!e.ctrlKey&&!e.button}function I6(){return this.parentNode}function _6(e,t){return t??{x:e.x,y:e.y}}function A6(){return navigator.maxTouchPoints||"ontouchstart"in this}function yE(){var e=R6,t=I6,n=_6,r=A6,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,P6).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(P,M){if(!(g||!e.call(this,P,M))){var R=k(this,t.call(this,P,M),P,M,"mouse");R&&(rn(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,R("start",P))}}function S(P){if(ui(P),!f){var M=P.clientX-c,R=P.clientY-d;f=M*M+R*R>h}o.mouse("drag",P)}function w(P){rn(P.view).on("mousemove.drag mouseup.drag",null),mE(P.view,f),ui(P),o.mouse("end",P)}function E(P,M){if(e.call(this,P,M)){var R=P.changedTouches,_=t.call(this,P,M),$=R.length,D,H;for(D=0;D<$;++D)(H=k(this,_,P,M,R[D].identifier,R[D]))&&(Gh(P),H("start",P,R[D]))}}function b(P){var M=P.changedTouches,R=M.length,_,$;for(_=0;_<R;++_)($=o[M[_].identifier])&&(ui(P),$("drag",P,M[_]))}function N(P){var M=P.changedTouches,R=M.length,_,$;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),_=0;_<R;++_)($=o[M[_].identifier])&&(Gh(P),$("end",P,M[_]))}function k(P,M,R,_,$,D){var H=i.copy(),j=kn(D||R,M),U,Y,I;if((I=n.call(P,new Og("beforestart",{sourceEvent:R,target:v,identifier:$,active:l,x:j[0],y:j[1],dx:0,dy:0,dispatch:H}),_))!=null)return U=I.x-j[0]||0,Y=I.y-j[1]||0,function B(A,V,F){var W=j,q;switch(A){case"start":o[$]=B,q=l++;break;case"end":delete o[$],--l;case"drag":j=kn(F||V,M),q=l;break}H.call(A,P,new Og(A,{sourceEvent:V,subject:I,target:v,identifier:$,active:q,x:j[0]+U,y:j[1]+Y,dx:j[0]-W[0],dy:j[1]-W[1],dispatch:H}),_)}}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*",Yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",M6=/^#([0-9a-f]{3,8})$/,D6=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),j6=new RegExp(`^rgb\\(${Yn},${Yn},${Yn}\\)$`),O6=new RegExp(`^rgba\\(${di},${di},${di},${dl}\\)$`),$6=new RegExp(`^rgba\\(${Yn},${Yn},${Yn},${dl}\\)$`),L6=new RegExp(`^hsl\\(${dl},${Yn},${Yn}\\)$`),F6=new RegExp(`^hsla\\(${dl},${Yn},${Yn},${dl}\\)$`),$w={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,is,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lw,formatHex:Lw,formatHex8:z6,formatHsl:V6,formatRgb:Fw,toString:Fw});function Lw(){return this.rgb().formatHex()}function z6(){return this.rgb().formatHex8()}function V6(){return xE(this).formatHsl()}function Fw(){return this.rgb().formatRgb()}function is(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=M6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?zw(t):n===3?new Gt(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=D6.exec(e))?new Gt(t[1],t[2],t[3],1):(t=j6.exec(e))?new Gt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=O6.exec(e))?mu(t[1],t[2],t[3],t[4]):(t=$6.exec(e))?mu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=L6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,1):(t=F6.exec(e))?Hw(t[1],t[2]/100,t[3]/100,t[4]):$w.hasOwnProperty(e)?zw($w[e]):e==="transparent"?new Gt(NaN,NaN,NaN,0):null}function zw(e){return new Gt(e>>16&255,e>>8&255,e&255,1)}function mu(e,t,n,r){return r<=0&&(e=t=n=NaN),new Gt(e,t,n,r)}function B6(e){return e instanceof Rl||(e=is(e)),e?(e=e.rgb(),new Gt(e.r,e.g,e.b,e.opacity)):new Gt}function $g(e,t,n,r){return arguments.length===1?B6(e):new Gt(e,t,n,r??1)}function Gt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ly(Gt,$g,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gt(qo(this.r),qo(this.g),qo(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:Vw,formatHex:Vw,formatHex8:H6,formatRgb:Bw,toString:Bw}));function Vw(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}`}function H6(){return`#${Ko(this.r)}${Ko(this.g)}${Ko(this.b)}${Ko((isNaN(this.opacity)?1:this.opacity)*255)}`}function Bw(){const e=sd(this.opacity);return`${e===1?"rgb(":"rgba("}${qo(this.r)}, ${qo(this.g)}, ${qo(this.b)}${e===1?")":`, ${e})`}`}function sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ko(e){return e=qo(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 Pn(e,t,n,r)}function xE(e){if(e instanceof Pn)return new Pn(e.h,e.s,e.l,e.opacity);if(e instanceof Rl||(e=is(e)),!e)return new Pn;if(e instanceof Pn)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 Pn(l,c,d,e.opacity)}function W6(e,t,n,r){return arguments.length===1?xE(e):new Pn(e,t,n,r??1)}function Pn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ly(Pn,W6,vE(Rl,{brighter(e){return e=e==null?od:Math.pow(od,e),new Pn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ul:Math.pow(ul,e),new Pn(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 Gt(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 Pn(Ww(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("}${Ww(this.h)}, ${yu(this.s)*100}%, ${yu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ww(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 U6(e,t){return function(n){return e+n*t}}function K6(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 G6(e){return(e=+e)==1?wE:function(t,n){return n-t?K6(t,n,e):cy(isNaN(t)?n:t)}}function wE(e,t){var n=t-e;return n?U6(e,n):cy(isNaN(e)?t:e)}const id=(function e(t){var n=G6(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 Y6(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 X6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function q6(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 Z6(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Hn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Q6(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 J6(e){return function(){return e}}function eW(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:Hn(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]?eW(d[0].x):J6(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"?Hn:n==="string"?(r=is(t))?(t=r,id):bE:t instanceof is?id:t instanceof Date?Z6:X6(t)?Y6:Array.isArray(t)?q6:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Q6:Hn)(e,t)}var Uw=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)*Uw,skewX:Math.atan(d)*Uw,scaleX:l,scaleY:c}}var vu;function tW(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 nW(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:Hn(f,h)},{i:w-2,x:Hn(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:Hn(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:Hn(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:Hn(f,h)},{i:w-2,x:Hn(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 rW=CE(tW,"px, ","px)","deg)"),oW=CE(nW,", ",")",")"),sW=1e-12;function Kw(e){return((e=Math.exp(e))+1/e)/2}function iW(e){return((e=Math.exp(e))-1/e)/2}function aW(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<sW)b=Math.log(v/f)/t,E=function(_){return[c+_*x,d+_*S,f*Math.exp(t*_*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),M=Math.log(Math.sqrt(k*k+1)-k),R=Math.log(Math.sqrt(P*P+1)-P);b=(R-M)/t,E=function(_){var $=_*b,D=Kw(M),H=f/(n*N)*(D*aW(t*$+M)-iW(M));return[c+H*x,d+H*S,f*D/Kw(t*$+M)]}}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,Ha=0,Oa=0,EE=1e3,ad,Wa,ld=0,as=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 as||(NE(lW),as=fl.now()+sf)}function lW(){as=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 cW(){uy(),++wi;for(var e=ad,t;e;)(t=as-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wi}function Gw(){as=(ld=fl.now())+sf,wi=Ha=0;try{cW()}finally{wi=0,dW(),as=0}}function uW(){var e=fl.now(),t=e-ld;t>EE&&(sf-=t,ld=e)}function dW(){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){Ha&&(Ha=clearTimeout(Ha));var t=e-as;t>24?(e<1/0&&(Ha=setTimeout(Gw,e-fl.now()-sf)),Oa&&(Oa=clearInterval(Oa))):(Oa||(ld=fl.now(),Oa=setInterval(uW,EE)),wi=1,NE(Gw))}}function Yw(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 fW=rf("start","end","cancel","interrupt"),pW=[],TE=0,Xw=1,Vg=2,Lu=3,qw=4,Bg=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;hW(e,n,{name:t,index:r,group:o,on:fW,tween:pW,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:TE})}function dy(e,t){var n=$n(e,t);if(n.state>TE)throw new Error("too late; already scheduled");return n}function er(e,t){var n=$n(e,t);if(n.state>Lu)throw new Error("too late; already running");return n}function $n(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hW(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=kE(i,0,n.time);function i(f){n.state=Xw,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!==Xw)return d();for(g in r)if(x=r[g],x.name===n.name){if(x.state===Lu)return Yw(l);x.state===qw?(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(Yw(function(){n.state===Lu&&(n.state=qw,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=Bg,1),h=-1,v=o.length;++h<v;)o[h].call(e,g);n.state===Bg&&(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<Bg,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 gW(e){return this.each(function(){zu(this,e)})}function mW(e,t){var n,r;return function(){var o=er(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 yW(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=er(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 vW(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=$n(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?mW:yW)(n,e,t))}function fy(e,t,n){var r=e._id;return e.each(function(){var o=er(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return $n(o,r).value[t]}}function PE(e,t){var n;return(typeof t=="number"?Hn:t instanceof is?id:(n=is(t))?(t=n,id):bE)(e,t)}function xW(e){return function(){this.removeAttribute(e)}}function wW(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bW(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 SW(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 CW(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 EW(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 NW(e,t){var n=of(e),r=n==="transform"?oW:PE;return this.attrTween(e,typeof t=="function"?(n.local?EW:CW)(n,r,fy(this,"attr."+e,t)):t==null?(n.local?wW:xW)(n):(n.local?SW:bW)(n,r,t))}function kW(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function TW(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function PW(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 RW(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&kW(e,i)),n}return o._value=t,o}function IW(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?PW:RW)(r,t))}function _W(e,t){return function(){dy(this,e).delay=+t.apply(this,arguments)}}function AW(e,t){return t=+t,function(){dy(this,e).delay=t}}function MW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_W:AW)(t,e)):$n(this.node(),t).delay}function DW(e,t){return function(){er(this,e).duration=+t.apply(this,arguments)}}function jW(e,t){return t=+t,function(){er(this,e).duration=t}}function OW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?DW:jW)(t,e)):$n(this.node(),t).duration}function $W(e,t){if(typeof t!="function")throw new Error;return function(){er(this,e).ease=t}}function LW(e){var t=this._id;return arguments.length?this.each($W(t,e)):$n(this.node(),t).ease}function FW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;er(this,e).ease=n}}function zW(e){if(typeof e!="function")throw new Error;return this.each(FW(this._id,e))}function VW(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 Er(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 Er(l,this._parents,this._name,this._id)}function HW(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 WW(e,t,n){var r,o,i=HW(t)?dy:er;return function(){var l=i(this,e),c=l.on;c!==r&&(o=(r=c).copy()).on(t,n),l.on=o}}function UW(e,t){var n=this._id;return arguments.length<2?$n(this.node(),n).on.on(e):this.each(WW(n,e,t))}function KW(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function GW(){return this.on("end.remove",KW(this._id))}function YW(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,$n(g,n)));return new Er(i,this._parents,t,n)}function XW(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=$n(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 Er(i,l,t,n)}var qW=Pl.prototype.constructor;function ZW(){return new qW(this._groups,this._parents)}function QW(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 JW(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 eU(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 tU(e,t){var n,r,o,i="style."+t,l="end."+i,c;return function(){var d=er(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 nU(e,t,n){var r=(e+="")=="transform"?rW:PE;return t==null?this.styleTween(e,QW(e,r)).on("end.style."+e,RE(e)):typeof t=="function"?this.styleTween(e,eU(e,r,fy(this,"style."+e,t))).each(tU(this._id,e)):this.styleTween(e,JW(e,r,t),n).on("end.style."+e,null)}function rU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function oU(e,t,n){var r,o;function i(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&rU(e,l,n)),r}return i._value=t,i}function sU(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,oU(e,t,n??""))}function iU(e){return function(){this.textContent=e}}function aU(e){return function(){var t=e(this);this.textContent=t??""}}function lU(e){return this.tween("text",typeof e=="function"?aU(fy(this,"text",e)):iU(e==null?"":e+""))}function cU(e){return function(t){this.textContent=e.call(this,t)}}function uU(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&cU(o)),t}return r._value=e,r}function dU(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,uU(e))}function fU(){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=$n(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 Er(r,this._parents,e,n)}function pU(){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=er(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 hU=0;function Er(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function IE(){return++hU}var pr=Pl.prototype;Er.prototype={constructor:Er,select:YW,selectAll:XW,selectChild:pr.selectChild,selectChildren:pr.selectChildren,filter:VW,merge:BW,selection:ZW,transition:fU,call:pr.call,nodes:pr.nodes,node:pr.node,size:pr.size,empty:pr.empty,each:pr.each,on:UW,attr:NW,attrTween:IW,style:nU,styleTween:sU,text:lU,textTween:dU,remove:GW,tween:vW,delay:MW,duration:OW,ease:LW,easeVarying:zW,end:pU,[Symbol.iterator]:pr[Symbol.iterator]};function gU(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mU={time:null,delay:0,duration:250,ease:gU};function yU(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 vU(e){var t,n;e instanceof Er?(t=e._id,e=e._name):(t=IE(),(n=mU).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||yU(d,t));return new Er(r,this._parents,e,t)}Pl.prototype.interrupt=gW;Pl.prototype.transition=vU;const xu=e=>()=>e;function xU(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 mr(e,t,n){this.k=e,this.x=t,this.y=n}mr.prototype={constructor:mr,scale:function(e){return e===1?this:new mr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new mr(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 mr(1,0,0);_E.prototype=mr.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 wU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bU(){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 Zw(){return this.__zoom||lf}function SU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function CU(){return navigator.maxTouchPoints||"ontouchstart"in this}function EU(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=wU,t=bU,n=EU,r=SU,o=CU,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(I){I.property("__zoom",Zw).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",H).filter(o).on("touchstart.zoom",j).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(I,B,A,V){var F=I.selection?I.selection():I;F.property("__zoom",Zw),I!==F?M(I,B,A,V):F.interrupt().each(function(){R(this,arguments).event(V).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},b.scaleBy=function(I,B,A,V){b.scaleTo(I,function(){var F=this.__zoom.k,W=typeof B=="function"?B.apply(this,arguments):B;return F*W},A,V)},b.scaleTo=function(I,B,A,V){b.transform(I,function(){var F=t.apply(this,arguments),W=this.__zoom,q=A==null?P(F):typeof A=="function"?A.apply(this,arguments):A,L=W.invert(q),z=typeof B=="function"?B.apply(this,arguments):B;return n(k(N(W,z),q,L),F,l)},A,V)},b.translateBy=function(I,B,A,V){b.transform(I,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),l)},null,V)},b.translateTo=function(I,B,A,V,F){b.transform(I,function(){var W=t.apply(this,arguments),q=this.__zoom,L=V==null?P(W):typeof V=="function"?V.apply(this,arguments):V;return n(lf.translate(L[0],L[1]).scale(q.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof A=="function"?-A.apply(this,arguments):-A),W,l)},V,F)};function N(I,B){return B=Math.max(i[0],Math.min(i[1],B)),B===I.k?I:new mr(B,I.x,I.y)}function k(I,B,A){var V=B[0]-A[0]*I.k,F=B[1]-A[1]*I.k;return V===I.x&&F===I.y?I:new mr(I.k,V,F)}function P(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function M(I,B,A,V){I.on("start.zoom",function(){R(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event(V).end()}).tween("zoom",function(){var F=this,W=arguments,q=R(F,W).event(V),L=t.apply(F,W),z=A==null?P(L):typeof A=="function"?A.apply(F,W):A,X=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),Q=F.__zoom,te=typeof B=="function"?B.apply(F,W):B,ne=d(Q.invert(z).concat(X/Q.k),te.invert(z).concat(X/te.k));return function(Z){if(Z===1)Z=te;else{var K=ne(Z),re=X/K[2];Z=new mr(re,z[0]-K[0]*re,z[1]-K[1]*re)}q.zoom(null,Z)}})}function R(I,B,A){return!A&&I.__zooming||new _(I,B)}function _(I,B){this.that=I,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,B),this.taps=0}_.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,B){return this.mouse&&I!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var B=rn(this.that).datum();f.call(I,this.that,new xU(I,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:f}),B)}};function $(I,...B){if(!e.apply(this,arguments))return;var A=R(this,B).event(I),V=this.__zoom,F=Math.max(i[0],Math.min(i[1],V.k*Math.pow(2,r.apply(this,arguments)))),W=kn(I);if(A.wheel)(A.mouse[0][0]!==W[0]||A.mouse[0][1]!==W[1])&&(A.mouse[1]=V.invert(A.mouse[0]=W)),clearTimeout(A.wheel);else{if(V.k===F)return;A.mouse=[W,V.invert(W)],zu(this),A.start()}$a(I),A.wheel=setTimeout(q,S),A.zoom("mouse",n(k(N(V,F),A.mouse[0],A.mouse[1]),A.extent,l));function q(){A.wheel=null,A.end()}}function D(I,...B){if(v||!e.apply(this,arguments))return;var A=I.currentTarget,V=R(this,B,!0).event(I),F=rn(I.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",X,!0),W=kn(I,A),q=I.clientX,L=I.clientY;gE(I.view),qh(I),V.mouse=[W,this.__zoom.invert(W)],zu(this),V.start();function z(Q){if($a(Q),!V.moved){var te=Q.clientX-q,ne=Q.clientY-L;V.moved=te*te+ne*ne>w}V.event(Q).zoom("mouse",n(k(V.that.__zoom,V.mouse[0]=kn(Q,A),V.mouse[1]),V.extent,l))}function X(Q){F.on("mousemove.zoom mouseup.zoom",null),mE(Q.view,V.moved),$a(Q),V.event(Q).end()}}function H(I,...B){if(e.apply(this,arguments)){var A=this.__zoom,V=kn(I.changedTouches?I.changedTouches[0]:I,this),F=A.invert(V),W=A.k*(I.shiftKey?.5:2),q=n(k(N(A,W),V,F),t.apply(this,B),l);$a(I),c>0?rn(this).transition().duration(c).call(M,q,V,I):rn(this).call(b.transform,q,V,I)}}function j(I,...B){if(e.apply(this,arguments)){var A=I.touches,V=A.length,F=R(this,B,I.changedTouches.length===V).event(I),W,q,L,z;for(qh(I),q=0;q<V;++q)L=A[q],z=kn(L,this),z=[z,this.__zoom.invert(z),L.identifier],F.touch0?!F.touch1&&F.touch0[2]!==z[2]&&(F.touch1=z,F.taps=0):(F.touch0=z,W=!0,F.taps=1+!!g);g&&(g=clearTimeout(g)),W&&(F.taps<2&&(h=z[0],g=setTimeout(function(){g=null},x)),zu(this),F.start())}}function U(I,...B){if(this.__zooming){var A=R(this,B).event(I),V=I.changedTouches,F=V.length,W,q,L,z;for($a(I),W=0;W<F;++W)q=V[W],L=kn(q,this),A.touch0&&A.touch0[2]===q.identifier?A.touch0[0]=L:A.touch1&&A.touch1[2]===q.identifier&&(A.touch1[0]=L);if(q=A.that.__zoom,A.touch1){var X=A.touch0[0],Q=A.touch0[1],te=A.touch1[0],ne=A.touch1[1],Z=(Z=te[0]-X[0])*Z+(Z=te[1]-X[1])*Z,K=(K=ne[0]-Q[0])*K+(K=ne[1]-Q[1])*K;q=N(q,Math.sqrt(Z/K)),L=[(X[0]+te[0])/2,(X[1]+te[1])/2],z=[(Q[0]+ne[0])/2,(Q[1]+ne[1])/2]}else if(A.touch0)L=A.touch0[0],z=A.touch0[1];else return;A.zoom("touch",n(k(q,L,z),A.extent,l))}}function Y(I,...B){if(this.__zooming){var A=R(this,B).event(I),V=I.changedTouches,F=V.length,W,q;for(qh(I),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),W=0;W<F;++W)q=V[W],A.touch0&&A.touch0[2]===q.identifier?delete A.touch0:A.touch1&&A.touch1[2]===q.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(q=kn(q,this),Math.hypot(h[0]-q[0],h[1]-q[1])<E)){var L=rn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return b.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:xu(+I),b):r},b.filter=function(I){return arguments.length?(e=typeof I=="function"?I:xu(!!I),b):e},b.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:xu(!!I),b):o},b.extent=function(I){return arguments.length?(t=typeof I=="function"?I:xu([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),b):t},b.scaleExtent=function(I){return arguments.length?(i[0]=+I[0],i[1]=+I[1],b):[i[0],i[1]]},b.translateExtent=function(I){return arguments.length?(l[0][0]=+I[0][0],l[1][0]=+I[1][0],l[0][1]=+I[0][1],l[1][1]=+I[1][1],b):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},b.constrain=function(I){return arguments.length?(n=I,b):n},b.duration=function(I){return arguments.length?(c=+I,b):c},b.interpolate=function(I){return arguments.length?(d=I,b):d},b.on=function(){var I=f.on.apply(f,arguments);return I===f?b:I},b.clickDistance=function(I){return arguments.length?(w=(I=+I)*I,b):Math.sqrt(w)},b.tapDistance=function(I){return arguments.length?(E=+I,b):E},b}const Zn={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 Zo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Zo||(Zo={}));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 io;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(io||(io={}));var ud;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ud||(ud={}));var Se;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Se||(Se={}));const Qw={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top};function OE(e){return e===null?null:e?"valid":"invalid"}const $E=e=>"id"in e&&"source"in e&&"target"in e,NU=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}=Pr(e),o=e.origin??t,i=n*o[0],l=r*o[1];return{x:e.position.x-i,y:e.position.y-l}},kU=(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},TU=(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 PU(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 RU({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},l){if(e.size===0)return Promise.resolve(!0);const c=PU(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",Zn.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)?ls(t,h,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&i?.("015",Zn.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 IU({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=TU(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),ls=(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}=Pr(n),{x:i,y:l}=n.internals.positionAbsolute;return ls(e,[[i,l],[i+r,l+o]],t)}const Jw=(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=Jw(e.x,r,t.width-r)*n,i=Jw(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)}),Hg=({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(Hg(e),Hg(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)},eb=e=>Rn(e.width)&&Rn(e.height)&&Rn(e.x)&&Rn(e.y),Rn=e=>!isNaN(e)&&isFinite(e),_U=(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 AU(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 MU(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=AU(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=MU(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 Pr(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 BE(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 tb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function DU(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function jU(e){return{...DE,...e||{}}}function Qa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:l}=In(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}),HE=e=>e?.getRootNode?.()||window?.document,OU=["INPUT","SELECT","TEXTAREA"];function WE(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:OU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const UE=e=>"clientX"in e,In=(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)}},nb=(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 rb({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Se.Left:return[t-wu(t-r,i),n];case Se.Right:return[t+wu(r-t,i),n];case Se.Top:return[t,n-wu(n-o,i)];case Se.Bottom:return[t,n+wu(o-n,i)]}}function pd({sourceX:e,sourceY:t,sourcePosition:n=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top,curvature:l=.25}){const[c,d]=rb({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[f,g]=rb({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 $U({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 LU({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 FU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,zU=(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||FU;let o;return $E(e)?o={...e}:o={...e,id:r(e)},zU(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 ob={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}},VU=({source:e,sourcePosition:t=Se.Bottom,target:n})=>t===Se.Left||t===Se.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},sb=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function BU({source:e,sourcePosition:t=Se.Bottom,target:n,targetPosition:r=Se.Top,center:o,offset:i,stepPosition:l}){const c=ob[t],d=ob[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=VU({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 $=[{x:w,y:f.y},{x:w,y:g.y}],D=[{x:f.x,y:E},{x:g.x,y:E}];c[v]===x?S=v==="x"?$:D:S=v==="x"?D:$}else{const $=[{x:f.x,y:g.y}],D=[{x:g.x,y:f.y}];if(v==="x"?S=c.x===x?D:$:S=c.y===x?$:D,t===r){const I=Math.abs(e[v]-n[v]);if(I<=i){const B=Math.min(i-1,i-I);c[v]===x?b[v]=(f[v]>e[v]?-1:1)*B:N[v]=(g[v]>n[v]?-1:1)*B}}if(t!==r){const I=v==="x"?"y":"x",B=c[v]===d[I],A=f[I]>g[I],V=f[I]<g[I];(c[v]===1&&(!B&&A||B&&V)||c[v]!==1&&(!B&&V||B&&A))&&(S=v==="x"?$:D)}const H={x:f.x+b.x,y:f.y+b.y},j={x:g.x+N.x,y:g.y+N.y},U=Math.max(Math.abs(H.x-S[0].x),Math.abs(j.x-S[0].x)),Y=Math.max(Math.abs(H.y-S[0].y),Math.abs(j.y-S[0].y));U>=Y?(w=(H.x+j.x)/2,E=S[0].y):(w=S[0].x,E=(H.y+j.y)/2)}const M={x:f.x+b.x,y:f.y+b.y},R={x:g.x+N.x,y:g.y+N.y};return[[e,...M.x!==S[0].x||M.y!==S[0].y?[M]:[],...S,...R.x!==S[S.length-1].x||R.y!==S[S.length-1].y?[R]:[],n],w,E,k,P]}function HU(e,t,n,r){const o=Math.min(sb(e,t)/2,sb(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=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.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+=HU(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 ib(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function WU(e){const{sourceNode:t,targetNode:n}=e;if(!ib(t)||!ib(n))return null;const r=t.internals.handleBounds||ab(t.handles),o=n.internals.handleBounds||ab(n.handles),i=lb(r?.source??[],e.sourceHandle),l=lb(e.connectionMode===bi.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!l)return e.onError?.("008",Zn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||Se.Bottom,d=l?.position||Se.Top,f=cs(t,i,c),g=cs(n,l,d);return{sourceX:f.x,sourceY:f.y,targetX:g.x,targetY:g.y,sourcePosition:c,targetPosition:d}}function ab(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 cs(e,t,n=Se.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??Pr(e);if(r)return{x:o+l/2,y:i+c/2};switch(t?.position??n){case Se.Top:return{x:o+l/2,y:i};case Se.Right:return{x:o+l,y:i+c/2};case Se.Bottom:return{x:o+l/2,y:i+c};case Se.Left:return{x:o,y:i+c/2}}}function lb(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 UU(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,KU=10,vy={nodeOrigin:[0,0],nodeExtent:pl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},GU={...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 YU(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=ls(i,l,Pr(o));o.internals.positionAbsolute=c}}function XU(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(GU,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=ls(v,x,Pr(g));h={...o.defaults,...g,measured:{width:g.measured?.width,height:g.measured?.height},internals:{positionAbsolute:S,handleBounds:XU(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 qU(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}qU(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*KU),o&&g.internals.rootParentIndex!==void 0&&(o.i=g.internals.rootParentIndex);const h=i&&!wy(d)?qE:0,{x:v,y:x,z:S}=ZU(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=Rn(e.zIndex)?e.zIndex:0;return wy(n)?r:r+(e.selected?t:0)}function ZU(e,t,n,r,o,i){const{x:l,y:c}=t.internals.positionAbsolute,d=Pr(e),f=Il(e,n),g=Ni(e.extent)?ls(f,e.extent,d):f;let h=ls({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=Pr(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 QU(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=ls(P,k,w));const M={...S,measured:w,internals:{...S.internals,positionAbsolute:P,handleBounds:{source:nb("source",x.nodeElement,N,h,S.id),target:nb("target",x.nodeElement,N,h,S.id)}}};t.set(S.id,M),S.parentId&&by(M,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(M,o)}))}}if(v.length>0){const x=Sy(v,t,n,o);f.push(...x)}return{changes:f,updatedInternals:d}}async function JU({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 cb(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}`;cb("source",d,g,e,o,l),cb("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 ub(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 e9(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 t9({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 n9({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:M,nodeId:R,nodeClickDistance:_=0}){v=rn(P);function $({x:U,y:Y}){const{nodeLookup:I,nodeExtent:B,snapGrid:A,snapToGrid:V,nodeOrigin:F,onNodeDrag:W,onSelectionDrag:q,onError:L,updateNodePositions:z}=t();i={x:U,y:Y};let X=!1;const Q=c.size>1,te=Q&&B?Hg(_l(c)):null,ne=Q&&V?t9({dragItems:c,snapGrid:A,x:U,y:Y}):null;for(const[Z,K]of c){if(!I.has(Z))continue;let re={x:U-K.distance.x,y:Y-K.distance.y};V&&(re=ne?{x:Math.round(re.x+ne.x),y:Math.round(re.y+ne.y)}:Al(re,A));let ce=null;if(Q&&B&&!K.extent&&te){const{positionAbsolute:pe}=K.internals,Re=pe.x-te.x+B[0][0],Le=pe.x+K.measured.width-te.x2+B[1][0],ze=pe.y-te.y+B[0][1],le=pe.y+K.measured.height-te.y2+B[1][1];ce=[[Re,ze],[Le,le]]}const{position:me,positionAbsolute:ge}=LE({nodeId:Z,nextPosition:re,nodeLookup:I,nodeExtent:ce||B,nodeOrigin:F,onError:L});X=X||K.position.x!==me.x||K.position.y!==me.y,K.position=me,K.internals.positionAbsolute=ge}if(S=S||X,!!X&&(z(c,!0),w&&(r||W||!R&&q))){const[Z,K]=Zh({nodeId:R,dragItems:c,nodeLookup:I});r?.(w,c,Z,K),W?.(w,Z,K),R||q?.(w,K)}}async function D(){if(!g)return;const{transform:U,panBy:Y,autoPanSpeed:I,autoPanOnNodeDrag:B}=t();if(!B){d=!1,cancelAnimationFrame(l);return}const[A,V]=zE(f,g,I);(A!==0||V!==0)&&(i.x=(i.x??0)-A/U[2],i.y=(i.y??0)-V/U[2],await Y({x:A,y:V})&&$(i)),l=requestAnimationFrame(D)}function H(U){const{nodeLookup:Y,multiSelectionActive:I,nodesDraggable:B,transform:A,snapGrid:V,snapToGrid:F,selectNodesOnDrag:W,onNodeDragStart:q,onSelectionDragStart:L,unselectNodesAndEdges:z}=t();h=!0,(!W||!M)&&!I&&R&&(Y.get(R)?.selected||z()),M&&W&&R&&e?.(R);const X=Qa(U.sourceEvent,{transform:A,snapGrid:V,snapToGrid:F,containerBounds:g});if(i=X,c=e9(Y,B,X,R),c.size>0&&(n||q||!R&&L)){const[Q,te]=Zh({nodeId:R,dragItems:c,nodeLookup:Y});n?.(U.sourceEvent,c,Q,te),q?.(U.sourceEvent,Q,te),R||L?.(U.sourceEvent,te)}}const j=yE().clickDistance(_).on("start",U=>{const{domNode:Y,nodeDragThreshold:I,transform:B,snapGrid:A,snapToGrid:V}=t();g=Y?.getBoundingClientRect()||null,x=!1,S=!1,w=U.sourceEvent,I===0&&H(U),i=Qa(U.sourceEvent,{transform:B,snapGrid:A,snapToGrid:V,containerBounds:g}),f=In(U.sourceEvent,g)}).on("drag",U=>{const{autoPanOnNodeDrag:Y,transform:I,snapGrid:B,snapToGrid:A,nodeDragThreshold:V,nodeLookup:F}=t(),W=Qa(U.sourceEvent,{transform:I,snapGrid:B,snapToGrid:A,containerBounds:g});if(w=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||R&&!F.has(R))&&(x=!0),!x){if(!d&&Y&&h&&(d=!0,D()),!h){const q=In(U.sourceEvent,g),L=q.x-f.x,z=q.y-f.y;Math.sqrt(L*L+z*z)>V&&H(U)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&c&&h&&(f=In(U.sourceEvent,g),$(W))}}).on("end",U=>{if(!(!h||x)&&(d=!1,h=!1,cancelAnimationFrame(l),c.size>0)){const{nodeLookup:Y,updateNodePositions:I,onNodeDragStop:B,onSelectionDragStop:A}=t();if(S&&(I(c,!1),S=!1),o||B||!R&&A){const[V,F]=Zh({nodeId:R,dragItems:c,nodeLookup:Y,dragging:!1});o?.(U.sourceEvent,c,V,F),B?.(U.sourceEvent,V,F),R||A?.(U.sourceEvent,F)}}}).filter(U=>{const Y=U.target;return!U.button&&(!N||!ub(Y,`.${N}`,P))&&(!k||ub(Y,k,P))});v.call(j)}function b(){v?.on(".drag",null)}return{update:E,destroy:b}}function r9(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 o9=250;function s9(e,t,n,r){let o=[],i=1/0;const l=r9(e,n,t+o9);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}=cs(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,...cs(l,d,d.position,!0)}:d}function tN(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function i9(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const nN=()=>!0;function a9(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:M,autoPanSpeed:R,dragThreshold:_=1,handleDomNode:$}){const D=HE(e.target);let H=0,j;const{x:U,y:Y}=In(e),I=tN(i,$),B=c?.getBoundingClientRect();let A=!1;if(!B||!I)return;const V=eN(o,I,r,d,t);if(!V)return;let F=In(e,B),W=!1,q=null,L=!1,z=null;function X(){if(!g||!B)return;const[me,ge]=zE(F,B,R);v({x:me,y:ge}),H=requestAnimationFrame(X)}const Q={...V,nodeId:o,type:I,position:V.position},te=d.get(o);let Z={inProgress:!0,isValid:null,from:cs(te,Q,Se.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:te,to:F,toHandle:null,toPosition:Qw[Q.position],toNode:null,pointer:F};function K(){A=!0,k(Z),S?.(e,{nodeId:o,handleId:r,handleType:I})}_===0&&K();function re(me){if(!A){const{x:le,y:we}=In(me),Oe=le-U,ot=we-Y;if(!(Oe*Oe+ot*ot>_*_))return;K()}if(!M()||!Q){ce(me);return}const ge=P();F=In(me,B),j=s9(Ml(F,ge,!1,[1,1]),n,d,Q),W||(X(),W=!0);const pe=rN(me,{handle:j,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:l?"target":"source",isValidConnection:b,doc:D,lib:f,flowId:h,nodeLookup:d});z=pe.handleDomNode,q=pe.connection,L=i9(!!j,pe.isValid);const Re=d.get(o),Le=Re?cs(Re,Q,Se.Left,!0):Z.from,ze={...Z,from:Le,isValid:L,to:pe.toHandle&&L?fd({x:pe.toHandle.x,y:pe.toHandle.y},ge):F,toHandle:pe.toHandle,toPosition:L&&pe.toHandle?pe.toHandle.position:Qw[Q.position],toNode:pe.toHandle?d.get(pe.toHandle.nodeId):null,pointer:F};k(ze),Z=ze}function ce(me){if(!("touches"in me&&me.touches.length>0)){if(A){(j||z)&&q&&L&&w?.(q);const{inProgress:ge,...pe}=Z,Re={...pe,toPosition:Z.toHandle?Z.toPosition:null};E?.(me,Re),i&&N?.(me,Re)}x(),cancelAnimationFrame(H),W=!1,L=!1,q=null,z=null,D.removeEventListener("mousemove",re),D.removeEventListener("mouseup",ce),D.removeEventListener("touchmove",re),D.removeEventListener("touchend",ce)}}D.addEventListener("mousemove",re),D.addEventListener("mouseup",ce),D.addEventListener("touchmove",re),D.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}=In(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"),M=E.classList.contains("connectable"),R=E.classList.contains("connectableend");if(!k||!N)return b;const _={source:h?k:r,sourceHandle:h?P:o,target:h?r:k,targetHandle:h?o:P};b.connection=_;const D=M&&R&&(n===bi.Strict?h&&N==="source"||!h&&N==="target":k!==r||P!==o);b.isValid=D&&f(_),b.toHandle=eN(k,N,P,g,n,!0)}return b}const Gg={onPointerDown:a9,isValid:rN};function l9({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=rn(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(),M=k.sourceEvent.ctrlKey&&gl()?10:1,R=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*g,_=P[2]*Math.pow(2,R*M);t.scaleTo(_)};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 M=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],R=[M[0]-w[0],M[1]-w[1]];w=M;const _=r()*Math.max(P[2],Math.log(P[2]))*(x?-1:1),$={x:P[0]-R[0]*_,y:P[1]-R[1]*_},D=[[0,0],[d,f]];t.setViewportConstrained({x:$.x,y:$.y,zoom:P[2]},D,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:kn}}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),c9=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jh=(e,t=0,n=c9,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 u9({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=kn(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===Zo.Vertical?0:g.deltaX*v,S=o===Zo.Horizontal?0:g.deltaY*v;!gl()&&g.shiftKey&&o!==Zo.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 d9({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 f9({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 p9({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 h9({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 g9({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 m9({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=rn(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(j,U){return v?new Promise(Y=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).transform(Jh(v,U?.duration,U?.ease,()=>Y(!0)),j)}):Promise.resolve(!1)}function E({noWheelClassName:j,noPanClassName:U,onPaneContextMenu:Y,userSelectionActive:I,panOnScroll:B,panOnDrag:A,panOnScrollMode:V,panOnScrollSpeed:F,preventScrolling:W,zoomOnPinch:q,zoomOnScroll:L,zoomOnDoubleClick:z,zoomActivationKeyPressed:X,lib:Q,onTransformChange:te,connectionInProgress:ne,paneClickDistance:Z,selectionOnDrag:K}){I&&!f.isZoomingOrPanning&&b();const re=B&&!X&&!I;h.clickDistance(K?1/0:!Rn(Z)||Z<0?0:Z);const ce=re?u9({zoomPanValues:f,noWheelClassName:j,d3Selection:v,d3Zoom:h,panOnScrollMode:V,panOnScrollSpeed:F,zoomOnPinch:q,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):d9({noWheelClassName:j,preventScrolling:W,d3ZoomHandler:x});if(v.on("wheel.zoom",ce,{passive:!1}),!I){const ge=f9({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});h.on("start",ge);const pe=p9({zoomPanValues:f,panOnDrag:A,onPaneContextMenu:!!Y,onPanZoom:i,onTransformChange:te});h.on("zoom",pe);const Re=h9({zoomPanValues:f,panOnDrag:A,panOnScroll:B,onPaneContextMenu:Y,onPanZoomEnd:c,onDraggingChange:d});h.on("end",Re)}const me=g9({zoomActivationKeyPressed:X,panOnDrag:A,zoomOnScroll:L,panOnScroll:B,zoomOnDoubleClick:z,zoomOnPinch:q,userSelectionActive:I,noPanClassName:U,noWheelClassName:j,lib:Q,connectionInProgress:ne});h.filter(me),z?v.on("dblclick.zoom",S):v.on("dblclick.zoom",null)}function b(){h.on("zoom",null)}async function N(j,U,Y){const I=Qh(j),B=h?.constrain()(I,U,Y);return B&&await w(B),new Promise(A=>A(B))}async function k(j,U){const Y=Qh(j);return await w(Y,U),new Promise(I=>I(Y))}function P(j){if(v){const U=Qh(j),Y=v.property("__zoom");(Y.k!==j.zoom||Y.x!==j.x||Y.y!==j.y)&&h?.transform(v,U,null,{sync:!0})}}function M(){const j=v?_E(v.node()):{x:0,y:0,k:1};return{x:j.x,y:j.y,zoom:j.k}}function R(j,U){return v?new Promise(Y=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).scaleTo(Jh(v,U?.duration,U?.ease,()=>Y(!0)),j)}):Promise.resolve(!1)}function _(j,U){return v?new Promise(Y=>{h?.interpolate(U?.interpolate==="linear"?Za:$u).scaleBy(Jh(v,U?.duration,U?.ease,()=>Y(!0)),j)}):Promise.resolve(!1)}function $(j){h?.scaleExtent(j)}function D(j){h?.translateExtent(j)}function H(j){const U=!Rn(j)||j<0?0:j;h?.clickDistance(U)}return{update:E,destroy:b,setViewport:k,setViewportConstrained:N,getViewport:M,scaleTo:R,scaleBy:_,setScaleExtent:$,setTranslateExtent:D,syncViewport:P,setClickDistance:H}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function y9({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 db(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 eo(e,t){return Math.max(0,t-e)}function to(e,t){return Math.max(0,e-t)}function bu(e,t,n){return Math.max(0,t-e,e-n)}function fb(e,t){return e?!t:t}function v9(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:M,height:R,aspectRatio:_}=e;let $=Math.floor(g?x-e.pointerX:0),D=Math.floor(h?S-e.pointerY:0);const H=M+(d?-$:$),j=R+(f?-D:D),U=-i[0]*M,Y=-i[1]*R;let I=bu(H,w,E),B=bu(j,b,N);if(l){let F=0,W=0;d&&$<0?F=eo(k+$+U,l[0][0]):!d&&$>0&&(F=to(k+H+U,l[1][0])),f&&D<0?W=eo(P+D+Y,l[0][1]):!f&&D>0&&(W=to(P+j+Y,l[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(c){let F=0,W=0;d&&$>0?F=to(k+$,c[0][0]):!d&&$<0&&(F=eo(k+H,c[1][0])),f&&D>0?W=to(P+D,c[0][1]):!f&&D<0&&(W=eo(P+j,c[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(o){if(g){const F=bu(H/_,b,N)*_;if(I=Math.max(I,F),l){let W=0;!d&&!f||d&&!f&&v?W=to(P+Y+H/_,l[1][1])*_:W=eo(P+Y+(d?$:-$)/_,l[0][1])*_,I=Math.max(I,W)}if(c){let W=0;!d&&!f||d&&!f&&v?W=eo(P+H/_,c[1][1])*_:W=to(P+(d?$:-$)/_,c[0][1])*_,I=Math.max(I,W)}}if(h){const F=bu(j*_,w,E)/_;if(B=Math.max(B,F),l){let W=0;!d&&!f||f&&!d&&v?W=to(k+j*_+U,l[1][0])/_:W=eo(k+(f?D:-D)*_+U,l[0][0])/_,B=Math.max(B,W)}if(c){let W=0;!d&&!f||f&&!d&&v?W=eo(k+j*_,c[1][0])/_:W=to(k+(f?D:-D)*_,c[0][0])/_,B=Math.max(B,W)}}}D=D+(D<0?B:-B),$=$+($<0?I:-I),o&&(v?H>j*_?D=(fb(d,f)?-$:$)/_:$=(fb(d,f)?-D:D)*_:g?(D=$/_,f=d):($=D*_,d=f));const A=d?k+$:k,V=f?P+D:P;return{width:M+(d?-$:$),height:R+(f?-D:D),x:i[0]*$*(d?-1:1)+A,y:i[1]*D*(f?-1:1)+V}}const iN={width:0,height:0,x:0,y:0},x9={...iN,pointerX:0,pointerY:0,aspectRatio:1};function w9(e){return[[0,0],[e.measured.width,e.measured.height]]}function b9(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 S9({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=rn(e);let l={controlDirection:db("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={...x9};l={boundaries:g,resizeDirection:v,keepAspectRatio:h,controlDirection:db(f)};let k,P=null,M=[],R,_,$,D=!1;const H=yE().on("start",j=>{const{nodeLookup:U,transform:Y,snapGrid:I,snapToGrid:B,nodeOrigin:A,paneDomNode:V}=n();if(k=U.get(t),!k)return;P=V?.getBoundingClientRect()??null;const{xSnapped:F,ySnapped:W}=Qa(j.sourceEvent,{transform:Y,snapGrid:I,snapToGrid:B,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:F,pointerY:W,aspectRatio:b.width/b.height},R=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(R=U.get(k.parentId),_=R&&k.extent==="parent"?w9(R):void 0),M=[],$=void 0;for(const[q,L]of U)if(L.parentId===t&&(M.push({id:q,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const z=b9(L,k,L.origin??A);$?$=[[Math.min(z[0][0],$[0][0]),Math.min(z[0][1],$[0][1])],[Math.max(z[1][0],$[1][0]),Math.max(z[1][1],$[1][1])]]:$=z}x?.(j,{...b})}).on("drag",j=>{const{transform:U,snapGrid:Y,snapToGrid:I,nodeOrigin:B}=n(),A=Qa(j.sourceEvent,{transform:U,snapGrid:Y,snapToGrid:I,containerBounds:P}),V=[];if(!k)return;const{x:F,y:W,width:q,height:L}=b,z={},X=k.origin??B,{width:Q,height:te,x:ne,y:Z}=v9(N,l.controlDirection,A,l.boundaries,l.keepAspectRatio,X,_,$),K=Q!==q,re=te!==L,ce=ne!==F&&K,me=Z!==W&&re;if(!ce&&!me&&!K&&!re)return;if((ce||me||X[0]===1||X[1]===1)&&(z.x=ce?ne:b.x,z.y=me?Z:b.y,b.x=z.x,b.y=z.y,M.length>0)){const Le=ne-F,ze=Z-W;for(const le of M)le.position={x:le.position.x-Le+X[0]*(Q-q),y:le.position.y-ze+X[1]*(te-L)},V.push(le)}if((K||re)&&(z.width=K&&(!l.resizeDirection||l.resizeDirection==="horizontal")?Q:b.width,z.height=re&&(!l.resizeDirection||l.resizeDirection==="vertical")?te:b.height,b.width=z.width,b.height=z.height),R&&k.expandParent){const Le=X[0]*(z.width??0);z.x&&z.x<Le&&(b.x=Le,N.x=N.x-(z.x-Le));const ze=X[1]*(z.height??0);z.y&&z.y<ze&&(b.y=ze,N.y=N.y-(z.y-ze))}const ge=y9({width:b.width,prevWidth:q,height:b.height,prevHeight:L,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),pe={...b,direction:ge};E?.(j,pe)!==!1&&(D=!0,S?.(j,pe),r(z,V))}).on("end",j=>{D&&(w?.(j,{...b}),o?.({...b}),D=!1)});i.call(H)}function d(){i.on(".drag",null)}return{update:c,destroy:d}}var eg={exports:{}},tg={},ng={exports:{}},rg={};var pb;function C9(){if(pb)return rg;pb=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 hb;function E9(){return hb||(hb=1,ng.exports=C9()),ng.exports}var gb;function N9(){if(gb)return tg;gb=1;var e=wl(),t=E9();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(R){if(!N){if(N=!0,k=R,R=v(R),x!==void 0&&w.hasValue){var _=w.value;if(x(_,R))return P=_}return P=R}if(_=P,r(k,R))return _;var $=v(R);return x!==void 0&&x(_,$)?(k=R,_):(k=R,P=$)}var N=!1,k,P,M=h===void 0?null:h;return[function(){return b(g())},M===null?void 0:function(){return b(M())}]},[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 mb;function k9(){return mb||(mb=1,eg.exports=N9()),eg.exports}var T9=k9();const P9=lm(T9),R9={},yb=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:()=>{(R9?"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},I9=e=>e?yb(e):yb,{useDebugValue:_9}=qe,{useSyncExternalStoreWithSelector:A9}=P9,M9=e=>e;function aN(e,t=M9,n){const r=A9(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return _9(r),r}const vb=(e,t)=>{const n=I9(e),r=(o,i=t)=>aN(n,o,i);return Object.assign(r,n),r},D9=(e,t)=>e?vb(e,t):vb;function rt(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),j9=ff.Provider,lN=Zn.error001();function Be(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 xb={display:"none"},O9={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",$9="react-flow__aria-live",L9=e=>e.ariaLiveMessage,F9=e=>e.ariaLabelConfig;function z9({rfId:e}){const t=Be(L9);return p.jsx("div",{id:`${$9}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:O9,children:t})}function V9({rfId:e,disableKeyboardA11y:t}){const n=Be(F9);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${cN}-${e}`,style:xb,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${uN}-${e}`,style:xb,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(z9,{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 H9=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 W9(e,t){return rt(e.selectedNodes.map(Su),t.selectedNodes.map(Su))&&rt(e.selectedEdges.map(Su),t.selectedEdges.map(Su))}function U9({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:r}=Be(H9,W9);return m.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const K9=e=>!!e.onSelectionChangeHandlers;function G9({onSelectionChange:e}){const t=Be(K9);return e||t?p.jsx(U9,{onSelectionChange:e}):null}const Yg=typeof window<"u"?m.useLayoutEffect:m.useEffect,dN=[0,0],Y9={x:0,y:0,zoom:1},X9=["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"],wb=[...X9,"rfId"],q9=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}),bb={translateExtent:pl,nodeOrigin:dN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Z9(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:d}=Be(q9,rt),f=it();Yg(()=>(d(e.defaultNodes,e.defaultEdges),()=>{g.current=bb,c()}),[]);const g=m.useRef(bb);return Yg(()=>{for(const h of wb){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:jU(v)}):h==="fitView"?f.setState({fitViewQueued:v}):h==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[h]:v})))}g.current=e},wb.map(h=>e[h])),null}function Sb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Q9(e){const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=Sb(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:Sb()?.matches?"dark":"light"}const Cb=typeof document<"u"?document:null;function ml(e=null,t={target:Cb,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
54
|
`).replace(`
|
|
55
55
|
|
|
56
56
|
`,`
|
|
57
57
|
+`).split(`
|
|
58
|
-
`)),g=f.reduce((h,v)=>h.concat(...v),[]);return[f,g]}return[[],[]]},[e]);return m.useEffect(()=>{const d=t?.target??Cb,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 b=Nb(x.code,c);if(i.current.add(x[b]),Eb(l,i.current,!1)){const E=x.composedPath?.()?.[0]||x.target,w=E?.nodeName==="BUTTON"||E?.nodeName==="A";t.preventDefault!==!1&&(o.current||!w)&&x.preventDefault(),r(!0)}},h=x=>{const S=Nb(x.code,c);Eb(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 Eb(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Nb(e,t){return t.includes(e)?"code":"key"}const J9=()=>{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)e7(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 e7(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 Wo(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(Wo(i.id,l)))}return r}function kb({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 Tb(e){return{id:e.id,type:"remove"}}const Pb=e=>NU(e),t7=e=>$E(e);function gN(e){return m.forwardRef(e)}function Rb(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>n7(()=>n(o=>o+BigInt(1))));return Yg(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function n7(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const mN=m.createContext(null);function r7({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 b=d;for(const w of c)b=typeof w=="function"?w(b):w;let E=kb({items:b,lookup:v});for(const w of S.values())E=w(E);g&&f(b),E.length>0?h?.(E):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:N,setNodes:k}=t.getState();w&&k(N)})},[]),r=Rb(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(kb({items:x,lookup:v}))},[]),i=Rb(o),l=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return p.jsx(mN.Provider,{value:l,children:e})}function o7(){const e=m.useContext(mN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const s7=e=>!!e.panZoom;function hf(){const e=J9(),t=it(),n=o7(),r=Be(s7),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=Pb(h)?h:v.get(h.id),b=S.parentId?BE(S.position,S.measured,S.parentId,v,x):S.position,E={...S,position:b,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(b=>{if(b.id===h){const E=typeof v=="function"?v(b):v;return x.replace&&Pb(E)?E:{...b,...E}}return b}))},g=(h,v,x={replace:!1})=>{c(S=>S.map(b=>{if(b.id===h){const E=typeof v=="function"?v(b):v;return x.replace&&t7(E)?E:{...b,...E}}return b}))};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,b,E]=x;return{nodes:h.map(w=>({...w})),edges:v.map(w=>({...w})),viewport:{x:S,y:b,zoom:E}}},deleteElements:async({nodes:h=[],edges:v=[]})=>{const{nodes:x,edges:S,onNodesDelete:b,onEdgesDelete:E,triggerNodeChanges:w,triggerEdgeChanges:N,onDelete:k,onBeforeDelete:P}=t.getState(),{nodes:M,edges:R}=await IU({nodesToRemove:h,edgesToRemove:v,nodes:x,edges:S,onBeforeDelete:P}),_=R.length>0,$=M.length>0;if(_){const D=R.map(Tb);E?.(R),N(D)}if($){const D=M.map(Tb);b?.(M),w(D)}return($||_)&&k?.({nodes:M,edges:R}),{deletedNodes:M,deletedEdges:R}},getIntersectingNodes:(h,v=!0,x)=>{const S=eb(h),b=S?h:d(h),E=x!==void 0;return b?(x||t.getState().nodes).filter(w=>{const N=t.getState().nodeLookup.get(w.id);if(N&&!S&&(w.id===h.id||!N.internals.positionAbsolute))return!1;const k=Ei(E?w:N),P=hl(k,b);return v&&P>0||P>=k.width*k.height||P>=b.width*b.height}):[]},isNodeIntersecting:(h,v,x=!0)=>{const b=eb(h)?h:d(h);if(!b)return!1;const E=hl(b,v);return x&&E>0||E>=v.width*v.height||E>=b.width*b.height},updateNode:f,updateNodeData:(h,v,x={replace:!1})=>{f(h,S=>{const b=typeof v=="function"?v(S):v;return x.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},x)},updateEdge:g,updateEdgeData:(h,v,x={replace:!1})=>{g(h,S=>{const b=typeof v=="function"?v(S):v;return x.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},x)},getNodesBounds:h=>{const{nodeLookup:v,nodeOrigin:x}=t.getState();return kU(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??DU();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 Ib=e=>e.selected,i7=typeof window<"u"?window:void 0;function a7({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=it(),{deleteElements:r}=hf(),o=ml(e,{actInsideInputWithModifier:!1}),i=ml(t,{target:i7});m.useEffect(()=>{if(o){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(Ib),edges:l.filter(Ib)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function l7(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",Zn.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},c7=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function u7({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Zo.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:f,minZoom:g,maxZoom:h,zoomActivationKeyCode:v,preventScrolling:x=!0,children:S,noWheelClassName:b,noPanClassName:E,onViewportChange:w,isControlledViewport:N,paneClickDistance:k,selectionOnDrag:P}){const M=it(),R=m.useRef(null),{userSelectionActive:_,lib:$,connectionInProgress:D}=Be(c7,rt),H=ml(v),j=m.useRef();l7(R);const U=m.useCallback(G=>{w?.({x:G[0],y:G[1],zoom:G[2]}),N||M.setState({transform:G})},[w,N]);return m.useEffect(()=>{if(R.current){j.current=m9({domNode:R.current,minZoom:g,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:A=>M.setState(V=>V.paneDragging===A?V:{paneDragging:A}),onPanZoomStart:(A,V)=>{const{onViewportChangeStart:F,onMoveStart:W}=M.getState();W?.(A,V),F?.(V)},onPanZoom:(A,V)=>{const{onViewportChange:F,onMove:W}=M.getState();W?.(A,V),F?.(V)},onPanZoomEnd:(A,V)=>{const{onViewportChangeEnd:F,onMoveEnd:W}=M.getState();W?.(A,V),F?.(V)}});const{x:G,y:I,zoom:B}=j.current.getViewport();return M.setState({panZoom:j.current,transform:[G,I,B],domNode:R.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),m.useEffect(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:H,preventScrolling:x,noPanClassName:E,userSelectionActive:_,noWheelClassName:b,lib:$,onTransformChange:U,connectionInProgress:D,selectionOnDrag:P,paneClickDistance:k})},[e,t,n,r,o,i,l,c,H,x,E,_,b,$,U,D,P,k]),p.jsx("div",{className:"react-flow__renderer",ref:R,style:gf,children:S})}const d7=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function f7(){const{userSelectionActive:e,userSelectionRect:t}=Be(d7,rt);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)},p7=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function h7({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 b=it(),{userSelectionActive:E,elementsSelectable:w,dragging:N,connectionInProgress:k}=Be(p7,rt),P=w&&(e||E),M=m.useRef(null),R=m.useRef(),_=m.useRef(new Set),$=m.useRef(new Set),D=m.useRef(!1),H=F=>{if(D.current||k){D.current=!1;return}d?.(F),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},j=F=>{if(Array.isArray(r)&&r?.includes(2)){F.preventDefault();return}f?.(F)},U=g?F=>g(F):void 0,G=F=>{D.current&&(F.stopPropagation(),D.current=!1)},I=F=>{const{domNode:W}=b.getState();if(R.current=W?.getBoundingClientRect(),!R.current)return;const q=F.target===M.current;if(!q&&!!F.target.closest(".nokey")||!e||!(i&&q||t)||F.button!==0||!F.isPrimary)return;F.target?.setPointerCapture?.(F.pointerId),D.current=!1;const{x:X,y:Q}=_n(F.nativeEvent,R.current);b.setState({userSelectionRect:{width:0,height:0,startX:X,startY:Q,x:X,y:Q}}),q||(F.stopPropagation(),F.preventDefault())},B=F=>{const{userSelectionRect:W,transform:q,nodeLookup:L,edgeLookup:z,connectionLookup:X,triggerNodeChanges:Q,triggerEdgeChanges:te,defaultEdgeOptions:ne,resetSelectedElements:Z}=b.getState();if(!R.current||!W)return;const{x:K,y:re}=_n(F.nativeEvent,R.current),{startX:ce,startY:me}=W;if(!D.current){const ze=t?0:o;if(Math.hypot(K-ce,re-me)<=ze)return;Z(),l?.(F)}D.current=!0;const ge={startX:ce,startY:me,x:K<ce?K:ce,y:re<me?re:me,width:Math.abs(K-ce),height:Math.abs(re-me)},pe=_.current,Re=$.current;_.current=new Set(hy(L,ge,q,n===Si.Partial,!0).map(ze=>ze.id)),$.current=new Set;const Le=ne?.selectable??!0;for(const ze of _.current){const le=X.get(ze);if(le)for(const{edgeId:we}of le.values()){const Oe=z.get(we);Oe&&(Oe.selectable??Le)&&$.current.add(we)}}if(!tb(pe,_.current)){const ze=oi(L,_.current,!0);Q(ze)}if(!tb(Re,$.current)){const ze=oi(z,$.current);te(ze)}b.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})},A=F=>{F.button===0&&(F.target?.releasePointerCapture?.(F.pointerId),!E&&F.target===M.current&&b.getState().userSelectionRect&&H?.(F),b.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c?.(F),b.setState({nodesSelectionActive:_.current.size>0})))},V=r===!0||Array.isArray(r)&&r.includes(0);return p.jsxs("div",{className:mt(["react-flow__pane",{draggable:V,dragging:N,selection:e}]),onClick:P?void 0:og(H,M),onContextMenu:og(j,M),onWheel:og(U,M),onPointerEnter:P?void 0:h,onPointerMove:P?B:v,onPointerUp:P?A:void 0,onPointerDownCapture:P?I:void 0,onClickCapture:P?G:void 0,onPointerLeave:x,ref:M,style:gf,children:[S,p.jsx(f7,{})]})}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",Zn.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=n9({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 g7=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=g7(l),x=o?i[0]:5,S=o?i[1]:5,b=n.direction.x*x*n.factor,E=n.direction.y*S*n.factor;for(const[,w]of f){if(!v(w))continue;let N={x:w.internals.positionAbsolute.x+b,y:w.internals.positionAbsolute.y+E};o&&(N=Al(N,i));const{position:k,positionAbsolute:P}=LE({nodeId:w.id,nextPosition:N,nodeLookup:f,nodeExtent:r,nodeOrigin:g,onError:c});w.position=k,w.internals.positionAbsolute=P,h.set(w.id,w)}d(h)},[])}const Cy=m.createContext(null),m7=Cy.Provider;Cy.Consumer;const xN=()=>m.useContext(Cy),y7=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),v7=(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 x7({type:e="source",position:t=Se.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,b=e==="target",E=it(),w=xN(),{connectOnClick:N,noPanClassName:k,rfId:P}=Be(y7,rt),{connectingFrom:M,connectingTo:R,clickConnecting:_,isPossibleEndHandle:$,connectionInProcess:D,clickConnectionInProcess:H,valid:j}=Be(v7(w,S,e),rt);w||E.getState().onError?.("010",Zn.error010());const U=B=>{const{defaultEdgeOptions:A,onConnect:V,hasDefaultEdges:F}=E.getState(),W={...A,...B};if(F){const{edges:q,setEdges:L}=E.getState();L(YE(W,q))}V?.(W),c?.(W)},G=B=>{if(!w)return;const A=UE(B.nativeEvent);if(o&&(A&&B.button===0||!A)){const V=E.getState();Gg.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:V.autoPanOnConnect,connectionMode:V.connectionMode,connectionRadius:V.connectionRadius,domNode:V.domNode,nodeLookup:V.nodeLookup,lib:V.lib,isTarget:b,handleId:S,nodeId:w,flowId:V.rfId,panBy:V.panBy,cancelConnection:V.cancelConnection,onConnectStart:V.onConnectStart,onConnectEnd:(...F)=>E.getState().onConnectEnd?.(...F),updateConnection:V.updateConnection,onConnect:U,isValidConnection:n||((...F)=>E.getState().isValidConnection?.(...F)??!0),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:V.autoPanSpeed,dragThreshold:V.connectionDragThreshold})}A?g?.(B):h?.(B)},I=B=>{const{onClickConnectStart:A,onClickConnectEnd:V,connectionClickStartHandle:F,connectionMode:W,isValidConnection:q,lib:L,rfId:z,nodeLookup:X,connection:Q}=E.getState();if(!w||!F&&!o)return;if(!F){A?.(B.nativeEvent,{nodeId:w,handleId:S,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:w,type:e,id:S}});return}const te=HE(B.target),ne=n||q,{connection:Z,isValid:K}=Gg.isValid(B.nativeEvent,{handle:{nodeId:w,id:S,type:e},connectionMode:W,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:ne,flowId:z,doc:te,lib:L,nodeLookup:X});K&&Z&&U(Z);const re=structuredClone(Q);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,V?.(B,re),E.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":S,"data-nodeid":w,"data-handlepos":t,"data-id":`${P}-${w}-${S}-${e}`,className:mt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,f,{source:!b,target:b,connectable:r,connectablestart:o,connectableend:i,clickconnecting:_,connectingfrom:M,connectingto:R,valid:j,connectionindicator:r&&(!D||$)&&(D||H?i:o)}]),onMouseDown:G,onTouchStart:G,onClick:N?I:void 0,ref:x,...v,children:d})}const yl=m.memo(gN(x7));function w7({data:e,isConnectable:t,sourcePosition:n=Se.Bottom}){return p.jsxs(p.Fragment,{children:[e?.label,p.jsx(yl,{type:"source",position:n,isConnectable:t})]})}function b7({data:e,isConnectable:t,targetPosition:n=Se.Top,sourcePosition:r=Se.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 S7(){return null}function C7({data:e,isConnectable:t,targetPosition:n=Se.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}},_b={input:w7,default:b7,output:C7,group:S7};function E7(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 N7=e=>{const{width:t,height:n,x:r,y:o}=_l(e.nodeLookup,{filter:i=>!!i.selected});return{width:In(t)?t:null,height:In(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 k7({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=it(),{width:o,height:i,transformString:l,userSelectionActive:c}=Be(N7,rt),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(b=>b.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 Ab=typeof window<"u"?window:void 0,T7=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:b,zoomActivationKeyCode:E,elementsSelectable:w,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:P,panOnScrollSpeed:M,panOnScrollMode:R,zoomOnDoubleClick:_,panOnDrag:$,defaultViewport:D,translateExtent:H,minZoom:j,maxZoom:U,preventScrolling:G,onSelectionContextMenu:I,noWheelClassName:B,noPanClassName:A,disableKeyboardA11y:V,onViewportChange:F,isControlledViewport:W}){const{nodesSelectionActive:q,userSelectionActive:L}=Be(T7,rt),z=ml(f,{target:Ab}),X=ml(b,{target:Ab}),Q=X||$,te=X||P,ne=g&&Q!==!0,Z=z||L||ne;return a7({deleteKeyCode:d,multiSelectionKeyCode:S}),p.jsx(u7,{onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:te,panOnScrollSpeed:M,panOnScrollMode:R,zoomOnDoubleClick:_,panOnDrag:!z&&Q,defaultViewport:D,translateExtent:H,minZoom:j,maxZoom:U,zoomActivationKeyCode:E,preventScrolling:G,noWheelClassName:B,noPanClassName:A,onViewportChange:F,isControlledViewport:W,paneClickDistance:c,selectionOnDrag:ne,children:p.jsxs(h7,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:Q,isSelecting:!!Z,selectionMode:h,selectionKeyPressed:z,paneClickDistance:c,selectionOnDrag:ne,children:[e,q&&p.jsx(k7,{onSelectionContextMenu:I,noPanClassName:A,disableKeyboardA11y:V})]})})}wN.displayName="FlowRenderer";const P7=m.memo(wN),R7=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 I7(e){return Be(m.useCallback(R7(e),[e]),rt)}const _7=e=>e.updateNodeInternals;function A7(){const e=Be(_7),[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 M7({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 D7({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:b,nodeTypes:E,nodeClickDistance:w,onError:N}){const{node:k,internals:P,isParent:M}=Be(K=>{const re=K.nodeLookup.get(e),ce=K.parentLookup.has(e);return{node:re,internals:re.internals,isParent:ce}},rt);let R=k.type||"default",_=E?.[R]||_b[R];_===void 0&&(N?.("003",Zn.error003(R)),R="default",_=E?.default||_b.default);const $=!!(k.draggable||c&&typeof k.draggable>"u"),D=!!(k.selectable||d&&typeof k.selectable>"u"),H=!!(k.connectable||f&&typeof k.connectable>"u"),j=!!(k.focusable||g&&typeof k.focusable>"u"),U=it(),G=my(k),I=M7({node:k,nodeType:R,hasDimensions:G,resizeObserver:h}),B=yN({nodeRef:I,disabled:k.hidden||!$,noDragClassName:v,handleSelector:k.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:w}),A=vN();if(k.hidden)return null;const V=Pr(k),F=E7(k),W=D||$||t||n||r||o,q=n?K=>n(K,{...P.userNode}):void 0,L=r?K=>r(K,{...P.userNode}):void 0,z=o?K=>o(K,{...P.userNode}):void 0,X=i?K=>i(K,{...P.userNode}):void 0,Q=l?K=>l(K,{...P.userNode}):void 0,te=K=>{const{selectNodesOnDrag:re,nodeDragThreshold:ce}=U.getState();D&&(!re||!$||ce>0)&&Xg({id:e,store:U,nodeRef:I}),t&&t(K,{...P.userNode})},ne=K=>{if(!(WE(K.nativeEvent)||S)){if(ME.includes(K.key)&&D){const re=K.key==="Escape";Xg({id:e,store:U,unselect:re,nodeRef:I})}else if($&&k.selected&&Object.prototype.hasOwnProperty.call(hd,K.key)){K.preventDefault();const{ariaLabelConfig:re}=U.getState();U.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~P.positionAbsolute.x,y:~~P.positionAbsolute.y})}),A({direction:hd[K.key],factor:K.shiftKey?4:1})}}},Z=()=>{if(S||!I.current?.matches(":focus-visible"))return;const{transform:K,width:re,height:ce,autoPanOnNodeFocus:me,setCenter:ge}=U.getState();if(!me)return;hy(new Map([[e,k]]),{x:0,y:0,width:re,height:ce},K,!0).length>0||ge(k.position.x+V.width/2,k.position.y+V.height/2,{zoom:K[2]})};return p.jsx("div",{className:mt(["react-flow__node",`react-flow__node-${R}`,{[x]:$},k.className,{selected:k.selected,selectable:D,parent:M,draggable:$,dragging:B}]),ref:I,style:{zIndex:P.z,transform:`translate(${P.positionAbsolute.x}px,${P.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:G?"visible":"hidden",...k.style,...F},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:q,onMouseMove:L,onMouseLeave:z,onContextMenu:X,onClick:te,onDoubleClick:Q,onKeyDown:j?ne:void 0,tabIndex:j?0:void 0,onFocus:j?Z:void 0,role:k.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${cN}-${b}`,"aria-label":k.ariaLabel,...k.domAttributes,children:p.jsx(m7,{value:e,children:p.jsx(_,{id:e,data:k.data,type:R,positionAbsoluteX:P.positionAbsolute.x,positionAbsoluteY:P.positionAbsolute.y,selected:k.selected??!1,selectable:D,draggable:$,deletable:k.deletable??!0,isConnectable:H,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:B,dragHandle:k.dragHandle,zIndex:P.z,parentId:k.parentId,...V})})})}var j7=m.memo(D7);const O7=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}=Be(O7,rt),l=I7(e.onlyRenderVisibleElements),c=A7();return p.jsx("div",{className:"react-flow__nodes",style:gf,children:l.map(d=>p.jsx(j7,{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 $7=m.memo(bN);function L7(e){return Be(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&&LU({sourceNode:i,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),rt)}const F7=({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"})},z7=({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"})},Mb={[ud.Arrow]:F7,[ud.ArrowClosed]:z7};function V7(e){const t=it();return m.useMemo(()=>Object.prototype.hasOwnProperty.call(Mb,e)?Mb[e]:(t.getState().onError?.("009",Zn.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=V7(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=Be(i=>i.edges),r=Be(i=>i.defaultEdgeOptions),o=m.useMemo(()=>UU(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 H7=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 b=S.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.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 W7=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&&In(t)&&In(n)?p.jsx(W7,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function Db({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Se.Left||e===Se.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function EN({sourceX:e,sourceY:t,sourcePosition:n=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top}){const[l,c]=Db({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=Db({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:b,markerStart:E,interactionWidth:w})=>{const[N,k,P]=EN({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c}),M=e.isInternal?void 0:t;return p.jsx(Dl,{id:M,path:N,labelX:k,labelY:P,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:b,markerStart:E,interactionWidth:w})})}const U7=NN({isInternal:!1}),kN=NN({isInternal:!0});U7.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=Se.Bottom,targetPosition:S=Se.Top,markerEnd:b,markerStart:E,pathOptions:w,interactionWidth:N})=>{const[k,P,M]=Wg({sourceX:n,sourceY:r,sourcePosition:x,targetX:o,targetY:i,targetPosition:S,borderRadius:w?.borderRadius,offset:w?.offset,stepPosition:w?.stepPosition}),R=e.isInternal?void 0:t;return p.jsx(Dl,{id:R,path:k,labelX:P,labelY:M,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:b,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 K7=IN({isInternal:!1}),_N=IN({isInternal:!0});K7.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:b})=>{const[E,w,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:w,labelY:N,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:x,markerStart:S,interactionWidth:b})})}const G7=AN({isInternal:!1}),MN=AN({isInternal:!0});G7.displayName="StraightEdge";MN.displayName="StraightEdgeInternal";function DN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l=Se.Bottom,targetPosition:c=Se.Top,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:b,markerStart:E,pathOptions:w,interactionWidth:N})=>{const[k,P,M]=pd({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c,curvature:w?.curvature}),R=e.isInternal?void 0:t;return p.jsx(Dl,{id:R,path:k,labelX:P,labelY:M,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:b,markerStart:E,interactionWidth:N})})}const Y7=DN({isInternal:!1}),jN=DN({isInternal:!0});Y7.displayName="BezierEdge";jN.displayName="BezierEdgeInternal";const jb={default:jN,straight:MN,step:_N,smoothstep:RN,simplebezier:kN},Ob={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},X7=(e,t,n)=>n===Se.Left?e-t:n===Se.Right?e+t:e,q7=(e,t,n)=>n===Se.Top?e-t:n===Se.Bottom?e+t:e,$b="react-flow__edgeupdater";function Lb({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([$b,`${$b}-${c}`]),cx:X7(t,r,e),cy:q7(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Z7({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(),b=(P,M)=>{if(P.button!==0)return;const{autoPanOnConnect:R,domNode:_,connectionMode:$,connectionRadius:D,lib:H,onConnectStart:j,cancelConnection:U,nodeLookup:G,rfId:I,panBy:B,updateConnection:A}=S.getState(),V=M.type==="target",F=(L,z)=>{v(!1),h?.(L,n,M.type,z)},W=L=>f?.(n,L),q=(L,z)=>{v(!0),g?.(P,n,M.type),j?.(L,z)};Gg.onPointerDown(P.nativeEvent,{autoPanOnConnect:R,connectionMode:$,connectionRadius:D,domNode:_,handleId:M.id,nodeId:M.nodeId,nodeLookup:G,isTarget:V,edgeUpdaterType:M.type,lib:H,flowId:I,cancelConnection:U,panBy:B,isValidConnection:(...L)=>S.getState().isValidConnection?.(...L)??!0,onConnect:W,onConnectStart:q,onConnectEnd:(...L)=>S.getState().onConnectEnd?.(...L),onReconnectEnd:F,updateConnection:A,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:P.currentTarget})},E=P=>b(P,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),w=P=>b(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(Lb,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:N,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&p.jsx(Lb,{position:d,centerX:i,centerY:l,radius:t,onMouseDown:w,onMouseEnter:N,onMouseOut:k,type:"target"})]})}function Q7({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:b,noPanClassName:E,onError:w,disableKeyboardA11y:N}){let k=Be(ge=>ge.edgeLookup.get(e));const P=Be(ge=>ge.defaultEdgeOptions);k=P?{...P,...k}:k;let M=k.type||"default",R=b?.[M]||jb[M];R===void 0&&(w?.("011",Zn.error011(M)),M="default",R=b?.default||jb.default);const _=!!(k.focusable||t&&typeof k.focusable>"u"),$=typeof h<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),D=!!(k.selectable||r&&typeof k.selectable>"u"),H=m.useRef(null),[j,U]=m.useState(!1),[G,I]=m.useState(!1),B=it(),{zIndex:A,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z}=Be(m.useCallback(ge=>{const pe=ge.nodeLookup.get(k.source),Re=ge.nodeLookup.get(k.target);if(!pe||!Re)return{zIndex:k.zIndex,...Ob};const Le=WU({id:e,sourceNode:pe,targetNode:Re,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ge.connectionMode,onError:w});return{zIndex:$U({selected:k.selected,zIndex:k.zIndex,sourceNode:pe,targetNode:Re,elevateOnSelect:ge.elevateEdgesOnSelect,zIndexMode:ge.zIndexMode}),...Le||Ob}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),rt),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||V===null||F===null||W===null||q===null)return null;const te=ge=>{const{addSelectedEdges:pe,unselectNodesAndEdges:Re,multiSelectionActive:Le}=B.getState();D&&(B.setState({nodesSelectionActive:!1}),k.selected&&Le?(Re({nodes:[],edges:[k]}),H.current?.blur()):pe([e])),o&&o(ge,k)},ne=i?ge=>{i(ge,{...k})}:void 0,Z=l?ge=>{l(ge,{...k})}:void 0,K=c?ge=>{c(ge,{...k})}:void 0,re=d?ge=>{d(ge,{...k})}:void 0,ce=f?ge=>{f(ge,{...k})}:void 0,me=ge=>{if(!N&&ME.includes(ge.key)&&D){const{unselectNodesAndEdges:pe,addSelectedEdges:Re}=B.getState();ge.key==="Escape"?(H.current?.blur(),pe({edges:[k]})):Re([e])}};return p.jsx("svg",{style:{zIndex:A},children:p.jsxs("g",{className:mt(["react-flow__edge",`react-flow__edge-${M}`,k.className,E,{selected:k.selected,animated:k.animated,inactive:!D&&!o,updating:j,selectable:D}]),onClick:te,onDoubleClick:ne,onContextMenu:Z,onMouseEnter:K,onMouseMove:re,onMouseLeave:ce,onKeyDown:_?me:void 0,tabIndex:_?0:void 0,role:k.ariaRole??(_?"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":_?`${uN}-${S}`:void 0,ref:H,...k.domAttributes,children:[!G&&p.jsx(R,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:D,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z,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}),$&&p.jsx(Z7,{edge:k,isReconnectable:$,reconnectRadius:g,onReconnect:h,onReconnectStart:v,onReconnectEnd:x,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z,setUpdateHover:U,setReconnecting:I})]})})}var J7=m.memo(Q7);const eK=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:b}){const{edgesFocusable:E,edgesReconnectable:w,elementsSelectable:N,onError:k}=Be(eK,rt),P=L7(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(H7,{defaultColor:e,rfId:n}),P.map(M=>p.jsx(J7,{id:M,edgesFocusable:E,edgesReconnectable:w,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:b},M))]})}ON.displayName="EdgeRenderer";const tK=m.memo(ON),nK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function rK({children:e}){const t=Be(nK);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function oK(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 sK=e=>e.panZoom?.syncViewport;function iK(e){const t=Be(sK),n=it();return m.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function aK(e){return e.connection.inProgress?{...e.connection,to:Ml(e.connection.to,e.transform)}:{...e.connection}}function lK(e){return aK}function cK(e){const t=lK();return Be(t,rt)}const uK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:l,isValid:c,inProgress:d}=Be(uK,rt);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=io.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}=cK();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 b={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:v};switch(t){case io.Bezier:[S]=pd(b);break;case io.SimpleBezier:[S]=EN(b);break;case io.Step:[S]=Wg({...b,borderRadius:0});break;case io.SmoothStep:[S]=Wg(b);break;default:[S]=XE(b)}return p.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};$N.displayName="ConnectionLine";const fK={};function Fb(e=fK){m.useRef(e),it(),m.useEffect(()=>{},[e])}function pK(){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:b,connectionLineComponent:E,connectionLineContainerStyle:w,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,multiSelectionKeyCode:M,panActivationKeyCode:R,zoomActivationKeyCode:_,deleteKeyCode:$,onlyRenderVisibleElements:D,elementsSelectable:H,defaultViewport:j,translateExtent:U,minZoom:G,maxZoom:I,preventScrolling:B,defaultMarkerColor:A,zoomOnScroll:V,zoomOnPinch:F,panOnScroll:W,panOnScrollSpeed:q,panOnScrollMode:L,zoomOnDoubleClick:z,panOnDrag:X,onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ne,onPaneMouseLeave:Z,onPaneScroll:K,onPaneContextMenu:re,paneClickDistance:ce,nodeClickDistance:me,onEdgeContextMenu:ge,onEdgeMouseEnter:pe,onEdgeMouseMove:Re,onEdgeMouseLeave:Le,reconnectRadius:ze,onReconnect:le,onReconnectStart:we,onReconnectEnd:Oe,noDragClassName:ot,noWheelClassName:Je,noPanClassName:Ct,disableKeyboardA11y:Ke,nodeExtent:ms,rfId:bo,viewport:tr,onViewportChange:nr}){return Fb(e),Fb(t),pK(),oK(n),iK(tr),p.jsx(P7,{onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ne,onPaneMouseLeave:Z,onPaneContextMenu:re,onPaneScroll:K,paneClickDistance:ce,deleteKeyCode:$,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:M,panActivationKeyCode:R,zoomActivationKeyCode:_,elementsSelectable:H,zoomOnScroll:V,zoomOnPinch:F,zoomOnDoubleClick:z,panOnScroll:W,panOnScrollSpeed:q,panOnScrollMode:L,panOnDrag:X,defaultViewport:j,translateExtent:U,minZoom:G,maxZoom:I,onSelectionContextMenu:h,preventScrolling:B,noDragClassName:ot,noWheelClassName:Je,noPanClassName:Ct,disableKeyboardA11y:Ke,onViewportChange:nr,isControlledViewport:!!tr,children:p.jsxs(rK,{children:[p.jsx(tK,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:le,onReconnectStart:we,onReconnectEnd:Oe,onlyRenderVisibleElements:D,onEdgeContextMenu:ge,onEdgeMouseEnter:pe,onEdgeMouseMove:Re,onEdgeMouseLeave:Le,reconnectRadius:ze,defaultMarkerColor:A,noPanClassName:Ct,disableKeyboardA11y:Ke,rfId:bo}),p.jsx(dK,{style:b,type:S,component:E,containerStyle:w}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx($7,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:g,nodeClickDistance:me,onlyRenderVisibleElements:D,noPanClassName:Ct,noDragClassName:ot,disableKeyboardA11y:Ke,nodeExtent:ms,rfId:bo}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}LN.displayName="GraphView";const hK=m.memo(LN),zb=({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,b=new Map,E=new Map,w=r??t??[],N=n??e??[],k=g??[0,0],P=h??pl;QE(b,E,w);const{nodesInitialized:M}=Kg(N,x,S,{nodeOrigin:k,nodeExtent:P,zIndexMode:v});let R=[0,0,1];if(l&&o&&i){const _=_l(x,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:$,y:D,zoom:H}=gy(_,o,i,d,f,c?.padding??.1);R=[$,D,H]}return{rfId:"1",width:o??0,height:i??0,transform:R,nodes:N,nodesInitialized:M,nodeLookup:x,parentLookup:S,edges:w,edgeLookup:E,connectionLookup:b,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:_U,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:DE,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gK=({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})=>D9((x,S)=>{async function b(){const{nodeLookup:E,panZoom:w,fitViewOptions:N,fitViewResolver:k,width:P,height:M,minZoom:R,maxZoom:_}=S();w&&(await RU({nodes:E,width:P,height:M,panZoom:w,minZoom:R,maxZoom:_},N),k?.resolve(!0),x({fitViewResolver:null}))}return{...zb({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:w,parentLookup:N,nodeOrigin:k,elevateNodesOnSelect:P,fitViewQueued:M,zIndexMode:R,nodesSelectionActive:_}=S(),{nodesInitialized:$,hasSelectedNodes:D}=Kg(E,w,N,{nodeOrigin:k,nodeExtent:h,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:R}),H=_&&D;M&&$?(b(),x({nodes:E,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):x({nodes:E,nodesInitialized:$,nodesSelectionActive:H})},setEdges:E=>{const{connectionLookup:w,edgeLookup:N}=S();QE(w,N,E),x({edges:E})},setDefaultNodesAndEdges:(E,w)=>{if(E){const{setNodes:N}=S();N(E),x({hasDefaultNodes:!0})}if(w){const{setEdges:N}=S();N(w),x({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:w,nodeLookup:N,parentLookup:k,domNode:P,nodeOrigin:M,nodeExtent:R,debug:_,fitViewQueued:$,zIndexMode:D}=S(),{changes:H,updatedInternals:j}=QU(E,N,k,P,M,R,D);j&&(YU(N,k,{nodeOrigin:M,nodeExtent:R,zIndexMode:D}),$?(b(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),H?.length>0&&(_&&console.log("React Flow: trigger node changes",H),w?.(H)))},updateNodePositions:(E,w=!1)=>{const N=[];let k=[];const{nodeLookup:P,triggerNodeChanges:M,connection:R,updateConnection:_,onNodesChangeMiddlewareMap:$}=S();for(const[D,H]of E){const j=P.get(D),U=!!(j?.expandParent&&j?.parentId&&H?.position),G={id:D,type:"position",position:U?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:w};if(j&&R.inProgress&&R.fromNode.id===j.id){const I=cs(j,R.fromHandle,Se.Left,!0);_({...R,from:I})}U&&j.parentId&&N.push({id:D,parentId:j.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),k.push(G)}if(N.length>0){const{parentLookup:D,nodeOrigin:H}=S(),j=Sy(N,P,D,H);k.push(...j)}for(const D of $.values())k=D(k);M(k)},triggerNodeChanges:E=>{const{onNodesChange:w,setNodes:N,nodes:k,hasDefaultNodes:P,debug:M}=S();if(E?.length){if(P){const R=pN(E,k);N(R)}M&&console.log("React Flow: trigger node changes",E),w?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:w,setEdges:N,edges:k,hasDefaultEdges:P,debug:M}=S();if(E?.length){if(P){const R=hN(E,k);N(R)}M&&console.log("React Flow: trigger edge changes",E),w?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:M}=S();if(w){const R=E.map(_=>Wo(_,!0));P(R);return}P(oi(k,new Set([...E]),!0)),M(oi(N))},addSelectedEdges:E=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:M}=S();if(w){const R=E.map(_=>Wo(_,!0));M(R);return}M(oi(N,new Set([...E]))),P(oi(k,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:w}={})=>{const{edges:N,nodes:k,nodeLookup:P,triggerNodeChanges:M,triggerEdgeChanges:R}=S(),_=E||k,$=w||N,D=[];for(const j of _){if(!j.selected)continue;const U=P.get(j.id);U&&(U.selected=!1),D.push(Wo(j.id,!1))}const H=[];for(const j of $)j.selected&&H.push(Wo(j.id,!1));M(D),R(H)},setMinZoom:E=>{const{panZoom:w,maxZoom:N}=S();w?.setScaleExtent([E,N]),x({minZoom:E})},setMaxZoom:E=>{const{panZoom:w,minZoom:N}=S();w?.setScaleExtent([N,E]),x({maxZoom:E})},setTranslateExtent:E=>{S().panZoom?.setTranslateExtent(E),x({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:w,triggerNodeChanges:N,triggerEdgeChanges:k,elementsSelectable:P}=S();if(!P)return;const M=w.reduce((_,$)=>$.selected?[..._,Wo($.id,!1)]:_,[]),R=E.reduce((_,$)=>$.selected?[..._,Wo($.id,!1)]:_,[]);N(M),k(R)},setNodeExtent:E=>{const{nodes:w,nodeLookup:N,parentLookup:k,nodeOrigin:P,elevateNodesOnSelect:M,nodeExtent:R,zIndexMode:_}=S();E[0][0]===R[0][0]&&E[0][1]===R[0][1]&&E[1][0]===R[1][0]&&E[1][1]===R[1][1]||(Kg(w,N,k,{nodeOrigin:P,nodeExtent:E,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:_}),x({nodeExtent:E}))},panBy:E=>{const{transform:w,width:N,height:k,panZoom:P,translateExtent:M}=S();return JU({delta:E,panZoom:P,transform:w,translateExtent:M,width:N,height:k})},setCenter:async(E,w,N)=>{const{width:k,height:P,maxZoom:M,panZoom:R}=S();if(!R)return Promise.resolve(!1);const _=typeof N?.zoom<"u"?N.zoom:M;return await R.setViewport({x:k/2-E*_,y:P/2-w*_,zoom:_},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...jE}})},updateConnection:E=>{x({connection:E})},reset:()=>x({...zb()})}},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(()=>gK({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(j9,{value:S,children:p.jsx(r7,{children:x})})}function mK({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 yK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function vK({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:b,onClickConnectStart:E,onClickConnectEnd:w,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:M,onNodeDoubleClick:R,onNodeDragStart:_,onNodeDrag:$,onNodeDragStop:D,onNodesDelete:H,onEdgesDelete:j,onDelete:U,onSelectionChange:G,onSelectionDragStart:I,onSelectionDrag:B,onSelectionDragStop:A,onSelectionContextMenu:V,onSelectionStart:F,onSelectionEnd:W,onBeforeDelete:q,connectionMode:L,connectionLineType:z=io.Bezier,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:te,deleteKeyCode:ne="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:K=!1,selectionMode:re=Si.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:me=gl()?"Meta":"Control",zoomActivationKeyCode:ge=gl()?"Meta":"Control",snapToGrid:pe,snapGrid:Re,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:ze,nodesDraggable:le,autoPanOnNodeFocus:we,nodesConnectable:Oe,nodesFocusable:ot,nodeOrigin:Je=dN,edgesFocusable:Ct,edgesReconnectable:Ke,elementsSelectable:ms=!0,defaultViewport:bo=Y9,minZoom:tr=.5,maxZoom:nr=2,translateExtent:So=pl,preventScrolling:Vl=!0,nodeExtent:rr,defaultMarkerColor:Co="#b1b1b7",zoomOnScroll:Tf=!0,zoomOnPinch:Bl=!0,panOnScroll:Hl=!1,panOnScrollSpeed:Pf=.5,panOnScrollMode:Vi=Zo.Free,zoomOnDoubleClick:Bi=!0,panOnDrag:Hi=!0,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:Ir,onPaneMouseLeave:_r,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl=1,nodeClickDistance:Gl=0,children:Yl,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:Eo,onEdgeContextMenu:Gi,onEdgeDoubleClick:No,onEdgeMouseEnter:Rf,onEdgeMouseMove:ko,onEdgeMouseLeave:ys,reconnectRadius:vs=10,onNodesChange:Yi,onEdgesChange:If,noDragClassName:_f="nodrag",noWheelClassName:Af="nowheel",noPanClassName:Ln="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:To,nodeDragThreshold:un,connectionDragThreshold:$f,viewport:qt,onViewportChange:Lf,width:Ff,height:zf,colorMode:ws="light",debug:bs,onScroll:Ar,ariaLabelConfig:Ss,zIndexMode:rc="basic",...Vf},Qi){const Cs=To||"1",Ji=Q9(ws),Po=m.useCallback(oc=>{oc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ar?.(oc)},[Ar]);return p.jsx("div",{"data-testid":"rf__wrapper",...Vf,onScroll:Po,style:{...nc,...yK},ref:Qi,className:mt(["react-flow",o,Ji]),id:To,role:"application",children:p.jsxs(mK,{nodes:e,edges:t,width:Ff,height:zf,fitView:Xi,fitViewOptions:qi,minZoom:tr,maxZoom:nr,nodeOrigin:Je,nodeExtent:rr,zIndexMode:rc,children:[p.jsx(Z9,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:w,nodesDraggable:le,autoPanOnNodeFocus:we,nodesConnectable:Oe,nodesFocusable:ot,edgesFocusable:Ct,edgesReconnectable:Ke,elementsSelectable:ms,elevateNodesOnSelect:Jl,elevateEdgesOnSelect:Df,minZoom:tr,maxZoom:nr,nodeExtent:rr,onNodesChange:Yi,onEdgesChange:If,snapToGrid:pe,snapGrid:Re,connectionMode:L,translateExtent:So,connectOnClick:Mf,defaultEdgeOptions:Ql,fitView:Xi,fitViewOptions:qi,onNodesDelete:H,onEdgesDelete:j,onDelete:U,onNodeDragStart:_,onNodeDrag:$,onNodeDragStop:D,onSelectionDrag:B,onSelectionDragStart:I,onSelectionDragStop:A,onMove:g,onMoveStart:h,onMoveEnd:v,noPanClassName:Ln,nodeOrigin:Je,rfId:Cs,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,onError:Of,connectionRadius:tc,isValidConnection:xs,selectNodesOnDrag:ze,nodeDragThreshold:un,connectionDragThreshold:$f,onBeforeDelete:q,debug:bs,ariaLabelConfig:Ss,zIndexMode:rc}),p.jsx(hK,{onInit:f,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:M,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:l,connectionLineType:z,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:te,selectionKeyCode:Z,selectionOnDrag:K,selectionMode:re,deleteKeyCode:ne,multiSelectionKeyCode:me,panActivationKeyCode:ce,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Le,defaultViewport:bo,translateExtent:So,minZoom:tr,maxZoom:nr,preventScrolling:Vl,zoomOnScroll:Tf,zoomOnPinch:Bl,zoomOnDoubleClick:Bi,panOnScroll:Hl,panOnScrollSpeed:Pf,panOnScrollMode:Vi,panOnDrag:Hi,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:Ir,onPaneMouseLeave:_r,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl,nodeClickDistance:Gl,onSelectionContextMenu:V,onSelectionStart:F,onSelectionEnd:W,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:Eo,onEdgeContextMenu:Gi,onEdgeDoubleClick:No,onEdgeMouseEnter:Rf,onEdgeMouseMove:ko,onEdgeMouseLeave:ys,reconnectRadius:vs,defaultMarkerColor:Co,noDragClassName:_f,noWheelClassName:Af,noPanClassName:Ln,rfId:Cs,disableKeyboardA11y:ec,nodeExtent:rr,viewport:qt,onViewportChange:Lf}),p.jsx(G9,{onSelectionChange:G}),Yl,p.jsx(B9,{proOptions:Zl,position:ql}),p.jsx(V9,{rfId:Cs,disableKeyboardA11y:ec})]})})}var xK=gN(vK);const wK=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function bK({children:e}){const t=Be(wK);return t?ps.createPortal(e,t):null}const SK=e=>e.edges;function CK(){return Be(SK,rt)}const EK=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 NK(e={includeHiddenNodes:!1}){return Be(EK(e))}function kK({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 TK({radius:e,className:t}){return p.jsx("circle",{cx:e,cy:e,r:e,className:mt(["react-flow__background-pattern","dots",t])})}var xr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(xr||(xr={}));const PK={[xr.Dots]:1,[xr.Lines]:1,[xr.Cross]:6},RK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function zN({id:e,variant:t=xr.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}=Be(RK,rt),S=r||PK[t],b=t===xr.Dots,E=t===xr.Cross,w=Array.isArray(n)?n:[n,n],N=[w[0]*v[2]||1,w[1]*v[2]||1],k=S*v[2],P=Array.isArray(i)?i:[i,i],M=E?[k,k]:N,R=[P[0]*v[2]||1+M[0]/2,P[1]*v[2]||1+M[1]/2],_=`${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:_,x:v[0]%N[0],y:v[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:b?p.jsx(TK,{radius:k/2,className:g}):p.jsx(kK,{dimensions:M,lineWidth:o,variant:t,className:g})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${_})`})]})}zN.displayName="Background";const IK=m.memo(zN);function _K(){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 AK(){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 MK(){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 DK(){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 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 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 OK=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:b,minZoomReached:E,maxZoomReached:w,ariaLabelConfig:N}=Be(OK,rt),{zoomIn:k,zoomOut:P,fitView:M}=hf(),R=()=>{k(),i?.()},_=()=>{P(),l?.()},$=()=>{M(o),c?.()},D=()=>{S.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d?.(!b)},H=v==="horizontal"?"horizontal":"vertical";return p.jsxs(pf,{className:mt(["react-flow__controls",H,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:R,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:w,children:p.jsx(_K,{})}),p.jsx(Cu,{onClick:_,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:E,children:p.jsx(AK,{})})]}),n&&p.jsx(Cu,{className:"react-flow__controls-fitview",onClick:$,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:p.jsx(MK,{})}),r&&p.jsx(Cu,{className:"react-flow__controls-interactive",onClick:D,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:b?p.jsx(jK,{}):p.jsx(DK,{})}),g]})}VN.displayName="Controls";const $K=m.memo(VN);function LK({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:b}=i||{},E=l||S||b;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?w=>x(w,e):void 0})}const FK=m.memo(LK),zK=e=>e.nodes.map(t=>t.id),sg=e=>e instanceof Function?e:()=>e;function VK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=FK,onClick:l}){const c=Be(zK,rt),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(HK,{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}=Be(S=>{const b=S.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const E=b.internals.userNode,{x:w,y:N}=b.internals.positionAbsolute,{width:k,height:P}=Pr(E);return{node:E,x:w,y:N,width:k,height:P}},rt);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 HK=m.memo(BK);var WK=m.memo(VK);const UK=200,KK=150,GK=e=>!e.hidden,YK=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:GK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},XK="react-flow__minimap-desc";function BN({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:b=!1,zoomable:E=!1,ariaLabel:w,inversePan:N,zoomStep:k=1,offsetScale:P=5}){const M=it(),R=m.useRef(null),{boundingRect:_,viewBB:$,rfId:D,panZoom:H,translateExtent:j,flowWidth:U,flowHeight:G,ariaLabelConfig:I}=Be(YK,rt),B=e?.width??UK,A=e?.height??KK,V=_.width/B,F=_.height/A,W=Math.max(V,F),q=W*B,L=W*A,z=P*W,X=_.x-(q-_.width)/2-z,Q=_.y-(L-_.height)/2-z,te=q+z*2,ne=L+z*2,Z=`${XK}-${D}`,K=m.useRef(0),re=m.useRef();K.current=W,m.useEffect(()=>{if(R.current&&H)return re.current=l9({domNode:R.current,panZoom:H,getTransform:()=>M.getState().transform,getViewScale:()=>K.current}),()=>{re.current?.destroy()}},[H]),m.useEffect(()=>{re.current?.update({translateExtent:j,width:U,height:G,inversePan:N,pannable:b,zoomStep:k,zoomable:E})},[b,E,N,k,j,U,G]);const ce=x?pe=>{const[Re,Le]=re.current?.pointer(pe)||[0,0];x(pe,{x:Re,y:Le})}:void 0,me=S?m.useCallback((pe,Re)=>{const Le=M.getState().nodeLookup.get(Re).internals.userNode;S(pe,Le)},[]):void 0,ge=w??I["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:B,height:A,viewBox:`${X} ${Q} ${te} ${ne}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:R,onClick:ce,children:[ge&&p.jsx("title",{id:Z,children:ge}),p.jsx(WK,{onClick:me,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-z},${Q-z}h${te+z*2}v${ne+z*2}h${-te-z*2}z
|
|
59
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}BN.displayName="MiniMap";const qK=m.memo(BN),ZK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,QK={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function JK({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:b,onResize:E,onResizeEnd:w}){const N=xN(),k=typeof e=="string"?e:N,P=it(),M=m.useRef(null),R=n===ki.Handle,_=Be(m.useCallback(ZK(R&&x),[R,x]),rt),$=m.useRef(null),D=t??QK[n];m.useEffect(()=>{if(!(!M.current||!k))return $.current||($.current=S9({domNode:M.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:j,transform:U,snapGrid:G,snapToGrid:I,nodeOrigin:B,domNode:A}=P.getState();return{nodeLookup:j,transform:U,snapGrid:G,snapToGrid:I,nodeOrigin:B,paneDomNode:A}},onChange:(j,U)=>{const{triggerNodeChanges:G,nodeLookup:I,parentLookup:B,nodeOrigin:A}=P.getState(),V=[],F={x:j.x,y:j.y},W=I.get(k);if(W&&W.expandParent&&W.parentId){const q=W.origin??A,L=j.width??W.measured.width??0,z=j.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:L,height:z,...BE({x:j.x??W.position.x,y:j.y??W.position.y},{width:L,height:z},W.parentId,I,q)}},Q=Sy([X],I,B,A);V.push(...Q),F.x=j.x?Math.max(q[0]*L,j.x):void 0,F.y=j.y?Math.max(q[1]*z,j.y):void 0}if(F.x!==void 0&&F.y!==void 0){const q={id:k,type:"position",position:{...F}};V.push(q)}if(j.width!==void 0&&j.height!==void 0){const L={id:k,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};V.push(L)}for(const q of U){const L={...q,type:"position"};V.push(L)}G(V)},onEnd:({width:j,height:U})=>{const G={id:k,type:"dimensions",resizing:!1,dimensions:{width:j,height:U}};P.getState().triggerNodeChanges([G])}})),$.current.update({controlPosition:D,boundaries:{minWidth:c,minHeight:d,maxWidth:f,maxHeight:g},keepAspectRatio:h,resizeDirection:v,onResizeStart:b,onResize:E,onResizeEnd:w,shouldResize:S}),()=>{$.current?.destroy()}},[D,c,d,f,g,h,b,E,w,S]);const H=D.split("-");return p.jsx("div",{className:mt(["react-flow__resize-control","nodrag",...H,n,r]),ref:M,style:{...o,scale:_,...l&&{[R?"backgroundColor":"borderColor"]:l}},children:i})}m.memo(JK);function HN(){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 Se.Left:return"right-full mr-3 text-right";case Se.Right:return"left-full ml-3 text-left";case Se.Top:return"bottom-full mb-2 text-center left-1/2 -translate-x-1/2";case Se.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===Se.Left||r===Se.Right?{top:"50%",transform:"translateY(calc(-50% + 12px))"}:{},v=()=>r===Se.Bottom?"top-[15px] left-1/2 -ml-2":"left-[15px] top-1/2 -mt-2",x=r===Se.Top?"translateY(1px)":r===Se.Bottom?"translateY(-1px)":r===Se.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 b={nodeId:t,handleId:e,portType:o};S.currentTarget.dispatchEvent(new CustomEvent("port-plus-click",{detail:b,bubbles:!0}))},onPointerDown:S=>S.stopPropagation(),children:p.jsx(es,{className:"w-2.5 h-2.5",strokeWidth:3})})]})};function eG(e,t,n,r,o,i){switch(e.type){case"variableSelect":{const l=t;if(!l?.varId)return{text:""};const c=n[yr(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 tG(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=>xn(le.builderMode))||!!t?._preview,f=ss(m.useCallback(le=>{const we=le.phase;return(we.status==="paused"||we.status==="stepping")&&we.cursorNodeId===e},[e])),g=ue.getState().activeCanvasId,v=Qe(g)(le=>le.edges),x=ue(le=>le.channels),S=ue(le=>le.memory),b=ue(le=>le.models),E=ue(le=>le.availableModels),{lookup:w}=Li(g),N=m.useMemo(()=>{const le={};for(const we of Object.values(x))le[we.id]=we.label;return le},[x]),k=m.useMemo(()=>{const le={};for(const we of Object.values(S))le[we.id]=we.label;return le},[S]),{modelLabels:P,availableModelIds:M}=m.useMemo(()=>{const le={},we=new Set;for(const Oe of E)le[Oe.id]=Oe.label,we.add(Oe.id);for(const Oe of Object.values(b))le[Oe.id]=Oe.label;return{modelLabels:le,availableModelIds:we}},[E,b]),R=m.useMemo(()=>Mn(l),[l]),{executionInputs:_,toolInputs:$,executionOutputs:D,toolOutputs:H}=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]),j=m.useMemo(()=>tl(e,l,v),[e,l,v]),U=Sd(l),G=m.useMemo(()=>{const le=new Set;for(const we of r?.parameters??[])kr(we,U,j)||le.add(we.id);return le.size>0?le:null},[j,r,U]),I=r?.category,B=m.useMemo(()=>N1({canvasId:g,nodeId:e,nodeData:l,nodeDefinition:r,availableVariables:w,channels:x,memory:S,models:b,availableModelIds:M,edges:v,isStale:o,isDeleted:i}),[g,e,l,r,w,x,S,b,M,v,o,i]),A=m.useMemo(()=>{const le={},we=r?.parameters??[];for(const Oe of we){if(G?.has(Oe.id))continue;const ot=U[Oe.id];if(Jo(ot)){const Je=Sl(ot,w),Ct=Cd(Je);le[Oe.id]={expr:Je,parseRes:Ct}}}return le},[U,w,G,r]),V=B.some(le=>le.severity==="error"),F=B.some(le=>le.severity==="warning"),W=Ye(le=>le.setNodeDiagnostics),q=Ye(le=>le.clearNodeDiagnostics);m.useEffect(()=>{if(!d)return W(e,B),()=>q(e)},[e,B,W,q,d]);const L=m.useMemo(()=>v.some(le=>le.source===e?D.some(we=>we.id===le.sourceHandle):le.target===e?_.some(we=>we.id===le.targetHandle):!1),[v,e,_,D]),z=I?oy[I]:null,X=m.useMemo(()=>I==="Trigger"?"tapered-right":"rectangle",[I]),Q=m.useMemo(()=>I===xe.Trigger?"--node-trigger":I===xe.Tool?"--node-tool":I===xe.AI?"--node-agent":I===xe.Input?"--node-input":I===xe.Output?"--node-output":I===xe.Logic?"--node-logic":I===xe.Data?"--node-data":I===xe.Function?"--node-function":"--primary",[I]),te=I===xe.Tool||I===xe.Trigger||I===xe.AI,ne=m.useMemo(()=>{const le=r?.parameters??[];return G?le.filter(we=>!G.has(we.id)):le},[r,G]),Z=m.useMemo(()=>{const le=Math.min(ne.length,3),we=ne.length>3?1:0;return le+we},[ne]),K=Math.max(_.length,D.length),re=200,ce=24,me=16,ge=50,pe=m.useMemo(()=>{const le=Z*me,we=ge+le;return X==="tapered-right"?Math.max(we,60+Math.max(K,1)*40):Math.max(we,80+K*40)},[X,K,Z]);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 Re=(le,we)=>we===1?pe/2:20+(pe-40)/(we+1)*(le+1),Le=(le,we)=>we===1?re/2:20+(re-40)/(we+1)*(le+1),ze=()=>{const le=`node-gradient-${l.id}`,we=2,Oe="hsl(var(--canvas-background))",ot=`color-mix(in srgb, hsl(var(${Q})), hsl(var(--canvas-background)) 80%)`,Je="hsl(var(--card))",Ct=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(X==="tapered-right"){const Ke=we/2;return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:re,height:pe,viewBox:`0 0 ${re} ${pe}`,preserveAspectRatio:"none",style:Ct,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:ot})]})}),p.jsx("path",{d:`
|
|
58
|
+
`)),g=f.reduce((h,v)=>h.concat(...v),[]);return[f,g]}return[[],[]]},[e]);return m.useEffect(()=>{const d=t?.target??Cb,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=Nb(x.code,c);if(i.current.add(x[w]),Eb(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=Nb(x.code,c);Eb(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 Eb(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Nb(e,t){return t.includes(e)?"code":"key"}const J9=()=>{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)e7(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 e7(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 Wo(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(Wo(i.id,l)))}return r}function kb({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 Tb(e){return{id:e.id,type:"remove"}}const Pb=e=>NU(e),t7=e=>$E(e);function gN(e){return m.forwardRef(e)}function Rb(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>n7(()=>n(o=>o+BigInt(1))));return Yg(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function n7(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const mN=m.createContext(null);function r7({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=kb({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=Rb(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(kb({items:x,lookup:v}))},[]),i=Rb(o),l=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return p.jsx(mN.Provider,{value:l,children:e})}function o7(){const e=m.useContext(mN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const s7=e=>!!e.panZoom;function hf(){const e=J9(),t=it(),n=o7(),r=Be(s7),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=Pb(h)?h:v.get(h.id),w=S.parentId?BE(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&&Pb(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&&t7(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:M,edges:R}=await IU({nodesToRemove:h,edgesToRemove:v,nodes:x,edges:S,onBeforeDelete:P}),_=R.length>0,$=M.length>0;if(_){const D=R.map(Tb);E?.(R),N(D)}if($){const D=M.map(Tb);w?.(M),b(D)}return($||_)&&k?.({nodes:M,edges:R}),{deletedNodes:M,deletedEdges:R}},getIntersectingNodes:(h,v=!0,x)=>{const S=eb(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=eb(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 kU(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??DU();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 Ib=e=>e.selected,i7=typeof window<"u"?window:void 0;function a7({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=it(),{deleteElements:r}=hf(),o=ml(e,{actInsideInputWithModifier:!1}),i=ml(t,{target:i7});m.useEffect(()=>{if(o){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(Ib),edges:l.filter(Ib)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function l7(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",Zn.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},c7=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function u7({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Zo.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 M=it(),R=m.useRef(null),{userSelectionActive:_,lib:$,connectionInProgress:D}=Be(c7,rt),H=ml(v),j=m.useRef();l7(R);const U=m.useCallback(Y=>{b?.({x:Y[0],y:Y[1],zoom:Y[2]}),N||M.setState({transform:Y})},[b,N]);return m.useEffect(()=>{if(R.current){j.current=m9({domNode:R.current,minZoom:g,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:A=>M.setState(V=>V.paneDragging===A?V:{paneDragging:A}),onPanZoomStart:(A,V)=>{const{onViewportChangeStart:F,onMoveStart:W}=M.getState();W?.(A,V),F?.(V)},onPanZoom:(A,V)=>{const{onViewportChange:F,onMove:W}=M.getState();W?.(A,V),F?.(V)},onPanZoomEnd:(A,V)=>{const{onViewportChangeEnd:F,onMoveEnd:W}=M.getState();W?.(A,V),F?.(V)}});const{x:Y,y:I,zoom:B}=j.current.getViewport();return M.setState({panZoom:j.current,transform:[Y,I,B],domNode:R.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),m.useEffect(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:H,preventScrolling:x,noPanClassName:E,userSelectionActive:_,noWheelClassName:w,lib:$,onTransformChange:U,connectionInProgress:D,selectionOnDrag:P,paneClickDistance:k})},[e,t,n,r,o,i,l,c,H,x,E,_,w,$,U,D,P,k]),p.jsx("div",{className:"react-flow__renderer",ref:R,style:gf,children:S})}const d7=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function f7(){const{userSelectionActive:e,userSelectionRect:t}=Be(d7,rt);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)},p7=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function h7({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}=Be(p7,rt),P=b&&(e||E),M=m.useRef(null),R=m.useRef(),_=m.useRef(new Set),$=m.useRef(new Set),D=m.useRef(!1),H=F=>{if(D.current||k){D.current=!1;return}d?.(F),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},j=F=>{if(Array.isArray(r)&&r?.includes(2)){F.preventDefault();return}f?.(F)},U=g?F=>g(F):void 0,Y=F=>{D.current&&(F.stopPropagation(),D.current=!1)},I=F=>{const{domNode:W}=w.getState();if(R.current=W?.getBoundingClientRect(),!R.current)return;const q=F.target===M.current;if(!q&&!!F.target.closest(".nokey")||!e||!(i&&q||t)||F.button!==0||!F.isPrimary)return;F.target?.setPointerCapture?.(F.pointerId),D.current=!1;const{x:X,y:Q}=In(F.nativeEvent,R.current);w.setState({userSelectionRect:{width:0,height:0,startX:X,startY:Q,x:X,y:Q}}),q||(F.stopPropagation(),F.preventDefault())},B=F=>{const{userSelectionRect:W,transform:q,nodeLookup:L,edgeLookup:z,connectionLookup:X,triggerNodeChanges:Q,triggerEdgeChanges:te,defaultEdgeOptions:ne,resetSelectedElements:Z}=w.getState();if(!R.current||!W)return;const{x:K,y:re}=In(F.nativeEvent,R.current),{startX:ce,startY:me}=W;if(!D.current){const ze=t?0:o;if(Math.hypot(K-ce,re-me)<=ze)return;Z(),l?.(F)}D.current=!0;const ge={startX:ce,startY:me,x:K<ce?K:ce,y:re<me?re:me,width:Math.abs(K-ce),height:Math.abs(re-me)},pe=_.current,Re=$.current;_.current=new Set(hy(L,ge,q,n===Si.Partial,!0).map(ze=>ze.id)),$.current=new Set;const Le=ne?.selectable??!0;for(const ze of _.current){const le=X.get(ze);if(le)for(const{edgeId:we}of le.values()){const Oe=z.get(we);Oe&&(Oe.selectable??Le)&&$.current.add(we)}}if(!tb(pe,_.current)){const ze=oi(L,_.current,!0);Q(ze)}if(!tb(Re,$.current)){const ze=oi(z,$.current);te(ze)}w.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})},A=F=>{F.button===0&&(F.target?.releasePointerCapture?.(F.pointerId),!E&&F.target===M.current&&w.getState().userSelectionRect&&H?.(F),w.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c?.(F),w.setState({nodesSelectionActive:_.current.size>0})))},V=r===!0||Array.isArray(r)&&r.includes(0);return p.jsxs("div",{className:mt(["react-flow__pane",{draggable:V,dragging:N,selection:e}]),onClick:P?void 0:og(H,M),onContextMenu:og(j,M),onWheel:og(U,M),onPointerEnter:P?void 0:h,onPointerMove:P?B:v,onPointerUp:P?A:void 0,onPointerDownCapture:P?I:void 0,onClickCapture:P?Y:void 0,onPointerLeave:x,ref:M,style:gf,children:[S,p.jsx(f7,{})]})}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",Zn.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=n9({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 g7=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=g7(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),m7=Cy.Provider;Cy.Consumer;const xN=()=>m.useContext(Cy),y7=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),v7=(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 x7({type:e="source",position:t=Se.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}=Be(y7,rt),{connectingFrom:M,connectingTo:R,clickConnecting:_,isPossibleEndHandle:$,connectionInProcess:D,clickConnectionInProcess:H,valid:j}=Be(v7(b,S,e),rt);b||E.getState().onError?.("010",Zn.error010());const U=B=>{const{defaultEdgeOptions:A,onConnect:V,hasDefaultEdges:F}=E.getState(),W={...A,...B};if(F){const{edges:q,setEdges:L}=E.getState();L(YE(W,q))}V?.(W),c?.(W)},Y=B=>{if(!b)return;const A=UE(B.nativeEvent);if(o&&(A&&B.button===0||!A)){const V=E.getState();Gg.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:V.autoPanOnConnect,connectionMode:V.connectionMode,connectionRadius:V.connectionRadius,domNode:V.domNode,nodeLookup:V.nodeLookup,lib:V.lib,isTarget:w,handleId:S,nodeId:b,flowId:V.rfId,panBy:V.panBy,cancelConnection:V.cancelConnection,onConnectStart:V.onConnectStart,onConnectEnd:(...F)=>E.getState().onConnectEnd?.(...F),updateConnection:V.updateConnection,onConnect:U,isValidConnection:n||((...F)=>E.getState().isValidConnection?.(...F)??!0),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:V.autoPanSpeed,dragThreshold:V.connectionDragThreshold})}A?g?.(B):h?.(B)},I=B=>{const{onClickConnectStart:A,onClickConnectEnd:V,connectionClickStartHandle:F,connectionMode:W,isValidConnection:q,lib:L,rfId:z,nodeLookup:X,connection:Q}=E.getState();if(!b||!F&&!o)return;if(!F){A?.(B.nativeEvent,{nodeId:b,handleId:S,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:b,type:e,id:S}});return}const te=HE(B.target),ne=n||q,{connection:Z,isValid:K}=Gg.isValid(B.nativeEvent,{handle:{nodeId:b,id:S,type:e},connectionMode:W,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:ne,flowId:z,doc:te,lib:L,nodeLookup:X});K&&Z&&U(Z);const re=structuredClone(Q);delete re.inProgress,re.toPosition=re.toHandle?re.toHandle.position:null,V?.(B,re),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:_,connectingfrom:M,connectingto:R,valid:j,connectionindicator:r&&(!D||$)&&(D||H?i:o)}]),onMouseDown:Y,onTouchStart:Y,onClick:N?I:void 0,ref:x,...v,children:d})}const yl=m.memo(gN(x7));function w7({data:e,isConnectable:t,sourcePosition:n=Se.Bottom}){return p.jsxs(p.Fragment,{children:[e?.label,p.jsx(yl,{type:"source",position:n,isConnectable:t})]})}function b7({data:e,isConnectable:t,targetPosition:n=Se.Top,sourcePosition:r=Se.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 S7(){return null}function C7({data:e,isConnectable:t,targetPosition:n=Se.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}},_b={input:w7,default:b7,output:C7,group:S7};function E7(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 N7=e=>{const{width:t,height:n,x:r,y:o}=_l(e.nodeLookup,{filter:i=>!!i.selected});return{width:Rn(t)?t:null,height:Rn(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 k7({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=it(),{width:o,height:i,transformString:l,userSelectionActive:c}=Be(N7,rt),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 Ab=typeof window<"u"?window:void 0,T7=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:M,panOnScrollMode:R,zoomOnDoubleClick:_,panOnDrag:$,defaultViewport:D,translateExtent:H,minZoom:j,maxZoom:U,preventScrolling:Y,onSelectionContextMenu:I,noWheelClassName:B,noPanClassName:A,disableKeyboardA11y:V,onViewportChange:F,isControlledViewport:W}){const{nodesSelectionActive:q,userSelectionActive:L}=Be(T7,rt),z=ml(f,{target:Ab}),X=ml(w,{target:Ab}),Q=X||$,te=X||P,ne=g&&Q!==!0,Z=z||L||ne;return a7({deleteKeyCode:d,multiSelectionKeyCode:S}),p.jsx(u7,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:te,panOnScrollSpeed:M,panOnScrollMode:R,zoomOnDoubleClick:_,panOnDrag:!z&&Q,defaultViewport:D,translateExtent:H,minZoom:j,maxZoom:U,zoomActivationKeyCode:E,preventScrolling:Y,noWheelClassName:B,noPanClassName:A,onViewportChange:F,isControlledViewport:W,paneClickDistance:c,selectionOnDrag:ne,children:p.jsxs(h7,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:l,panOnDrag:Q,isSelecting:!!Z,selectionMode:h,selectionKeyPressed:z,paneClickDistance:c,selectionOnDrag:ne,children:[e,q&&p.jsx(k7,{onSelectionContextMenu:I,noPanClassName:A,disableKeyboardA11y:V})]})})}wN.displayName="FlowRenderer";const P7=m.memo(wN),R7=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 I7(e){return Be(m.useCallback(R7(e),[e]),rt)}const _7=e=>e.updateNodeInternals;function A7(){const e=Be(_7),[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 M7({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 D7({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:M}=Be(K=>{const re=K.nodeLookup.get(e),ce=K.parentLookup.has(e);return{node:re,internals:re.internals,isParent:ce}},rt);let R=k.type||"default",_=E?.[R]||_b[R];_===void 0&&(N?.("003",Zn.error003(R)),R="default",_=E?.default||_b.default);const $=!!(k.draggable||c&&typeof k.draggable>"u"),D=!!(k.selectable||d&&typeof k.selectable>"u"),H=!!(k.connectable||f&&typeof k.connectable>"u"),j=!!(k.focusable||g&&typeof k.focusable>"u"),U=it(),Y=my(k),I=M7({node:k,nodeType:R,hasDimensions:Y,resizeObserver:h}),B=yN({nodeRef:I,disabled:k.hidden||!$,noDragClassName:v,handleSelector:k.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:b}),A=vN();if(k.hidden)return null;const V=Pr(k),F=E7(k),W=D||$||t||n||r||o,q=n?K=>n(K,{...P.userNode}):void 0,L=r?K=>r(K,{...P.userNode}):void 0,z=o?K=>o(K,{...P.userNode}):void 0,X=i?K=>i(K,{...P.userNode}):void 0,Q=l?K=>l(K,{...P.userNode}):void 0,te=K=>{const{selectNodesOnDrag:re,nodeDragThreshold:ce}=U.getState();D&&(!re||!$||ce>0)&&Xg({id:e,store:U,nodeRef:I}),t&&t(K,{...P.userNode})},ne=K=>{if(!(WE(K.nativeEvent)||S)){if(ME.includes(K.key)&&D){const re=K.key==="Escape";Xg({id:e,store:U,unselect:re,nodeRef:I})}else if($&&k.selected&&Object.prototype.hasOwnProperty.call(hd,K.key)){K.preventDefault();const{ariaLabelConfig:re}=U.getState();U.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:K.key.replace("Arrow","").toLowerCase(),x:~~P.positionAbsolute.x,y:~~P.positionAbsolute.y})}),A({direction:hd[K.key],factor:K.shiftKey?4:1})}}},Z=()=>{if(S||!I.current?.matches(":focus-visible"))return;const{transform:K,width:re,height:ce,autoPanOnNodeFocus:me,setCenter:ge}=U.getState();if(!me)return;hy(new Map([[e,k]]),{x:0,y:0,width:re,height:ce},K,!0).length>0||ge(k.position.x+V.width/2,k.position.y+V.height/2,{zoom:K[2]})};return p.jsx("div",{className:mt(["react-flow__node",`react-flow__node-${R}`,{[x]:$},k.className,{selected:k.selected,selectable:D,parent:M,draggable:$,dragging:B}]),ref:I,style:{zIndex:P.z,transform:`translate(${P.positionAbsolute.x}px,${P.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:Y?"visible":"hidden",...k.style,...F},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:q,onMouseMove:L,onMouseLeave:z,onContextMenu:X,onClick:te,onDoubleClick:Q,onKeyDown:j?ne:void 0,tabIndex:j?0:void 0,onFocus:j?Z:void 0,role:k.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${cN}-${w}`,"aria-label":k.ariaLabel,...k.domAttributes,children:p.jsx(m7,{value:e,children:p.jsx(_,{id:e,data:k.data,type:R,positionAbsoluteX:P.positionAbsolute.x,positionAbsoluteY:P.positionAbsolute.y,selected:k.selected??!1,selectable:D,draggable:$,deletable:k.deletable??!0,isConnectable:H,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:B,dragHandle:k.dragHandle,zIndex:P.z,parentId:k.parentId,...V})})})}var j7=m.memo(D7);const O7=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}=Be(O7,rt),l=I7(e.onlyRenderVisibleElements),c=A7();return p.jsx("div",{className:"react-flow__nodes",style:gf,children:l.map(d=>p.jsx(j7,{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 $7=m.memo(bN);function L7(e){return Be(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&&LU({sourceNode:i,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),rt)}const F7=({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"})},z7=({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"})},Mb={[ud.Arrow]:F7,[ud.ArrowClosed]:z7};function V7(e){const t=it();return m.useMemo(()=>Object.prototype.hasOwnProperty.call(Mb,e)?Mb[e]:(t.getState().onError?.("009",Zn.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=V7(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=Be(i=>i.edges),r=Be(i=>i.defaultEdgeOptions),o=m.useMemo(()=>UU(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 H7=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 W7=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&&Rn(t)&&Rn(n)?p.jsx(W7,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function Db({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Se.Left||e===Se.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function EN({sourceX:e,sourceY:t,sourcePosition:n=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top}){const[l,c]=Db({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=Db({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}),M=e.isInternal?void 0:t;return p.jsx(Dl,{id:M,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 U7=NN({isInternal:!1}),kN=NN({isInternal:!0});U7.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=Se.Bottom,targetPosition:S=Se.Top,markerEnd:w,markerStart:E,pathOptions:b,interactionWidth:N})=>{const[k,P,M]=Wg({sourceX:n,sourceY:r,sourcePosition:x,targetX:o,targetY:i,targetPosition:S,borderRadius:b?.borderRadius,offset:b?.offset,stepPosition:b?.stepPosition}),R=e.isInternal?void 0:t;return p.jsx(Dl,{id:R,path:k,labelX:P,labelY:M,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 K7=IN({isInternal:!1}),_N=IN({isInternal:!0});K7.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 G7=AN({isInternal:!1}),MN=AN({isInternal:!0});G7.displayName="StraightEdge";MN.displayName="StraightEdgeInternal";function DN(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:l=Se.Bottom,targetPosition:c=Se.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,M]=pd({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c,curvature:b?.curvature}),R=e.isInternal?void 0:t;return p.jsx(Dl,{id:R,path:k,labelX:P,labelY:M,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:w,markerStart:E,interactionWidth:N})})}const Y7=DN({isInternal:!1}),jN=DN({isInternal:!0});Y7.displayName="BezierEdge";jN.displayName="BezierEdgeInternal";const jb={default:jN,straight:MN,step:_N,smoothstep:RN,simplebezier:kN},Ob={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},X7=(e,t,n)=>n===Se.Left?e-t:n===Se.Right?e+t:e,q7=(e,t,n)=>n===Se.Top?e-t:n===Se.Bottom?e+t:e,$b="react-flow__edgeupdater";function Lb({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([$b,`${$b}-${c}`]),cx:X7(t,r,e),cy:q7(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Z7({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,M)=>{if(P.button!==0)return;const{autoPanOnConnect:R,domNode:_,connectionMode:$,connectionRadius:D,lib:H,onConnectStart:j,cancelConnection:U,nodeLookup:Y,rfId:I,panBy:B,updateConnection:A}=S.getState(),V=M.type==="target",F=(L,z)=>{v(!1),h?.(L,n,M.type,z)},W=L=>f?.(n,L),q=(L,z)=>{v(!0),g?.(P,n,M.type),j?.(L,z)};Gg.onPointerDown(P.nativeEvent,{autoPanOnConnect:R,connectionMode:$,connectionRadius:D,domNode:_,handleId:M.id,nodeId:M.nodeId,nodeLookup:Y,isTarget:V,edgeUpdaterType:M.type,lib:H,flowId:I,cancelConnection:U,panBy:B,isValidConnection:(...L)=>S.getState().isValidConnection?.(...L)??!0,onConnect:W,onConnectStart:q,onConnectEnd:(...L)=>S.getState().onConnectEnd?.(...L),onReconnectEnd:F,updateConnection:A,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(Lb,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:N,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&p.jsx(Lb,{position:d,centerX:i,centerY:l,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:k,type:"target"})]})}function Q7({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=Be(ge=>ge.edgeLookup.get(e));const P=Be(ge=>ge.defaultEdgeOptions);k=P?{...P,...k}:k;let M=k.type||"default",R=w?.[M]||jb[M];R===void 0&&(b?.("011",Zn.error011(M)),M="default",R=w?.default||jb.default);const _=!!(k.focusable||t&&typeof k.focusable>"u"),$=typeof h<"u"&&(k.reconnectable||n&&typeof k.reconnectable>"u"),D=!!(k.selectable||r&&typeof k.selectable>"u"),H=m.useRef(null),[j,U]=m.useState(!1),[Y,I]=m.useState(!1),B=it(),{zIndex:A,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z}=Be(m.useCallback(ge=>{const pe=ge.nodeLookup.get(k.source),Re=ge.nodeLookup.get(k.target);if(!pe||!Re)return{zIndex:k.zIndex,...Ob};const Le=WU({id:e,sourceNode:pe,targetNode:Re,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ge.connectionMode,onError:b});return{zIndex:$U({selected:k.selected,zIndex:k.zIndex,sourceNode:pe,targetNode:Re,elevateOnSelect:ge.elevateEdgesOnSelect,zIndexMode:ge.zIndexMode}),...Le||Ob}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),rt),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||V===null||F===null||W===null||q===null)return null;const te=ge=>{const{addSelectedEdges:pe,unselectNodesAndEdges:Re,multiSelectionActive:Le}=B.getState();D&&(B.setState({nodesSelectionActive:!1}),k.selected&&Le?(Re({nodes:[],edges:[k]}),H.current?.blur()):pe([e])),o&&o(ge,k)},ne=i?ge=>{i(ge,{...k})}:void 0,Z=l?ge=>{l(ge,{...k})}:void 0,K=c?ge=>{c(ge,{...k})}:void 0,re=d?ge=>{d(ge,{...k})}:void 0,ce=f?ge=>{f(ge,{...k})}:void 0,me=ge=>{if(!N&&ME.includes(ge.key)&&D){const{unselectNodesAndEdges:pe,addSelectedEdges:Re}=B.getState();ge.key==="Escape"?(H.current?.blur(),pe({edges:[k]})):Re([e])}};return p.jsx("svg",{style:{zIndex:A},children:p.jsxs("g",{className:mt(["react-flow__edge",`react-flow__edge-${M}`,k.className,E,{selected:k.selected,animated:k.animated,inactive:!D&&!o,updating:j,selectable:D}]),onClick:te,onDoubleClick:ne,onContextMenu:Z,onMouseEnter:K,onMouseMove:re,onMouseLeave:ce,onKeyDown:_?me:void 0,tabIndex:_?0:void 0,role:k.ariaRole??(_?"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":_?`${uN}-${S}`:void 0,ref:H,...k.domAttributes,children:[!Y&&p.jsx(R,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:D,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z,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}),$&&p.jsx(Z7,{edge:k,isReconnectable:$,reconnectRadius:g,onReconnect:h,onReconnectStart:v,onReconnectEnd:x,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:L,targetPosition:z,setUpdateHover:U,setReconnecting:I})]})})}var J7=m.memo(Q7);const eK=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}=Be(eK,rt),P=L7(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(H7,{defaultColor:e,rfId:n}),P.map(M=>p.jsx(J7,{id:M,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},M))]})}ON.displayName="EdgeRenderer";const tK=m.memo(ON),nK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function rK({children:e}){const t=Be(nK);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function oK(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 sK=e=>e.panZoom?.syncViewport;function iK(e){const t=Be(sK),n=it();return m.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function aK(e){return e.connection.inProgress?{...e.connection,to:Ml(e.connection.to,e.transform)}:{...e.connection}}function lK(e){return aK}function cK(e){const t=lK();return Be(t,rt)}const uK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:l,isValid:c,inProgress:d}=Be(uK,rt);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=io.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}=cK();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 io.Bezier:[S]=pd(w);break;case io.SimpleBezier:[S]=EN(w);break;case io.Step:[S]=Wg({...w,borderRadius:0});break;case io.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 fK={};function Fb(e=fK){m.useRef(e),it(),m.useEffect(()=>{},[e])}function pK(){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:M,panActivationKeyCode:R,zoomActivationKeyCode:_,deleteKeyCode:$,onlyRenderVisibleElements:D,elementsSelectable:H,defaultViewport:j,translateExtent:U,minZoom:Y,maxZoom:I,preventScrolling:B,defaultMarkerColor:A,zoomOnScroll:V,zoomOnPinch:F,panOnScroll:W,panOnScrollSpeed:q,panOnScrollMode:L,zoomOnDoubleClick:z,panOnDrag:X,onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ne,onPaneMouseLeave:Z,onPaneScroll:K,onPaneContextMenu:re,paneClickDistance:ce,nodeClickDistance:me,onEdgeContextMenu:ge,onEdgeMouseEnter:pe,onEdgeMouseMove:Re,onEdgeMouseLeave:Le,reconnectRadius:ze,onReconnect:le,onReconnectStart:we,onReconnectEnd:Oe,noDragClassName:ot,noWheelClassName:Je,noPanClassName:Ct,disableKeyboardA11y:Ke,nodeExtent:ms,rfId:bo,viewport:tr,onViewportChange:nr}){return Fb(e),Fb(t),pK(),oK(n),iK(tr),p.jsx(P7,{onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ne,onPaneMouseLeave:Z,onPaneContextMenu:re,onPaneScroll:K,paneClickDistance:ce,deleteKeyCode:$,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:M,panActivationKeyCode:R,zoomActivationKeyCode:_,elementsSelectable:H,zoomOnScroll:V,zoomOnPinch:F,zoomOnDoubleClick:z,panOnScroll:W,panOnScrollSpeed:q,panOnScrollMode:L,panOnDrag:X,defaultViewport:j,translateExtent:U,minZoom:Y,maxZoom:I,onSelectionContextMenu:h,preventScrolling:B,noDragClassName:ot,noWheelClassName:Je,noPanClassName:Ct,disableKeyboardA11y:Ke,onViewportChange:nr,isControlledViewport:!!tr,children:p.jsxs(rK,{children:[p.jsx(tK,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:le,onReconnectStart:we,onReconnectEnd:Oe,onlyRenderVisibleElements:D,onEdgeContextMenu:ge,onEdgeMouseEnter:pe,onEdgeMouseMove:Re,onEdgeMouseLeave:Le,reconnectRadius:ze,defaultMarkerColor:A,noPanClassName:Ct,disableKeyboardA11y:Ke,rfId:bo}),p.jsx(dK,{style:w,type:S,component:E,containerStyle:b}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx($7,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:g,nodeClickDistance:me,onlyRenderVisibleElements:D,noPanClassName:Ct,noDragClassName:ot,disableKeyboardA11y:Ke,nodeExtent:ms,rfId:bo}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}LN.displayName="GraphView";const hK=m.memo(LN),zb=({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:M}=Kg(N,x,S,{nodeOrigin:k,nodeExtent:P,zIndexMode:v});let R=[0,0,1];if(l&&o&&i){const _=_l(x,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:$,y:D,zoom:H}=gy(_,o,i,d,f,c?.padding??.1);R=[$,D,H]}return{rfId:"1",width:o??0,height:i??0,transform:R,nodes:N,nodesInitialized:M,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:_U,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:DE,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gK=({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})=>D9((x,S)=>{async function w(){const{nodeLookup:E,panZoom:b,fitViewOptions:N,fitViewResolver:k,width:P,height:M,minZoom:R,maxZoom:_}=S();b&&(await RU({nodes:E,width:P,height:M,panZoom:b,minZoom:R,maxZoom:_},N),k?.resolve(!0),x({fitViewResolver:null}))}return{...zb({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:M,zIndexMode:R,nodesSelectionActive:_}=S(),{nodesInitialized:$,hasSelectedNodes:D}=Kg(E,b,N,{nodeOrigin:k,nodeExtent:h,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:R}),H=_&&D;M&&$?(w(),x({nodes:E,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):x({nodes:E,nodesInitialized:$,nodesSelectionActive:H})},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:M,nodeExtent:R,debug:_,fitViewQueued:$,zIndexMode:D}=S(),{changes:H,updatedInternals:j}=QU(E,N,k,P,M,R,D);j&&(YU(N,k,{nodeOrigin:M,nodeExtent:R,zIndexMode:D}),$?(w(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),H?.length>0&&(_&&console.log("React Flow: trigger node changes",H),b?.(H)))},updateNodePositions:(E,b=!1)=>{const N=[];let k=[];const{nodeLookup:P,triggerNodeChanges:M,connection:R,updateConnection:_,onNodesChangeMiddlewareMap:$}=S();for(const[D,H]of E){const j=P.get(D),U=!!(j?.expandParent&&j?.parentId&&H?.position),Y={id:D,type:"position",position:U?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:b};if(j&&R.inProgress&&R.fromNode.id===j.id){const I=cs(j,R.fromHandle,Se.Left,!0);_({...R,from:I})}U&&j.parentId&&N.push({id:D,parentId:j.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),k.push(Y)}if(N.length>0){const{parentLookup:D,nodeOrigin:H}=S(),j=Sy(N,P,D,H);k.push(...j)}for(const D of $.values())k=D(k);M(k)},triggerNodeChanges:E=>{const{onNodesChange:b,setNodes:N,nodes:k,hasDefaultNodes:P,debug:M}=S();if(E?.length){if(P){const R=pN(E,k);N(R)}M&&console.log("React Flow: trigger node changes",E),b?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:b,setEdges:N,edges:k,hasDefaultEdges:P,debug:M}=S();if(E?.length){if(P){const R=hN(E,k);N(R)}M&&console.log("React Flow: trigger edge changes",E),b?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:b,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:M}=S();if(b){const R=E.map(_=>Wo(_,!0));P(R);return}P(oi(k,new Set([...E]),!0)),M(oi(N))},addSelectedEdges:E=>{const{multiSelectionActive:b,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:M}=S();if(b){const R=E.map(_=>Wo(_,!0));M(R);return}M(oi(N,new Set([...E]))),P(oi(k,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:b}={})=>{const{edges:N,nodes:k,nodeLookup:P,triggerNodeChanges:M,triggerEdgeChanges:R}=S(),_=E||k,$=b||N,D=[];for(const j of _){if(!j.selected)continue;const U=P.get(j.id);U&&(U.selected=!1),D.push(Wo(j.id,!1))}const H=[];for(const j of $)j.selected&&H.push(Wo(j.id,!1));M(D),R(H)},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 M=b.reduce((_,$)=>$.selected?[..._,Wo($.id,!1)]:_,[]),R=E.reduce((_,$)=>$.selected?[..._,Wo($.id,!1)]:_,[]);N(M),k(R)},setNodeExtent:E=>{const{nodes:b,nodeLookup:N,parentLookup:k,nodeOrigin:P,elevateNodesOnSelect:M,nodeExtent:R,zIndexMode:_}=S();E[0][0]===R[0][0]&&E[0][1]===R[0][1]&&E[1][0]===R[1][0]&&E[1][1]===R[1][1]||(Kg(b,N,k,{nodeOrigin:P,nodeExtent:E,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:_}),x({nodeExtent:E}))},panBy:E=>{const{transform:b,width:N,height:k,panZoom:P,translateExtent:M}=S();return JU({delta:E,panZoom:P,transform:b,translateExtent:M,width:N,height:k})},setCenter:async(E,b,N)=>{const{width:k,height:P,maxZoom:M,panZoom:R}=S();if(!R)return Promise.resolve(!1);const _=typeof N?.zoom<"u"?N.zoom:M;return await R.setViewport({x:k/2-E*_,y:P/2-b*_,zoom:_},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...jE}})},updateConnection:E=>{x({connection:E})},reset:()=>x({...zb()})}},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(()=>gK({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(j9,{value:S,children:p.jsx(r7,{children:x})})}function mK({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 yK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function vK({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:M,onNodeDoubleClick:R,onNodeDragStart:_,onNodeDrag:$,onNodeDragStop:D,onNodesDelete:H,onEdgesDelete:j,onDelete:U,onSelectionChange:Y,onSelectionDragStart:I,onSelectionDrag:B,onSelectionDragStop:A,onSelectionContextMenu:V,onSelectionStart:F,onSelectionEnd:W,onBeforeDelete:q,connectionMode:L,connectionLineType:z=io.Bezier,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:te,deleteKeyCode:ne="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:K=!1,selectionMode:re=Si.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:me=gl()?"Meta":"Control",zoomActivationKeyCode:ge=gl()?"Meta":"Control",snapToGrid:pe,snapGrid:Re,onlyRenderVisibleElements:Le=!1,selectNodesOnDrag:ze,nodesDraggable:le,autoPanOnNodeFocus:we,nodesConnectable:Oe,nodesFocusable:ot,nodeOrigin:Je=dN,edgesFocusable:Ct,edgesReconnectable:Ke,elementsSelectable:ms=!0,defaultViewport:bo=Y9,minZoom:tr=.5,maxZoom:nr=2,translateExtent:So=pl,preventScrolling:Vl=!0,nodeExtent:rr,defaultMarkerColor:Co="#b1b1b7",zoomOnScroll:Tf=!0,zoomOnPinch:Bl=!0,panOnScroll:Hl=!1,panOnScrollSpeed:Pf=.5,panOnScrollMode:Vi=Zo.Free,zoomOnDoubleClick:Bi=!0,panOnDrag:Hi=!0,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:Ir,onPaneMouseLeave:_r,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl=1,nodeClickDistance:Gl=0,children:Yl,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:Eo,onEdgeContextMenu:Gi,onEdgeDoubleClick:No,onEdgeMouseEnter:Rf,onEdgeMouseMove:ko,onEdgeMouseLeave:ys,reconnectRadius:vs=10,onNodesChange:Yi,onEdgesChange:If,noDragClassName:_f="nodrag",noWheelClassName:Af="nowheel",noPanClassName:Ln="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:To,nodeDragThreshold:un,connectionDragThreshold:$f,viewport:qt,onViewportChange:Lf,width:Ff,height:zf,colorMode:ws="light",debug:bs,onScroll:Ar,ariaLabelConfig:Ss,zIndexMode:rc="basic",...Vf},Qi){const Cs=To||"1",Ji=Q9(ws),Po=m.useCallback(oc=>{oc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ar?.(oc)},[Ar]);return p.jsx("div",{"data-testid":"rf__wrapper",...Vf,onScroll:Po,style:{...nc,...yK},ref:Qi,className:mt(["react-flow",o,Ji]),id:To,role:"application",children:p.jsxs(mK,{nodes:e,edges:t,width:Ff,height:zf,fitView:Xi,fitViewOptions:qi,minZoom:tr,maxZoom:nr,nodeOrigin:Je,nodeExtent:rr,zIndexMode:rc,children:[p.jsx(Z9,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:S,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:b,nodesDraggable:le,autoPanOnNodeFocus:we,nodesConnectable:Oe,nodesFocusable:ot,edgesFocusable:Ct,edgesReconnectable:Ke,elementsSelectable:ms,elevateNodesOnSelect:Jl,elevateEdgesOnSelect:Df,minZoom:tr,maxZoom:nr,nodeExtent:rr,onNodesChange:Yi,onEdgesChange:If,snapToGrid:pe,snapGrid:Re,connectionMode:L,translateExtent:So,connectOnClick:Mf,defaultEdgeOptions:Ql,fitView:Xi,fitViewOptions:qi,onNodesDelete:H,onEdgesDelete:j,onDelete:U,onNodeDragStart:_,onNodeDrag:$,onNodeDragStop:D,onSelectionDrag:B,onSelectionDragStart:I,onSelectionDragStop:A,onMove:g,onMoveStart:h,onMoveEnd:v,noPanClassName:Ln,nodeOrigin:Je,rfId:Cs,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,onError:Of,connectionRadius:tc,isValidConnection:xs,selectNodesOnDrag:ze,nodeDragThreshold:un,connectionDragThreshold:$f,onBeforeDelete:q,debug:bs,ariaLabelConfig:Ss,zIndexMode:rc}),p.jsx(hK,{onInit:f,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:M,onNodeDoubleClick:R,nodeTypes:i,edgeTypes:l,connectionLineType:z,connectionLineStyle:X,connectionLineComponent:Q,connectionLineContainerStyle:te,selectionKeyCode:Z,selectionOnDrag:K,selectionMode:re,deleteKeyCode:ne,multiSelectionKeyCode:me,panActivationKeyCode:ce,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Le,defaultViewport:bo,translateExtent:So,minZoom:tr,maxZoom:nr,preventScrolling:Vl,zoomOnScroll:Tf,zoomOnPinch:Bl,zoomOnDoubleClick:Bi,panOnScroll:Hl,panOnScrollSpeed:Pf,panOnScrollMode:Vi,panOnDrag:Hi,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:Ir,onPaneMouseLeave:_r,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl,nodeClickDistance:Gl,onSelectionContextMenu:V,onSelectionStart:F,onSelectionEnd:W,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:Eo,onEdgeContextMenu:Gi,onEdgeDoubleClick:No,onEdgeMouseEnter:Rf,onEdgeMouseMove:ko,onEdgeMouseLeave:ys,reconnectRadius:vs,defaultMarkerColor:Co,noDragClassName:_f,noWheelClassName:Af,noPanClassName:Ln,rfId:Cs,disableKeyboardA11y:ec,nodeExtent:rr,viewport:qt,onViewportChange:Lf}),p.jsx(G9,{onSelectionChange:Y}),Yl,p.jsx(B9,{proOptions:Zl,position:ql}),p.jsx(V9,{rfId:Cs,disableKeyboardA11y:ec})]})})}var xK=gN(vK);const wK=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function bK({children:e}){const t=Be(wK);return t?ps.createPortal(e,t):null}const SK=e=>e.edges;function CK(){return Be(SK,rt)}const EK=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 NK(e={includeHiddenNodes:!1}){return Be(EK(e))}function kK({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 TK({radius:e,className:t}){return p.jsx("circle",{cx:e,cy:e,r:e,className:mt(["react-flow__background-pattern","dots",t])})}var xr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(xr||(xr={}));const PK={[xr.Dots]:1,[xr.Lines]:1,[xr.Cross]:6},RK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function zN({id:e,variant:t=xr.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}=Be(RK,rt),S=r||PK[t],w=t===xr.Dots,E=t===xr.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],M=E?[k,k]:N,R=[P[0]*v[2]||1+M[0]/2,P[1]*v[2]||1+M[1]/2],_=`${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:_,x:v[0]%N[0],y:v[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`,children:w?p.jsx(TK,{radius:k/2,className:g}):p.jsx(kK,{dimensions:M,lineWidth:o,variant:t,className:g})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${_})`})]})}zN.displayName="Background";const IK=m.memo(zN);function _K(){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 AK(){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 MK(){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 DK(){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 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 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 OK=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}=Be(OK,rt),{zoomIn:k,zoomOut:P,fitView:M}=hf(),R=()=>{k(),i?.()},_=()=>{P(),l?.()},$=()=>{M(o),c?.()},D=()=>{S.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},H=v==="horizontal"?"horizontal":"vertical";return p.jsxs(pf,{className:mt(["react-flow__controls",H,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:R,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:b,children:p.jsx(_K,{})}),p.jsx(Cu,{onClick:_,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:E,children:p.jsx(AK,{})})]}),n&&p.jsx(Cu,{className:"react-flow__controls-fitview",onClick:$,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:p.jsx(MK,{})}),r&&p.jsx(Cu,{className:"react-flow__controls-interactive",onClick:D,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:w?p.jsx(jK,{}):p.jsx(DK,{})}),g]})}VN.displayName="Controls";const $K=m.memo(VN);function LK({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 FK=m.memo(LK),zK=e=>e.nodes.map(t=>t.id),sg=e=>e instanceof Function?e:()=>e;function VK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=FK,onClick:l}){const c=Be(zK,rt),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(HK,{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}=Be(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}=Pr(E);return{node:E,x:b,y:N,width:k,height:P}},rt);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 HK=m.memo(BK);var WK=m.memo(VK);const UK=200,KK=150,GK=e=>!e.hidden,YK=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:GK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},XK="react-flow__minimap-desc";function BN({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 M=it(),R=m.useRef(null),{boundingRect:_,viewBB:$,rfId:D,panZoom:H,translateExtent:j,flowWidth:U,flowHeight:Y,ariaLabelConfig:I}=Be(YK,rt),B=e?.width??UK,A=e?.height??KK,V=_.width/B,F=_.height/A,W=Math.max(V,F),q=W*B,L=W*A,z=P*W,X=_.x-(q-_.width)/2-z,Q=_.y-(L-_.height)/2-z,te=q+z*2,ne=L+z*2,Z=`${XK}-${D}`,K=m.useRef(0),re=m.useRef();K.current=W,m.useEffect(()=>{if(R.current&&H)return re.current=l9({domNode:R.current,panZoom:H,getTransform:()=>M.getState().transform,getViewScale:()=>K.current}),()=>{re.current?.destroy()}},[H]),m.useEffect(()=>{re.current?.update({translateExtent:j,width:U,height:Y,inversePan:N,pannable:w,zoomStep:k,zoomable:E})},[w,E,N,k,j,U,Y]);const ce=x?pe=>{const[Re,Le]=re.current?.pointer(pe)||[0,0];x(pe,{x:Re,y:Le})}:void 0,me=S?m.useCallback((pe,Re)=>{const Le=M.getState().nodeLookup.get(Re).internals.userNode;S(pe,Le)},[]):void 0,ge=b??I["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:B,height:A,viewBox:`${X} ${Q} ${te} ${ne}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:R,onClick:ce,children:[ge&&p.jsx("title",{id:Z,children:ge}),p.jsx(WK,{onClick:me,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:l,nodeComponent:c}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-z},${Q-z}h${te+z*2}v${ne+z*2}h${-te-z*2}z
|
|
59
|
+
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}BN.displayName="MiniMap";const qK=m.memo(BN),ZK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,QK={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function JK({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(),M=m.useRef(null),R=n===ki.Handle,_=Be(m.useCallback(ZK(R&&x),[R,x]),rt),$=m.useRef(null),D=t??QK[n];m.useEffect(()=>{if(!(!M.current||!k))return $.current||($.current=S9({domNode:M.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:j,transform:U,snapGrid:Y,snapToGrid:I,nodeOrigin:B,domNode:A}=P.getState();return{nodeLookup:j,transform:U,snapGrid:Y,snapToGrid:I,nodeOrigin:B,paneDomNode:A}},onChange:(j,U)=>{const{triggerNodeChanges:Y,nodeLookup:I,parentLookup:B,nodeOrigin:A}=P.getState(),V=[],F={x:j.x,y:j.y},W=I.get(k);if(W&&W.expandParent&&W.parentId){const q=W.origin??A,L=j.width??W.measured.width??0,z=j.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:L,height:z,...BE({x:j.x??W.position.x,y:j.y??W.position.y},{width:L,height:z},W.parentId,I,q)}},Q=Sy([X],I,B,A);V.push(...Q),F.x=j.x?Math.max(q[0]*L,j.x):void 0,F.y=j.y?Math.max(q[1]*z,j.y):void 0}if(F.x!==void 0&&F.y!==void 0){const q={id:k,type:"position",position:{...F}};V.push(q)}if(j.width!==void 0&&j.height!==void 0){const L={id:k,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};V.push(L)}for(const q of U){const L={...q,type:"position"};V.push(L)}Y(V)},onEnd:({width:j,height:U})=>{const Y={id:k,type:"dimensions",resizing:!1,dimensions:{width:j,height:U}};P.getState().triggerNodeChanges([Y])}})),$.current.update({controlPosition:D,boundaries:{minWidth:c,minHeight:d,maxWidth:f,maxHeight:g},keepAspectRatio:h,resizeDirection:v,onResizeStart:w,onResize:E,onResizeEnd:b,shouldResize:S}),()=>{$.current?.destroy()}},[D,c,d,f,g,h,w,E,b,S]);const H=D.split("-");return p.jsx("div",{className:mt(["react-flow__resize-control","nodrag",...H,n,r]),ref:M,style:{...o,scale:_,...l&&{[R?"backgroundColor":"borderColor"]:l}},children:i})}m.memo(JK);function HN(){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 Se.Left:return"right-full mr-3 text-right";case Se.Right:return"left-full ml-3 text-left";case Se.Top:return"bottom-full mb-2 text-center left-1/2 -translate-x-1/2";case Se.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===Se.Left||r===Se.Right?{top:"50%",transform:"translateY(calc(-50% + 12px))"}:{},v=()=>r===Se.Bottom?"top-[15px] left-1/2 -ml-2":"left-[15px] top-1/2 -mt-2",x=r===Se.Top?"translateY(1px)":r===Se.Bottom?"translateY(-1px)":r===Se.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(es,{className:"w-2.5 h-2.5",strokeWidth:3})})]})};function eG(e,t,n,r,o,i){switch(e.type){case"variableSelect":{const l=t;if(!l?.varId)return{text:""};const c=n[yr(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 tG(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=>On(le.builderMode)),f=ss(m.useCallback(le=>{const we=le.phase;return(we.status==="paused"||we.status==="stepping")&&we.cursorNodeId===e},[e])),g=ue.getState().activeCanvasId,v=Qe(g)(le=>le.edges),x=ue(le=>le.channels),S=ue(le=>le.memory),w=ue(le=>le.models),E=ue(le=>le.availableModels),{lookup:b}=Li(g),N=m.useMemo(()=>{const le={};for(const we of Object.values(x))le[we.id]=we.label;return le},[x]),k=m.useMemo(()=>{const le={};for(const we of Object.values(S))le[we.id]=we.label;return le},[S]),{modelLabels:P,availableModelIds:M}=m.useMemo(()=>{const le={},we=new Set;for(const Oe of E)le[Oe.id]=Oe.label,we.add(Oe.id);for(const Oe of Object.values(w))le[Oe.id]=Oe.label;return{modelLabels:le,availableModelIds:we}},[E,w]),R=m.useMemo(()=>An(l),[l]),{executionInputs:_,toolInputs:$,executionOutputs:D,toolOutputs:H}=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]),j=m.useMemo(()=>tl(e,l,v),[e,l,v]),U=Sd(l),Y=m.useMemo(()=>{const le=new Set;for(const we of r?.parameters??[])kr(we,U,j)||le.add(we.id);return le.size>0?le:null},[j,r,U]),I=r?.category,B=m.useMemo(()=>N1({canvasId:g,nodeId:e,nodeData:l,nodeDefinition:r,availableVariables:b,channels:x,memory:S,models:w,availableModelIds:M,edges:v,isStale:o,isDeleted:i}),[g,e,l,r,b,x,S,w,M,v,o,i]),A=m.useMemo(()=>{const le={},we=r?.parameters??[];for(const Oe of we){if(Y?.has(Oe.id))continue;const ot=U[Oe.id];if(Jo(ot)){const Je=Sl(ot,b),Ct=Cd(Je);le[Oe.id]={expr:Je,parseRes:Ct}}}return le},[U,b,Y,r]),V=B.some(le=>le.severity==="error"),F=B.some(le=>le.severity==="warning"),W=Ye(le=>le.setNodeDiagnostics),q=Ye(le=>le.clearNodeDiagnostics);m.useEffect(()=>(W(e,B),()=>q(e)),[e,B,W,q]);const L=m.useMemo(()=>v.some(le=>le.source===e?D.some(we=>we.id===le.sourceHandle):le.target===e?_.some(we=>we.id===le.targetHandle):!1),[v,e,_,D]),z=I?oy[I]:null,X=m.useMemo(()=>I==="Trigger"?"tapered-right":"rectangle",[I]),Q=m.useMemo(()=>I===xe.Trigger?"--node-trigger":I===xe.Tool?"--node-tool":I===xe.AI?"--node-agent":I===xe.Input?"--node-input":I===xe.Output?"--node-output":I===xe.Logic?"--node-logic":I===xe.Data?"--node-data":I===xe.Function?"--node-function":"--primary",[I]),te=I===xe.Tool||I===xe.Trigger||I===xe.AI,ne=m.useMemo(()=>{const le=r?.parameters??[];return Y?le.filter(we=>!Y.has(we.id)):le},[r,Y]),Z=m.useMemo(()=>{const le=Math.min(ne.length,3),we=ne.length>3?1:0;return le+we},[ne]),K=Math.max(_.length,D.length),re=200,ce=24,me=16,ge=50,pe=m.useMemo(()=>{const le=Z*me,we=ge+le;return X==="tapered-right"?Math.max(we,60+Math.max(K,1)*40):Math.max(we,80+K*40)},[X,K,Z]);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 Re=(le,we)=>we===1?pe/2:20+(pe-40)/(we+1)*(le+1),Le=(le,we)=>we===1?re/2:20+(re-40)/(we+1)*(le+1),ze=()=>{const le=`node-gradient-${l.id}`,we=2,Oe="hsl(var(--canvas-background))",ot=`color-mix(in srgb, hsl(var(${Q})), hsl(var(--canvas-background)) 80%)`,Je="hsl(var(--card))",Ct=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(X==="tapered-right"){const Ke=we/2;return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:re,height:pe,viewBox:`0 0 ${re} ${pe}`,preserveAspectRatio:"none",style:Ct,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:ot})]})}),p.jsx("path",{d:`
|
|
60
60
|
M ${12+Ke} ${0+Ke}
|
|
61
61
|
L ${re-ce-Ke} ${0+Ke}
|
|
62
62
|
L ${re-Ke} ${pe/2}
|
|
@@ -66,10 +66,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
66
66
|
L ${0+Ke} ${12+Ke}
|
|
67
67
|
Q ${0+Ke} ${0+Ke} ${12+Ke} ${0+Ke}
|
|
68
68
|
Z
|
|
69
|
-
`,fill:`url(#${le})`,stroke:V?"hsl(var(--destructive))":te?`hsl(var(${Q})/0.5)`:"hsl(var(--edge-default))",strokeWidth:we})]})}return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:re,height:pe,viewBox:`0 0 ${re} ${pe}`,preserveAspectRatio:"none",style:Ct,children:[te&&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:ot})]})}),p.jsx("rect",{x:we/2,y:we/2,width:re-we,height:pe-we,rx:"10",ry:"10",fill:te?`url(#${le})`:Je,stroke:V?"hsl(var(--destructive))":te?`hsl(var(${Q})/0.5)`:"hsl(var(--edge-default))",strokeWidth:we})]})};return p.jsxs("div",{className:"relative z-0",style:{height:`${pe}px`,width:`${re}px`},children:[$.map((le,we)=>p.jsx(Eu,{id:le.id,type:"target",position:Se.Top,portType:le.type,label:le.label,disabled:L,style:{left:`${Le(we,$.length)}px`}},le.id)),_.map((le,we)=>p.jsx(Eu,{id:le.id,type:"target",position:Se.Left,portType:le.type,label:le.label,disabled:j,style:{top:X==="tapered-right"?`${pe/2}px`:`${Re(we,_.length)}px`}},le.id)),ze(),V&&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(go,{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:B.find(le=>le.severity==="error")?.message??"This node has errors"})]}),!V&&F&&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:B.find(le=>le.severity==="warning")?.message??"This node has warnings"})]}),p.jsxs("div",{className:`relative z-10 p-3 ${X==="tapered-right"?"pr-8":""}`,children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 mb-1.5",children:[z&&p.jsx(z,{className:"w-4 h-4 shrink-0",style:{color:`hsl(var(${Q}))`}}),p.jsx(uo,{variant:"secondary",className:"text-sm truncate max-w-full text-foreground",style:{backgroundColor:`hsl(var(${Q}) / 0.3)`,borderColor:`hsl(var(${Q}) / 0.4)`},children:l.label||r.label})]}),ne.length>0&&p.jsxs("div",{className:"space-y-0.5",children:[ne.slice(0,3).map(le=>{const we=U[le.id],Oe=A[le.id],ot=Oe?null:eG(le,we,w,N,k,P),Je=Oe?!Oe.parseRes.isValid:!!ot?.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 ${Je?"text-destructive":"text-foreground"}`,children:Oe?tG(Oe.expr):ot.text})]},le.id)}),ne.length>3&&p.jsxs("div",{className:"text-xs text-muted-foreground",children:["+",ne.length-3," more..."]})]})]}),D.map((le,we)=>{const Oe=!d&&!j&&Dg(l,le.id,v);return p.jsx(Eu,{id:le.id,type:"source",position:Se.Right,portType:le.type,label:le.label,disabled:j,showPlus:Oe,nodeId:e,style:{top:X==="tapered-right"?`${pe/2}px`:`${Re(we,D.length)}px`,right:"0"}},le.id)}),H.map((le,we)=>{const Oe=!d&&Dg(l,le.id,v);return p.jsx(Eu,{id:le.id,type:"source",position:Se.Bottom,portType:le.type,label:le.label,showPlus:Oe,nodeId:e,style:{left:`${Le(we,H.length)}px`,bottom:0}},le.id)})]})}),Nu=m.memo(e=>{const t=e.data,n=m.useMemo(()=>$t.getByType(t.type),[t.type]);return p.jsx(WN,{...e,nodeDefinition:n})}),nG=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 rG(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=>xn(G.builderMode)),h=n??"control",v=CK(),x=ue.getState().activeCanvasId,{lookup:S}=Li(x),b=v.filter(G=>G.source===t&&cm(G.type)).length,E=m.useMemo(()=>k1({canvasId:x,edgeId:e,edgeType:h,edgeData:c,availableVariables:S,sourceControlEdgeCount:b}),[h,b,c,S,x,e]),w=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(h1(h))return pd({sourceX:r,sourceY:o-3,targetX:i,targetY:l+3});const G=2;return pd({sourceX:r-G,sourceY:o,sourcePosition:Se.Right,targetX:i+G,targetY:l,targetPosition:Se.Left})},[M,R,_]=P(),$=w?{source:ag,target:ag}:rG(h),D=3,H=`edge-gradient-${e}`,j=w?ag:"hsl(var(--selection-glow))",U=f?`drop-shadow(0 0 8px ${j}) drop-shadow(0 0 16px ${j})`:void 0;return p.jsxs(p.Fragment,{children:[p.jsxs("g",{style:{filter:U},children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:H,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:l,children:[p.jsx("stop",{offset:"0%",stopColor:$.source}),p.jsx("stop",{offset:"100%",stopColor:$.target})]})}),p.jsx(Dl,{id:e,path:M,style:{stroke:`url(#${H})`,strokeWidth:D,strokeDasharray:"none"}})]}),p.jsx(bK,{children:p.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${R}px,${_}px)`,pointerEvents:"all"},className:"flex flex-col items-center gap-0.5",children:w&&p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsx("div",{className:"cursor-help",children:p.jsx(go,{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"})]})})})]})},oG={Standard:Nu,FunctionCall:nG,[xe.Trigger]:Nu,[xe.Tool]:Nu,[xe.AI]:Nu},sG={control:La,tool:La,agentTask:La,agentChoice:La,agentDelegate:La},iG=({canvasId:e,onConnect:t,onSelectionChange:n,onSelectionStart:r,onSelectionStop:o,onPaneClick:i,onAddNode:l,onNodeDragStart:c,viewportCenterRef:d})=>{const f=ue(A=>xn(A.builderMode)),g=HN(),{screenToFlowPosition:h,getViewport:v,fitView:x}=hf(),S=NK(),b=m.useRef(null);m.useEffect(()=>{d.current=()=>{const A=b.current;if(!A)return{x:250,y:100};const{width:V,height:F}=A.getBoundingClientRect(),{x:W,y:q,zoom:L}=v();return{x:(-W+V/2)/L-90,y:(-q+F/2)/L-50}}},[v,d]);const E=Qe(e),w=E(A=>A.nodes),N=E(A=>A.edges),k=E(A=>A.setNodes),P=E(A=>A.setEdges),M=E(A=>A.setViewport),R=m.useRef(E.getState().viewport).current,[_,$]=m.useState(R!=null);m.useEffect(()=>{if(_||R!=null)return;if(w.length===0){$(!0);return}if(!S)return;x({padding:.15,maxZoom:1});const A=requestAnimationFrame(()=>{M(v()),$(!0)});return()=>cancelAnimationFrame(A)},[_,R,w.length,S,x,v,M]);const D=A=>{switch(A.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))"}},H=m.useCallback(A=>{k(V=>pN(A,V))},[k]),j=m.useCallback(A=>{P(V=>hN(A,V))},[P]),U=m.useCallback(A=>{if(A.preventDefault(),!(!l||f))try{const V=JSON.parse(A.dataTransfer.getData("application/json")),F=h({x:A.clientX,y:A.clientY});l(V.nodeDef,F)}catch(V){console.error("Failed to parse node data:",V)}},[l,h,f]),G=A=>{f||(A.preventDefault(),A.dataTransfer.dropEffect="copy")},I=A=>{A.button===1&&A.preventDefault()},B=A=>{A.button===1&&A.preventDefault()};return p.jsx("div",{ref:b,className:"w-full h-full",style:{opacity:_?1:0},children:p.jsxs(xK,{nodes:w,edges:N,onNodesChange:H,onEdgesChange:j,onConnect:t,isValidConnection:A=>!!nE(A.source,A.target,A.sourceHandle,A.targetHandle,w,N),onPaneClick:i,onNodeDragStart:c,onSelectionChange:n,onSelectionStart:r,onSelectionEnd:o,onMoveEnd:(A,V)=>M(V),nodeTypes:oG,edgeTypes:sG,defaultViewport:R??void 0,selectionOnDrag:!f,panOnDrag:[1,2],selectionMode:Si.Partial,selectNodesOnDrag:!1,nodesConnectable:!f,nodesDraggable:!f,zoomOnScroll:!0,zoomOnPinch:!0,onDrop:U,onDragOver:G,deleteKeyCode:null,onContextMenu:A=>A.preventDefault(),onMouseDownCapture:I,onAuxClick:B,colorMode:g,style:{"--xy-background-color":"hsl(var(--canvas-background))"},children:[p.jsx(IK,{variant:xr.Dots,color:"hsl(var(--muted-foreground))",gap:24,size:1.5,className:"opacity-40"}),p.jsx($K,{className:"glass-forest-panel !border !shadow-lg [&_button]:glass-forest-button [&_button]:!text-foreground hover:[&_button]:!scale-105"}),p.jsx(qK,{nodeColor:D,className:"glass-forest-panel !border !shadow-lg",maskColor:"hsl(var(--primary) / 0.15)",nodeBorderRadius:12,nodeStrokeWidth:2,style:{width:120,height:80}})]})})},aG=e=>p.jsx("div",{className:"w-full h-full overflow-hidden overscroll-contain",children:p.jsx(FN,{children:p.jsx(iG,{...e})})});var Vb=1,lG=.9,cG=.8,uG=.17,lg=.1,cg=.999,dG=.9999,fG=.99,pG=/[\\\/_+.#"@\[\(\{&]/,hG=/[\\\/_+.#"@\[\(\{&]/g,gG=/[\s-]/,UN=/[\s-]/g;function qg(e,t,n,r,o,i,l){if(i===t.length)return o===e.length?Vb:fG;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*=Vb:pG.test(e.charAt(f-1))?(h*=cG,x=e.slice(o,f-1).match(hG),x&&o>0&&(h*=Math.pow(cg,x.length))):gG.test(e.charAt(f-1))?(h*=lG,S=e.slice(o,f-1).match(UN),S&&o>0&&(h*=Math.pow(cg,S.length))):(h*=uG,o>0&&(h*=Math.pow(cg,f-o))),e.charAt(f)!==t.charAt(i)&&(h*=dG)),(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 Bb(e){return e.toLowerCase().replace(UN," ")}function mG(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,qg(e,t,Bb(e),Bb(t),0,0,{})}var Fa='[cmdk-group=""]',ug='[cmdk-group-items=""]',yG='[cmdk-group-heading=""]',KN='[cmdk-item=""]',Hb=`${KN}:not([aria-disabled="true"])`,Zg="cmdk-item-select",ei="data-value",vG=(e,t,n)=>mG(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 z,X;return{search:"",value:(X=(z=e.value)!=null?z: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:b=!1,vimBindings:E=!0,...w}=e,N=kt(),k=kt(),P=kt(),M=m.useRef(null),R=RG();us(()=>{if(g!==void 0){let z=g.trim();n.current.value=z,_.emit()}},[g]),us(()=>{R(6,G)},[]);let _=m.useMemo(()=>({subscribe:z=>(l.current.add(z),()=>l.current.delete(z)),snapshot:()=>n.current,setState:(z,X,Q)=>{var te,ne,Z,K;if(!Object.is(n.current[z],X)){if(n.current[z]=X,z==="search")U(),H(),R(1,j);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(P);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(R(7,()=>{var re;n.current.selectedItemId=(re=I())==null?void 0:re.id,_.emit()}),Q||R(5,G),((ne=c.current)==null?void 0:ne.value)!==void 0){let re=X??"";(K=(Z=c.current).onValueChange)==null||K.call(Z,re);return}}_.emit()}},emit:()=>{l.current.forEach(z=>z())}}),[]),$=m.useMemo(()=>({value:(z,X,Q)=>{var te;X!==((te=i.current.get(z))==null?void 0:te.value)&&(i.current.set(z,{value:X,keywords:Q}),n.current.filtered.items.set(z,D(X,Q)),R(2,()=>{H(),_.emit()}))},item:(z,X)=>(r.current.add(z),X&&(o.current.has(X)?o.current.get(X).add(z):o.current.set(X,new Set([z]))),R(3,()=>{U(),H(),n.current.value||j(),_.emit()}),()=>{i.current.delete(z),r.current.delete(z),n.current.filtered.items.delete(z);let Q=I();R(4,()=>{U(),Q?.getAttribute("id")===z&&j(),_.emit()})}),group:z=>(o.current.has(z)||o.current.set(z,new Set),()=>{i.current.delete(z),o.current.delete(z)}),filter:()=>c.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:P,labelId:k,listInnerRef:M}),[]);function D(z,X){var Q,te;let ne=(te=(Q=c.current)==null?void 0:Q.filter)!=null?te:vG;return z?ne(z,n.current.search,X):0}function H(){if(!n.current.search||c.current.shouldFilter===!1)return;let z=n.current.filtered.items,X=[];n.current.filtered.groups.forEach(te=>{let ne=o.current.get(te),Z=0;ne.forEach(K=>{let re=z.get(K);Z=Math.max(re,Z)}),X.push([te,Z])});let Q=M.current;B().sort((te,ne)=>{var Z,K;let re=te.getAttribute("id"),ce=ne.getAttribute("id");return((Z=z.get(ce))!=null?Z:0)-((K=z.get(re))!=null?K:0)}).forEach(te=>{let ne=te.closest(ug);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${ug} > *`)):Q.appendChild(te.parentElement===Q?te:te.closest(`${ug} > *`))}),X.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Z=(ne=M.current)==null?void 0:ne.querySelector(`${Fa}[${ei}="${encodeURIComponent(te[0])}"]`);Z?.parentElement.appendChild(Z)})}function j(){let z=B().find(Q=>Q.getAttribute("aria-disabled")!=="true"),X=z?.getAttribute(ei);_.setState("value",X||void 0)}function U(){var z,X,Q,te;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 Z of r.current){let K=(X=(z=i.current.get(Z))==null?void 0:z.value)!=null?X:"",re=(te=(Q=i.current.get(Z))==null?void 0:Q.keywords)!=null?te:[],ce=D(K,re);n.current.filtered.items.set(Z,ce),ce>0&&ne++}for(let[Z,K]of o.current)for(let re of K)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Z);break}n.current.filtered.count=ne}function G(){var z,X,Q;let te=I();te&&(((z=te.parentElement)==null?void 0:z.firstChild)===te&&((Q=(X=te.closest(Fa))==null?void 0:X.querySelector(yG))==null||Q.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function I(){var z;return(z=M.current)==null?void 0:z.querySelector(`${KN}[aria-selected="true"]`)}function B(){var z;return Array.from(((z=M.current)==null?void 0:z.querySelectorAll(Hb))||[])}function A(z){let X=B()[z];X&&_.setState("value",X.getAttribute(ei))}function V(z){var X;let Q=I(),te=B(),ne=te.findIndex(K=>K===Q),Z=te[ne+z];(X=c.current)!=null&&X.loop&&(Z=ne+z<0?te[te.length-1]:ne+z===te.length?te[0]:te[ne+z]),Z&&_.setState("value",Z.getAttribute(ei))}function F(z){let X=I(),Q=X?.closest(Fa),te;for(;Q&&!te;)Q=z>0?TG(Q,Fa):PG(Q,Fa),te=Q?.querySelector(Hb);te?_.setState("value",te.getAttribute(ei)):V(z)}let W=()=>A(B().length-1),q=z=>{z.preventDefault(),z.metaKey?W():z.altKey?F(1):V(1)},L=z=>{z.preventDefault(),z.metaKey?A(0):z.altKey?F(-1):V(-1)};return m.createElement(Ne.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:z=>{var X;(X=w.onKeyDown)==null||X.call(w,z);let Q=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||Q))switch(z.key){case"n":case"j":{E&&z.ctrlKey&&q(z);break}case"ArrowDown":{q(z);break}case"p":case"k":{E&&z.ctrlKey&&L(z);break}case"ArrowUp":{L(z);break}case"Home":{z.preventDefault(),A(0);break}case"End":{z.preventDefault(),W();break}case"Enter":{z.preventDefault();let te=I();if(te){let ne=new Event(Zg);te.dispatchEvent(ne)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:_G},d),mf(e,z=>m.createElement(YN.Provider,{value:_},m.createElement(GN.Provider,{value:$},z))))}),xG=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;us(()=>{if(!f)return c.item(o,l?.id)},[f]);let g=QN(o,i,[e.value,e.children,i],e.keywords),h=Ey(),v=ho(R=>R.value&&R.value===g.current),x=ho(R=>f||c.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);m.useEffect(()=>{let R=i.current;if(!(!R||e.disabled))return R.addEventListener(Zg,S),()=>R.removeEventListener(Zg,S)},[x,e.onSelect,e.disabled]);function S(){var R,_;b(),(_=(R=d.current).onSelect)==null||_.call(R,g.current)}function b(){h.setState("value",g.current,!0)}if(!x)return null;let{disabled:E,value:w,onSelect:N,forceMount:k,keywords:P,...M}=e;return m.createElement(Ne.div,{ref:Yt(i,t),...M,id:o,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!v,"data-disabled":!!E,"data-selected":!!v,onPointerMove:E||c.getDisablePointerSelection()?void 0:b,onClick:E?void 0:S},e.children)}),wG=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=ho(x=>o||g.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);us(()=>g.group(l),[]),QN(l,c,[e.value,e.heading,d]);let v=m.useMemo(()=>({id:l,forceMount:o}),[o]);return m.createElement(Ne.div,{ref:Yt(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))))}),bG=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),i=ho(l=>!l.search);return!n&&!i?null:m.createElement(Ne.div,{ref:Yt(o,t),...r,"cmdk-separator":"",role:"separator"})}),SG=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=Ey(),l=ho(f=>f.search),c=ho(f=>f.selectedItemId),d=jl();return m.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),m.createElement(Ne.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)}})}),CG=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=m.useRef(null),l=m.useRef(null),c=ho(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(Ne.div,{ref:Yt(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:Yt(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),EG=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}))))}),NG=m.forwardRef((e,t)=>ho(n=>n.filtered.count===0)?m.createElement(Ne.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),kG=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return m.createElement(Ne.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)))}),Xt=Object.assign(qN,{List:CG,Item:xG,Input:SG,Group:wG,Separator:bG,Dialog:EG,Empty:NG,Loading:kG});function TG(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function PG(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 us(()=>{t.current=e}),t}var us=typeof window>"u"?m.useEffect:m.useLayoutEffect;function ti(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function ho(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 us(()=>{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 RG=()=>{let[e,t]=m.useState(),n=ti(()=>new Map);return us(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function IG(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(IG(t),{ref:t.ref},n(t.props.children)):n(t)}var _G={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(Xt,{ref:n,className:Ce("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));JN.displayName=Xt.displayName;const AG=({children:e,...t})=>p.jsx(SS,{...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($1,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(Xt.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=Xt.Input.displayName;const tk=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.List,{ref:n,className:Ce("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));tk.displayName=Xt.List.displayName;const nk=m.forwardRef((e,t)=>p.jsx(Xt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nk.displayName=Xt.Empty.displayName;const rk=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.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=Xt.Group.displayName;const MG=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.Separator,{ref:n,className:Ce("-mx-1 h-px bg-border",e),...t}));MG.displayName=Xt.Separator.displayName;const ok=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.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=Xt.Item.displayName;const DG=[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output];function jG({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(AG,{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.")}),DG.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 OG=({canvasId:e,viewportCenterRef:t,nodeDefinitions:n,onConnect:r,onAddNode:o,onAddNodeAndConnect:i,onSelectionChange:l,onPaneClick:c,onNodeDragStart:d,setSelectionDrag:f})=>{const g=e!==He,[h,v]=m.useState(null),x=m.useRef(null);m.useEffect(()=>{const E=x.current;if(!E)return;const w=N=>v(N.detail);return E.addEventListener("port-plus-click",w),()=>E.removeEventListener("port-plus-click",w)},[]);const S=m.useMemo(()=>{if(!h)return[];const{nodes:E,edges:w}=Qe(e).getState();return UH(h.nodeId,h.handleId,E,w,n,g)},[h,e,n,g]),b=m.useCallback(E=>{if(!h)return;const{nodes:w}=Qe(e).getState(),N=w.find(_=>_.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},R=Mn({type:E.type}).input.find(_=>_.type===h.portType);R&&(i(E,P,{source:h.nodeId,sourceHandle:h.handleId,target:"",targetHandle:R.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(aG,{canvasId:e,onConnect:r,onSelectionChange:l,onSelectionStart:()=>f(!0),onSelectionStop:()=>f(!1),onPaneClick:c,onAddNode:o,onNodeDragStart:d,viewportCenterRef:t})}),p.jsx(jG,{open:h!==null,onOpenChange:E=>{E||v(null)},compatibleDefs:S,onSelect:b})]})};var $G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LG=$G.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}},{}),FG="Separator",Wb="horizontal",zG=["horizontal","vertical"],sk=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Wb,...o}=e,i=VG(r)?r:Wb,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(LG.div,{"data-orientation":i,...c,...o,ref:t})});sk.displayName=FG;function VG(e){return zG.includes(e)}var ik=sk;const Ot=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}));Ot.displayName=ik.displayName;const BG=mo("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 Ub(e){const t=HG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(UG);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 HG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=GG(o),c=KG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 WG=Symbol("radix.slottable");function UG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WG}function KG(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 GG(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]=Lt(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:E,children:w}=b,N=qe.useRef(null),k=qe.useRef(new Map).current;return p.jsx(o,{scope:E,itemMap:k,collectionRef:N,children:w})};l.displayName=t;const c=e+"CollectionSlot",d=Ub(c),f=qe.forwardRef((b,E)=>{const{scope:w,children:N}=b,k=i(c,w),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=Ub(g),x=qe.forwardRef((b,E)=>{const{scope:w,children:N,...k}=b,P=qe.useRef(null),M=De(E,P),R=i(g,w);return qe.useEffect(()=>(R.itemMap.set(P,{ref:P,...k}),()=>{R.itemMap.delete(P)})),p.jsx(v,{[h]:"",ref:M,children:N})});x.displayName=g;function S(b){const E=i(e+"CollectionConsumer",b);return qe.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(E.itemMap.values()).sort((R,_)=>k.indexOf(R.ref.current)-k.indexOf(_.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},S,r]}function YG(e){const t=XG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(ZG);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 XG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=JG(o),c=QG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 qG=Symbol("radix.slottable");function ZG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qG}function QG(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 JG(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 eY=[" ","Enter","ArrowUp","ArrowDown"],tY=[" ","Enter"],ds="Select",[vf,xf,nY]=yf(ds),[Fi]=Lt(ds,[nY,$i]),wf=$i(),[rY,yo]=Fi(ds),[oY,sY]=Fi(ds),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,b=wf(t),[E,w]=m.useState(null),[N,k]=m.useState(null),[P,M]=m.useState(!1),R=Nl(f),[_,$]=ln({prop:r,defaultProp:o??!1,onChange:i,caller:ds}),[D,H]=ln({prop:l,defaultProp:c,onChange:d,caller:ds}),j=m.useRef(null),U=E?S||!!E.closest("form"):!0,[G,I]=m.useState(new Set),B=Array.from(G).map(A=>A.props.value).join(";");return p.jsx(Wm,{...b,children:p.jsxs(rY,{required:x,scope:t,trigger:E,onTriggerChange:w,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:P,onValueNodeHasChildrenChange:M,contentId:kt(),value:D,onValueChange:H,open:_,onOpenChange:$,dir:R,triggerPointerDownPosRef:j,disabled:v,children:[p.jsx(vf.Provider,{scope:t,children:p.jsx(oY,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(A=>{I(V=>new Set(V).add(A))},[]),onNativeOptionRemove:m.useCallback(A=>{I(V=>{const F=new Set(V);return F.delete(A),F})},[]),children:n})}),U?p.jsxs(Ak,{"aria-hidden":!0,required:x,tabIndex:-1,name:g,autoComplete:h,value:D,onChange:A=>H(A.target.value),disabled:v,form:S,children:[D===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},B):null]})})};lk.displayName=ds;var ck="SelectTrigger",uk=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=wf(n),l=yo(ck,n),c=l.disabled||r,d=De(t,l.onTriggerChange),f=xf(n),g=m.useRef("touch"),[h,v,x]=Dk(b=>{const E=f().filter(k=>!k.disabled),w=E.find(k=>k.value===l.value),N=jk(E,b,w);N!==void 0&&l.onValueChange(N.value)}),S=b=>{c||(l.onOpenChange(!0),x()),b&&(l.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return p.jsx(Um,{asChild:!0,...i,children:p.jsx(Ne.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,b=>{b.currentTarget.focus(),g.current!=="mouse"&&S(b)}),onPointerDown:ve(o.onPointerDown,b=>{g.current=b.pointerType;const E=b.target;E.hasPointerCapture(b.pointerId)&&E.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(S(b),b.preventDefault())}),onKeyDown:ve(o.onKeyDown,b=>{const E=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&v(b.key),!(E&&b.key===" ")&&eY.includes(b.key)&&(S(),b.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=yo(dk,n),{onValueNodeHasChildrenChange:f}=d,g=i!==void 0,h=De(t,d.onValueNodeChange);return xt(()=>{f(g)},[f,g]),p.jsx(Ne.span,{...c,ref:h,style:{pointerEvents:"none"},children:Mk(d.value)?p.jsx(p.Fragment,{children:l}):i})});fk.displayName=dk;var iY="SelectIcon",pk=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});pk.displayName=iY;var aY="SelectPortal",hk=e=>p.jsx(Mi,{asChild:!0,...e});hk.displayName=aY;var fs="SelectContent",gk=m.forwardRef((e,t)=>{const n=yo(fs,e.__scopeSelect),[r,o]=m.useState();if(xt(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ps.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=fs;var kn=10,[mk,vo]=Fi(fs),lY="SelectContentImpl",cY=YG("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:b,avoidCollisions:E,...w}=e,N=yo(fs,n),[k,P]=m.useState(null),[M,R]=m.useState(null),_=De(t,Z=>P(Z)),[$,D]=m.useState(null),[H,j]=m.useState(null),U=xf(n),[G,I]=m.useState(!1),B=m.useRef(!1);m.useEffect(()=>{if(k)return ym(k)},[k]),mm();const A=m.useCallback(Z=>{const[K,...re]=U().map(ge=>ge.ref.current),[ce]=re.slice(-1),me=document.activeElement;for(const ge of Z)if(ge===me||(ge?.scrollIntoView({block:"nearest"}),ge===K&&M&&(M.scrollTop=0),ge===ce&&M&&(M.scrollTop=M.scrollHeight),ge?.focus(),document.activeElement!==me))return},[U,M]),V=m.useCallback(()=>A([$,k]),[A,$,k]);m.useEffect(()=>{G&&V()},[G,V]);const{onOpenChange:F,triggerPointerDownPosRef:W}=N;m.useEffect(()=>{if(k){let Z={x:0,y:0};const K=ce=>{Z={x:Math.abs(Math.round(ce.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(W.current?.y??0))}},re=ce=>{Z.x<=10&&Z.y<=10?ce.preventDefault():k.contains(ce.target)||F(!1),document.removeEventListener("pointermove",K),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",re,{capture:!0})}}},[k,F,W]),m.useEffect(()=>{const Z=()=>F(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[F]);const[q,L]=Dk(Z=>{const K=U().filter(me=>!me.disabled),re=K.find(me=>me.ref.current===document.activeElement),ce=jk(K,Z,re);ce&&setTimeout(()=>ce.ref.current.focus())}),z=m.useCallback((Z,K,re)=>{const ce=!B.current&&!re;(N.value!==void 0&&N.value===K||ce)&&(D(Z),ce&&(B.current=!0))},[N.value]),X=m.useCallback(()=>k?.focus(),[k]),Q=m.useCallback((Z,K,re)=>{const ce=!B.current&&!re;(N.value!==void 0&&N.value===K||ce)&&j(Z)},[N.value]),te=r==="popper"?Qg:vk,ne=te===Qg?{side:c,sideOffset:d,align:f,alignOffset:g,arrowPadding:h,collisionBoundary:v,collisionPadding:x,sticky:S,hideWhenDetached:b,avoidCollisions:E}:{};return p.jsx(mk,{scope:n,content:k,viewport:M,onViewportChange:R,itemRefCallback:z,selectedItem:$,onItemLeave:X,itemTextRefCallback:Q,focusSelectedItem:V,selectedItemText:H,position:r,isPositioned:G,searchRef:q,children:p.jsx(Ad,{as:cY,allowPinchZoom:!0,children:p.jsx(Id,{asChild:!0,trapped:N.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:ve(o,Z=>{N.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:p.jsx(Ai,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:p.jsx(te,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Z=>Z.preventDefault(),...w,...ne,onPlaced:()=>I(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:ve(w.onKeyDown,Z=>{const K=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!K&&Z.key.length===1&&L(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ce=U().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const me=Z.target,ge=ce.indexOf(me);ce=ce.slice(ge+1)}setTimeout(()=>A(ce)),Z.preventDefault()}})})})})})})});yk.displayName=lY;var uY="SelectItemAlignedPosition",vk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=yo(fs,n),l=vo(fs,n),[c,d]=m.useState(null),[f,g]=m.useState(null),h=De(t,_=>g(_)),v=xf(n),x=m.useRef(!1),S=m.useRef(!0),{viewport:b,selectedItem:E,selectedItemText:w,focusSelectedItem:N}=l,k=m.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&f&&b&&E&&w){const _=i.trigger.getBoundingClientRect(),$=f.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),H=w.getBoundingClientRect();if(i.dir!=="rtl"){const me=H.left-$.left,ge=D.left-me,pe=_.left-ge,Re=_.width+pe,Le=Math.max(Re,$.width),ze=window.innerWidth-kn,le=kg(ge,[kn,Math.max(kn,ze-Le)]);c.style.minWidth=Re+"px",c.style.left=le+"px"}else{const me=$.right-H.right,ge=window.innerWidth-D.right-me,pe=window.innerWidth-_.right-ge,Re=_.width+pe,Le=Math.max(Re,$.width),ze=window.innerWidth-kn,le=kg(ge,[kn,Math.max(kn,ze-Le)]);c.style.minWidth=Re+"px",c.style.right=le+"px"}const j=v(),U=window.innerHeight-kn*2,G=b.scrollHeight,I=window.getComputedStyle(f),B=parseInt(I.borderTopWidth,10),A=parseInt(I.paddingTop,10),V=parseInt(I.borderBottomWidth,10),F=parseInt(I.paddingBottom,10),W=B+A+G+F+V,q=Math.min(E.offsetHeight*5,W),L=window.getComputedStyle(b),z=parseInt(L.paddingTop,10),X=parseInt(L.paddingBottom,10),Q=_.top+_.height/2-kn,te=U-Q,ne=E.offsetHeight/2,Z=E.offsetTop+ne,K=B+A+Z,re=W-K;if(K<=Q){const me=j.length>0&&E===j[j.length-1].ref.current;c.style.bottom="0px";const ge=f.clientHeight-b.offsetTop-b.offsetHeight,pe=Math.max(te,ne+(me?X:0)+ge+V),Re=K+pe;c.style.height=Re+"px"}else{const me=j.length>0&&E===j[0].ref.current;c.style.top="0px";const pe=Math.max(Q,B+b.offsetTop+(me?z:0)+ne)+re;c.style.height=pe+"px",b.scrollTop=K-Q+b.offsetTop}c.style.margin=`${kn}px 0`,c.style.minHeight=q+"px",c.style.maxHeight=U+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,i.trigger,i.valueNode,c,f,b,E,w,i.dir,r]);xt(()=>k(),[k]);const[P,M]=m.useState();xt(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const R=m.useCallback(_=>{_&&S.current===!0&&(k(),N?.(),S.current=!1)},[k,N]);return p.jsx(fY,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:R,children:p.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:p.jsx(Ne.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});vk.displayName=uY;var dY="SelectPopperPosition",Qg=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=kn,...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=dY;var[fY,Ny]=Fi(fs,{}),Jg="SelectViewport",xk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=vo(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(Ne.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-kn*2,b=parseFloat(h.style.minHeight),E=parseFloat(h.style.height),w=Math.max(b,E);if(w<S){const N=w+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",[pY,hY]=Fi(wk),gY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=kt();return p.jsx(pY,{scope:n,id:o,children:p.jsx(Ne.div,{role:"group","aria-labelledby":o,...r,ref:t})})});gY.displayName=wk;var bk="SelectLabel",Sk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=hY(bk,n);return p.jsx(Ne.div,{id:o.id,...r,ref:t})});Sk.displayName=bk;var gd="SelectItem",[mY,Ck]=Fi(gd),Ek=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,c=yo(gd,n),d=vo(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)),b=kt(),E=m.useRef("touch"),w=()=>{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(mY,{scope:n,value:r,disabled:o,textId:b,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(Ne.div,{role:"option","aria-labelledby":b,"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"&&w()}),onPointerUp:ve(l.onPointerUp,()=>{E.current==="mouse"&&w()}),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===" "||(tY.includes(N.key)&&w(),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=yo(Ua,n),c=vo(Ua,n),d=Ck(Ua,n),f=sY(Ua,n),[g,h]=m.useState(null),v=De(t,w=>h(w),d.onItemTextChange,w=>c.itemTextRefCallback?.(w,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:b,onNativeOptionRemove:E}=f;return xt(()=>(b(S),()=>E(S)),[b,E,S]),p.jsxs(p.Fragment,{children:[p.jsx(Ne.span,{id:d.textId,...i,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ps.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(Ne.span,{"aria-hidden":!0,...r,ref:t}):null});Tk.displayName=kk;var em="SelectScrollUpButton",Pk=m.forwardRef((e,t)=>{const n=vo(em,e.__scopeSelect),r=Ny(em,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return xt(()=>{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=vo(tm,e.__scopeSelect),r=Ny(tm,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return xt(()=>{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=vo("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]),xt(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),p.jsx(Ne.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()})})}),yY="SelectSeparator",_k=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Ne.div,{"aria-hidden":!0,...r,ref:t})});_k.displayName=yY;var nm="SelectArrow",vY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wf(n),i=yo(nm,n),l=vo(nm,n);return i.open&&l.position==="popper"?p.jsx(Gm,{...o,...r,ref:t}):null});vY.displayName=nm;var xY="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(Ne.select,{...n,style:{...RC,...n.style},ref:i,defaultValue:t})});Ak.displayName=xY;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=wY(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 wY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bY=lk,Ok=uk,SY=fk,CY=pk,EY=hk,$k=gk,NY=xk,Lk=Sk,Fk=Ek,kY=Nk,TY=Tk,zk=Pk,Vk=Rk,Bk=_k;const wr=bY,br=SY,Xn=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(CY,{asChild:!0,children:p.jsx(Ii,{className:"h-4 w-4 opacity-50"})})]}));Xn.displayName=Ok.displayName;const Hk=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"})}));Hk.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 qn=m.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(EY,{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(Hk,{}),p.jsx(NY,{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,{})]})}));qn.displayName=$k.displayName;const PY=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}));PY.displayName=Lk.displayName;const sn=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(TY,{children:p.jsx(M1,{className:"h-4 w-4"})})}),p.jsx(kY,{children:t})]}));sn.displayName=Fk.displayName;const RY=m.forwardRef(({className:e,...t},n)=>p.jsx(Bk,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));RY.displayName=Bk.displayName;const IY=mo("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(IY({variant:t}),e),...n}));Uk.displayName="Alert";const _Y=m.forwardRef(({className:e,...t},n)=>p.jsx("h5",{ref:n,className:Ce("mb-1 font-medium leading-none tracking-tight",e),...t}));_Y.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",AY={bubbles:!1,cancelable:!0},Ol="RovingFocusGroup",[rm,Gk,MY]=yf(Ol),[DY,bf]=Lt(Ol,[MY]),[jY,OY]=DY(Ol),Yk=m.forwardRef((e,t)=>p.jsx(rm.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(rm.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx($Y,{...e,ref:t})})}));Yk.displayName=Ol;var $Y=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),[b,E]=ln({prop:l,defaultProp:c??null,onChange:d,caller:Ol}),[w,N]=m.useState(!1),k=pt(f),P=Gk(n),M=m.useRef(!1),[R,_]=m.useState(0);return m.useEffect(()=>{const $=v.current;if($)return $.addEventListener(dg,k),()=>$.removeEventListener(dg,k)},[k]),p.jsx(jY,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:b,onItemFocus:m.useCallback($=>E($),[E]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>_($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>_($=>$-1),[]),children:p.jsx(Ne.div,{tabIndex:w||R===0?-1:0,"data-orientation":r,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{M.current=!0}),onFocus:ve(e.onFocus,$=>{const D=!M.current;if($.target===$.currentTarget&&D&&!w){const H=new CustomEvent(dg,AY);if($.currentTarget.dispatchEvent(H),!H.defaultPrevented){const j=P().filter(A=>A.focusable),U=j.find(A=>A.active),G=j.find(A=>A.id===b),B=[U,G,...j].filter(Boolean).map(A=>A.ref.current);Zk(B,g)}}M.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=OY(Xk,n),h=g.currentTabStopId===f,v=Gk(n),{onFocusableItemAdd:x,onFocusableItemRemove:S,currentTabStopId:b}=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(Ne.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 w=zY(E,g.orientation,g.dir);if(w!==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(w==="last")k.reverse();else if(w==="prev"||w==="next"){w==="prev"&&k.reverse();const P=k.indexOf(E.currentTarget);k=g.loop?VY(k,P+1):k.slice(P+1)}setTimeout(()=>Zk(k))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:b!=null}):l})})});qk.displayName=Xk;var LY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zY(e,t,n){const r=FY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return LY[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 VY(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]=ln({prop:n,onChange:o,defaultProp:r??!1,caller:eT});return p.jsx(Ne.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,xo="ToggleGroup",[nT]=Lt(xo,[bf]),rT=bf(),Ty=qe.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(HY,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${xo}\``)});Ty.displayName=xo;var[oT,sT]=nT(xo),BY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??"",onChange:o,caller:xo});return p.jsx(oT,{scope:e.__scopeToggleGroup,type:"single",value:qe.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:qe.useCallback(()=>c(""),[c]),children:p.jsx(iT,{...i,ref:t})})}),HY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??[],onChange:o,caller:xo}),d=qe.useCallback(g=>c((h=[])=>[...h,g]),[c]),f=qe.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=xo;var[WY,UY]=nT(xo),iT=qe.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(WY,{scope:n,rovingFocus:o,disabled:r,children:o?p.jsx(Qk,{asChild:!0,...f,orientation:i,dir:g,loop:c,children:p.jsx(Ne.div,{...h,ref:t})}):p.jsx(Ne.div,{...h,ref:t})})}),md="ToggleGroupItem",aT=qe.forwardRef((e,t)=>{const n=sT(md,e.__scopeToggleGroup),r=UY(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=qe.useRef(null);return r.rovingFocus?p.jsx(Jk,{asChild:!0,...o,focusable:!l,active:i,ref:d,children:p.jsx(Kb,{...c,ref:t})}):p.jsx(Kb,{...c,ref:t})});aT.displayName=md;var Kb=qe.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=mo("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"}}),KY=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}));KY.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 Go=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})});Go.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),[b,E]=m.useState(""),[w,N]=m.useState(0),k=m.useRef(null),P=m.useRef(null),M=m.useRef(!1),R=m.useMemo(()=>d.filter(A=>A.name.toLowerCase().includes(b.toLowerCase())),[d,b]),_=ue(A=>A.activeCanvasId),$=m.useMemo(()=>{const A={};if(!h)return A;for(const V of Qe(_).getState().nodes)A[V.id]=V.data.label??$t.getByType(V.data.type)?.label??V.data.type;return A},[h,_]),D=m.useCallback(A=>d.find(V=>V.name===A),[d]),H=m.useCallback(A=>{const V=[],F=/\$\{([^}]+)\}/g;let W,q=A;const L=[];for(;(W=F.exec(A))!==null;)L.push({name:W[1]??"",start:W.index,end:W.index+W[0].length});let z=0;for(const X of L){const Q=D(X.name);Q?Q.kind==="node"?V.push({srcId:Q.nodeId,varId:Q.outputId}):Q.kind==="fnarg"?V.push({srcId:"fnarg",varId:Q.uid}):V.push({srcId:"declared",varId:Q.uid}):V.push({srcId:"",varId:""});const te=q.slice(0,X.start+z),ne=q.slice(X.end+z);q=te+"${}"+ne,z-=X.name.length}return{expression:q,references:V,dataType:n}},[D,n]),j=m.useCallback(A=>{if(!A)return"";let V=A.expression,F=0;return V=V.replace(/\$\{\}/g,()=>{if(F<A.variables.length){const W=A.variables[F];return F++,`\${${W?.name??"unknown"}}`}return"${}"}),V},[]);m.useEffect(()=>{if(M.current)return;const A=j(c);A!==f&&g(A)},[c,j,f]);const U=A=>{M.current=!0;const V=A.target.value,F=A.target.selectionStart??0;g(V);const W=V.slice(0,F),q=W.lastIndexOf("$");if(q!==-1){const L=W.slice(q+1);if(!(L.startsWith("{")&&L.includes("}"))&&(L===""||L.startsWith("{")||/^[a-zA-Z_]/.test(L))){const X=L.replace(/^\{?/,"");E(X),S(q),v(!0),N(0);return}}v(!1),t(H(V))},G=()=>{M.current=!1,t(H(f))},I=A=>{const V=f.slice(0,x),W=f.slice(k.current?.selectionStart??f.length).replace(/^[{]?[a-zA-Z_]*[}]?/,""),q=`${V}\${${A.name}}${W}`;g(q),v(!1),t(H(q)),setTimeout(()=>{k.current?.focus();const L=V.length+A.name.length+3;k.current?.setSelectionRange(L,L)},0)},B=A=>{if(h)switch(A.key){case"ArrowDown":A.preventDefault(),N(V=>Math.min(V+1,R.length-1));break;case"ArrowUp":A.preventDefault(),N(V=>Math.max(V-1,0));break;case"Enter":case"Tab":A.preventDefault(),R[w]&&I(R[w]);break;case"Escape":v(!1);break}};return m.useEffect(()=>{const A=V=>{P.current&&!P.current.contains(V.target)&&v(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]),p.jsx("div",{ref:P,children:p.jsxs("div",{className:"relative",children:[p.jsx("input",{ref:k,type:"text",value:f,onChange:U,onKeyDown:B,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&&R.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:R.map((A,V)=>p.jsxs("button",{onClick:()=>I(A),className:Ce("w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-accent",V===w&&"bg-accent"),children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("span",{className:"font-mono",children:["$","{",A.name,"}"]}),p.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[150px]",children:A.kind==="node"?i("fromNode",{node:$[A.nodeId]??A.nodeId}):A.kind==="declared"?i("globalVariable"):i("fnarg")})]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:A.dataType})]},oo(A)))}),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(wr,{value:c,onValueChange:d=>i(d===l?void 0:d),disabled:r,children:[p.jsx(Xn,{children:p.jsx(br,{placeholder:n?p.jsx("span",{className:"text-destructive",children:"Deleted reference"}):r?"Loading...":o})}),p.jsxs(qn,{children:[p.jsx(sn,{value:l,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.map(d=>p.jsx(sn,{value:d.value,children:d.label},d.value))]})]})}function GY(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(w=>w.channels),v=ue(w=>w.memory),x=ue(w=>w.models),S=ue(w=>w.availableModels),b=()=>{switch(t.type){case"variableSelect":{const w=d,N=w?.varId?yr(w):void 0,k=!!(N&&!g[N]),P=f.map(M=>({value:oo(M),label:`${M.name} (${M.dataType})`}));return p.jsx(Pu,{value:N,options:P,isStale:k,placeholder:"Select variable...",onChange:M=>{if(!M){o(void 0);return}const R=g[M];if(!R)return;const _=R.kind==="node"?{srcId:R.nodeId,varId:R.outputId}:R.kind==="declared"?{srcId:"declared",varId:R.uid}:{srcId:"fnarg",varId:R.uid};o(_)}})}case"expression":{const N=y1(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:GY(N)})}case"string":return t.multiline?p.jsx(ak,{value:d||"",onChange:w=>o(w.target.value),placeholder:String(t.default??""),rows:4}):p.jsx(Mt,{value:d||"",onChange:w=>o(w.target.value),placeholder:String(t.default??"")});case"int":return p.jsx(Mt,{type:"number",step:1,value:d??"",onChange:w=>{const N=parseInt(w.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:w=>{const N=parseFloat(w.target.value);o(isNaN(N)?void 0:N)},placeholder:t.default?.toString()||"0"});case"bool":{const w=d;return p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(nf,{checked:w,onCheckedChange:o}),p.jsx("span",{className:"text-sm text-muted-foreground",children:w?"Enabled":"Disabled"})]})}case"selection":{const w="__none__",N=d??(t.optional?w:"");return p.jsxs(wr,{value:N,onValueChange:k=>o(k===w?void 0:k),children:[p.jsx(Xn,{children:p.jsx(br,{placeholder:"Select..."})}),p.jsxs(qn,{children:[t.optional&&p.jsx(sn,{value:w,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.options.map(k=>p.jsx(sn,{value:k.value,children:k.label},k.value))]})]})}case"memorySelect":{const N=x1(t,r),k=Object.values(v).filter(_=>N.includes(_.type)),P=d,M=!!(P&&!k.some(_=>_.id===P)),R=k.map(_=>({value:_.id,label:_.label}));return p.jsx(Pu,{value:P,options:R,isStale:M,placeholder:c("selectMemory","Select memory..."),onChange:_=>o(_)})}case"modelSelect":{const w=t,N=w1(w,r),k=cA(w,r),P=j=>!k?.length||k.every(U=>j.includes(U)),M=S.filter(j=>P(j.capabilities)).map(j=>({value:j.id,label:j.label})),R=Object.values(x).filter(j=>N.includes(j.type)&&P(j.arguments.capabilities??["chat"])).map(j=>({value:j.id,label:j.label})),_=new Set(M.map(j=>j.value)),$=[...M,...R.filter(j=>!_.has(j.value))],D=d,H=!!(D&&!$.some(j=>j.value===D));return $.length===0?p.jsxs(Uk,{variant:"destructive",children:[p.jsx(go,{className:"h-4 w-4"}),p.jsx(Kk,{children:c("noModelsAvailable")})]}):p.jsx(Pu,{value:D,options:$,isStale:H,placeholder:c("selectModel","Select model..."),onChange:j=>o(j)})}case"time":return p.jsx(Mt,{type:"time",value:d??"",onChange:w=>o(w.target.value)});case"weekdays":{const w=[{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 M=N.includes(P)?N.filter(R=>R!==P):[...N,P];o(M)};return p.jsx("div",{className:"space-y-1.5",children:p.jsx("div",{className:"flex gap-1",children:w.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 w=d??[],N=Object.values(v).filter($=>$.type==="MemoryFile"),k=new Map(N.map($=>[$.id,$])),P=($,D)=>o(w.map((H,j)=>j===$?D:H)),M=$=>o(w.filter((D,H)=>H!==$)),R=()=>{const $=new Set(w.map(H=>H.id)),D=N.find(H=>!$.has(H.id));o([...w,{id:D?.id??"",mode:"r"}])},_=N.length>w.length;return p.jsxs("div",{className:"space-y-2",children:[w.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.")}),w.map(($,D)=>{const H=$.id?k.get($.id):void 0,j=!!($.id&&!H),U=new Set(w.filter((I,B)=>B!==D).map(I=>I.id)),G=N.filter(I=>I.id===$.id||!U.has(I.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(wr,{value:$.id||void 0,onValueChange:I=>P(D,{...$,id:I}),children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:j?p.jsx("span",{className:"text-destructive",children:c("memoryRefStale","Deleted memory file")}):c("selectMemoryFile","Select memory file...")})}),p.jsx(qn,{children:G.map(I=>p.jsx(sn,{value:I.id,children:I.label},I.id))})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>M(D),"aria-label":c("removeMemoryRef","Remove memory ref"),children:p.jsx(El,{className:"w-3.5 h-3.5"})})]}),p.jsxs(yd,{type:"single",value:$.mode,onValueChange:I=>I&&P(D,{...$,mode:I}),className:"gap-0 justify-start",children:[p.jsx(Go,{value:"r",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-r-none",children:c("memoryModeRead","Read")}),p.jsx(Go,{value:"rw",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-l-none -ml-px",children:c("memoryModeReadWrite","Read + Write")})]})]},D)}),_&&p.jsx(os,{onClick:R,children:c("addMemoryRef","Add memory ref")})]})}case"channelSelect":{const N=v1(t,r),k=Object.values(h).filter(_=>N.includes(_.type)),P=d,M=!!(P&&!k.some(_=>_.id===P)),R=k.map(_=>({value:_.id,label:_.label}));return p.jsx(Pu,{value:P,options:R,isStale:M,placeholder:c("selectChannel"),onChange:_=>o(_)})}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?lH(c,l,t):t.description}),b(),E&&p.jsx("div",{className:"space-y-0.5",children:i.map((w,N)=>p.jsx("p",{className:"text-xs text-destructive",children:w},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:b=He})=>{const E=ue(P=>xn(P.builderMode)),w=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(Ot,{}),p.jsx("div",{className:`space-y-3 ${E?"pointer-events-none opacity-60":""}`,children:l.map(P=>p.jsx(Py,{canvasId:b,parameter:P,value:c(P),allArguments:d,onChange:M=>f(P.id,M),errors:w.get(P.id),translationPrefix:h},P.id))})]}),!E&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:x,children:v})]})]})})},YY=({channel:e,onClose:t})=>{const{t:n}=Xe(),r={...e.arguments,type:e.type},o=Ed.parameters.filter(c=>kr(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:()=>gH(e.id),onClose:t})},XY=({canvasId:e,onStep:t,getNodeCategory:n})=>{const{t:r}=Xe(),o=ss(w=>w.phase),i=ZY(o),c=Qe(e)(w=>i?w.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,b]=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((w,N)=>p.jsx(qY,{requirement:w,gpioValues:v,setGpioValues:x,serialValues:S,setSerialValues:b,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 qY({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 ZY(e){return e.status==="paused"||e.status==="stepping"?e.cursorNodeId:null}const QY=({canvasId:e,edgeId:t,edgeType:n,edgeData:r,sourceControlEdgeCount:o,onEdgeUpdate:i,onEdgeDelete:l,onClose:c})=>{const{t:d}=Xe(),f=ue(S=>xn(S.builderMode)),g=p1(n),h=Ye(S=>S.byEdgeId[t]),v=Ry(h),x=m.useCallback((S,b)=>{i(t,{[S]:b})},[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:cH(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(Ot,{}),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:w=>x(S.id,w),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(Ot,{}),p.jsx(zi,{onClick:()=>l(t),children:d("deleteEdge")})]})]})};var JY=Symbol("radix.slottable");function eX(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=JY,t}var pT="AlertDialog",[tX]=Lt(pT,[iS]),Rr=iS(),hT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Rr(t);return p.jsx(bm,{...r,...n,modal:!0})};hT.displayName=pT;var nX="AlertDialogTrigger",rX=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(a4,{...o,...r,ref:t})});rX.displayName=nX;var oX="AlertDialogPortal",gT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Rr(t);return p.jsx(Sm,{...r,...n})};gT.displayName=oX;var sX="AlertDialogOverlay",mT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(Dd,{...o,...r,ref:t})});mT.displayName=sX;var fi="AlertDialogContent",[iX,aX]=tX(fi),lX=eX("AlertDialogContent"),yT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Rr(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(iX,{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(lX,{children:r}),p.jsx(uX,{contentRef:l})]})})})});yT.displayName=fi;var vT="AlertDialogTitle",xT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(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=Rr(n);return p.jsx(Em,{...o,...r,ref:t})});bT.displayName=wT;var cX="AlertDialogAction",ST=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(Nm,{...o,...r,ref:t})});ST.displayName=cX;var CT="AlertDialogCancel",ET=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=aX(CT,n),i=Rr(n),l=De(t,o);return p.jsx(Nm,{...i,...r,ref:l})});ET.displayName=CT;var uX=({contentRef:e})=>{const t=`\`${fi}\` requires a description for the component to be accessible for screen reader users.
|
|
69
|
+
`,fill:`url(#${le})`,stroke:V?"hsl(var(--destructive))":te?`hsl(var(${Q})/0.5)`:"hsl(var(--edge-default))",strokeWidth:we})]})}return p.jsxs("svg",{className:"absolute inset-0 z-0 transition-all duration-300 will-change-[filter]",width:re,height:pe,viewBox:`0 0 ${re} ${pe}`,preserveAspectRatio:"none",style:Ct,children:[te&&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:ot})]})}),p.jsx("rect",{x:we/2,y:we/2,width:re-we,height:pe-we,rx:"10",ry:"10",fill:te?`url(#${le})`:Je,stroke:V?"hsl(var(--destructive))":te?`hsl(var(${Q})/0.5)`:"hsl(var(--edge-default))",strokeWidth:we})]})};return p.jsxs("div",{className:"relative z-0",style:{height:`${pe}px`,width:`${re}px`},children:[$.map((le,we)=>p.jsx(Eu,{id:le.id,type:"target",position:Se.Top,portType:le.type,label:le.label,disabled:L,style:{left:`${Le(we,$.length)}px`}},le.id)),_.map((le,we)=>p.jsx(Eu,{id:le.id,type:"target",position:Se.Left,portType:le.type,label:le.label,disabled:j,style:{top:X==="tapered-right"?`${pe/2}px`:`${Re(we,_.length)}px`}},le.id)),ze(),V&&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(go,{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:B.find(le=>le.severity==="error")?.message??"This node has errors"})]}),!V&&F&&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:B.find(le=>le.severity==="warning")?.message??"This node has warnings"})]}),p.jsxs("div",{className:`relative z-10 p-3 ${X==="tapered-right"?"pr-8":""}`,children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 mb-1.5",children:[z&&p.jsx(z,{className:"w-4 h-4 shrink-0",style:{color:`hsl(var(${Q}))`}}),p.jsx(uo,{variant:"secondary",className:"text-sm truncate max-w-full text-foreground",style:{backgroundColor:`hsl(var(${Q}) / 0.3)`,borderColor:`hsl(var(${Q}) / 0.4)`},children:l.label||r.label})]}),ne.length>0&&p.jsxs("div",{className:"space-y-0.5",children:[ne.slice(0,3).map(le=>{const we=U[le.id],Oe=A[le.id],ot=Oe?null:eG(le,we,b,N,k,P),Je=Oe?!Oe.parseRes.isValid:!!ot?.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 ${Je?"text-destructive":"text-foreground"}`,children:Oe?tG(Oe.expr):ot.text})]},le.id)}),ne.length>3&&p.jsxs("div",{className:"text-xs text-muted-foreground",children:["+",ne.length-3," more..."]})]})]}),D.map((le,we)=>{const Oe=!d&&!j&&Dg(l,le.id,v);return p.jsx(Eu,{id:le.id,type:"source",position:Se.Right,portType:le.type,label:le.label,disabled:j,showPlus:Oe,nodeId:e,style:{top:X==="tapered-right"?`${pe/2}px`:`${Re(we,D.length)}px`,right:"0"}},le.id)}),H.map((le,we)=>{const Oe=!d&&Dg(l,le.id,v);return p.jsx(Eu,{id:le.id,type:"source",position:Se.Bottom,portType:le.type,label:le.label,showPlus:Oe,nodeId:e,style:{left:`${Le(we,H.length)}px`,bottom:0}},le.id)})]})}),Nu=m.memo(e=>{const t=e.data,n=m.useMemo(()=>$t.getByType(t.type),[t.type]);return p.jsx(WN,{...e,nodeDefinition:n})}),nG=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 rG(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=n??"control",h=CK(),v=ue.getState().activeCanvasId,{lookup:x}=Li(v),S=h.filter(U=>U.source===t&&cm(U.type)).length,w=m.useMemo(()=>k1({canvasId:v,edgeId:e,edgeType:g,edgeData:c,availableVariables:x,sourceControlEdgeCount:S}),[g,S,c,x,v,e]),E=w.length>0,b=Ye(U=>U.setEdgeDiagnostics),N=Ye(U=>U.clearEdgeDiagnostics);m.useEffect(()=>(b(e,w),()=>N(e)),[e,w,b,N]);const k=()=>{if(h1(g))return pd({sourceX:r,sourceY:o-3,targetX:i,targetY:l+3});const U=2;return pd({sourceX:r-U,sourceY:o,sourcePosition:Se.Right,targetX:i+U,targetY:l,targetPosition:Se.Left})},[P,M,R]=k(),_=E?{source:ag,target:ag}:rG(g),$=3,D=`edge-gradient-${e}`,H=E?ag:"hsl(var(--selection-glow))",j=f?`drop-shadow(0 0 8px ${H}) drop-shadow(0 0 16px ${H})`:void 0;return p.jsxs(p.Fragment,{children:[p.jsxs("g",{style:{filter:j},children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:D,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:l,children:[p.jsx("stop",{offset:"0%",stopColor:_.source}),p.jsx("stop",{offset:"100%",stopColor:_.target})]})}),p.jsx(Dl,{id:e,path:P,style:{stroke:`url(#${D})`,strokeWidth:$,strokeDasharray:"none"}})]}),p.jsx(bK,{children:p.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${M}px,${R}px)`,pointerEvents:"all"},className:"flex flex-col items-center gap-0.5",children:E&&p.jsxs(al,{delayDuration:300,children:[p.jsx(ll,{asChild:!0,children:p.jsx("div",{className:"cursor-help",children:p.jsx(go,{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:w[0]?.message??"This edge has errors"})]})})})]})},oG={Standard:Nu,FunctionCall:nG,[xe.Trigger]:Nu,[xe.Tool]:Nu,[xe.AI]:Nu},sG={control:La,tool:La,agentTask:La,agentChoice:La,agentDelegate:La},iG=({canvasId:e,onConnect:t,onSelectionChange:n,onSelectionStart:r,onSelectionStop:o,onPaneClick:i,onAddNode:l,onNodeDragStart:c,viewportCenterRef:d})=>{const f=ue(A=>On(A.builderMode)),g=HN(),{screenToFlowPosition:h,getViewport:v,fitView:x}=hf(),S=NK(),w=m.useRef(null);m.useEffect(()=>{d.current=()=>{const A=w.current;if(!A)return{x:250,y:100};const{width:V,height:F}=A.getBoundingClientRect(),{x:W,y:q,zoom:L}=v();return{x:(-W+V/2)/L-90,y:(-q+F/2)/L-50}}},[v,d]);const E=Qe(e),b=E(A=>A.nodes),N=E(A=>A.edges),k=E(A=>A.setNodes),P=E(A=>A.setEdges),M=E(A=>A.setViewport),R=m.useRef(E.getState().viewport).current,[_,$]=m.useState(R!=null);m.useEffect(()=>{if(_||R!=null)return;if(b.length===0){$(!0);return}if(!S)return;x({padding:.15,maxZoom:1});const A=requestAnimationFrame(()=>{M(v()),$(!0)});return()=>cancelAnimationFrame(A)},[_,R,b.length,S,x,v,M]);const D=A=>{switch(A.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))"}},H=m.useCallback(A=>{k(V=>pN(A,V))},[k]),j=m.useCallback(A=>{P(V=>hN(A,V))},[P]),U=m.useCallback(A=>{if(A.preventDefault(),!(!l||f))try{const V=JSON.parse(A.dataTransfer.getData("application/json")),F=h({x:A.clientX,y:A.clientY});l(V.nodeDef,F)}catch(V){console.error("Failed to parse node data:",V)}},[l,h,f]),Y=A=>{f||(A.preventDefault(),A.dataTransfer.dropEffect="copy")},I=A=>{A.button===1&&A.preventDefault()},B=A=>{A.button===1&&A.preventDefault()};return p.jsx("div",{ref:w,className:"w-full h-full",style:{opacity:_?1:0},children:p.jsxs(xK,{nodes:b,edges:N,onNodesChange:H,onEdgesChange:j,onConnect:t,isValidConnection:A=>!!nE(A.source,A.target,A.sourceHandle,A.targetHandle,b,N),onPaneClick:i,onNodeDragStart:c,onSelectionChange:n,onSelectionStart:r,onSelectionEnd:o,onMoveEnd:(A,V)=>M(V),nodeTypes:oG,edgeTypes:sG,defaultViewport:R??void 0,selectionOnDrag:!f,panOnDrag:[1,2],selectionMode:Si.Partial,selectNodesOnDrag:!1,nodesConnectable:!f,nodesDraggable:!f,zoomOnScroll:!0,zoomOnPinch:!0,onDrop:U,onDragOver:Y,deleteKeyCode:null,onContextMenu:A=>A.preventDefault(),onMouseDownCapture:I,onAuxClick:B,colorMode:g,style:{"--xy-background-color":"hsl(var(--canvas-background))"},children:[p.jsx(IK,{variant:xr.Dots,color:"hsl(var(--muted-foreground))",gap:24,size:1.5,className:"opacity-40"}),p.jsx($K,{className:"glass-forest-panel !border !shadow-lg [&_button]:glass-forest-button [&_button]:!text-foreground hover:[&_button]:!scale-105"}),p.jsx(qK,{nodeColor:D,className:"glass-forest-panel !border !shadow-lg",maskColor:"hsl(var(--primary) / 0.15)",nodeBorderRadius:12,nodeStrokeWidth:2,style:{width:120,height:80}})]})})},aG=e=>p.jsx("div",{className:"w-full h-full overflow-hidden overscroll-contain",children:p.jsx(FN,{children:p.jsx(iG,{...e})})});var Vb=1,lG=.9,cG=.8,uG=.17,lg=.1,cg=.999,dG=.9999,fG=.99,pG=/[\\\/_+.#"@\[\(\{&]/,hG=/[\\\/_+.#"@\[\(\{&]/g,gG=/[\s-]/,UN=/[\s-]/g;function qg(e,t,n,r,o,i,l){if(i===t.length)return o===e.length?Vb:fG;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*=Vb:pG.test(e.charAt(f-1))?(h*=cG,x=e.slice(o,f-1).match(hG),x&&o>0&&(h*=Math.pow(cg,x.length))):gG.test(e.charAt(f-1))?(h*=lG,S=e.slice(o,f-1).match(UN),S&&o>0&&(h*=Math.pow(cg,S.length))):(h*=uG,o>0&&(h*=Math.pow(cg,f-o))),e.charAt(f)!==t.charAt(i)&&(h*=dG)),(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 Bb(e){return e.toLowerCase().replace(UN," ")}function mG(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,qg(e,t,Bb(e),Bb(t),0,0,{})}var Fa='[cmdk-group=""]',ug='[cmdk-group-items=""]',yG='[cmdk-group-heading=""]',KN='[cmdk-item=""]',Hb=`${KN}:not([aria-disabled="true"])`,Zg="cmdk-item-select",ei="data-value",vG=(e,t,n)=>mG(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 z,X;return{search:"",value:(X=(z=e.value)!=null?z: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(),M=m.useRef(null),R=RG();us(()=>{if(g!==void 0){let z=g.trim();n.current.value=z,_.emit()}},[g]),us(()=>{R(6,Y)},[]);let _=m.useMemo(()=>({subscribe:z=>(l.current.add(z),()=>l.current.delete(z)),snapshot:()=>n.current,setState:(z,X,Q)=>{var te,ne,Z,K;if(!Object.is(n.current[z],X)){if(n.current[z]=X,z==="search")U(),H(),R(1,j);else if(z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(P);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(R(7,()=>{var re;n.current.selectedItemId=(re=I())==null?void 0:re.id,_.emit()}),Q||R(5,Y),((ne=c.current)==null?void 0:ne.value)!==void 0){let re=X??"";(K=(Z=c.current).onValueChange)==null||K.call(Z,re);return}}_.emit()}},emit:()=>{l.current.forEach(z=>z())}}),[]),$=m.useMemo(()=>({value:(z,X,Q)=>{var te;X!==((te=i.current.get(z))==null?void 0:te.value)&&(i.current.set(z,{value:X,keywords:Q}),n.current.filtered.items.set(z,D(X,Q)),R(2,()=>{H(),_.emit()}))},item:(z,X)=>(r.current.add(z),X&&(o.current.has(X)?o.current.get(X).add(z):o.current.set(X,new Set([z]))),R(3,()=>{U(),H(),n.current.value||j(),_.emit()}),()=>{i.current.delete(z),r.current.delete(z),n.current.filtered.items.delete(z);let Q=I();R(4,()=>{U(),Q?.getAttribute("id")===z&&j(),_.emit()})}),group:z=>(o.current.has(z)||o.current.set(z,new Set),()=>{i.current.delete(z),o.current.delete(z)}),filter:()=>c.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:N,inputId:P,labelId:k,listInnerRef:M}),[]);function D(z,X){var Q,te;let ne=(te=(Q=c.current)==null?void 0:Q.filter)!=null?te:vG;return z?ne(z,n.current.search,X):0}function H(){if(!n.current.search||c.current.shouldFilter===!1)return;let z=n.current.filtered.items,X=[];n.current.filtered.groups.forEach(te=>{let ne=o.current.get(te),Z=0;ne.forEach(K=>{let re=z.get(K);Z=Math.max(re,Z)}),X.push([te,Z])});let Q=M.current;B().sort((te,ne)=>{var Z,K;let re=te.getAttribute("id"),ce=ne.getAttribute("id");return((Z=z.get(ce))!=null?Z:0)-((K=z.get(re))!=null?K:0)}).forEach(te=>{let ne=te.closest(ug);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${ug} > *`)):Q.appendChild(te.parentElement===Q?te:te.closest(`${ug} > *`))}),X.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Z=(ne=M.current)==null?void 0:ne.querySelector(`${Fa}[${ei}="${encodeURIComponent(te[0])}"]`);Z?.parentElement.appendChild(Z)})}function j(){let z=B().find(Q=>Q.getAttribute("aria-disabled")!=="true"),X=z?.getAttribute(ei);_.setState("value",X||void 0)}function U(){var z,X,Q,te;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 Z of r.current){let K=(X=(z=i.current.get(Z))==null?void 0:z.value)!=null?X:"",re=(te=(Q=i.current.get(Z))==null?void 0:Q.keywords)!=null?te:[],ce=D(K,re);n.current.filtered.items.set(Z,ce),ce>0&&ne++}for(let[Z,K]of o.current)for(let re of K)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Z);break}n.current.filtered.count=ne}function Y(){var z,X,Q;let te=I();te&&(((z=te.parentElement)==null?void 0:z.firstChild)===te&&((Q=(X=te.closest(Fa))==null?void 0:X.querySelector(yG))==null||Q.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function I(){var z;return(z=M.current)==null?void 0:z.querySelector(`${KN}[aria-selected="true"]`)}function B(){var z;return Array.from(((z=M.current)==null?void 0:z.querySelectorAll(Hb))||[])}function A(z){let X=B()[z];X&&_.setState("value",X.getAttribute(ei))}function V(z){var X;let Q=I(),te=B(),ne=te.findIndex(K=>K===Q),Z=te[ne+z];(X=c.current)!=null&&X.loop&&(Z=ne+z<0?te[te.length-1]:ne+z===te.length?te[0]:te[ne+z]),Z&&_.setState("value",Z.getAttribute(ei))}function F(z){let X=I(),Q=X?.closest(Fa),te;for(;Q&&!te;)Q=z>0?TG(Q,Fa):PG(Q,Fa),te=Q?.querySelector(Hb);te?_.setState("value",te.getAttribute(ei)):V(z)}let W=()=>A(B().length-1),q=z=>{z.preventDefault(),z.metaKey?W():z.altKey?F(1):V(1)},L=z=>{z.preventDefault(),z.metaKey?A(0):z.altKey?F(-1):V(-1)};return m.createElement(Ne.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:z=>{var X;(X=b.onKeyDown)==null||X.call(b,z);let Q=z.nativeEvent.isComposing||z.keyCode===229;if(!(z.defaultPrevented||Q))switch(z.key){case"n":case"j":{E&&z.ctrlKey&&q(z);break}case"ArrowDown":{q(z);break}case"p":case"k":{E&&z.ctrlKey&&L(z);break}case"ArrowUp":{L(z);break}case"Home":{z.preventDefault(),A(0);break}case"End":{z.preventDefault(),W();break}case"Enter":{z.preventDefault();let te=I();if(te){let ne=new Event(Zg);te.dispatchEvent(ne)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:_G},d),mf(e,z=>m.createElement(YN.Provider,{value:_},m.createElement(GN.Provider,{value:$},z))))}),xG=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;us(()=>{if(!f)return c.item(o,l?.id)},[f]);let g=QN(o,i,[e.value,e.children,i],e.keywords),h=Ey(),v=ho(R=>R.value&&R.value===g.current),x=ho(R=>f||c.filter()===!1?!0:R.search?R.filtered.items.get(o)>0:!0);m.useEffect(()=>{let R=i.current;if(!(!R||e.disabled))return R.addEventListener(Zg,S),()=>R.removeEventListener(Zg,S)},[x,e.onSelect,e.disabled]);function S(){var R,_;w(),(_=(R=d.current).onSelect)==null||_.call(R,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,...M}=e;return m.createElement(Ne.div,{ref:Yt(i,t),...M,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)}),wG=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=ho(x=>o||g.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);us(()=>g.group(l),[]),QN(l,c,[e.value,e.heading,d]);let v=m.useMemo(()=>({id:l,forceMount:o}),[o]);return m.createElement(Ne.div,{ref:Yt(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))))}),bG=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),i=ho(l=>!l.search);return!n&&!i?null:m.createElement(Ne.div,{ref:Yt(o,t),...r,"cmdk-separator":"",role:"separator"})}),SG=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=Ey(),l=ho(f=>f.search),c=ho(f=>f.selectedItemId),d=jl();return m.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),m.createElement(Ne.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)}})}),CG=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=m.useRef(null),l=m.useRef(null),c=ho(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(Ne.div,{ref:Yt(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:Yt(l,d.listInnerRef),"cmdk-list-sizer":""},f)))}),EG=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}))))}),NG=m.forwardRef((e,t)=>ho(n=>n.filtered.count===0)?m.createElement(Ne.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),kG=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return m.createElement(Ne.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)))}),Xt=Object.assign(qN,{List:CG,Item:xG,Input:SG,Group:wG,Separator:bG,Dialog:EG,Empty:NG,Loading:kG});function TG(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function PG(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 us(()=>{t.current=e}),t}var us=typeof window>"u"?m.useEffect:m.useLayoutEffect;function ti(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function ho(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 us(()=>{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 RG=()=>{let[e,t]=m.useState(),n=ti(()=>new Map);return us(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function IG(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(IG(t),{ref:t.ref},n(t.props.children)):n(t)}var _G={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(Xt,{ref:n,className:Ce("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));JN.displayName=Xt.displayName;const AG=({children:e,...t})=>p.jsx(SS,{...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($1,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(Xt.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=Xt.Input.displayName;const tk=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.List,{ref:n,className:Ce("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));tk.displayName=Xt.List.displayName;const nk=m.forwardRef((e,t)=>p.jsx(Xt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nk.displayName=Xt.Empty.displayName;const rk=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.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=Xt.Group.displayName;const MG=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.Separator,{ref:n,className:Ce("-mx-1 h-px bg-border",e),...t}));MG.displayName=Xt.Separator.displayName;const ok=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.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=Xt.Item.displayName;const DG=[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output];function jG({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(AG,{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.")}),DG.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 OG=({canvasId:e,viewportCenterRef:t,nodeDefinitions:n,onConnect:r,onAddNode:o,onAddNodeAndConnect:i,onSelectionChange:l,onPaneClick:c,onNodeDragStart:d,setSelectionDrag:f})=>{const g=e!==He,[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}=Qe(e).getState();return UH(h.nodeId,h.handleId,E,b,n,g)},[h,e,n,g]),w=m.useCallback(E=>{if(!h)return;const{nodes:b}=Qe(e).getState(),N=b.find(_=>_.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},R=An({type:E.type}).input.find(_=>_.type===h.portType);R&&(i(E,P,{source:h.nodeId,sourceHandle:h.handleId,target:"",targetHandle:R.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(aG,{canvasId:e,onConnect:r,onSelectionChange:l,onSelectionStart:()=>f(!0),onSelectionStop:()=>f(!1),onPaneClick:c,onAddNode:o,onNodeDragStart:d,viewportCenterRef:t})}),p.jsx(jG,{open:h!==null,onOpenChange:E=>{E||v(null)},compatibleDefs:S,onSelect:w})]})};var $G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LG=$G.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}},{}),FG="Separator",Wb="horizontal",zG=["horizontal","vertical"],sk=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Wb,...o}=e,i=VG(r)?r:Wb,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(LG.div,{"data-orientation":i,...c,...o,ref:t})});sk.displayName=FG;function VG(e){return zG.includes(e)}var ik=sk;const Ot=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}));Ot.displayName=ik.displayName;const BG=mo("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 Ub(e){const t=HG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(UG);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 HG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=GG(o),c=KG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 WG=Symbol("radix.slottable");function UG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WG}function KG(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 GG(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]=Lt(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:E,children:b}=w,N=qe.useRef(null),k=qe.useRef(new Map).current;return p.jsx(o,{scope:E,itemMap:k,collectionRef:N,children:b})};l.displayName=t;const c=e+"CollectionSlot",d=Ub(c),f=qe.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=Ub(g),x=qe.forwardRef((w,E)=>{const{scope:b,children:N,...k}=w,P=qe.useRef(null),M=De(E,P),R=i(g,b);return qe.useEffect(()=>(R.itemMap.set(P,{ref:P,...k}),()=>{R.itemMap.delete(P)})),p.jsx(v,{[h]:"",ref:M,children:N})});x.displayName=g;function S(w){const E=i(e+"CollectionConsumer",w);return qe.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(E.itemMap.values()).sort((R,_)=>k.indexOf(R.ref.current)-k.indexOf(_.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},S,r]}function YG(e){const t=XG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(ZG);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 XG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=JG(o),c=QG(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 qG=Symbol("radix.slottable");function ZG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qG}function QG(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 JG(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 eY=[" ","Enter","ArrowUp","ArrowDown"],tY=[" ","Enter"],ds="Select",[vf,xf,nY]=yf(ds),[Fi]=Lt(ds,[nY,$i]),wf=$i(),[rY,yo]=Fi(ds),[oY,sY]=Fi(ds),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,M]=m.useState(!1),R=Nl(f),[_,$]=ln({prop:r,defaultProp:o??!1,onChange:i,caller:ds}),[D,H]=ln({prop:l,defaultProp:c,onChange:d,caller:ds}),j=m.useRef(null),U=E?S||!!E.closest("form"):!0,[Y,I]=m.useState(new Set),B=Array.from(Y).map(A=>A.props.value).join(";");return p.jsx(Wm,{...w,children:p.jsxs(rY,{required:x,scope:t,trigger:E,onTriggerChange:b,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:P,onValueNodeHasChildrenChange:M,contentId:kt(),value:D,onValueChange:H,open:_,onOpenChange:$,dir:R,triggerPointerDownPosRef:j,disabled:v,children:[p.jsx(vf.Provider,{scope:t,children:p.jsx(oY,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(A=>{I(V=>new Set(V).add(A))},[]),onNativeOptionRemove:m.useCallback(A=>{I(V=>{const F=new Set(V);return F.delete(A),F})},[]),children:n})}),U?p.jsxs(Ak,{"aria-hidden":!0,required:x,tabIndex:-1,name:g,autoComplete:h,value:D,onChange:A=>H(A.target.value),disabled:v,form:S,children:[D===void 0?p.jsx("option",{value:""}):null,Array.from(Y)]},B):null]})})};lk.displayName=ds;var ck="SelectTrigger",uk=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=wf(n),l=yo(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(Ne.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===" ")&&eY.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=yo(dk,n),{onValueNodeHasChildrenChange:f}=d,g=i!==void 0,h=De(t,d.onValueNodeChange);return xt(()=>{f(g)},[f,g]),p.jsx(Ne.span,{...c,ref:h,style:{pointerEvents:"none"},children:Mk(d.value)?p.jsx(p.Fragment,{children:l}):i})});fk.displayName=dk;var iY="SelectIcon",pk=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});pk.displayName=iY;var aY="SelectPortal",hk=e=>p.jsx(Mi,{asChild:!0,...e});hk.displayName=aY;var fs="SelectContent",gk=m.forwardRef((e,t)=>{const n=yo(fs,e.__scopeSelect),[r,o]=m.useState();if(xt(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ps.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=fs;var Nn=10,[mk,vo]=Fi(fs),lY="SelectContentImpl",cY=YG("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=yo(fs,n),[k,P]=m.useState(null),[M,R]=m.useState(null),_=De(t,Z=>P(Z)),[$,D]=m.useState(null),[H,j]=m.useState(null),U=xf(n),[Y,I]=m.useState(!1),B=m.useRef(!1);m.useEffect(()=>{if(k)return ym(k)},[k]),mm();const A=m.useCallback(Z=>{const[K,...re]=U().map(ge=>ge.ref.current),[ce]=re.slice(-1),me=document.activeElement;for(const ge of Z)if(ge===me||(ge?.scrollIntoView({block:"nearest"}),ge===K&&M&&(M.scrollTop=0),ge===ce&&M&&(M.scrollTop=M.scrollHeight),ge?.focus(),document.activeElement!==me))return},[U,M]),V=m.useCallback(()=>A([$,k]),[A,$,k]);m.useEffect(()=>{Y&&V()},[Y,V]);const{onOpenChange:F,triggerPointerDownPosRef:W}=N;m.useEffect(()=>{if(k){let Z={x:0,y:0};const K=ce=>{Z={x:Math.abs(Math.round(ce.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(W.current?.y??0))}},re=ce=>{Z.x<=10&&Z.y<=10?ce.preventDefault():k.contains(ce.target)||F(!1),document.removeEventListener("pointermove",K),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",re,{capture:!0})}}},[k,F,W]),m.useEffect(()=>{const Z=()=>F(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[F]);const[q,L]=Dk(Z=>{const K=U().filter(me=>!me.disabled),re=K.find(me=>me.ref.current===document.activeElement),ce=jk(K,Z,re);ce&&setTimeout(()=>ce.ref.current.focus())}),z=m.useCallback((Z,K,re)=>{const ce=!B.current&&!re;(N.value!==void 0&&N.value===K||ce)&&(D(Z),ce&&(B.current=!0))},[N.value]),X=m.useCallback(()=>k?.focus(),[k]),Q=m.useCallback((Z,K,re)=>{const ce=!B.current&&!re;(N.value!==void 0&&N.value===K||ce)&&j(Z)},[N.value]),te=r==="popper"?Qg:vk,ne=te===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:M,onViewportChange:R,itemRefCallback:z,selectedItem:$,onItemLeave:X,itemTextRefCallback:Q,focusSelectedItem:V,selectedItemText:H,position:r,isPositioned:Y,searchRef:q,children:p.jsx(Ad,{as:cY,allowPinchZoom:!0,children:p.jsx(Id,{asChild:!0,trapped:N.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:ve(o,Z=>{N.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:p.jsx(Ai,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:p.jsx(te,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Z=>Z.preventDefault(),...b,...ne,onPlaced:()=>I(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,Z=>{const K=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!K&&Z.key.length===1&&L(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ce=U().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const me=Z.target,ge=ce.indexOf(me);ce=ce.slice(ge+1)}setTimeout(()=>A(ce)),Z.preventDefault()}})})})})})})});yk.displayName=lY;var uY="SelectItemAlignedPosition",vk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=yo(fs,n),l=vo(fs,n),[c,d]=m.useState(null),[f,g]=m.useState(null),h=De(t,_=>g(_)),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 _=i.trigger.getBoundingClientRect(),$=f.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),H=b.getBoundingClientRect();if(i.dir!=="rtl"){const me=H.left-$.left,ge=D.left-me,pe=_.left-ge,Re=_.width+pe,Le=Math.max(Re,$.width),ze=window.innerWidth-Nn,le=kg(ge,[Nn,Math.max(Nn,ze-Le)]);c.style.minWidth=Re+"px",c.style.left=le+"px"}else{const me=$.right-H.right,ge=window.innerWidth-D.right-me,pe=window.innerWidth-_.right-ge,Re=_.width+pe,Le=Math.max(Re,$.width),ze=window.innerWidth-Nn,le=kg(ge,[Nn,Math.max(Nn,ze-Le)]);c.style.minWidth=Re+"px",c.style.right=le+"px"}const j=v(),U=window.innerHeight-Nn*2,Y=w.scrollHeight,I=window.getComputedStyle(f),B=parseInt(I.borderTopWidth,10),A=parseInt(I.paddingTop,10),V=parseInt(I.borderBottomWidth,10),F=parseInt(I.paddingBottom,10),W=B+A+Y+F+V,q=Math.min(E.offsetHeight*5,W),L=window.getComputedStyle(w),z=parseInt(L.paddingTop,10),X=parseInt(L.paddingBottom,10),Q=_.top+_.height/2-Nn,te=U-Q,ne=E.offsetHeight/2,Z=E.offsetTop+ne,K=B+A+Z,re=W-K;if(K<=Q){const me=j.length>0&&E===j[j.length-1].ref.current;c.style.bottom="0px";const ge=f.clientHeight-w.offsetTop-w.offsetHeight,pe=Math.max(te,ne+(me?X:0)+ge+V),Re=K+pe;c.style.height=Re+"px"}else{const me=j.length>0&&E===j[0].ref.current;c.style.top="0px";const pe=Math.max(Q,B+w.offsetTop+(me?z:0)+ne)+re;c.style.height=pe+"px",w.scrollTop=K-Q+w.offsetTop}c.style.margin=`${Nn}px 0`,c.style.minHeight=q+"px",c.style.maxHeight=U+"px",r?.(),requestAnimationFrame(()=>x.current=!0)}},[v,i.trigger,i.valueNode,c,f,w,E,b,i.dir,r]);xt(()=>k(),[k]);const[P,M]=m.useState();xt(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const R=m.useCallback(_=>{_&&S.current===!0&&(k(),N?.(),S.current=!1)},[k,N]);return p.jsx(fY,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:R,children:p.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:p.jsx(Ne.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});vk.displayName=uY;var dY="SelectPopperPosition",Qg=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Nn,...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=dY;var[fY,Ny]=Fi(fs,{}),Jg="SelectViewport",xk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=vo(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(Ne.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-Nn*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",[pY,hY]=Fi(wk),gY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=kt();return p.jsx(pY,{scope:n,id:o,children:p.jsx(Ne.div,{role:"group","aria-labelledby":o,...r,ref:t})})});gY.displayName=wk;var bk="SelectLabel",Sk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=hY(bk,n);return p.jsx(Ne.div,{id:o.id,...r,ref:t})});Sk.displayName=bk;var gd="SelectItem",[mY,Ck]=Fi(gd),Ek=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,c=yo(gd,n),d=vo(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(mY,{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(Ne.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===" "||(tY.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=yo(Ua,n),c=vo(Ua,n),d=Ck(Ua,n),f=sY(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 xt(()=>(w(S),()=>E(S)),[w,E,S]),p.jsxs(p.Fragment,{children:[p.jsx(Ne.span,{id:d.textId,...i,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ps.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(Ne.span,{"aria-hidden":!0,...r,ref:t}):null});Tk.displayName=kk;var em="SelectScrollUpButton",Pk=m.forwardRef((e,t)=>{const n=vo(em,e.__scopeSelect),r=Ny(em,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return xt(()=>{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=vo(tm,e.__scopeSelect),r=Ny(tm,e.__scopeSelect),[o,i]=m.useState(!1),l=De(t,r.onScrollButtonChange);return xt(()=>{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=vo("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]),xt(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),p.jsx(Ne.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()})})}),yY="SelectSeparator",_k=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Ne.div,{"aria-hidden":!0,...r,ref:t})});_k.displayName=yY;var nm="SelectArrow",vY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=wf(n),i=yo(nm,n),l=vo(nm,n);return i.open&&l.position==="popper"?p.jsx(Gm,{...o,...r,ref:t}):null});vY.displayName=nm;var xY="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(Ne.select,{...n,style:{...RC,...n.style},ref:i,defaultValue:t})});Ak.displayName=xY;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=wY(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 wY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bY=lk,Ok=uk,SY=fk,CY=pk,EY=hk,$k=gk,NY=xk,Lk=Sk,Fk=Ek,kY=Nk,TY=Tk,zk=Pk,Vk=Rk,Bk=_k;const wr=bY,br=SY,Xn=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(CY,{asChild:!0,children:p.jsx(Ii,{className:"h-4 w-4 opacity-50"})})]}));Xn.displayName=Ok.displayName;const Hk=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"})}));Hk.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 qn=m.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(EY,{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(Hk,{}),p.jsx(NY,{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,{})]})}));qn.displayName=$k.displayName;const PY=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}));PY.displayName=Lk.displayName;const sn=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(TY,{children:p.jsx(M1,{className:"h-4 w-4"})})}),p.jsx(kY,{children:t})]}));sn.displayName=Fk.displayName;const RY=m.forwardRef(({className:e,...t},n)=>p.jsx(Bk,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));RY.displayName=Bk.displayName;const IY=mo("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(IY({variant:t}),e),...n}));Uk.displayName="Alert";const _Y=m.forwardRef(({className:e,...t},n)=>p.jsx("h5",{ref:n,className:Ce("mb-1 font-medium leading-none tracking-tight",e),...t}));_Y.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",AY={bubbles:!1,cancelable:!0},Ol="RovingFocusGroup",[rm,Gk,MY]=yf(Ol),[DY,bf]=Lt(Ol,[MY]),[jY,OY]=DY(Ol),Yk=m.forwardRef((e,t)=>p.jsx(rm.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(rm.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx($Y,{...e,ref:t})})}));Yk.displayName=Ol;var $Y=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]=ln({prop:l,defaultProp:c??null,onChange:d,caller:Ol}),[b,N]=m.useState(!1),k=pt(f),P=Gk(n),M=m.useRef(!1),[R,_]=m.useState(0);return m.useEffect(()=>{const $=v.current;if($)return $.addEventListener(dg,k),()=>$.removeEventListener(dg,k)},[k]),p.jsx(jY,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:w,onItemFocus:m.useCallback($=>E($),[E]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>_($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>_($=>$-1),[]),children:p.jsx(Ne.div,{tabIndex:b||R===0?-1:0,"data-orientation":r,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{M.current=!0}),onFocus:ve(e.onFocus,$=>{const D=!M.current;if($.target===$.currentTarget&&D&&!b){const H=new CustomEvent(dg,AY);if($.currentTarget.dispatchEvent(H),!H.defaultPrevented){const j=P().filter(A=>A.focusable),U=j.find(A=>A.active),Y=j.find(A=>A.id===w),B=[U,Y,...j].filter(Boolean).map(A=>A.ref.current);Zk(B,g)}}M.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=OY(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(Ne.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=zY(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?VY(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 LY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zY(e,t,n){const r=FY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return LY[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 VY(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]=ln({prop:n,onChange:o,defaultProp:r??!1,caller:eT});return p.jsx(Ne.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,xo="ToggleGroup",[nT]=Lt(xo,[bf]),rT=bf(),Ty=qe.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(HY,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${xo}\``)});Ty.displayName=xo;var[oT,sT]=nT(xo),BY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??"",onChange:o,caller:xo});return p.jsx(oT,{scope:e.__scopeToggleGroup,type:"single",value:qe.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:qe.useCallback(()=>c(""),[c]),children:p.jsx(iT,{...i,ref:t})})}),HY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??[],onChange:o,caller:xo}),d=qe.useCallback(g=>c((h=[])=>[...h,g]),[c]),f=qe.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=xo;var[WY,UY]=nT(xo),iT=qe.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(WY,{scope:n,rovingFocus:o,disabled:r,children:o?p.jsx(Qk,{asChild:!0,...f,orientation:i,dir:g,loop:c,children:p.jsx(Ne.div,{...h,ref:t})}):p.jsx(Ne.div,{...h,ref:t})})}),md="ToggleGroupItem",aT=qe.forwardRef((e,t)=>{const n=sT(md,e.__scopeToggleGroup),r=UY(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=qe.useRef(null);return r.rovingFocus?p.jsx(Jk,{asChild:!0,...o,focusable:!l,active:i,ref:d,children:p.jsx(Kb,{...c,ref:t})}):p.jsx(Kb,{...c,ref:t})});aT.displayName=md;var Kb=qe.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=mo("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"}}),KY=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}));KY.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 Go=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})});Go.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),M=m.useRef(!1),R=m.useMemo(()=>d.filter(A=>A.name.toLowerCase().includes(w.toLowerCase())),[d,w]),_=ue(A=>A.activeCanvasId),$=m.useMemo(()=>{const A={};if(!h)return A;for(const V of Qe(_).getState().nodes)A[V.id]=V.data.label??$t.getByType(V.data.type)?.label??V.data.type;return A},[h,_]),D=m.useCallback(A=>d.find(V=>V.name===A),[d]),H=m.useCallback(A=>{const V=[],F=/\$\{([^}]+)\}/g;let W,q=A;const L=[];for(;(W=F.exec(A))!==null;)L.push({name:W[1]??"",start:W.index,end:W.index+W[0].length});let z=0;for(const X of L){const Q=D(X.name);Q?Q.kind==="node"?V.push({srcId:Q.nodeId,varId:Q.outputId}):Q.kind==="fnarg"?V.push({srcId:"fnarg",varId:Q.uid}):V.push({srcId:"declared",varId:Q.uid}):V.push({srcId:"",varId:""});const te=q.slice(0,X.start+z),ne=q.slice(X.end+z);q=te+"${}"+ne,z-=X.name.length}return{expression:q,references:V,dataType:n}},[D,n]),j=m.useCallback(A=>{if(!A)return"";let V=A.expression,F=0;return V=V.replace(/\$\{\}/g,()=>{if(F<A.variables.length){const W=A.variables[F];return F++,`\${${W?.name??"unknown"}}`}return"${}"}),V},[]);m.useEffect(()=>{if(M.current)return;const A=j(c);A!==f&&g(A)},[c,j,f]);const U=A=>{M.current=!0;const V=A.target.value,F=A.target.selectionStart??0;g(V);const W=V.slice(0,F),q=W.lastIndexOf("$");if(q!==-1){const L=W.slice(q+1);if(!(L.startsWith("{")&&L.includes("}"))&&(L===""||L.startsWith("{")||/^[a-zA-Z_]/.test(L))){const X=L.replace(/^\{?/,"");E(X),S(q),v(!0),N(0);return}}v(!1),t(H(V))},Y=()=>{M.current=!1,t(H(f))},I=A=>{const V=f.slice(0,x),W=f.slice(k.current?.selectionStart??f.length).replace(/^[{]?[a-zA-Z_]*[}]?/,""),q=`${V}\${${A.name}}${W}`;g(q),v(!1),t(H(q)),setTimeout(()=>{k.current?.focus();const L=V.length+A.name.length+3;k.current?.setSelectionRange(L,L)},0)},B=A=>{if(h)switch(A.key){case"ArrowDown":A.preventDefault(),N(V=>Math.min(V+1,R.length-1));break;case"ArrowUp":A.preventDefault(),N(V=>Math.max(V-1,0));break;case"Enter":case"Tab":A.preventDefault(),R[b]&&I(R[b]);break;case"Escape":v(!1);break}};return m.useEffect(()=>{const A=V=>{P.current&&!P.current.contains(V.target)&&v(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]),p.jsx("div",{ref:P,children:p.jsxs("div",{className:"relative",children:[p.jsx("input",{ref:k,type:"text",value:f,onChange:U,onKeyDown:B,onBlur:Y,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&&R.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:R.map((A,V)=>p.jsxs("button",{onClick:()=>I(A),className:Ce("w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-accent",V===b&&"bg-accent"),children:[p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("span",{className:"font-mono",children:["$","{",A.name,"}"]}),p.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[150px]",children:A.kind==="node"?i("fromNode",{node:$[A.nodeId]??A.nodeId}):A.kind==="declared"?i("globalVariable"):i("fnarg")})]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:A.dataType})]},oo(A)))}),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(wr,{value:c,onValueChange:d=>i(d===l?void 0:d),disabled:r,children:[p.jsx(Xn,{children:p.jsx(br,{placeholder:n?p.jsx("span",{className:"text-destructive",children:"Deleted reference"}):r?"Loading...":o})}),p.jsxs(qn,{children:[p.jsx(sn,{value:l,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.map(d=>p.jsx(sn,{value:d.value,children:d.label},d.value))]})]})}function GY(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?yr(b):void 0,k=!!(N&&!g[N]),P=f.map(M=>({value:oo(M),label:`${M.name} (${M.dataType})`}));return p.jsx(Pu,{value:N,options:P,isStale:k,placeholder:"Select variable...",onChange:M=>{if(!M){o(void 0);return}const R=g[M];if(!R)return;const _=R.kind==="node"?{srcId:R.nodeId,varId:R.outputId}:R.kind==="declared"?{srcId:"declared",varId:R.uid}:{srcId:"fnarg",varId:R.uid};o(_)}})}case"expression":{const N=y1(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:GY(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(wr,{value:N,onValueChange:k=>o(k===b?void 0:k),children:[p.jsx(Xn,{children:p.jsx(br,{placeholder:"Select..."})}),p.jsxs(qn,{children:[t.optional&&p.jsx(sn,{value:b,children:p.jsx("span",{className:"text-muted-foreground italic pr-0.5",children:"None"})}),t.options.map(k=>p.jsx(sn,{value:k.value,children:k.label},k.value))]})]})}case"memorySelect":{const N=x1(t,r),k=Object.values(v).filter(_=>N.includes(_.type)),P=d,M=!!(P&&!k.some(_=>_.id===P)),R=k.map(_=>({value:_.id,label:_.label}));return p.jsx(Pu,{value:P,options:R,isStale:M,placeholder:c("selectMemory","Select memory..."),onChange:_=>o(_)})}case"modelSelect":{const b=t,N=w1(b,r),k=cA(b,r),P=j=>!k?.length||k.every(U=>j.includes(U)),M=S.filter(j=>P(j.capabilities)).map(j=>({value:j.id,label:j.label})),R=Object.values(x).filter(j=>N.includes(j.type)&&P(j.arguments.capabilities??["chat"])).map(j=>({value:j.id,label:j.label})),_=new Set(M.map(j=>j.value)),$=[...M,...R.filter(j=>!_.has(j.value))],D=d,H=!!(D&&!$.some(j=>j.value===D));return $.length===0?p.jsxs(Uk,{variant:"destructive",children:[p.jsx(go,{className:"h-4 w-4"}),p.jsx(Kk,{children:c("noModelsAvailable")})]}):p.jsx(Pu,{value:D,options:$,isStale:H,placeholder:c("selectModel","Select model..."),onChange:j=>o(j)})}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 M=N.includes(P)?N.filter(R=>R!==P):[...N,P];o(M)};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($=>$.type==="MemoryFile"),k=new Map(N.map($=>[$.id,$])),P=($,D)=>o(b.map((H,j)=>j===$?D:H)),M=$=>o(b.filter((D,H)=>H!==$)),R=()=>{const $=new Set(b.map(H=>H.id)),D=N.find(H=>!$.has(H.id));o([...b,{id:D?.id??"",mode:"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(($,D)=>{const H=$.id?k.get($.id):void 0,j=!!($.id&&!H),U=new Set(b.filter((I,B)=>B!==D).map(I=>I.id)),Y=N.filter(I=>I.id===$.id||!U.has(I.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(wr,{value:$.id||void 0,onValueChange:I=>P(D,{...$,id:I}),children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:j?p.jsx("span",{className:"text-destructive",children:c("memoryRefStale","Deleted memory file")}):c("selectMemoryFile","Select memory file...")})}),p.jsx(qn,{children:Y.map(I=>p.jsx(sn,{value:I.id,children:I.label},I.id))})]}),p.jsx(gt,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>M(D),"aria-label":c("removeMemoryRef","Remove memory ref"),children:p.jsx(El,{className:"w-3.5 h-3.5"})})]}),p.jsxs(yd,{type:"single",value:$.mode,onValueChange:I=>I&&P(D,{...$,mode:I}),className:"gap-0 justify-start",children:[p.jsx(Go,{value:"r",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-r-none",children:c("memoryModeRead","Read")}),p.jsx(Go,{value:"rw",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-l-none -ml-px",children:c("memoryModeReadWrite","Read + Write")})]})]},D)}),_&&p.jsx(os,{onClick:R,children:c("addMemoryRef","Add memory ref")})]})}case"channelSelect":{const N=v1(t,r),k=Object.values(h).filter(_=>N.includes(_.type)),P=d,M=!!(P&&!k.some(_=>_.id===P)),R=k.map(_=>({value:_.id,label:_.label}));return p.jsx(Pu,{value:P,options:R,isStale:M,placeholder:c("selectChannel"),onChange:_=>o(_)})}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?lH(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=He})=>{const E=ue(P=>On(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(Ot,{}),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:M=>f(P.id,M),errors:b.get(P.id),translationPrefix:h},P.id))})]}),!E&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:x,children:v})]})]})})},YY=({channel:e,onClose:t})=>{const{t:n}=Xe(),r={...e.arguments,type:e.type},o=Ed.parameters.filter(c=>kr(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:()=>gH(e.id),onClose:t})},XY=({canvasId:e,onStep:t,getNodeCategory:n})=>{const{t:r}=Xe(),o=ss(b=>b.phase),i=ZY(o),c=Qe(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(qY,{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 qY({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 ZY(e){return e.status==="paused"||e.status==="stepping"?e.cursorNodeId:null}const QY=({canvasId:e,edgeId:t,edgeType:n,edgeData:r,sourceControlEdgeCount:o,onEdgeUpdate:i,onEdgeDelete:l,onClose:c})=>{const{t:d}=Xe(),f=ue(S=>On(S.builderMode)),g=p1(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:cH(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(Ot,{}),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(Ot,{}),p.jsx(zi,{onClick:()=>l(t),children:d("deleteEdge")})]})]})};var JY=Symbol("radix.slottable");function eX(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=JY,t}var pT="AlertDialog",[tX]=Lt(pT,[iS]),Rr=iS(),hT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Rr(t);return p.jsx(bm,{...r,...n,modal:!0})};hT.displayName=pT;var nX="AlertDialogTrigger",rX=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(a4,{...o,...r,ref:t})});rX.displayName=nX;var oX="AlertDialogPortal",gT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Rr(t);return p.jsx(Sm,{...r,...n})};gT.displayName=oX;var sX="AlertDialogOverlay",mT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(Dd,{...o,...r,ref:t})});mT.displayName=sX;var fi="AlertDialogContent",[iX,aX]=tX(fi),lX=eX("AlertDialogContent"),yT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Rr(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(iX,{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(lX,{children:r}),p.jsx(uX,{contentRef:l})]})})})});yT.displayName=fi;var vT="AlertDialogTitle",xT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(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=Rr(n);return p.jsx(Em,{...o,...r,ref:t})});bT.displayName=wT;var cX="AlertDialogAction",ST=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Rr(n);return p.jsx(Nm,{...o,...r,ref:t})});ST.displayName=cX;var CT="AlertDialogCancel",ET=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=aX(CT,n),i=Rr(n),l=De(t,o);return p.jsx(Nm,{...i,...r,ref:l})});ET.displayName=CT;var uX=({contentRef:e})=>{const t=`\`${fi}\` requires a description for the component to be accessible for screen reader users.
|
|
70
70
|
|
|
71
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
72
|
|
|
73
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
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},dX=hT,fX=gT,NT=mT,kT=yT,TT=ST,PT=ET,RT=xT,IT=bT;const pX=dX,hX=fX,_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(hX,{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 gX=["int","float","bool","string"];function mX({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(wr,{value:e.dataType,onValueChange:l=>t({dataType:l}),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(br,{})}),p.jsx(qn,{children:gX.map(l=>p.jsx(sn,{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 Gb({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(mX,{port:g,onUpdate:v=>l(h,v),onRemove:()=>c(h),errors:d?.(g),children:f?.(g,h)},g.uid))}),p.jsx(os,{onClick:i,children:n})]})}const yX=e=>({expression:"",references:[],dataType:e});function vX(e){const t=Zm(e.id);t&&GB(t,e.arguments)}function wo(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&&vX(r)}function xX(){const e=an(),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})),Qe(e),Zd(),n}function wX(e){ue.getState().setFunctions(n=>{const{[e]:r,...o}=n;return o}),XB(e);const t=ue.getState().selection;t.kind==="function"&&t.id===e&&ue.getState().clearSelection()}function bX(e,t){wo(e,n=>({...n,name:t}),!1)}function SX(e){wo(e,t=>({...t,arguments:[...t.arguments,g1({name:`input${t.arguments.length+1}`,dataType:"string"})]}),!0)}function CX(e,t,n){wo(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 EX(e,t){wo(e,n=>({...n,arguments:n.arguments.filter((r,o)=>o!==t)}),!0)}function NX(e){wo(e,t=>{const n="string";return{...t,outputs:[...t.outputs,{uid:an(),name:`output${t.outputs.length+1}`,dataType:n,expression:yX(n)}]}},!0)}function kX(e,t,n){wo(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 TX(e,t){wo(e,n=>({...n,outputs:n.outputs.filter((r,o)=>o!==t)}),!0)}function PX(e,t,n){wo(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 RX=({func:e,onClose:t})=>{const{t:n}=Xe(),r=ue(S=>xn(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 b of v??[]){if(!b.outputId)continue;const E=S.get(b.outputId);E?E.push(b.message):S.set(b.outputId,[b.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),bX(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(Ot,{}),p.jsx(Gb,{title:n("inputs"),description:n("functionInputsDesc"),addLabel:n("add"),emptyText:n("noInputs"),ports:i,onAdd:()=>SX(o),onUpdate:(S,b)=>CX(o,S,b),onRemove:S=>EX(o,S)}),p.jsx(Ot,{}),p.jsx(Gb,{title:n("outputs"),description:n("functionOutputsDesc"),addLabel:n("add"),emptyText:n("noOutputs"),ports:l,onAdd:()=>NX(o),onUpdate:(S,b)=>kX(o,S,b),onRemove:S=>TX(o,S),errorsFor:S=>x.get(S.uid)??[],renderExtra:(S,b)=>p.jsx(fT,{value:S.expression,onChange:E=>PX(o,b,E),expressionType:S.dataType,availableVariables:h,placeholder:`${n("expressionFor")} ${S.name}...`})})]}),!r&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:()=>d(!0),children:n("deleteFunction")})]})]}),p.jsx(pX,{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:()=>{wX(o),d(!1),t()},children:n("delete")})]})]})})]})},IX=({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=>Mw(e.id,{label:f}),description:o?.description??"",belowLabel:d,parameters:o?.parameters??[],getValue:f=>e.arguments[f.id],allArguments:{...e.arguments},onParamChange:(f,g)=>Mw(e.id,{arguments:{[f]:g}}),diagnostics:i,translationPrefix:"memory",deleteLabel:n("deleteMemory","Delete memory"),onDelete:()=>xH(e.id),onClose:t})},_X=({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=>Dw(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)=>Dw(e.id,{arguments:{[l]:c}}),diagnostics:o,translationPrefix:"models",deleteLabel:n("deleteModel","Delete model"),onDelete:()=>EH(e.id),onClose:t})};var Sf="Checkbox",[AX]=Lt(Sf),[MX,_y]=AX(Sf);function DX(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]=ln({prop:n,defaultProp:o??!1,onChange:d,caller:Sf}),[S,b]=m.useState(null),[E,w]=m.useState(null),N=m.useRef(!1),k=S?!!l||!!S.closest("form"):!0,P={checked:v,disabled:i,setChecked:x,control:S,setControl:b,name:c,form:l,value:g,hasConsumerStoppedPropagationRef:N,required:f,defaultChecked:co(o)?!1:o,isFormControl:k,bubbleInput:E,setBubbleInput:w};return p.jsx(MX,{scope:t,...P,children:jX(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),b=De(o,g),E=m.useRef(d);return m.useEffect(()=>{const w=i?.form;if(w){const N=()=>h(E.current);return w.addEventListener("reset",N),()=>w.removeEventListener("reset",N)}},[i,h]),p.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":co(d)?"mixed":d,"aria-required":f,"data-state":UT(d),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:b,onKeyDown:ve(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:ve(n,w=>{h(N=>co(N)?!0:!N),S&&x&&(v.current=w.isPropagationStopped(),v.current||w.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(DX,{__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",BT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=_y(VT,n);return p.jsx(Pt,{present:r||co(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{"data-state":UT(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});BT.displayName=VT;var HT="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(HT,e),S=De(n,x),b=sy(i),E=Vm(r);m.useEffect(()=>{const N=v;if(!N)return;const k=window.HTMLInputElement.prototype,M=Object.getOwnPropertyDescriptor(k,"checked").set,R=!o.current;if(b!==i&&M){const _=new Event("click",{bubbles:R});N.indeterminate=co(i),M.call(N,co(i)?!1:i),N.dispatchEvent(_)}},[v,b,i,o]);const w=m.useRef(co(i)?!1:i);return p.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??w.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=HT;function jX(e){return typeof e=="function"}function co(e){return e==="indeterminate"}function UT(e){return co(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(BT,{className:Ce("flex items-center justify-center text-current"),children:p.jsx(M1,{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(Qo(i));return}const o=$t.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 Yb(e,t,n){if(!XT(e,t))return null;const r=an(),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 b of x.functionInfo.arguments)o[Qo(b)]={expression:"",references:[],dataType:b.dataType};for(const b of x.functionInfo.returns)o[Qo(b)]={active:!0,mode:"emit",name:b.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(w=>w.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 w=n.functionInfo?n.arguments:{...v.arguments,...n.arguments};x={...v,...n,arguments:w}}else x={...v,...n};l=Uu(x);const S=f.map((w,N)=>N===g?{...w,data:x}:w),b=Object.keys(i),E=Object.keys(l);return c=b.length!==E.length||E.some(w=>{const N=i[w],k=l[w];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 Xb(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 OX(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 qb(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=OX(i,l,c);return o(f=>YE({...t,type:d},f)),d}function $X(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 Zb(e,t){const{setEdges:n}=e.getState(),r=new Set(t);n(o=>o.filter(i=>!r.has(i.id)))}function LX(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 b=r(S.data);return b?XT(e,b)?!0:(d.push(b.label),!1):!0});if(f.length===0)return{pasted:!1,skippedLabels:d};const g=new Map;f.forEach(S=>{const b=an();g.set(S.id,b)});const h=f.map(S=>{const b=g.get(S.id),E=JSON.parse(JSON.stringify(S.data));return E.id=b,E.arguments=ZT(Sd(E),g),{...S,id:b,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 b={...S,id:an(),source:g.get(S.source),target:g.get(S.target),data:S.data?{...S.data}:S.data};if(b.data?.prompt&&Jo(b.data.prompt)){const E=b.data.prompt;b.data={...b.data,prompt:{...E,references:E.references.map(w=>({srcId:g.get(w.srcId)??w.srcId,varId:w.varId}))}}}return b});return i(S=>[...S.map(b=>({...b,selected:!1})),...h]),l(S=>[...S,...x]),c(S=>({...S,...qd(h.map(b=>b.data))})),{pasted:!0,skippedLabels:d}}function ZT(e,t){const n={};for(const[r,o]of Object.entries(e))if(Jo(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=>Jo(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=$t.getByType(e)?.category??"Uncategorized";switch(t){case xe.Trigger:case xe.Tool:case xe.AI:return t;default:return"Standard"}}function FX(e,t){const n=e.arguments,r={};for(const o of t.arguments){const i=Qo(o),l=n[i];r[i]=l?{...l,dataType:o.dataType}:{expression:"",references:[],dataType:o.dataType}}for(const o of t.returns){const i=Qo(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,FX(l,c)),n++))}}n>0&&Kt({title:gr.t("functionCallNodesMigrated"),description:gr.t("functionCallNodesMigratedDesc",{count:n})})}let Qb=ue.getState().functions;ue.subscribe(e=>{e.functions!==Qb&&(Qb=e.functions,JT())});const zX=({canvasId:e,selectedNode:t,onNodeUpdate:n,onNodeDelete:r,onClose:o,onOpenTest:i,getNodeDef:l})=>{const{t:c}=Xe(),d=ue(H=>xn(H.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(),b=x?S(x):void 0,E=t.type!=="FunctionCall"||!b?!1:t.functionInfo.version!==b.version,w=t.type==="FunctionCall"?Jm({...t.functionInfo,name:b?.name??t.functionInfo.name}):l(t),N=w?.isUnremovable??!1,k=Qe(e)(H=>H.edges),P=m.useMemo(()=>tl(t.id,t,k),[t,k]),M=Ye(H=>H.byNodeId[t.id]),R=Ry(M);if(!w)return p.jsx("div",{className:"p-4",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:c("unknownNodeType",{type:t.type})})});const _=Sd(t),$=w.parameters.filter(H=>kr(H,_,P)),D=(w.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||w.label,readOnly:d,onFocus:()=>{d||(v(!0),f||g(w.label))},onBlur:()=>{v(!1),(!f||f===w.label)&&(g(""),n(t.id,{label:void 0}))},onChange:H=>{g(H.target.value),n(t.id,{label:H.target.value})}})}),p.jsx("p",{className:"text-sm text-muted-foreground",children:WC(c,w)})]}),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,{}),$.length>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx("div",{className:`space-y-3 ${d?"pointer-events-none opacity-60":""}`,children:$.map(H=>p.jsx(Py,{canvasId:e,parameter:H,value:_[H.id],allArguments:_,onChange:j=>n(t.id,{arguments:{[H.id]:j}}),errors:R.get(H.id),translationPrefix:`nodes.${t.type}`},H.id))})]}),!d&&E&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),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&&D&&!P&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(WX,{canvasId:e,node:t,nodeDefinition:w,onNodeUpdate:n,nodeDiags:M})]}),!d&&t.type==="Agent"&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(gt,{variant:"outline",className:"w-full",onClick:()=>i(t.id),children:c("testAgent")})]}),!d&&!N&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:()=>r(t.id),children:c("deleteNode")})]})]})})},VX=["int","float","bool","string"],BX={int:"int",float:"float",bool:"bool",string:"string"};function HX(e,t){return`${e}[${t}]`}function Jb(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 WX({canvasId:e,node:t,nodeDefinition:n,onNodeUpdate:r,nodeDiags:o}){const{t:i}=Xe(),{list:l}=Li(e),c=m.useMemo(()=>C1(t),[t]),d=m.useMemo(()=>(n.outputs??[]).filter(w=>w.type==="static"),[n]),f=m.useMemo(()=>(n.outputs??[]).filter(w=>w.type==="list"),[n]),g=m.useMemo(()=>{const w=new Map;if(!o)return w;for(const N of o)if(N.outputId&&N.severity==="error"){const k=w.get(N.outputId);k?k.push(N.message):w.set(N.outputId,[N.message])}return w},[o]),h=m.useCallback((w,N)=>{r(t.id,{arguments:{[w]:N}})},[t.id,r]),v=m.useCallback((w,N)=>r(t.id,{arguments:{[w]:N}}),[t.id,r]),x=m.useCallback(w=>l.filter(N=>N.dataType===w&&!("nodeId"in N&&N.nodeId===t.id)),[l,t.id]);if(d.length===0&&f.length===0)return null;const S=(w,N,k)=>{const P=S1(t,w)??{active:!0,mode:"emit",name:N.name},M=x(N.dataType),R=g.get(w),_=!!R?.length,$=P.active,D=j=>{j!==$&&h(w,{...P,active:j})},H=j=>{j!==P.mode&&(j==="emit"?h(w,{active:P.active,mode:"emit",name:N.name}):h(w,{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 ${_?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(KT,{checked:$,onCheckedChange:j=>D(j===!0),"aria-label":i("outputBinding.enable","Enable output"),className:"shrink-0"}),p.jsx("span",{className:`text-xs font-medium flex-1 truncate ${$?"":"opacity-50"}`,children:k}),p.jsx("span",{className:`text-xs text-muted-foreground ${$?"":"opacity-50"}`,children:BX[N.dataType]})]}),p.jsxs("div",{className:$?"":"opacity-50",children:[p.jsxs("div",{className:`flex items-center gap-2 ${$?"":"pointer-events-none"}`,children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:j=>j&&H(j),className:"gap-0",children:[p.jsx(Go,{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(es,{className:"w-3.5 h-3.5"})}),p.jsx(Go,{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:!$,onChange:j=>h(w,{active:P.active,mode:"emit",name:j.target.value})}):M.length>0?p.jsxs(wr,{value:P.target.srcId?yr(P.target):"",onValueChange:j=>{const U=l.find(G=>oo(G)===j);U&&h(w,{active:P.active,mode:"assign",target:Jb(U)})},disabled:!$,children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:M.map(j=>p.jsx(sn,{value:oo(j),children:j.name},oo(j)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),_&&p.jsx("div",{className:"space-y-0.5",children:R.map((j,U)=>p.jsx("p",{className:"text-xs text-destructive",children:j},U))})]})]},w)},b=(w,N,k)=>{const P=N[k];if(!P)return null;const M=x(P.dataType),R=HX(w,k),_=g.get(R),$=!!_?.length,D=I=>v(w,N.map((B,A)=>A===k?I:B)),H=()=>v(w,N.filter((I,B)=>B!==k)),j=I=>{P.mode!==I&&D(I==="emit"?{mode:"emit",uid:an(),name:P.name,dataType:P.dataType}:{mode:"assign",name:P.name,dataType:P.dataType,target:{srcId:"",varId:""}})},U=I=>D({...P,name:I}),G=I=>D({...P,dataType:I});return p.jsxs("div",{className:`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${$?"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:H,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:I=>U(I.target.value)}),p.jsxs(wr,{value:P.dataType,onValueChange:I=>G(I),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(br,{})}),p.jsx(qn,{children:VX.map(I=>p.jsx(sn,{value:I,children:I},I))})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:I=>I&&j(I),className:"gap-0",children:[p.jsx(Go,{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(es,{className:"w-3.5 h-3.5"})}),p.jsx(Go,{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")}):M.length>0?p.jsxs(wr,{value:P.target.srcId?yr(P.target):"",onValueChange:I=>{const B=l.find(A=>oo(A)===I);B&&D({...P,target:Jb(B)})},children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:M.map(I=>p.jsx(sn,{value:oo(I),children:I.name},oo(I)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),$&&p.jsx("div",{className:"space-y-0.5",children:_.map((I,B)=>p.jsx("p",{className:"text-xs text-destructive",children:I},B))})]},`${w}-${P.mode==="emit"?P.uid:`assign-${k}`}`)},E=(w,N)=>{const k={mode:"emit",uid:an(),name:`output${N.length+1}`,dataType:"string"};v(w,[...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(w=>{const N=c[w.id];return N?S(w.id,N,w.label):null}),f.map(w=>{const N=t.arguments[w.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:w.label}),p.jsx("div",{className:"flex-1 h-px bg-border/60"})]}),N.map((k,P)=>b(w.id,N,P)),p.jsx(os,{onClick:()=>E(w.id,N),children:i("addOutput",{label:w.label,defaultValue:`Add ${w.label.toLowerCase()}`})})]},w.id)})]})]})}const UX=["int","float","bool","string"],KX=({canvasId:e,variable:t,onClose:n})=>{const{t:r}=Xe(),o=ue(f=>xn(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(wr,{value:t.initialValue!=null?String(t.initialValue):"false",onValueChange:f=>Ba(e,t.uid,{initialValue:f==="true"}),children:[p.jsx(Xn,{className:"h-8 text-sm",children:p.jsx(br,{})}),p.jsxs(qn,{children:[p.jsx(sn,{value:"false",children:"false"}),p.jsx(sn,{value:"true",children:"true"})]})]});case"string":return p.jsx(Mt,{className:"h-8 text-sm",value:t.initialValue??"",onChange:f=>Ba(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);Ba(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),Ba(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(Ot,{}),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(wr,{value:t.dataType,onValueChange:f=>PH(e,t.uid,f),children:[p.jsx(Xn,{className:"h-8 text-sm",children:p.jsx(br,{})}),p.jsx(qn,{children:UX.map(f=>p.jsx(sn,{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(Ot,{}),p.jsx(zi,{onClick:()=>RH(e,t.uid),children:r("deleteVariable","Delete variable")})]})]})})},GX=({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),b=ue(G=>G.models),E=ue(G=>G.functions),w=Qe(e),N=w(m.useCallback(G=>h.kind!=="graph"||h.nodeIds.length!==1?null:G.nodes.find(B=>B.id===h.nodeIds[0])?.data??null,[h])),k=w(m.useCallback(G=>{if(h.kind!=="variable")return null;const I=G.variables[Pi(h.uid)];return I&&I.kind==="declared"?I:null},[h])),P=w(m.useCallback(G=>h.kind!=="graph"||h.edgeIds.length!==1||h.nodeIds.length>0?null:G.edges.find(I=>I.id===h.edgeIds[0])??null,[h])),M=P?{id:P.id,source:P.source,type:P.type??"control",data:P.data??{}}:null,R=w(m.useCallback(G=>M?G.edges.filter(I=>I.source===M.source&&cm(I.type)).length:0,[M?.source])),_=m.useMemo(()=>h.kind==="channel"?Object.values(x).find(G=>G.id===h.id)??null:null,[h,x]),$=m.useMemo(()=>h.kind==="memory"?Object.values(S).find(G=>G.id===h.id)??null:null,[h,S]),D=m.useMemo(()=>h.kind==="model"?Object.values(b).find(G=>G.id===h.id)??null:null,[h,b]),H=m.useMemo(()=>h.kind==="function"?E[h.id]??null:null,[h,E]),j=m.useCallback(G=>r(G)?.category,[r]),U=m.useCallback(G=>f?.(G),[f]);return n?null:t?N?p.jsx(no,{bg:"bg-background",pad:!0,children:p.jsx(XY,{canvasId:e,onStep:g??(()=>{}),getNodeCategory:j})}):null:N?p.jsx(no,{children:p.jsx(zX,{canvasId:e,selectedNode:N,onNodeUpdate:o,onNodeDelete:i,onClose:d,onOpenTest:U,getNodeDef:r})}):M?p.jsx(no,{children:p.jsx(QY,{canvasId:e,edgeId:M.id,edgeType:M.type,edgeData:M.data,sourceControlEdgeCount:R,onEdgeUpdate:l,onEdgeDelete:c,onClose:d})}):k?p.jsx(no,{children:p.jsx(KX,{canvasId:e,variable:k,onClose:v})}):_?p.jsx(no,{children:p.jsx(YY,{channel:_,onClose:v})}):$?p.jsx(no,{children:p.jsx(IX,{memory:$,onClose:v})}):D?p.jsx(no,{children:p.jsx(_X,{model:D,onClose:v})}):H?p.jsx(no,{children:p.jsx(RX,{func:H,onClose:v})}):null},no=({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}),YX=(e=He)=>{const t=Qe(e);return{undo:t.undo,redo:t.redo,takeCheckpoint:t.takeCheckpoint,withCheckpoint:t.withCheckpoint,clearHistory:t.clearHistory,canUndo:t.canUndo,canRedo:t.canRedo}},e1={current:null},XX=(e=He,t=!1)=>{const n=Qe(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(()=>Yb(n,N,k))??null,[n,c]),f=m.useCallback((N,k)=>{c(()=>qT(n,N,k))},[n,c]),g=m.useCallback(N=>{c(()=>Xb(n,N,l))},[n,l,c]),h=m.useCallback(N=>c(()=>qb(n,N))??!1,[n,c]),v=m.useCallback((N,k)=>{c(()=>$X(n,N,k))},[n,c]),x=m.useCallback(N=>{c(()=>Zb(n,N))},[n,c]),S=m.useCallback((N,k)=>{N.length===0&&k.length===0||c(()=>{for(const P of N)Xb(n,P,l);k.length>0&&Zb(n,k)})},[n,l,c]),b=m.useCallback(N=>{if(N.length===0)return;const k=new Set(N),P=r.filter(R=>k.has(R.id)).map(R=>JSON.parse(JSON.stringify(R))),M=o.filter(R=>k.has(R.source)&&k.has(R.target)).map(R=>JSON.parse(JSON.stringify(R)));e1.current={nodes:P,edges:M}},[r,o]),E=m.useCallback(N=>{const k=e1.current;if(k)return c(()=>LX(n,k,N,l))},[n,l,c]),w=m.useCallback((N,k,P)=>c(()=>{const M=Yb(n,N,k);return M==null?null:(qb(n,{...P,target:M}),M)})??null,[n,c]);return{nodes:r,edges:o,addNode:d,updateNode:f,updateEdge:v,deleteNode:g,deleteEdges:x,deleteSelected:S,onConnect:h,addNodeAndConnect:w,copySelection:b,pasteSelection:E}},qX=()=>{const{t:e}=Xe(),t=ss(o=>o.console),n=ss(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(ZX,{entry:o},o.id))})})]})};function ZX({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 QX=({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=xn(g),v=g.type==="debug",{nodeDefinitions:x,getNodeDefinition:S,getAllCategories:b}=ey(),E=XX(f,h),{undo:w,redo:N,takeCheckpoint:k,canUndo:P,canRedo:M}=YX(f),R=ue(K=>K.selection),_=ue(K=>K.selectGraph),$=ue(K=>K.syncSelectionFromRF),D=ue(K=>K.clearSelection),H=ue(K=>K.activeSidebarTab),j=ue(K=>K.setActiveSidebarTab);m.useEffect(()=>{const K=H==="debug-context";v&&!K?j("debug-context"):!v&&K&&j("nodes")},[v,H,j]);const[U,G]=m.useState(!1),I=m.useRef(null),B=m.useCallback(K=>_([K],[]),[_]),A=m.useCallback(K=>_([],[K]),[_]),V=m.useCallback((K,re)=>{const ce=re??I.current?.(),me=E.addNode(K,ce);return me==null&&Kt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),me},[E]),F=m.useCallback(K=>{const re=E.onConnect(K);if(re&&re!=="control"&&re!=="tool"){const{edges:ce}=Qe(f).getState(),me=ce.find(ge=>ge.source===K.source&&ge.target===K.target&&ge.sourceHandle===K.sourceHandle&&ge.targetHandle===K.targetHandle);me&&A(me.id)}},[E,f,A]),W=m.useCallback((K,re,ce)=>{const me=E.addNodeAndConnect(K,re,ce);return me==null&&Kt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),me},[E]),q=m.useCallback(({nodes:K,edges:re})=>{$(K.map(ce=>ce.id),re.map(ce=>ce.id))},[$]),L=m.useCallback(K=>{E.deleteEdges([K]),D()},[E,D]),z=m.useCallback(()=>{k()},[k]),X=m.useCallback(()=>{const K=ue.getState().selection,re=K.kind==="graph"?K.nodeIds:[],ce=K.kind==="graph"?K.edgeIds:[];E.deleteSelected(re,ce),D()},[E,D]),Q=m.useCallback(K=>{const re=E.pasteSelection(K);if(re?.skippedLabels.length)for(const ce of re.skippedLabels)Kt({title:`Only one ${ce} node allowed per canvas`,variant:"destructive"});return re},[E]),te=K=>{const re=K.target;if(!(re?.tagName==="INPUT"||re?.tagName==="TEXTAREA"||re?.isContentEditable)){if(h){K.key==="Escape"&&D();return}if((K.ctrlKey||K.metaKey)&&K.key==="z"&&!K.shiftKey){K.preventDefault(),P()&&(D(),w());return}if((K.ctrlKey||K.metaKey)&&(K.key==="y"||K.key==="z"&&K.shiftKey)){K.preventDefault(),M()&&(D(),N());return}if((K.ctrlKey||K.metaKey)&&K.key==="c"){R.kind==="graph"&&R.nodeIds.length>0&&(K.preventDefault(),E.copySelection(R.nodeIds));return}if((K.ctrlKey||K.metaKey)&&K.key==="v"){K.preventDefault(),Q();return}(K.key==="Delete"||K.key==="Backspace")&&X(),K.key==="Escape"&&D()}},ne=f!==He,Z=p.jsxs("div",{className:"flex flex-col h-full min-w-0",children:[p.jsx(HH,{tabs:r,activeTabId:f,onTabChange:o,onTabClose:i,onTabReorder:l}),p.jsx("div",{className:"flex-1 relative",children:p.jsx(OG,{canvasId:f,viewportCenterRef:I,nodeDefinitions:x,onConnect:F,onAddNode:V,onAddNodeAndConnect:W,onSelectionChange:q,onPaneClick:D,onNodeDragStart:z,setSelectionDrag:G},f)})]});return p.jsx("div",{className:"h-full bg-canvas-bg flex flex-col outline-none",tabIndex:-1,onKeyDown:te,children:p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsx(BH,{canvasId:f,activeTab:H,onTabChange:j,onAddNode:V,nodeDefinitions:x,getAllCategories:b,onSelectNode:B,onSelectEdge:A,isFunctionCanvas:ne,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:Z}),p.jsx(L4,{withHandle:!0}),p.jsx(hw,{defaultSize:25,minSize:10,children:p.jsx(qX,{})})]}):Z}),p.jsx(GX,{canvasId:f,isDebugMode:v,selectionDrag:U,getNodeDef:S,onNodeUpdate:E.updateNode,onNodeDelete:E.deleteNode,onEdgeUpdate:E.updateEdge,onEdgeDelete:L,onClearSelection:D,onTestNode:c,onDebugStep:d})]})})};var My="ToastProvider",[Dy,JX,eq]=yf("Toast"),[eP]=Lt("Toast",[eq]),[tq,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(tq,{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",nq=["F8"],om="toast.viewportPause",sm="toast.viewportResume",rP=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=nq,label:o="Notifications ({hotkey})",...i}=e,l=Cf(nP,n),c=JX(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=w=>{r.length!==0&&r.every(k=>w[k]||w.code===k)&&h.current?.focus()};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[r]),m.useEffect(()=>{const E=d.current,w=h.current;if(S&&E&&w){const N=()=>{if(!l.isClosePausedRef.current){const R=new CustomEvent(om);w.dispatchEvent(R),l.isClosePausedRef.current=!0}},k=()=>{if(l.isClosePausedRef.current){const R=new CustomEvent(sm);w.dispatchEvent(R),l.isClosePausedRef.current=!1}},P=R=>{!E.contains(R.relatedTarget)&&k()},M=()=>{E.contains(document.activeElement)||k()};return E.addEventListener("focusin",N),E.addEventListener("focusout",P),E.addEventListener("pointermove",N),E.addEventListener("pointerleave",M),window.addEventListener("blur",N),window.addEventListener("focus",k),()=>{E.removeEventListener("focusin",N),E.removeEventListener("focusout",P),E.removeEventListener("pointermove",N),E.removeEventListener("pointerleave",M),window.removeEventListener("blur",N),window.removeEventListener("focus",k)}}},[S,l.isClosePausedRef]);const b=m.useCallback(({tabbingDirection:E})=>{const N=c().map(k=>{const P=k.ref.current,M=[P,...gq(P)];return E==="forwards"?M:M.reverse()});return(E==="forwards"?N.reverse():N).flat()},[c]);return m.useEffect(()=>{const E=h.current;if(E){const w=N=>{const k=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!k){const M=document.activeElement,R=N.shiftKey;if(N.target===E&&R){f.current?.focus();return}const D=b({tabbingDirection:R?"backwards":"forwards"}),H=D.findIndex(j=>j===M);fg(D.slice(H+1))?N.preventDefault():R?f.current?.focus():g.current?.focus()}};return E.addEventListener("keydown",w),()=>E.removeEventListener("keydown",w)}},[c,b]),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=b({tabbingDirection:"forwards"});fg(E)}}),p.jsx(Dy.Slot,{scope:n,children:p.jsx(Ne.ol,{tabIndex:-1,...i,ref:v})}),S&&p.jsx(im,{ref:g,onFocusFromOutsideViewport:()=>{const E=b({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",rq="toast.swipeStart",oq="toast.swipeMove",sq="toast.swipeCancel",iq="toast.swipeEnd",sP=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...l}=e,[c,d]=ln({prop:r,defaultProp:o??!0,onChange:i,caller:Ll});return p.jsx(Pt,{present:n||c,children:p.jsx(cq,{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[aq,lq]=eP(Ll,{onClose(){}}),cq=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,b=Cf(Ll,n),[E,w]=m.useState(null),N=De(t,I=>w(I)),k=m.useRef(null),P=m.useRef(null),M=o||b.duration,R=m.useRef(0),_=m.useRef(M),$=m.useRef(0),{onToastAdd:D,onToastRemove:H}=b,j=pt(()=>{E?.contains(document.activeElement)&&b.viewport?.focus(),l()}),U=m.useCallback(I=>{!I||I===1/0||(window.clearTimeout($.current),R.current=new Date().getTime(),$.current=window.setTimeout(j,I))},[j]);m.useEffect(()=>{const I=b.viewport;if(I){const B=()=>{U(_.current),f?.()},A=()=>{const V=new Date().getTime()-R.current;_.current=_.current-V,window.clearTimeout($.current),d?.()};return I.addEventListener(om,A),I.addEventListener(sm,B),()=>{I.removeEventListener(om,A),I.removeEventListener(sm,B)}}},[b.viewport,M,d,f,U]),m.useEffect(()=>{i&&!b.isClosePausedRef.current&&U(M)},[i,M,b.isClosePausedRef,U]),m.useEffect(()=>(D(),()=>H()),[D,H]);const G=m.useMemo(()=>E?fP(E):null,[E]);return b.viewport?p.jsxs(p.Fragment,{children:[G&&p.jsx(uq,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:G}),p.jsx(aq,{scope:n,onClose:j,children:ps.createPortal(p.jsx(Dy.ItemSlot,{scope:n,children:p.jsx(G3,{asChild:!0,onEscapeKeyDown:ve(c,()=>{b.isFocusedToastEscapeKeyDownRef.current||j(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(Ne.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...S,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ve(e.onKeyDown,I=>{I.key==="Escape"&&(c?.(I.nativeEvent),I.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:ve(e.onPointerDown,I=>{I.button===0&&(k.current={x:I.clientX,y:I.clientY})}),onPointerMove:ve(e.onPointerMove,I=>{if(!k.current)return;const B=I.clientX-k.current.x,A=I.clientY-k.current.y,V=!!P.current,F=["left","right"].includes(b.swipeDirection),W=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,q=F?W(0,B):0,L=F?0:W(0,A),z=I.pointerType==="touch"?10:2,X={x:q,y:L},Q={originalEvent:I,delta:X};V?(P.current=X,Ru(oq,h,Q,{discrete:!1})):t1(X,b.swipeDirection,z)?(P.current=X,Ru(rq,g,Q,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(B)>z||Math.abs(A)>z)&&(k.current=null)}),onPointerUp:ve(e.onPointerUp,I=>{const B=P.current,A=I.target;if(A.hasPointerCapture(I.pointerId)&&A.releasePointerCapture(I.pointerId),P.current=null,k.current=null,B){const V=I.currentTarget,F={originalEvent:I,delta:B};t1(B,b.swipeDirection,b.swipeThreshold)?Ru(iq,x,F,{discrete:!0}):Ru(sq,v,F,{discrete:!0}),V.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),uq=e=>{const{__scopeToast:t,children:n,...r}=e,o=Cf(Ll,t),[i,l]=m.useState(!1),[c,d]=m.useState(!1);return pq(()=>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]})})})},dq="ToastTitle",iP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});iP.displayName=dq;var fq="ToastDescription",aP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});aP.displayName=fq;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=lq(uP,n);return p.jsx(dP,{asChild:!0,children:p.jsx(Ne.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(Ne.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),hq(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 t1=(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 pq(e=()=>{}){const t=pt(e);xt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function hq(e){return e.nodeType===e.ELEMENT_NODE}function gq(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 mq=tP,pP=rP,hP=sP,gP=iP,mP=aP,yP=cP,vP=jy;const yq=mq,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 vq=mo("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(vq({variant:t}),e),...n}));wP.displayName=hP.displayName;const xq=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}));xq.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 wq(){const{toasts:e}=cz();return p.jsxs(yq,{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 bq=()=>{const[e,t]=m.useState([{id:He,label:"Main"}]),n=ue(b=>b.activeCanvasId),r=ue(b=>b.setActiveCanvas),o=ue(b=>b.selectFunction),i=ue(b=>b.functions);m.useEffect(()=>{t(b=>{let E=!1;const w=b.flatMap(N=>{if(N.id===He)return[N];const k=i[N.id];return k?k.name!==N.label?(E=!0,[{...N,label:k.name}]):[N]:(E=!0,[])});return E?w:b}),n!==He&&!i[n]&&r(He)},[i,n,r]);const l=m.useCallback(b=>{b!==He&&i[b]?o(b):r(b)},[i,o,r]),c=m.useCallback((b,E)=>(t(w=>w.find(k=>k.id===b)?w:[...w,{id:b,label:E}]),r(b),b),[r]),d=m.useCallback(b=>{b!==He&&t(E=>{const w=E.filter(N=>N.id!==b);return b===n&&r(He),w})},[n,r]),f=m.useCallback(b=>{b!==He&&t(E=>{const w=E.filter(N=>N.id!==b);return b===n&&r(He),w})},[n,r]),g=m.useCallback((b,E)=>{t(w=>w.map(N=>N.id===b?{...N,label:E}:N))},[]),h=m.useCallback((b,E)=>{b===0||E===0||t(w=>{const N=[...w],[k]=N.splice(b,1);return k?(N.splice(E,0,k),N):w})},[]),v=m.useCallback(()=>{t([{id:He,label:"Main"}]),r(He)},[r]),x=m.useCallback((b,E)=>{t(b),r(E)},[r]),S=m.useCallback(b=>e.find(E=>E.id===b)?.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===He}};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 Sq(){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 Cq(){const e=HN();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 Eq=({onOpenTab:e})=>{const{functionsList:t,getFunction:n}=Qd(),r=ue(l=>l.selectFunction),o=m.useCallback(l=>{const c=n(l);c&&(Qe(l),e(l,c.name),r(l))},[n,e,r]),i=m.useCallback(()=>{const l=xX();return e(l.id,l.name),r(l.id),l.id},[e,r]);return{functions:t,openFunction:o,createFunction:i}};function Nq(){const e=m.useCallback(r=>{const o=KB(HB(r));Aw();for(const[d,f]of Object.entries(o.canvases)){const g=Qe(d),h=f.nodes.map(x=>({id:x.id,type:QT(x.type),position:x.position,data:x})),v=f.edges.map(x=>({id:x.id,type:x.type,source:x.source,sourceHandle:x.sourceHandle,target:x.target,targetHandle:x.targetHandle,...x.data?{data:x.data}:{}}));g.getState().initialize(h,v),g.getState().setVariables(()=>f.variables)}const{channels:i,memory:l,models:c}=o;ue.getState().setChannels(()=>i),ue.getState().setMemory(()=>l),ue.getState().setModels(()=>c),ue.getState().setFunctions(()=>o.functions),Zd()},[]),t=m.useCallback(()=>UB(EP()),[]),n=m.useCallback(()=>{Aw();const r=ue.getState();r.setActiveCanvas(He),r.setChannels(o=>Object.keys(o).length?{}:o),r.setMemory(o=>Object.keys(o).length?{}:o),r.setModels(o=>Object.keys(o).length?{}:o),r.setFunctions(o=>Object.keys(o).length?{}:o),r.clearSelection()},[]);return{exportProject:t,importProject:e,clearProject:n}}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}}const kq=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&&gr.language!==l&&gr.changeLanguage(l)},[l]);const{importProject:v,exportProject:x,clearProject:S}=Nq();Cq(),pg({selectItems:D=>D.channels,validate:T1,getStored:D=>D.byChannelId,set:(D,H,j)=>D.setChannelDiagnostics(H,j),clear:(D,H)=>D.clearChannelDiagnostics(H)}),pg({selectItems:D=>D.memory,validate:P1,getStored:D=>D.byMemoryId,set:(D,H,j)=>D.setMemoryDiagnostics(H,j),clear:(D,H)=>D.clearMemoryDiagnostics(H)}),pg({selectItems:D=>D.models,validate:R1,getStored:D=>D.byModelId,set:(D,H,j)=>D.setModelDiagnostics(H,j),clear:(D,H)=>D.clearModelDiagnostics(H)}),Sq(),m.useEffect(()=>{ue.getState().setAvailableModels(i??[])},[i]);const b=bq(),E=Eq({onOpenTab:b.openTab}),[w,N]=m.useState(null),k=m.useCallback(()=>{const D=VA(EP());D.totalErrors===0&&D.totalWarnings===0?Kt({title:gr.t("validationPassed")}):N(D)},[]),P=m.useCallback(D=>{const H=ue.getState();D.channelId?(H.setActiveSidebarTab("channels"),H.selectChannel(D.channelId)):D.memoryId?(H.setActiveSidebarTab("memory"),H.selectMemory(D.memoryId)):D.modelId?(H.setActiveSidebarTab("models"),H.selectModel(D.modelId)):D.canvasId&&(D.canvasId===He?H.setActiveCanvas(He):E.openFunction(D.canvasId),D.nodeId?H.selectGraph([D.nodeId],[]):D.edgeId&&H.selectGraph([],[D.edgeId])),N(null)},[E]),M=m.useRef(!1);m.useEffect(()=>{if(!M.current){M.current=!0;try{o&&ue.getState().setBuilderMode(o),r?v(r):S()}catch(D){h?.(D instanceof Error?D:new Error(String(D)))}}},[]);const R=m.useRef(f),_=m.useRef(g);R.current=f,_.current=g;const $=m.useRef(!1);return m.useEffect(()=>{const D=[],H=new WeakSet;function j(A){if(H.has(A))return;H.add(A);let V=A.getState().mutationCount;const F=A.subscribe(W=>{W.mutationCount!==V&&(V=W.mutationCount,$.current||R.current?.())});D.push(F)}function U(){for(const A of Object.values(Qm()))j(A)}U();const G=_w(()=>{U()});D.push(G);let I=ue.getState().mutationCount;const B=ue.subscribe(A=>{A.mutationCount!==I&&(I=A.mutationCount,$.current||R.current?.())});return D.push(B),()=>{for(const A of D)A()}},[]),m.useEffect(()=>{let D=null,H=null,j=null;const U=()=>{const V=Qe(ue.getState().activeCanvasId),F=V.canUndo(),W=V.canRedo();F===D&&W===H||(D=F,H=W,_.current?.({canUndo:F,canRedo:W}))},G=()=>{j?.(),j=Qe(ue.getState().activeCanvasId).subscribe(U),U()};G();let I=ue.getState().activeCanvasId;const B=ue.subscribe(V=>{V.activeCanvasId!==I&&(I=V.activeCanvasId,G())}),A=_w(G);return()=>{j?.(),B(),A()}},[]),m.useImperativeHandle(n,()=>({loadWorkflow:D=>{$.current=!0;try{v(D)}catch(H){h?.(H instanceof Error?H:new Error(String(H)))}finally{$.current=!1}},exportWorkflow:()=>x(),clear:()=>{$.current=!0;try{S()}finally{$.current=!1}},setMode:D=>ue.getState().setBuilderMode(D),getMode:()=>ue.getState().builderMode,validate:k,undo:()=>Qe(ue.getState().activeCanvasId).undo(),redo:()=>Qe(ue.getState().activeCanvasId).redo(),setDebugPhase:D=>ss.getState().setPhase(D)}),[v,x,S,h,k]),p.jsx(T_,{i18n:gr,children:p.jsx(FC,{delayDuration:300,children:p.jsxs("div",{className:"fh-builder h-full w-full bg-background text-foreground font-sans antialiased",children:[p.jsx(QX,{functions:E.functions,onOpenFunction:E.openFunction,onCreateFunction:E.createFunction,canvasTabs:b.tabs,onCanvasTabChange:b.setActiveTabId,onCanvasTabClose:b.closeTab,onCanvasTabReorder:b.reorderTabs,onTestNode:c,onDebugStep:d}),p.jsx(wq,{}),w&&p.jsx(c4,{open:!0,onOpenChange:D=>{D||N(null)},validation:w,onSelectDiagnostic:P})]})})})});function Tq({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 Pq(e){const t=Rq(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(_q);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 Rq(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=Mq(o),c=Aq(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 Iq=Symbol("radix.slottable");function _q(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Iq}function Aq(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 Mq(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"," "],Dq=["ArrowDown","PageUp","Home"],NP=["ArrowUp","PageDown","End"],jq=[...Dq,...NP],Oq={ltr:[...am,"ArrowRight"],rtl:[...am,"ArrowLeft"]},$q={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fl="Menu",[vl,Lq,Fq]=yf(Fl),[hs,kP]=Lt(Fl,[Fq,$i,bf]),Ef=$i(),TP=bf(),[zq,gs]=hs(Fl),[Vq,zl]=hs(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(zq,{scope:t,open:n,onOpenChange:h,content:d,onContentChange:f,children:p.jsx(Vq,{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",[Hq,RP]=hs($y,{forceMount:void 0}),IP=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=gs($y,t);return p.jsx(Hq,{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 yn="MenuContent",[Wq,Ly]=hs(yn),_P=m.forwardRef((e,t)=>{const n=RP(yn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=gs(yn,e.__scopeMenu),l=zl(yn,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(Uq,{...o,ref:t}):p.jsx(Kq,{...o,ref:t})})})})}),Uq=m.forwardRef((e,t)=>{const n=gs(yn,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)})}),Kq=m.forwardRef((e,t)=>{const n=gs(yn,e.__scopeMenu);return p.jsx(Fy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gq=Pq("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,...b}=e,E=gs(yn,n),w=zl(yn,n),N=Ef(n),k=TP(n),P=Lq(n),[M,R]=m.useState(null),_=m.useRef(null),$=De(t,_,E.onContentChange),D=m.useRef(0),H=m.useRef(""),j=m.useRef(0),U=m.useRef(null),G=m.useRef("right"),I=m.useRef(0),B=S?Ad:m.Fragment,A=S?{as:Gq,allowPinchZoom:!0}:void 0,V=W=>{const q=H.current+W,L=P().filter(Z=>!Z.disabled),z=document.activeElement,X=L.find(Z=>Z.ref.current===z)?.textValue,Q=L.map(Z=>Z.textValue),te=sZ(Q,q,X),ne=L.find(Z=>Z.textValue===te)?.ref.current;(function Z(K){H.current=K,window.clearTimeout(D.current),K!==""&&(D.current=window.setTimeout(()=>Z(""),1e3))})(q),ne&&setTimeout(()=>ne.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),mm();const F=m.useCallback(W=>G.current===U.current?.side&&aZ(W,U.current?.area),[]);return p.jsx(Wq,{scope:n,searchRef:H,onItemEnter:m.useCallback(W=>{F(W)&&W.preventDefault()},[F]),onItemLeave:m.useCallback(W=>{F(W)||(_.current?.focus(),R(null))},[F]),onTriggerLeave:m.useCallback(W=>{F(W)&&W.preventDefault()},[F]),pointerGraceTimerRef:j,onPointerGraceIntentChange:m.useCallback(W=>{U.current=W},[]),children:p.jsx(B,{...A,children:p.jsx(Id,{asChild:!0,trapped:o,onMountAutoFocus:ve(i,W=>{W.preventDefault(),_.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:w.dir,orientation:"vertical",loop:r,currentTabStopId:M,onCurrentTabStopIdChange:R,onEntryFocus:ve(d,W=>{w.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:w.dir,...N,...b,ref:$,style:{outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,W=>{const L=W.target.closest("[data-radix-menu-content]")===W.currentTarget,z=W.ctrlKey||W.altKey||W.metaKey,X=W.key.length===1;L&&(W.key==="Tab"&&W.preventDefault(),!z&&X&&V(W.key));const Q=_.current;if(W.target!==Q||!jq.includes(W.key))return;W.preventDefault();const ne=P().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);NP.includes(W.key)&&ne.reverse(),rZ(ne)}),onBlur:ve(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(D.current),H.current="")}),onPointerMove:ve(e.onPointerMove,xl(W=>{const q=W.target,L=I.current!==W.clientX;if(W.currentTarget.contains(q)&&L){const z=W.clientX>I.current?"right":"left";G.current=z,I.current=W.clientX}}))})})})})})})});_P.displayName=yn;var Yq="MenuGroup",zy=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"group",...r,ref:t})});zy.displayName=Yq;var Xq="MenuLabel",AP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});AP.displayName=Xq;var vd="MenuItem",n1="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(n1,{bubbles:!0,cancelable:!0});h.addEventListener(n1,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(Ne.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))})})})}),qq="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":By(n),onSelect:ve(o.onSelect,()=>r?.(xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DP.displayName=qq;var jP="MenuRadioGroup",[Zq,Qq]=hs(jP,{value:void 0,onValueChange:()=>{}}),OP=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=pt(r);return p.jsx(Zq,{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=Qq($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":By(i),onSelect:ve(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});LP.displayName=$P;var Vy="MenuItemIndicator",[FP,Jq]=hs(Vy,{checked:!1}),zP=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Jq(Vy,n);return p.jsx(Pt,{present:r||xd(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{...o,ref:t,"data-state":By(i.checked)})})});zP.displayName=Vy;var eZ="MenuSeparator",VP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});VP.displayName=eZ;var tZ="MenuArrow",BP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Gm,{...o,...r,ref:t})});BP.displayName=tZ;var nZ="MenuSub",[aQ,HP]=hs(nZ),Ka="MenuSubTrigger",WP=m.forwardRef((e,t)=>{const n=gs(Ka,e.__scopeMenu),r=zl(Ka,e.__scopeMenu),o=HP(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:Yt(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",b=S?-5:5,E=v[S?"left":"right"],w=v[S?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+b,y:h.clientY},{x:E,y:v.top},{x:w,y:v.top},{x:w,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===" "||Oq[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(yn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=gs(yn,e.__scopeMenu),l=zl(yn,e.__scopeMenu),c=HP(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=$q[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 By(e){return xd(e)?"indeterminate":e?"checked":"unchecked"}function rZ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function oZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function sZ(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=oZ(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 iZ(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 aZ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return iZ(n,t)}function xl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var lZ=PP,cZ=Oy,uZ=IP,dZ=_P,fZ=zy,pZ=AP,hZ=Nf,gZ=DP,mZ=OP,yZ=LP,vZ=zP,xZ=VP,wZ=BP,bZ=WP,SZ=KP,kf="DropdownMenu",[CZ]=Lt(kf,[kP]),Ft=kP(),[EZ,YP]=CZ(kf),XP=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,d=Ft(t),f=m.useRef(null),[g,h]=ln({prop:o,defaultProp:i??!1,onChange:l,caller:kf});return p.jsx(EZ,{scope:t,triggerId:kt(),triggerRef:f,contentId:kt(),open:g,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(v=>!v),[h]),modal:c,children:p.jsx(lZ,{...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=Ft(n);return p.jsx(cZ,{asChild:!0,...l,children:p.jsx(Ne.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:Yt(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 NZ="DropdownMenuPortal",QP=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ft(t);return p.jsx(uZ,{...r,...n})};QP.displayName=NZ;var JP="DropdownMenuContent",eR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=YP(JP,n),i=Ft(n),l=m.useRef(!1);return p.jsx(dZ,{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 kZ="DropdownMenuGroup",TZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(fZ,{...o,...r,ref:t})});TZ.displayName=kZ;var PZ="DropdownMenuLabel",RZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(pZ,{...o,...r,ref:t})});RZ.displayName=PZ;var IZ="DropdownMenuItem",tR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(hZ,{...o,...r,ref:t})});tR.displayName=IZ;var _Z="DropdownMenuCheckboxItem",AZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(gZ,{...o,...r,ref:t})});AZ.displayName=_Z;var MZ="DropdownMenuRadioGroup",DZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(mZ,{...o,...r,ref:t})});DZ.displayName=MZ;var jZ="DropdownMenuRadioItem",OZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(yZ,{...o,...r,ref:t})});OZ.displayName=jZ;var $Z="DropdownMenuItemIndicator",LZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(vZ,{...o,...r,ref:t})});LZ.displayName=$Z;var FZ="DropdownMenuSeparator",zZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(xZ,{...o,...r,ref:t})});zZ.displayName=FZ;var VZ="DropdownMenuArrow",BZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(wZ,{...o,...r,ref:t})});BZ.displayName=VZ;var HZ="DropdownMenuSubTrigger",WZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(bZ,{...o,...r,ref:t})});WZ.displayName=HZ;var UZ="DropdownMenuSubContent",KZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(SZ,{...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)"}})});KZ.displayName=UZ;var GZ=XP,YZ=ZP,XZ=QP,qZ=eR,ZZ=tR;const hg=[{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"en",name:"English",flag:"🇺🇸"}];function QZ({language:e,onChange:t}){const{t:n}=Xe(),r=hg.find(o=>o.code===e)??hg[1];return p.jsxs(GZ,{children:[p.jsx(YZ,{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(XZ,{children:p.jsx(qZ,{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(ZZ,{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 JZ=[{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"),eQ=e=>e.split(/[\\/]/).pop()??e,tQ=typeof window<"u"&&"showOpenFilePicker"in window,nQ=typeof window<"u"&&"showSaveFilePicker"in window,rQ=Ti?{kind:"path",path:Ti}:null,oQ=Ti?eQ(Ti):null,r1=[{description:"Workflow JSON",accept:{"application/json":[".json"]}}];function sQ(){const{t:e}=Xe(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(!1),[o,i]=m.useState(!1),[l,c]=m.useState(!1),[d,f]=m.useState(!1),[g,h]=m.useState(()=>localStorage.getItem("fh-theme")==="light"?"light":"dark"),[v,x]=m.useState(()=>localStorage.getItem(xg)==="de"?"de":"en"),[S,b]=m.useState(rQ),[E,w]=m.useState(oQ);m.useEffect(()=>{document.documentElement.classList.toggle("light",g==="light"),localStorage.setItem("fh-theme",g)},[g]),m.useEffect(()=>{Tt.changeLanguage(v),localStorage.setItem(xg,v)},[v]),m.useEffect(()=>{const j=E??"Untitled.json";document.title=`${o?"• ":""}${j} — Edge Agents Builder`},[E,o]),m.useEffect(()=>{r.current||!Ti||(r.current=!0,fetch(`/api/file?path=${encodeURIComponent(Ti)}`).then(async j=>{if(j.status===404)return null;if(!j.ok)throw new Error(`${j.status} ${await j.text()}`);return j.json()}).then(j=>{j&&(t.current?.loadWorkflow(j),i(!1))}).catch(j=>Kt({title:e("toast.loadFailed"),description:j.message,variant:"destructive"})))},[e]);const N=m.useCallback((j,U,G)=>{let I;try{I=JSON.parse(j)}catch{Kt({title:e("toast.loadFailed"),description:e("error.invalidJson"),variant:"destructive"});return}t.current?.loadWorkflow(I),i(!1),w(U),b(G)},[e]),k=m.useCallback(async()=>{if(!(o&&!window.confirm(e("confirm.discard")))){if(tQ){try{const[j]=await window.showOpenFilePicker({types:r1});if(!j)return;const U=await j.getFile();N(await U.text(),j.name,{kind:"handle",handle:j})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")return;Kt({title:e("toast.loadFailed"),description:j instanceof Error?j.message:String(j),variant:"destructive"})}return}n.current?.click()}},[o,e,N]),P=m.useCallback(j=>{const U=j.target.files?.[0];U&&(U.text().then(G=>N(G,U.name,null)).catch(G=>Kt({title:e("toast.loadFailed"),description:G.message,variant:"destructive"})),j.target.value="")},[N,e]),M=m.useCallback(async()=>{const j=t.current?.exportWorkflow();if(!j)return;const U=JSON.stringify(j,null,2);if(S?.kind==="path"){try{const A=await fetch(`/api/file?path=${encodeURIComponent(S.path)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:U});if(!A.ok)throw new Error(`${A.status} ${await A.text()}`);i(!1)}catch(A){Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}if(S?.kind==="handle"){try{const A=await S.handle.createWritable();await A.write(U),await A.close(),i(!1)}catch(A){Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}if(nQ){try{const A=await window.showSaveFilePicker({suggestedName:E??"workflow.json",types:r1}),V=await A.createWritable();await V.write(U),await V.close(),b({kind:"handle",handle:A}),w(A.name),i(!1)}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}const G=new Blob([U],{type:"application/json"}),I=URL.createObjectURL(G),B=document.createElement("a");B.href=I,B.download=E??`workflow-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,B.click(),URL.revokeObjectURL(I),i(!1)},[S,E,e]),R=m.useCallback(()=>{o&&!window.confirm(e("confirm.discard"))||(t.current?.clear(),i(!1),b(null),w(null))},[o,e]),_=m.useCallback(()=>{t.current?.validate()},[]),$=m.useCallback(()=>{i(!0)},[]),D=m.useCallback(j=>{c(j.canUndo),f(j.canRedo)},[]),H=m.useCallback(j=>{Kt({title:e("toast.error"),description:j.message,variant:"destructive"})},[e]);return m.useEffect(()=>{const j=U=>{(U.metaKey||U.ctrlKey)&&!U.shiftKey&&U.key.toLowerCase()==="s"&&(U.preventDefault(),M())};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[M]),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:O1,onClick:R,children:e("toolbar.new")}),p.jsx(Qs,{icon:wz,onClick:k,children:e("toolbar.open")}),p.jsx(Qs,{icon:Iz,variant:"primary",onClick:M,children:e("toolbar.save")}),p.jsx(Qs,{icon:D1,onClick:_,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:!l,children:e("toolbar.undo")}),p.jsx(Qs,{icon:Pz,onClick:()=>t.current?.redo(),disabled:!d,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:S?.kind==="path"?S.path:E??"no file",children:[p.jsx("span",{className:"truncate",children:E??"Untitled.json"}),p.jsx("span",{className:"shrink-0 w-2 text-center text-foreground","aria-hidden":!0,children:o?"•":""})]}),p.jsx(Tq,{theme:g,onToggle:()=>h(j=>j==="dark"?"light":"dark")}),p.jsx(QZ,{language:v,onChange:x}),p.jsx("input",{ref:n,type:"file",accept:"application/json,.json",className:"hidden","aria-label":e("toolbar.open"),onChange:P})]}),p.jsx("main",{className:"flex-1 min-h-0",children:p.jsx(kq,{ref:t,models:JZ,language:v,onChange:$,onHistoryChange:D,onError:H})})]})}const nR=document.getElementById("root");if(!nR)throw new Error("#root not found");HI.createRoot(nR).render(p.jsx(m.StrictMode,{children:p.jsx(sQ,{})}));
|
|
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},dX=hT,fX=gT,NT=mT,kT=yT,TT=ST,PT=ET,RT=xT,IT=bT;const pX=dX,hX=fX,_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(hX,{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 gX=["int","float","bool","string"];function mX({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(wr,{value:e.dataType,onValueChange:l=>t({dataType:l}),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(br,{})}),p.jsx(qn,{children:gX.map(l=>p.jsx(sn,{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 Gb({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(mX,{port:g,onUpdate:v=>l(h,v),onRemove:()=>c(h),errors:d?.(g),children:f?.(g,h)},g.uid))}),p.jsx(os,{onClick:i,children:n})]})}const yX=e=>({expression:"",references:[],dataType:e});function vX(e){const t=Zm(e.id);t&&GB(t,e.arguments)}function wo(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&&vX(r)}function xX(){const e=an(),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})),Qe(e),Zd(),n}function wX(e){ue.getState().setFunctions(n=>{const{[e]:r,...o}=n;return o}),XB(e);const t=ue.getState().selection;t.kind==="function"&&t.id===e&&ue.getState().clearSelection()}function bX(e,t){wo(e,n=>({...n,name:t}),!1)}function SX(e){wo(e,t=>({...t,arguments:[...t.arguments,g1({name:`input${t.arguments.length+1}`,dataType:"string"})]}),!0)}function CX(e,t,n){wo(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 EX(e,t){wo(e,n=>({...n,arguments:n.arguments.filter((r,o)=>o!==t)}),!0)}function NX(e){wo(e,t=>{const n="string";return{...t,outputs:[...t.outputs,{uid:an(),name:`output${t.outputs.length+1}`,dataType:n,expression:yX(n)}]}},!0)}function kX(e,t,n){wo(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 TX(e,t){wo(e,n=>({...n,outputs:n.outputs.filter((r,o)=>o!==t)}),!0)}function PX(e,t,n){wo(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 RX=({func:e,onClose:t})=>{const{t:n}=Xe(),r=ue(S=>On(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),bX(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(Ot,{}),p.jsx(Gb,{title:n("inputs"),description:n("functionInputsDesc"),addLabel:n("add"),emptyText:n("noInputs"),ports:i,onAdd:()=>SX(o),onUpdate:(S,w)=>CX(o,S,w),onRemove:S=>EX(o,S)}),p.jsx(Ot,{}),p.jsx(Gb,{title:n("outputs"),description:n("functionOutputsDesc"),addLabel:n("add"),emptyText:n("noOutputs"),ports:l,onAdd:()=>NX(o),onUpdate:(S,w)=>kX(o,S,w),onRemove:S=>TX(o,S),errorsFor:S=>x.get(S.uid)??[],renderExtra:(S,w)=>p.jsx(fT,{value:S.expression,onChange:E=>PX(o,w,E),expressionType:S.dataType,availableVariables:h,placeholder:`${n("expressionFor")} ${S.name}...`})})]}),!r&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:()=>d(!0),children:n("deleteFunction")})]})]}),p.jsx(pX,{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:()=>{wX(o),d(!1),t()},children:n("delete")})]})]})})]})},IX=({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=>Mw(e.id,{label:f}),description:o?.description??"",belowLabel:d,parameters:o?.parameters??[],getValue:f=>e.arguments[f.id],allArguments:{...e.arguments},onParamChange:(f,g)=>Mw(e.id,{arguments:{[f]:g}}),diagnostics:i,translationPrefix:"memory",deleteLabel:n("deleteMemory","Delete memory"),onDelete:()=>xH(e.id),onClose:t})},_X=({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=>Dw(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)=>Dw(e.id,{arguments:{[l]:c}}),diagnostics:o,translationPrefix:"models",deleteLabel:n("deleteModel","Delete model"),onDelete:()=>EH(e.id),onClose:t})};var Sf="Checkbox",[AX]=Lt(Sf),[MX,_y]=AX(Sf);function DX(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]=ln({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:co(o)?!1:o,isFormControl:k,bubbleInput:E,setBubbleInput:b};return p.jsx(MX,{scope:t,...P,children:jX(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(Ne.button,{type:"button",role:"checkbox","aria-checked":co(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=>co(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(DX,{__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",BT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=_y(VT,n);return p.jsx(Pt,{present:r||co(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{"data-state":UT(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});BT.displayName=VT;var HT="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(HT,e),S=De(n,x),w=sy(i),E=Vm(r);m.useEffect(()=>{const N=v;if(!N)return;const k=window.HTMLInputElement.prototype,M=Object.getOwnPropertyDescriptor(k,"checked").set,R=!o.current;if(w!==i&&M){const _=new Event("click",{bubbles:R});N.indeterminate=co(i),M.call(N,co(i)?!1:i),N.dispatchEvent(_)}},[v,w,i,o]);const b=m.useRef(co(i)?!1:i);return p.jsx(Ne.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=HT;function jX(e){return typeof e=="function"}function co(e){return e==="indeterminate"}function UT(e){return co(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(BT,{className:Ce("flex items-center justify-center text-current"),children:p.jsx(M1,{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(Qo(i));return}const o=$t.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 Yb(e,t,n){if(!XT(e,t))return null;const r=an(),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[Qo(w)]={expression:"",references:[],dataType:w.dataType};for(const w of x.functionInfo.returns)o[Qo(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 Xb(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 OX(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 qb(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=OX(i,l,c);return o(f=>YE({...t,type:d},f)),d}function $X(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 Zb(e,t){const{setEdges:n}=e.getState(),r=new Set(t);n(o=>o.filter(i=>!r.has(i.id)))}function LX(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=an();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:an(),source:g.get(S.source),target:g.get(S.target),data:S.data?{...S.data}:S.data};if(w.data?.prompt&&Jo(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(Jo(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=>Jo(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=$t.getByType(e)?.category??"Uncategorized";switch(t){case xe.Trigger:case xe.Tool:case xe.AI:return t;default:return"Standard"}}function FX(e,t){const n=e.arguments,r={};for(const o of t.arguments){const i=Qo(o),l=n[i];r[i]=l?{...l,dataType:o.dataType}:{expression:"",references:[],dataType:o.dataType}}for(const o of t.returns){const i=Qo(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,FX(l,c)),n++))}}n>0&&Kt({title:gr.t("functionCallNodesMigrated"),description:gr.t("functionCallNodesMigratedDesc",{count:n})})}let Qb=ue.getState().functions;ue.subscribe(e=>{e.functions!==Qb&&(Qb=e.functions,JT())});const zX=({canvasId:e,selectedNode:t,onNodeUpdate:n,onNodeDelete:r,onClose:o,onOpenTest:i,getNodeDef:l})=>{const{t:c}=Xe(),d=ue(H=>On(H.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=Qe(e)(H=>H.edges),P=m.useMemo(()=>tl(t.id,t,k),[t,k]),M=Ye(H=>H.byNodeId[t.id]),R=Ry(M);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 _=Sd(t),$=b.parameters.filter(H=>kr(H,_,P)),D=(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:H=>{g(H.target.value),n(t.id,{label:H.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,{}),$.length>0&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx("div",{className:`space-y-3 ${d?"pointer-events-none opacity-60":""}`,children:$.map(H=>p.jsx(Py,{canvasId:e,parameter:H,value:_[H.id],allArguments:_,onChange:j=>n(t.id,{arguments:{[H.id]:j}}),errors:R.get(H.id),translationPrefix:`nodes.${t.type}`},H.id))})]}),!d&&E&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),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&&D&&!P&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(WX,{canvasId:e,node:t,nodeDefinition:b,onNodeUpdate:n,nodeDiags:M})]}),!d&&t.type==="Agent"&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(gt,{variant:"outline",className:"w-full",onClick:()=>i(t.id),children:c("testAgent")})]}),!d&&!N&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(zi,{onClick:()=>r(t.id),children:c("deleteNode")})]})]})})},VX=["int","float","bool","string"],BX={int:"int",float:"float",bool:"bool",string:"string"};function HX(e,t){return`${e}[${t}]`}function Jb(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 WX({canvasId:e,node:t,nodeDefinition:n,onNodeUpdate:r,nodeDiags:o}){const{t:i}=Xe(),{list:l}=Li(e),c=m.useMemo(()=>C1(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=S1(t,b)??{active:!0,mode:"emit",name:N.name},M=x(N.dataType),R=g.get(b),_=!!R?.length,$=P.active,D=j=>{j!==$&&h(b,{...P,active:j})},H=j=>{j!==P.mode&&(j==="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 ${_?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(KT,{checked:$,onCheckedChange:j=>D(j===!0),"aria-label":i("outputBinding.enable","Enable output"),className:"shrink-0"}),p.jsx("span",{className:`text-xs font-medium flex-1 truncate ${$?"":"opacity-50"}`,children:k}),p.jsx("span",{className:`text-xs text-muted-foreground ${$?"":"opacity-50"}`,children:BX[N.dataType]})]}),p.jsxs("div",{className:$?"":"opacity-50",children:[p.jsxs("div",{className:`flex items-center gap-2 ${$?"":"pointer-events-none"}`,children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:j=>j&&H(j),className:"gap-0",children:[p.jsx(Go,{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(es,{className:"w-3.5 h-3.5"})}),p.jsx(Go,{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:!$,onChange:j=>h(b,{active:P.active,mode:"emit",name:j.target.value})}):M.length>0?p.jsxs(wr,{value:P.target.srcId?yr(P.target):"",onValueChange:j=>{const U=l.find(Y=>oo(Y)===j);U&&h(b,{active:P.active,mode:"assign",target:Jb(U)})},disabled:!$,children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:M.map(j=>p.jsx(sn,{value:oo(j),children:j.name},oo(j)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),_&&p.jsx("div",{className:"space-y-0.5",children:R.map((j,U)=>p.jsx("p",{className:"text-xs text-destructive",children:j},U))})]})]},b)},w=(b,N,k)=>{const P=N[k];if(!P)return null;const M=x(P.dataType),R=HX(b,k),_=g.get(R),$=!!_?.length,D=I=>v(b,N.map((B,A)=>A===k?I:B)),H=()=>v(b,N.filter((I,B)=>B!==k)),j=I=>{P.mode!==I&&D(I==="emit"?{mode:"emit",uid:an(),name:P.name,dataType:P.dataType}:{mode:"assign",name:P.name,dataType:P.dataType,target:{srcId:"",varId:""}})},U=I=>D({...P,name:I}),Y=I=>D({...P,dataType:I});return p.jsxs("div",{className:`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${$?"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:H,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:I=>U(I.target.value)}),p.jsxs(wr,{value:P.dataType,onValueChange:I=>Y(I),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(br,{})}),p.jsx(qn,{children:VX.map(I=>p.jsx(sn,{value:I,children:I},I))})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:I=>I&&j(I),className:"gap-0",children:[p.jsx(Go,{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(es,{className:"w-3.5 h-3.5"})}),p.jsx(Go,{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")}):M.length>0?p.jsxs(wr,{value:P.target.srcId?yr(P.target):"",onValueChange:I=>{const B=l.find(A=>oo(A)===I);B&&D({...P,target:Jb(B)})},children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(br,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:M.map(I=>p.jsx(sn,{value:oo(I),children:I.name},oo(I)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),$&&p.jsx("div",{className:"space-y-0.5",children:_.map((I,B)=>p.jsx("p",{className:"text-xs text-destructive",children:I},B))})]},`${b}-${P.mode==="emit"?P.uid:`assign-${k}`}`)},E=(b,N)=>{const k={mode:"emit",uid:an(),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(os,{onClick:()=>E(b.id,N),children:i("addOutput",{label:b.label,defaultValue:`Add ${b.label.toLowerCase()}`})})]},b.id)})]})]})}const UX=["int","float","bool","string"],KX=({canvasId:e,variable:t,onClose:n})=>{const{t:r}=Xe(),o=ue(f=>On(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(wr,{value:t.initialValue!=null?String(t.initialValue):"false",onValueChange:f=>Ba(e,t.uid,{initialValue:f==="true"}),children:[p.jsx(Xn,{className:"h-8 text-sm",children:p.jsx(br,{})}),p.jsxs(qn,{children:[p.jsx(sn,{value:"false",children:"false"}),p.jsx(sn,{value:"true",children:"true"})]})]});case"string":return p.jsx(Mt,{className:"h-8 text-sm",value:t.initialValue??"",onChange:f=>Ba(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);Ba(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),Ba(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(Ot,{}),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(wr,{value:t.dataType,onValueChange:f=>PH(e,t.uid,f),children:[p.jsx(Xn,{className:"h-8 text-sm",children:p.jsx(br,{})}),p.jsx(qn,{children:UX.map(f=>p.jsx(sn,{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(Ot,{}),p.jsx(zi,{onClick:()=>RH(e,t.uid),children:r("deleteVariable","Delete variable")})]})]})})},GX=({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(Y=>Y.selection),v=ue(Y=>Y.clearSelection),x=ue(Y=>Y.channels),S=ue(Y=>Y.memory),w=ue(Y=>Y.models),E=ue(Y=>Y.functions),b=Qe(e),N=b(m.useCallback(Y=>h.kind!=="graph"||h.nodeIds.length!==1?null:Y.nodes.find(B=>B.id===h.nodeIds[0])?.data??null,[h])),k=b(m.useCallback(Y=>{if(h.kind!=="variable")return null;const I=Y.variables[Pi(h.uid)];return I&&I.kind==="declared"?I:null},[h])),P=b(m.useCallback(Y=>h.kind!=="graph"||h.edgeIds.length!==1||h.nodeIds.length>0?null:Y.edges.find(I=>I.id===h.edgeIds[0])??null,[h])),M=P?{id:P.id,source:P.source,type:P.type??"control",data:P.data??{}}:null,R=b(m.useCallback(Y=>M?Y.edges.filter(I=>I.source===M.source&&cm(I.type)).length:0,[M?.source])),_=m.useMemo(()=>h.kind==="channel"?Object.values(x).find(Y=>Y.id===h.id)??null:null,[h,x]),$=m.useMemo(()=>h.kind==="memory"?Object.values(S).find(Y=>Y.id===h.id)??null:null,[h,S]),D=m.useMemo(()=>h.kind==="model"?Object.values(w).find(Y=>Y.id===h.id)??null:null,[h,w]),H=m.useMemo(()=>h.kind==="function"?E[h.id]??null:null,[h,E]),j=m.useCallback(Y=>r(Y)?.category,[r]),U=m.useCallback(Y=>f?.(Y),[f]);return n?null:t?N?p.jsx(no,{bg:"bg-background",pad:!0,children:p.jsx(XY,{canvasId:e,onStep:g??(()=>{}),getNodeCategory:j})}):null:N?p.jsx(no,{children:p.jsx(zX,{canvasId:e,selectedNode:N,onNodeUpdate:o,onNodeDelete:i,onClose:d,onOpenTest:U,getNodeDef:r})}):M?p.jsx(no,{children:p.jsx(QY,{canvasId:e,edgeId:M.id,edgeType:M.type,edgeData:M.data,sourceControlEdgeCount:R,onEdgeUpdate:l,onEdgeDelete:c,onClose:d})}):k?p.jsx(no,{children:p.jsx(KX,{canvasId:e,variable:k,onClose:v})}):_?p.jsx(no,{children:p.jsx(YY,{channel:_,onClose:v})}):$?p.jsx(no,{children:p.jsx(IX,{memory:$,onClose:v})}):D?p.jsx(no,{children:p.jsx(_X,{model:D,onClose:v})}):H?p.jsx(no,{children:p.jsx(RX,{func:H,onClose:v})}):null},no=({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}),YX=(e=He)=>{const t=Qe(e);return{undo:t.undo,redo:t.redo,takeCheckpoint:t.takeCheckpoint,withCheckpoint:t.withCheckpoint,clearHistory:t.clearHistory,canUndo:t.canUndo,canRedo:t.canRedo}},e1={current:null},XX=(e=He,t=!1)=>{const n=Qe(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(()=>Yb(n,N,k))??null,[n,c]),f=m.useCallback((N,k)=>{c(()=>qT(n,N,k))},[n,c]),g=m.useCallback(N=>{c(()=>Xb(n,N,l))},[n,l,c]),h=m.useCallback(N=>c(()=>qb(n,N))??!1,[n,c]),v=m.useCallback((N,k)=>{c(()=>$X(n,N,k))},[n,c]),x=m.useCallback(N=>{c(()=>Zb(n,N))},[n,c]),S=m.useCallback((N,k)=>{N.length===0&&k.length===0||c(()=>{for(const P of N)Xb(n,P,l);k.length>0&&Zb(n,k)})},[n,l,c]),w=m.useCallback(N=>{if(N.length===0)return;const k=new Set(N),P=r.filter(R=>k.has(R.id)).map(R=>JSON.parse(JSON.stringify(R))),M=o.filter(R=>k.has(R.source)&&k.has(R.target)).map(R=>JSON.parse(JSON.stringify(R)));e1.current={nodes:P,edges:M}},[r,o]),E=m.useCallback(N=>{const k=e1.current;if(k)return c(()=>LX(n,k,N,l))},[n,l,c]),b=m.useCallback((N,k,P)=>c(()=>{const M=Yb(n,N,k);return M==null?null:(qb(n,{...P,target:M}),M)})??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}},qX=()=>{const{t:e}=Xe(),t=ss(o=>o.console),n=ss(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(ZX,{entry:o},o.id))})})]})};function ZX({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 QX=({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=On(g),v=g.type==="debug",{nodeDefinitions:x,getNodeDefinition:S,getAllCategories:w}=ey(),E=XX(f,h),{undo:b,redo:N,takeCheckpoint:k,canUndo:P,canRedo:M}=YX(f),R=ue(K=>K.selection),_=ue(K=>K.selectGraph),$=ue(K=>K.syncSelectionFromRF),D=ue(K=>K.clearSelection),H=ue(K=>K.activeSidebarTab),j=ue(K=>K.setActiveSidebarTab);m.useEffect(()=>{const K=H==="debug-context";v&&!K?j("debug-context"):!v&&K&&j("nodes")},[v,H,j]);const[U,Y]=m.useState(!1),I=m.useRef(null),B=m.useCallback(K=>_([K],[]),[_]),A=m.useCallback(K=>_([],[K]),[_]),V=m.useCallback((K,re)=>{const ce=re??I.current?.(),me=E.addNode(K,ce);return me==null&&Kt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),me},[E]),F=m.useCallback(K=>{const re=E.onConnect(K);if(re&&re!=="control"&&re!=="tool"){const{edges:ce}=Qe(f).getState(),me=ce.find(ge=>ge.source===K.source&&ge.target===K.target&&ge.sourceHandle===K.sourceHandle&&ge.targetHandle===K.targetHandle);me&&A(me.id)}},[E,f,A]),W=m.useCallback((K,re,ce)=>{const me=E.addNodeAndConnect(K,re,ce);return me==null&&Kt({title:`Only one ${K.label} node allowed per canvas`,variant:"destructive"}),me},[E]),q=m.useCallback(({nodes:K,edges:re})=>{$(K.map(ce=>ce.id),re.map(ce=>ce.id))},[$]),L=m.useCallback(K=>{E.deleteEdges([K]),D()},[E,D]),z=m.useCallback(()=>{k()},[k]),X=m.useCallback(()=>{const K=ue.getState().selection,re=K.kind==="graph"?K.nodeIds:[],ce=K.kind==="graph"?K.edgeIds:[];E.deleteSelected(re,ce),D()},[E,D]),Q=m.useCallback(K=>{const re=E.pasteSelection(K);if(re?.skippedLabels.length)for(const ce of re.skippedLabels)Kt({title:`Only one ${ce} node allowed per canvas`,variant:"destructive"});return re},[E]),te=K=>{const re=K.target;if(!(re?.tagName==="INPUT"||re?.tagName==="TEXTAREA"||re?.isContentEditable)){if(h){K.key==="Escape"&&D();return}if((K.ctrlKey||K.metaKey)&&K.key==="z"&&!K.shiftKey){K.preventDefault(),P()&&(D(),b());return}if((K.ctrlKey||K.metaKey)&&(K.key==="y"||K.key==="z"&&K.shiftKey)){K.preventDefault(),M()&&(D(),N());return}if((K.ctrlKey||K.metaKey)&&K.key==="c"){R.kind==="graph"&&R.nodeIds.length>0&&(K.preventDefault(),E.copySelection(R.nodeIds));return}if((K.ctrlKey||K.metaKey)&&K.key==="v"){K.preventDefault(),Q();return}(K.key==="Delete"||K.key==="Backspace")&&X(),K.key==="Escape"&&D()}},ne=f!==He,Z=p.jsxs("div",{className:"flex flex-col h-full min-w-0",children:[p.jsx(HH,{tabs:r,activeTabId:f,onTabChange:o,onTabClose:i,onTabReorder:l}),p.jsx("div",{className:"flex-1 relative",children:p.jsx(OG,{canvasId:f,viewportCenterRef:I,nodeDefinitions:x,onConnect:F,onAddNode:V,onAddNodeAndConnect:W,onSelectionChange:q,onPaneClick:D,onNodeDragStart:z,setSelectionDrag:Y},f)})]});return p.jsx("div",{className:"h-full bg-canvas-bg flex flex-col outline-none",tabIndex:-1,onKeyDown:te,children:p.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[p.jsx(BH,{canvasId:f,activeTab:H,onTabChange:j,onAddNode:V,nodeDefinitions:x,getAllCategories:w,onSelectNode:B,onSelectEdge:A,isFunctionCanvas:ne,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:Z}),p.jsx(L4,{withHandle:!0}),p.jsx(hw,{defaultSize:25,minSize:10,children:p.jsx(qX,{})})]}):Z}),p.jsx(GX,{canvasId:f,isDebugMode:v,selectionDrag:U,getNodeDef:S,onNodeUpdate:E.updateNode,onNodeDelete:E.deleteNode,onEdgeUpdate:E.updateEdge,onEdgeDelete:L,onClearSelection:D,onTestNode:c,onDebugStep:d})]})})};var My="ToastProvider",[Dy,JX,eq]=yf("Toast"),[eP]=Lt("Toast",[eq]),[tq,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(tq,{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",nq=["F8"],om="toast.viewportPause",sm="toast.viewportResume",rP=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=nq,label:o="Notifications ({hotkey})",...i}=e,l=Cf(nP,n),c=JX(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 R=new CustomEvent(om);b.dispatchEvent(R),l.isClosePausedRef.current=!0}},k=()=>{if(l.isClosePausedRef.current){const R=new CustomEvent(sm);b.dispatchEvent(R),l.isClosePausedRef.current=!1}},P=R=>{!E.contains(R.relatedTarget)&&k()},M=()=>{E.contains(document.activeElement)||k()};return E.addEventListener("focusin",N),E.addEventListener("focusout",P),E.addEventListener("pointermove",N),E.addEventListener("pointerleave",M),window.addEventListener("blur",N),window.addEventListener("focus",k),()=>{E.removeEventListener("focusin",N),E.removeEventListener("focusout",P),E.removeEventListener("pointermove",N),E.removeEventListener("pointerleave",M),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,M=[P,...gq(P)];return E==="forwards"?M:M.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 M=document.activeElement,R=N.shiftKey;if(N.target===E&&R){f.current?.focus();return}const D=w({tabbingDirection:R?"backwards":"forwards"}),H=D.findIndex(j=>j===M);fg(D.slice(H+1))?N.preventDefault():R?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(Ne.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",rq="toast.swipeStart",oq="toast.swipeMove",sq="toast.swipeCancel",iq="toast.swipeEnd",sP=m.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...l}=e,[c,d]=ln({prop:r,defaultProp:o??!0,onChange:i,caller:Ll});return p.jsx(Pt,{present:n||c,children:p.jsx(cq,{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[aq,lq]=eP(Ll,{onClose(){}}),cq=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,I=>b(I)),k=m.useRef(null),P=m.useRef(null),M=o||w.duration,R=m.useRef(0),_=m.useRef(M),$=m.useRef(0),{onToastAdd:D,onToastRemove:H}=w,j=pt(()=>{E?.contains(document.activeElement)&&w.viewport?.focus(),l()}),U=m.useCallback(I=>{!I||I===1/0||(window.clearTimeout($.current),R.current=new Date().getTime(),$.current=window.setTimeout(j,I))},[j]);m.useEffect(()=>{const I=w.viewport;if(I){const B=()=>{U(_.current),f?.()},A=()=>{const V=new Date().getTime()-R.current;_.current=_.current-V,window.clearTimeout($.current),d?.()};return I.addEventListener(om,A),I.addEventListener(sm,B),()=>{I.removeEventListener(om,A),I.removeEventListener(sm,B)}}},[w.viewport,M,d,f,U]),m.useEffect(()=>{i&&!w.isClosePausedRef.current&&U(M)},[i,M,w.isClosePausedRef,U]),m.useEffect(()=>(D(),()=>H()),[D,H]);const Y=m.useMemo(()=>E?fP(E):null,[E]);return w.viewport?p.jsxs(p.Fragment,{children:[Y&&p.jsx(uq,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:Y}),p.jsx(aq,{scope:n,onClose:j,children:ps.createPortal(p.jsx(Dy.ItemSlot,{scope:n,children:p.jsx(G3,{asChild:!0,onEscapeKeyDown:ve(c,()=>{w.isFocusedToastEscapeKeyDownRef.current||j(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(Ne.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,I=>{I.key==="Escape"&&(c?.(I.nativeEvent),I.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:ve(e.onPointerDown,I=>{I.button===0&&(k.current={x:I.clientX,y:I.clientY})}),onPointerMove:ve(e.onPointerMove,I=>{if(!k.current)return;const B=I.clientX-k.current.x,A=I.clientY-k.current.y,V=!!P.current,F=["left","right"].includes(w.swipeDirection),W=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,q=F?W(0,B):0,L=F?0:W(0,A),z=I.pointerType==="touch"?10:2,X={x:q,y:L},Q={originalEvent:I,delta:X};V?(P.current=X,Ru(oq,h,Q,{discrete:!1})):t1(X,w.swipeDirection,z)?(P.current=X,Ru(rq,g,Q,{discrete:!1}),I.target.setPointerCapture(I.pointerId)):(Math.abs(B)>z||Math.abs(A)>z)&&(k.current=null)}),onPointerUp:ve(e.onPointerUp,I=>{const B=P.current,A=I.target;if(A.hasPointerCapture(I.pointerId)&&A.releasePointerCapture(I.pointerId),P.current=null,k.current=null,B){const V=I.currentTarget,F={originalEvent:I,delta:B};t1(B,w.swipeDirection,w.swipeThreshold)?Ru(iq,x,F,{discrete:!0}):Ru(sq,v,F,{discrete:!0}),V.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),uq=e=>{const{__scopeToast:t,children:n,...r}=e,o=Cf(Ll,t),[i,l]=m.useState(!1),[c,d]=m.useState(!1);return pq(()=>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]})})})},dq="ToastTitle",iP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});iP.displayName=dq;var fq="ToastDescription",aP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});aP.displayName=fq;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=lq(uP,n);return p.jsx(dP,{asChild:!0,children:p.jsx(Ne.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(Ne.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),hq(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 t1=(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 pq(e=()=>{}){const t=pt(e);xt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function hq(e){return e.nodeType===e.ELEMENT_NODE}function gq(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 mq=tP,pP=rP,hP=sP,gP=iP,mP=aP,yP=cP,vP=jy;const yq=mq,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 vq=mo("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(vq({variant:t}),e),...n}));wP.displayName=hP.displayName;const xq=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}));xq.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 wq(){const{toasts:e}=cz();return p.jsxs(yq,{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 bq=()=>{const[e,t]=m.useState([{id:He,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===He)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!==He&&!i[n]&&r(He)},[i,n,r]);const l=m.useCallback(w=>{w!==He&&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!==He&&t(E=>{const b=E.filter(N=>N.id!==w);return w===n&&r(He),b})},[n,r]),f=m.useCallback(w=>{w!==He&&t(E=>{const b=E.filter(N=>N.id!==w);return w===n&&r(He),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:He,label:"Main"}]),r(He)},[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===He}};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 Sq(){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 Cq(){const e=HN();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 Eq=({onOpenTab:e})=>{const{functionsList:t,getFunction:n}=Qd(),r=ue(l=>l.selectFunction),o=m.useCallback(l=>{const c=n(l);c&&(Qe(l),e(l,c.name),r(l))},[n,e,r]),i=m.useCallback(()=>{const l=xX();return e(l.id,l.name),r(l.id),l.id},[e,r]);return{functions:t,openFunction:o,createFunction:i}};function Nq(){const e=m.useCallback(r=>{const o=KB(HB(r));Aw();for(const[d,f]of Object.entries(o.canvases)){const g=Qe(d),h=f.nodes.map(x=>({id:x.id,type:QT(x.type),position:x.position,data:x})),v=f.edges.map(x=>({id:x.id,type:x.type,source:x.source,sourceHandle:x.sourceHandle,target:x.target,targetHandle:x.targetHandle,...x.data?{data:x.data}:{}}));g.getState().initialize(h,v),g.getState().setVariables(()=>f.variables)}const{channels:i,memory:l,models:c}=o;ue.getState().setChannels(()=>i),ue.getState().setMemory(()=>l),ue.getState().setModels(()=>c),ue.getState().setFunctions(()=>o.functions),Zd()},[]),t=m.useCallback(()=>UB(EP()),[]),n=m.useCallback(()=>{Aw();const r=ue.getState();r.setActiveCanvas(He),r.setChannels(o=>Object.keys(o).length?{}:o),r.setMemory(o=>Object.keys(o).length?{}:o),r.setModels(o=>Object.keys(o).length?{}:o),r.setFunctions(o=>Object.keys(o).length?{}:o),r.clearSelection()},[]);return{exportProject:t,importProject:e,clearProject:n}}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}}const kq=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&&gr.language!==l&&gr.changeLanguage(l)},[l]);const{importProject:v,exportProject:x,clearProject:S}=Nq();Cq(),pg({selectItems:D=>D.channels,validate:T1,getStored:D=>D.byChannelId,set:(D,H,j)=>D.setChannelDiagnostics(H,j),clear:(D,H)=>D.clearChannelDiagnostics(H)}),pg({selectItems:D=>D.memory,validate:P1,getStored:D=>D.byMemoryId,set:(D,H,j)=>D.setMemoryDiagnostics(H,j),clear:(D,H)=>D.clearMemoryDiagnostics(H)}),pg({selectItems:D=>D.models,validate:R1,getStored:D=>D.byModelId,set:(D,H,j)=>D.setModelDiagnostics(H,j),clear:(D,H)=>D.clearModelDiagnostics(H)}),Sq(),m.useEffect(()=>{ue.getState().setAvailableModels(i??[])},[i]);const w=bq(),E=Eq({onOpenTab:w.openTab}),[b,N]=m.useState(null),k=m.useCallback(()=>{const D=VA(EP());D.totalErrors===0&&D.totalWarnings===0?Kt({title:gr.t("validationPassed")}):N(D)},[]),P=m.useCallback(D=>{const H=ue.getState();D.channelId?(H.setActiveSidebarTab("channels"),H.selectChannel(D.channelId)):D.memoryId?(H.setActiveSidebarTab("memory"),H.selectMemory(D.memoryId)):D.modelId?(H.setActiveSidebarTab("models"),H.selectModel(D.modelId)):D.canvasId&&(D.canvasId===He?H.setActiveCanvas(He):E.openFunction(D.canvasId),D.nodeId?H.selectGraph([D.nodeId],[]):D.edgeId&&H.selectGraph([],[D.edgeId])),N(null)},[E]),M=m.useRef(!1);m.useEffect(()=>{if(!M.current){M.current=!0;try{o&&ue.getState().setBuilderMode(o),r?v(r):S()}catch(D){h?.(D instanceof Error?D:new Error(String(D)))}}},[]);const R=m.useRef(f),_=m.useRef(g);R.current=f,_.current=g;const $=m.useRef(!1);return m.useEffect(()=>{const D=[],H=new WeakSet;function j(A){if(H.has(A))return;H.add(A);let V=A.getState().mutationCount;const F=A.subscribe(W=>{W.mutationCount!==V&&(V=W.mutationCount,$.current||R.current?.())});D.push(F)}function U(){for(const A of Object.values(Qm()))j(A)}U();const Y=_w(()=>{U()});D.push(Y);let I=ue.getState().mutationCount;const B=ue.subscribe(A=>{A.mutationCount!==I&&(I=A.mutationCount,$.current||R.current?.())});return D.push(B),()=>{for(const A of D)A()}},[]),m.useEffect(()=>{let D=null,H=null,j=null;const U=()=>{const V=Qe(ue.getState().activeCanvasId),F=V.canUndo(),W=V.canRedo();F===D&&W===H||(D=F,H=W,_.current?.({canUndo:F,canRedo:W}))},Y=()=>{j?.(),j=Qe(ue.getState().activeCanvasId).subscribe(U),U()};Y();let I=ue.getState().activeCanvasId;const B=ue.subscribe(V=>{V.activeCanvasId!==I&&(I=V.activeCanvasId,Y())}),A=_w(Y);return()=>{j?.(),B(),A()}},[]),m.useImperativeHandle(n,()=>({loadWorkflow:D=>{$.current=!0;try{v(D)}catch(H){h?.(H instanceof Error?H:new Error(String(H)))}finally{$.current=!1}},exportWorkflow:()=>x(),clear:()=>{$.current=!0;try{S()}finally{$.current=!1}},setMode:D=>ue.getState().setBuilderMode(D),getMode:()=>ue.getState().builderMode,validate:k,undo:()=>Qe(ue.getState().activeCanvasId).undo(),redo:()=>Qe(ue.getState().activeCanvasId).redo(),setDebugPhase:D=>ss.getState().setPhase(D)}),[v,x,S,h,k]),p.jsx(T_,{i18n:gr,children:p.jsx(FC,{delayDuration:300,children:p.jsxs("div",{className:"fh-builder h-full w-full bg-background text-foreground font-sans antialiased",children:[p.jsx(QX,{functions:E.functions,onOpenFunction:E.openFunction,onCreateFunction:E.createFunction,canvasTabs:w.tabs,onCanvasTabChange:w.setActiveTabId,onCanvasTabClose:w.closeTab,onCanvasTabReorder:w.reorderTabs,onTestNode:c,onDebugStep:d}),p.jsx(wq,{}),b&&p.jsx(c4,{open:!0,onOpenChange:D=>{D||N(null)},validation:b,onSelectDiagnostic:P})]})})})});function Tq({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 Pq(e){const t=Rq(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(_q);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 Rq(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=Mq(o),c=Aq(i,o.props);return o.type!==m.Fragment&&(c.ref=r?Yt(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 Iq=Symbol("radix.slottable");function _q(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Iq}function Aq(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 Mq(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"," "],Dq=["ArrowDown","PageUp","Home"],NP=["ArrowUp","PageDown","End"],jq=[...Dq,...NP],Oq={ltr:[...am,"ArrowRight"],rtl:[...am,"ArrowLeft"]},$q={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fl="Menu",[vl,Lq,Fq]=yf(Fl),[hs,kP]=Lt(Fl,[Fq,$i,bf]),Ef=$i(),TP=bf(),[zq,gs]=hs(Fl),[Vq,zl]=hs(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(zq,{scope:t,open:n,onOpenChange:h,content:d,onContentChange:f,children:p.jsx(Vq,{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",[Hq,RP]=hs($y,{forceMount:void 0}),IP=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=gs($y,t);return p.jsx(Hq,{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 yn="MenuContent",[Wq,Ly]=hs(yn),_P=m.forwardRef((e,t)=>{const n=RP(yn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=gs(yn,e.__scopeMenu),l=zl(yn,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(Uq,{...o,ref:t}):p.jsx(Kq,{...o,ref:t})})})})}),Uq=m.forwardRef((e,t)=>{const n=gs(yn,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)})}),Kq=m.forwardRef((e,t)=>{const n=gs(yn,e.__scopeMenu);return p.jsx(Fy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Gq=Pq("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=gs(yn,n),b=zl(yn,n),N=Ef(n),k=TP(n),P=Lq(n),[M,R]=m.useState(null),_=m.useRef(null),$=De(t,_,E.onContentChange),D=m.useRef(0),H=m.useRef(""),j=m.useRef(0),U=m.useRef(null),Y=m.useRef("right"),I=m.useRef(0),B=S?Ad:m.Fragment,A=S?{as:Gq,allowPinchZoom:!0}:void 0,V=W=>{const q=H.current+W,L=P().filter(Z=>!Z.disabled),z=document.activeElement,X=L.find(Z=>Z.ref.current===z)?.textValue,Q=L.map(Z=>Z.textValue),te=sZ(Q,q,X),ne=L.find(Z=>Z.textValue===te)?.ref.current;(function Z(K){H.current=K,window.clearTimeout(D.current),K!==""&&(D.current=window.setTimeout(()=>Z(""),1e3))})(q),ne&&setTimeout(()=>ne.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),mm();const F=m.useCallback(W=>Y.current===U.current?.side&&aZ(W,U.current?.area),[]);return p.jsx(Wq,{scope:n,searchRef:H,onItemEnter:m.useCallback(W=>{F(W)&&W.preventDefault()},[F]),onItemLeave:m.useCallback(W=>{F(W)||(_.current?.focus(),R(null))},[F]),onTriggerLeave:m.useCallback(W=>{F(W)&&W.preventDefault()},[F]),pointerGraceTimerRef:j,onPointerGraceIntentChange:m.useCallback(W=>{U.current=W},[]),children:p.jsx(B,{...A,children:p.jsx(Id,{asChild:!0,trapped:o,onMountAutoFocus:ve(i,W=>{W.preventDefault(),_.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:M,onCurrentTabStopIdChange:R,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:$,style:{outline:"none",...w.style},onKeyDown:ve(w.onKeyDown,W=>{const L=W.target.closest("[data-radix-menu-content]")===W.currentTarget,z=W.ctrlKey||W.altKey||W.metaKey,X=W.key.length===1;L&&(W.key==="Tab"&&W.preventDefault(),!z&&X&&V(W.key));const Q=_.current;if(W.target!==Q||!jq.includes(W.key))return;W.preventDefault();const ne=P().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);NP.includes(W.key)&&ne.reverse(),rZ(ne)}),onBlur:ve(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(D.current),H.current="")}),onPointerMove:ve(e.onPointerMove,xl(W=>{const q=W.target,L=I.current!==W.clientX;if(W.currentTarget.contains(q)&&L){const z=W.clientX>I.current?"right":"left";Y.current=z,I.current=W.clientX}}))})})})})})})});_P.displayName=yn;var Yq="MenuGroup",zy=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"group",...r,ref:t})});zy.displayName=Yq;var Xq="MenuLabel",AP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});AP.displayName=Xq;var vd="MenuItem",n1="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(n1,{bubbles:!0,cancelable:!0});h.addEventListener(n1,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(Ne.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))})})})}),qq="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":By(n),onSelect:ve(o.onSelect,()=>r?.(xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DP.displayName=qq;var jP="MenuRadioGroup",[Zq,Qq]=hs(jP,{value:void 0,onValueChange:()=>{}}),OP=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=pt(r);return p.jsx(Zq,{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=Qq($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":By(i),onSelect:ve(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});LP.displayName=$P;var Vy="MenuItemIndicator",[FP,Jq]=hs(Vy,{checked:!1}),zP=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Jq(Vy,n);return p.jsx(Pt,{present:r||xd(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{...o,ref:t,"data-state":By(i.checked)})})});zP.displayName=Vy;var eZ="MenuSeparator",VP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});VP.displayName=eZ;var tZ="MenuArrow",BP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Gm,{...o,...r,ref:t})});BP.displayName=tZ;var nZ="MenuSub",[aQ,HP]=hs(nZ),Ka="MenuSubTrigger",WP=m.forwardRef((e,t)=>{const n=gs(Ka,e.__scopeMenu),r=zl(Ka,e.__scopeMenu),o=HP(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:Yt(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===" "||Oq[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(yn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=gs(yn,e.__scopeMenu),l=zl(yn,e.__scopeMenu),c=HP(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=$q[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 By(e){return xd(e)?"indeterminate":e?"checked":"unchecked"}function rZ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function oZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function sZ(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=oZ(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 iZ(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 aZ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return iZ(n,t)}function xl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var lZ=PP,cZ=Oy,uZ=IP,dZ=_P,fZ=zy,pZ=AP,hZ=Nf,gZ=DP,mZ=OP,yZ=LP,vZ=zP,xZ=VP,wZ=BP,bZ=WP,SZ=KP,kf="DropdownMenu",[CZ]=Lt(kf,[kP]),Ft=kP(),[EZ,YP]=CZ(kf),XP=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,d=Ft(t),f=m.useRef(null),[g,h]=ln({prop:o,defaultProp:i??!1,onChange:l,caller:kf});return p.jsx(EZ,{scope:t,triggerId:kt(),triggerRef:f,contentId:kt(),open:g,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(v=>!v),[h]),modal:c,children:p.jsx(lZ,{...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=Ft(n);return p.jsx(cZ,{asChild:!0,...l,children:p.jsx(Ne.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:Yt(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 NZ="DropdownMenuPortal",QP=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ft(t);return p.jsx(uZ,{...r,...n})};QP.displayName=NZ;var JP="DropdownMenuContent",eR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=YP(JP,n),i=Ft(n),l=m.useRef(!1);return p.jsx(dZ,{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 kZ="DropdownMenuGroup",TZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(fZ,{...o,...r,ref:t})});TZ.displayName=kZ;var PZ="DropdownMenuLabel",RZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(pZ,{...o,...r,ref:t})});RZ.displayName=PZ;var IZ="DropdownMenuItem",tR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(hZ,{...o,...r,ref:t})});tR.displayName=IZ;var _Z="DropdownMenuCheckboxItem",AZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(gZ,{...o,...r,ref:t})});AZ.displayName=_Z;var MZ="DropdownMenuRadioGroup",DZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(mZ,{...o,...r,ref:t})});DZ.displayName=MZ;var jZ="DropdownMenuRadioItem",OZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(yZ,{...o,...r,ref:t})});OZ.displayName=jZ;var $Z="DropdownMenuItemIndicator",LZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(vZ,{...o,...r,ref:t})});LZ.displayName=$Z;var FZ="DropdownMenuSeparator",zZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(xZ,{...o,...r,ref:t})});zZ.displayName=FZ;var VZ="DropdownMenuArrow",BZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(wZ,{...o,...r,ref:t})});BZ.displayName=VZ;var HZ="DropdownMenuSubTrigger",WZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(bZ,{...o,...r,ref:t})});WZ.displayName=HZ;var UZ="DropdownMenuSubContent",KZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(SZ,{...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)"}})});KZ.displayName=UZ;var GZ=XP,YZ=ZP,XZ=QP,qZ=eR,ZZ=tR;const hg=[{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"en",name:"English",flag:"🇺🇸"}];function QZ({language:e,onChange:t}){const{t:n}=Xe(),r=hg.find(o=>o.code===e)??hg[1];return p.jsxs(GZ,{children:[p.jsx(YZ,{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(XZ,{children:p.jsx(qZ,{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(ZZ,{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 JZ=[{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"),eQ=e=>e.split(/[\\/]/).pop()??e,tQ=typeof window<"u"&&"showOpenFilePicker"in window,nQ=typeof window<"u"&&"showSaveFilePicker"in window,rQ=Ti?{kind:"path",path:Ti}:null,oQ=Ti?eQ(Ti):null,r1=[{description:"Workflow JSON",accept:{"application/json":[".json"]}}];function sQ(){const{t:e}=Xe(),t=m.useRef(null),n=m.useRef(null),r=m.useRef(!1),[o,i]=m.useState(!1),[l,c]=m.useState(!1),[d,f]=m.useState(!1),[g,h]=m.useState(()=>localStorage.getItem("fh-theme")==="light"?"light":"dark"),[v,x]=m.useState(()=>localStorage.getItem(xg)==="de"?"de":"en"),[S,w]=m.useState(rQ),[E,b]=m.useState(oQ);m.useEffect(()=>{document.documentElement.classList.toggle("light",g==="light"),localStorage.setItem("fh-theme",g)},[g]),m.useEffect(()=>{Tt.changeLanguage(v),localStorage.setItem(xg,v)},[v]),m.useEffect(()=>{const j=E??"Untitled.json";document.title=`${o?"• ":""}${j} — Edge Agents Builder`},[E,o]),m.useEffect(()=>{r.current||!Ti||(r.current=!0,fetch(`/api/file?path=${encodeURIComponent(Ti)}`).then(async j=>{if(j.status===404)return null;if(!j.ok)throw new Error(`${j.status} ${await j.text()}`);return j.json()}).then(j=>{j&&(t.current?.loadWorkflow(j),i(!1))}).catch(j=>Kt({title:e("toast.loadFailed"),description:j.message,variant:"destructive"})))},[e]);const N=m.useCallback((j,U,Y)=>{let I;try{I=JSON.parse(j)}catch{Kt({title:e("toast.loadFailed"),description:e("error.invalidJson"),variant:"destructive"});return}t.current?.loadWorkflow(I),i(!1),b(U),w(Y)},[e]),k=m.useCallback(async()=>{if(!(o&&!window.confirm(e("confirm.discard")))){if(tQ){try{const[j]=await window.showOpenFilePicker({types:r1});if(!j)return;const U=await j.getFile();N(await U.text(),j.name,{kind:"handle",handle:j})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")return;Kt({title:e("toast.loadFailed"),description:j instanceof Error?j.message:String(j),variant:"destructive"})}return}n.current?.click()}},[o,e,N]),P=m.useCallback(j=>{const U=j.target.files?.[0];U&&(U.text().then(Y=>N(Y,U.name,null)).catch(Y=>Kt({title:e("toast.loadFailed"),description:Y.message,variant:"destructive"})),j.target.value="")},[N,e]),M=m.useCallback(async()=>{const j=t.current?.exportWorkflow();if(!j)return;const U=JSON.stringify(j,null,2);if(S?.kind==="path"){try{const A=await fetch(`/api/file?path=${encodeURIComponent(S.path)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:U});if(!A.ok)throw new Error(`${A.status} ${await A.text()}`);i(!1)}catch(A){Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}if(S?.kind==="handle"){try{const A=await S.handle.createWritable();await A.write(U),await A.close(),i(!1)}catch(A){Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}if(nQ){try{const A=await window.showSaveFilePicker({suggestedName:E??"workflow.json",types:r1}),V=await A.createWritable();await V.write(U),await V.close(),w({kind:"handle",handle:A}),b(A.name),i(!1)}catch(A){if(A instanceof DOMException&&A.name==="AbortError")return;Kt({title:e("toast.saveFailed"),description:A instanceof Error?A.message:String(A),variant:"destructive"})}return}const Y=new Blob([U],{type:"application/json"}),I=URL.createObjectURL(Y),B=document.createElement("a");B.href=I,B.download=E??`workflow-${new Date().toISOString().replace(/[:.]/g,"-")}.json`,B.click(),URL.revokeObjectURL(I),i(!1)},[S,E,e]),R=m.useCallback(()=>{o&&!window.confirm(e("confirm.discard"))||(t.current?.clear(),i(!1),w(null),b(null))},[o,e]),_=m.useCallback(()=>{t.current?.validate()},[]),$=m.useCallback(()=>{i(!0)},[]),D=m.useCallback(j=>{c(j.canUndo),f(j.canRedo)},[]),H=m.useCallback(j=>{Kt({title:e("toast.error"),description:j.message,variant:"destructive"})},[e]);return m.useEffect(()=>{const j=U=>{(U.metaKey||U.ctrlKey)&&!U.shiftKey&&U.key.toLowerCase()==="s"&&(U.preventDefault(),M())};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[M]),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:O1,onClick:R,children:e("toolbar.new")}),p.jsx(Qs,{icon:wz,onClick:k,children:e("toolbar.open")}),p.jsx(Qs,{icon:Iz,variant:"primary",onClick:M,children:e("toolbar.save")}),p.jsx(Qs,{icon:D1,onClick:_,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:!l,children:e("toolbar.undo")}),p.jsx(Qs,{icon:Pz,onClick:()=>t.current?.redo(),disabled:!d,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:S?.kind==="path"?S.path:E??"no file",children:[p.jsx("span",{className:"truncate",children:E??"Untitled.json"}),p.jsx("span",{className:"shrink-0 w-2 text-center text-foreground","aria-hidden":!0,children:o?"•":""})]}),p.jsx(Tq,{theme:g,onToggle:()=>h(j=>j==="dark"?"light":"dark")}),p.jsx(QZ,{language:v,onChange:x}),p.jsx("input",{ref:n,type:"file",accept:"application/json,.json",className:"hidden","aria-label":e("toolbar.open"),onChange:P})]}),p.jsx("main",{className:"flex-1 min-h-0",children:p.jsx(kq,{ref:t,models:JZ,language:v,onChange:$,onHistoryChange:D,onError:H})})]})}const nR=document.getElementById("root");if(!nR)throw new Error("#root not found");HI.createRoot(nR).render(p.jsx(m.StrictMode,{children:p.jsx(sQ,{})}));
|