@foresthubai/workflow-cli 0.4.5 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
function LI(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 um(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xh={exports:{}},Ma={},bh={exports:{}},Ve={};var p0;function $I(){if(p0)return Ve;p0=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($){return $===null||typeof $!="object"?null:($=h&&$[h]||$["@@iterator"],typeof $=="function"?$:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,b={};function E($,z,X){this.props=$,this.context=z,this.refs=b,this.updater=X||x}E.prototype.isReactComponent={},E.prototype.setState=function($,z){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,z,"setState")},E.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function w(){}w.prototype=E.prototype;function N($,z,X){this.props=$,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,_=Object.prototype.hasOwnProperty,R={current:null},M={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)_.call(z,Q)&&!M.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($&&$.defaultProps)for(Q in K=$.defaultProps,K)te[Q]===void 0&&(te[Q]=K[Q]);return{$$typeof:e,type:$,key:ne,ref:Z,props:te,_owner:R.current}}function D($,z){return{$$typeof:e,type:$.type,key:z,ref:$.ref,props:$.props,_owner:$._owner}}function H($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function j($){var z={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(X){return z[X]})}var U=/\/+/g;function Y($,z){return typeof $=="object"&&$!==null&&$.key!=null?j(""+$.key):z.toString(36)}function I($,z,X,Q,te){var ne=typeof $;(ne==="undefined"||ne==="boolean")&&($=null);var Z=!1;if($===null)Z=!0;else switch(ne){case"string":case"number":Z=!0;break;case"object":switch($.$$typeof){case e:case t:Z=!0}}if(Z)return Z=$,te=te(Z),$=Q===""?"."+Y(Z,0):Q,P(te)?(X="",$!=null&&(X=$.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,"$&/")+"/")+$)),z.push(te)),1;if(Z=0,Q=Q===""?".":Q+":",P($))for(var K=0;K<$.length;K++){ne=$[K];var re=Q+Y(ne,K);Z+=I(ne,z,X,re,te)}else if(re=v($),typeof re=="function")for($=re.call($),K=0;!(ne=$.next()).done;)ne=ne.value,re=Q+Y(ne,K++),Z+=I(ne,z,X,re,te);else if(ne==="object")throw z=String($),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return Z}function B($,z,X){if($==null)return $;var Q=[],te=0;return I($,Q,"","",function(ne){return z.call(X,ne,te++)}),Q}function A($){if($._status===-1){var z=$._result;z=z(),z.then(function(X){($._status===0||$._status===-1)&&($._status=1,$._result=X)},function(X){($._status===0||$._status===-1)&&($._status=2,$._result=X)}),$._status===-1&&($._status=0,$._result=z)}if($._status===1)return $._result.default;throw $._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($,z,X){B($,function(){z.apply(this,arguments)},X)},count:function($){var z=0;return B($,function(){z++}),z},toArray:function($){return B($,function(z){return z})||[]},only:function($){if(!H($))throw Error("React.Children.only expected to receive a single React element child.");return $}},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($,z,X){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var Q=S({},$.props),te=$.key,ne=$.ref,Z=$._owner;if(z!=null){if(z.ref!==void 0&&(ne=z.ref,Z=R.current),z.key!==void 0&&(te=""+z.key),$.type&&$.type.defaultProps)var K=$.type.defaultProps;for(re in z)_.call(z,re)&&!M.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:$.type,key:te,ref:ne,props:Q,_owner:Z}},Ve.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:i,_context:$},$.Consumer=$},Ve.createElement=L,Ve.createFactory=function($){var z=L.bind(null,$);return z.type=$,z},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function($){return{$$typeof:c,render:$}},Ve.isValidElement=H,Ve.lazy=function($){return{$$typeof:g,_payload:{_status:-1,_result:$},_init:A}},Ve.memo=function($,z){return{$$typeof:f,type:$,compare:z===void 0?null:z}},Ve.startTransition=function($){var z=F.transition;F.transition={};try{$()}finally{F.transition=z}},Ve.unstable_act=q,Ve.useCallback=function($,z){return V.current.useCallback($,z)},Ve.useContext=function($){return V.current.useContext($)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function($){return V.current.useDeferredValue($)},Ve.useEffect=function($,z){return V.current.useEffect($,z)},Ve.useId=function(){return V.current.useId()},Ve.useImperativeHandle=function($,z,X){return V.current.useImperativeHandle($,z,X)},Ve.useInsertionEffect=function($,z){return V.current.useInsertionEffect($,z)},Ve.useLayoutEffect=function($,z){return V.current.useLayoutEffect($,z)},Ve.useMemo=function($,z){return V.current.useMemo($,z)},Ve.useReducer=function($,z,X){return V.current.useReducer($,z,X)},Ve.useRef=function($){return V.current.useRef($)},Ve.useState=function($){return V.current.useState($)},Ve.useSyncExternalStore=function($,z,X){return V.current.useSyncExternalStore($,z,X)},Ve.useTransition=function(){return V.current.useTransition()},Ve.version="18.3.1",Ve}var h0;function bl(){return h0||(h0=1,bh.exports=$I()),bh.exports}var g0;function FI(){if(g0)return Ma;g0=1;var e=bl(),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 Ma.Fragment=n,Ma.jsx=l,Ma.jsxs=l,Ma}var m0;function zI(){return m0||(m0=1,xh.exports=FI()),xh.exports}var p=zI(),m=bl();const qe=um(m),bd=LI({__proto__:null,default:qe},[m]);var su={},wh={exports:{}},Ut={},Sh={exports:{}},Ch={};var y0;function VI(){return y0||(y0=1,(function(e){function t(F,W){var q=F.length;F.push(W);e:for(;0<q;){var $=q-1>>>1,z=F[$];if(0<o(z,W))F[$]=W,F[q]=z,q=$;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 $=0,z=F.length,X=z>>>1;$<X;){var Q=2*($+1)-1,te=F[Q],ne=Q+1,Z=F[ne];if(0>o(te,q))ne<z&&0>o(Z,te)?(F[$]=Z,F[ne]=q,$=ne):(F[$]=te,F[Q]=q,$=Q);else if(ne<z&&0>o(Z,q))F[$]=Z,F[ne]=q,$=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(_);else{var W=n(f);W!==null&&V(P,W.startTime-F)}}function _(F,W){S=!1,b&&(b=!1,w(L),L=-1),x=!0;var q=v;try{for(k(W),h=n(d);h!==null&&(!(h.expirationTime>W)||F&&!j());){var $=h.callback;if(typeof $=="function"){h.callback=null,v=h.priorityLevel;var z=$(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,M=null,L=-1,D=5,H=-1;function j(){return!(e.unstable_now()-H<D)}function U(){if(M!==null){var F=e.unstable_now();H=F;var W=!0;try{W=M(!0,F)}finally{W?Y():(R=!1,M=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){M=F,R||(R=!0,Y())}function V(F,W){L=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(_))},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 $=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?$+q:$):q=$,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>$?(F.sortIndex=q,t(f,F),n(d)===null&&F===n(f)&&(b?(w(L),L=-1):b=!0,V(P,q-$))):(F.sortIndex=z,t(d,F),S||x||(S=!0,A(_))),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 v0;function BI(){return v0||(v0=1,Sh.exports=VI()),Sh.exports}var x0;function HI(){if(x0)return Ut;x0=1;var e=bl(),t=BI();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,_=Symbol.for("react.element"),R=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),L=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,$;function z(s){if($===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);$=a&&a[1]||""}return`
|
|
2
|
+
`+$+s}var X=!1;function Q(s,a){if(!s||X)return"";X=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ie){var y=ie}Reflect.construct(s,[],a)}else{try{a.call()}catch(ie){y=ie}s.call(a.prototype)}else{try{throw Error()}catch(ie){y=ie}s()}}catch(ie){if(ie&&y&&typeof ie.stack=="string"){for(var C=ie.stack.split(`
|
|
3
|
+
`),T=y.stack.split(`
|
|
4
|
+
`),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 M:return"Fragment";case R:return"Portal";case D:return"Profiler";case L: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===L?"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 $e(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 be(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 So(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 Co,Vl=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,u,y,C){MSApp.execUnsafeLocalFunction(function(){return s(a,u,y,C)})}:s})(function(s,a){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=a;else{for(Co=Co||document.createElement("div"),Co.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Co.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function 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 Eo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Tf=["Webkit","ms","Moz","O"];Object.keys(Eo).forEach(function(s){Tf.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Eo[a]=Eo[s]})});function Bl(s,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||Eo.hasOwnProperty(s)&&Eo[s]?(""+a).trim():a+"px"}function 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,Mr=null,Ar=null;function Wl(s){if(s=ma(s)){if(typeof Ui!="function")throw Error(n(280));var a=s.stateNode;a&&(a=bc(a),Ui(s.stateNode,s.type,a))}}function Ul(s){Mr?Ar?Ar.push(s):Ar=[s]:Mr=s}function Kl(){if(Mr){var s=Mr,a=Ar;if(Ar=Mr=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,(Mr!==null||Ar!==null)&&(Yl(),Kl())}}function No(s,a){var u=s.stateNode;if(u===null)return null;var y=bc(u);if(y===null)return null;u=y[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(s=s.type,y=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!y;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,a,typeof u));return u}var Gi=!1;if(c)try{var ko={};Object.defineProperty(ko,"passive",{get:function(){Gi=!0}}),window.addEventListener("test",ko,ko),window.removeEventListener("test",ko,ko)}catch{Gi=!1}function Rf(s,a,u,y,C,T,O,G,J){var ie=Array.prototype.slice.call(arguments,3);try{a.apply(u,ie)}catch(fe){this.onError(fe)}}var To=!1,ys=null,vs=!1,Yi=null,If={onError:function(s){To=!0,ys=s}};function Mf(s,a,u,y,C,T,O,G,J){To=!1,ys=null,Rf.apply(If,arguments)}function Af(s,a,u,y,C,T,O,G,J){if(Mf.apply(this,arguments),To){if(To){var ie=ys;To=!1,ys=null}else throw Error(n(198));vs||(vs=!0,Yi=ie)}}function $n(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($n(s)!==s)throw Error(n(188))}function _f(s){var a=s.alternate;if(!a){if(a=$n(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=_f(s),s!==null?Zl(s):null}function Zl(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=Zl(s);if(a!==null)return a;s=s.sibling}return null}var Ql=t.unstable_scheduleCallback,Jl=t.unstable_cancelCallback,Df=t.unstable_shouldYield,ec=t.unstable_requestPaint,at=t.unstable_now,jf=t.unstable_getCurrentPriorityLevel,Zi=t.unstable_ImmediatePriority,tc=t.unstable_UserBlockingPriority,xs=t.unstable_NormalPriority,Of=t.unstable_LowPriority,nc=t.unstable_IdlePriority,Po=null,un=null;function Lf(s){if(un&&typeof un.onCommitFiberRoot=="function")try{un.onCommitFiberRoot(Po,s,void 0,(s.current.flags&128)===128)}catch{}}var qt=Math.clz32?Math.clz32:zf,$f=Math.log,Ff=Math.LN2;function zf(s){return s>>>=0,s===0?32:31-($f(s)/Ff|0)|0}var bs=64,ws=4194304;function _r(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=_r(G):(T&=O,T!==0&&(y=_r(T)))}else O=u&~C,O!==0?y=_r(O):T!==0&&(y=_r(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=bs;return bs<<=1,(bs&4194240)===0&&(bs=64),s}function Ji(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function Ro(s,a,u){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-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 Uy(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ky,Hf,Gy,Yy,Xy,Wf=!1,sc=[],Dr=null,jr=null,Or=null,ea=new Map,ta=new Map,Lr=[],sR="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 qy(s,a){switch(s){case"focusin":case"focusout":Dr=null;break;case"dragenter":case"dragleave":jr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":ea.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ta.delete(a.pointerId)}}function na(s,a,u,y,C,T){return s===null||s.nativeEvent!==T?(s={blockedOn:a,domEventName:u,eventSystemFlags:y,nativeEvent:T,targetContainers:[C]},a!==null&&(a=ma(a),a!==null&&Hf(a)),s):(s.eventSystemFlags|=y,a=s.targetContainers,C!==null&&a.indexOf(C)===-1&&a.push(C),s)}function iR(s,a,u,y,C){switch(a){case"focusin":return Dr=na(Dr,s,a,u,y,C),!0;case"dragenter":return jr=na(jr,s,a,u,y,C),!0;case"mouseover":return Or=na(Or,s,a,u,y,C),!0;case"pointerover":var T=C.pointerId;return ea.set(T,na(ea.get(T)||null,s,a,u,y,C)),!0;case"gotpointercapture":return T=C.pointerId,ta.set(T,na(ta.get(T)||null,s,a,u,y,C)),!0}return!1}function Zy(s){var a=Io(s.target);if(a!==null){var u=$n(a);if(u!==null){if(a=u.tag,a===13){if(a=Xi(u),a!==null){s.blockedOn=a,Xy(s.priority,function(){Gy(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 aR(){Wf=!1,Dr!==null&&ic(Dr)&&(Dr=null),jr!==null&&ic(jr)&&(jr=null),Or!==null&&ic(Or)&&(Or=null),ea.forEach(Qy),ta.forEach(Qy)}function ra(s,a){s.blockedOn===a&&(s.blockedOn=null,Wf||(Wf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,aR)))}function oa(s){function a(C){return ra(C,s)}if(0<sc.length){ra(sc[0],s);for(var u=1;u<sc.length;u++){var y=sc[u];y.blockedOn===s&&(y.blockedOn=null)}}for(Dr!==null&&ra(Dr,s),jr!==null&&ra(jr,s),Or!==null&&ra(Or,s),ea.forEach(a),ta.forEach(a),u=0;u<Lr.length;u++)y=Lr[u],y.blockedOn===s&&(y.blockedOn=null);for(;0<Lr.length&&(u=Lr[0],u.blockedOn===null);)Zy(u),u.blockedOn===null&&Lr.shift()}var Es=P.ReactCurrentBatchConfig,ac=!0;function lR(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 cR(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),qy(s,y);else if(iR(C,s,a,u,y))y.stopPropagation();else if(qy(s,y),a&4&&-1<sR.indexOf(s)){for(;C!==null;){var T=ma(C);if(T!==null&&Ky(T),T=Kf(s,a,u,y),T===null&&cp(s,a,y,lc,u),T===C)break;C=T}C!==null&&y.stopPropagation()}else cp(s,a,y,null,u)}}var lc=null;function Kf(s,a,u,y){if(lc=null,s=Wi(y),s=Io(s),s!==null)if(a=$n(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 Jy(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 ev(){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 tv(){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:tv,this.isPropagationStopped=tv,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}),uR=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}}),nv=Zt(fc),dR=q({},fc,{dataTransfer:0}),fR=Zt(dR),pR=q({},sa,{relatedTarget:0}),Zf=Zt(pR),hR=q({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),gR=Zt(hR),mR=q({},Ns,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),yR=Zt(mR),vR=q({},Ns,{data:0}),rv=Zt(vR),xR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bR={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"},wR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function SR(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=wR[s])?!!a[s]:!1}function Qf(){return SR}var CR=q({},sa,{key:function(s){if(s.key){var a=xR[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"?bR[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}}),ER=Zt(CR),NR=q({},fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ov=Zt(NR),kR=q({},sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qf}),TR=Zt(kR),PR=q({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),RR=Zt(PR),IR=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}),MR=Zt(IR),AR=[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,sv=c&&(!Jf||aa&&8<aa&&11>=aa),iv=" ",av=!1;function lv(s,a){switch(s){case"keyup":return AR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ks=!1;function DR(s,a){switch(s){case"compositionend":return cv(a);case"keypress":return a.which!==32?null:(av=!0,iv);case"textInput":return s=a.data,s===iv&&av?null:s;default:return null}}function jR(s,a){if(ks)return s==="compositionend"||!Jf&&lv(s,a)?(s=ev(),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 sv&&a.locale!=="ko"?null:a.data;default:return null}}var OR={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 uv(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!OR[s.type]:a==="textarea"}function dv(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 LR(s){Rv(s,0)}function pc(s){var a=Ms(s);if(ge(a))return s}function $R(s,a){if(s==="change")return a}var fv=!1;if(c){var ep;if(c){var tp="oninput"in document;if(!tp){var pv=document.createElement("div");pv.setAttribute("oninput","return;"),tp=typeof pv.oninput=="function"}ep=tp}else ep=!1;fv=ep&&(!document.documentMode||9<document.documentMode)}function hv(){la&&(la.detachEvent("onpropertychange",gv),ca=la=null)}function gv(s){if(s.propertyName==="value"&&pc(ca)){var a=[];dv(a,ca,s,Wi(s)),Xl(LR,a)}}function FR(s,a,u){s==="focusin"?(hv(),la=a,ca=u,la.attachEvent("onpropertychange",gv)):s==="focusout"&&hv()}function zR(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return pc(ca)}function VR(s,a){if(s==="click")return pc(a)}function BR(s,a){if(s==="input"||s==="change")return pc(a)}function HR(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var xn=typeof Object.is=="function"?Object.is:HR;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 mv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function yv(s,a){var u=mv(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=mv(u)}}function vv(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?vv(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function xv(){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 WR(s){var a=xv(),u=s.focusedElem,y=s.selectionRange;if(a!==u&&u&&u.ownerDocument&&vv(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=yv(u,T);var O=yv(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 UR=c&&"documentMode"in document&&11>=document.documentMode,Ts=null,rp=null,da=null,op=!1;function bv(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={},wv={};c&&(wv=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 wv)return sp[s]=a[u];return s}var Sv=gc("animationend"),Cv=gc("animationiteration"),Ev=gc("animationstart"),Nv=gc("transitionend"),kv=new Map,Tv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Fr(s,a){kv.set(s,a),i(a,[s])}for(var ip=0;ip<Tv.length;ip++){var ap=Tv[ip],KR=ap.toLowerCase(),GR=ap[0].toUpperCase()+ap.slice(1);Fr(KR,"on"+GR)}Fr(Sv,"onAnimationEnd"),Fr(Cv,"onAnimationIteration"),Fr(Ev,"onAnimationStart"),Fr("dblclick","onDoubleClick"),Fr("focusin","onFocus"),Fr("focusout","onBlur"),Fr(Nv,"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(" "),YR=new Set("cancel close invalid load scroll toggle".split(" ").concat(fa));function Pv(s,a,u){var y=s.type||"unknown-event";s.currentTarget=u,Af(y,a,void 0,s),s.currentTarget=null}function Rv(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;Pv(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;Pv(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)||(Iv(a,s,2,!1),u.add(y))}function lp(s,a,u){var y=0;a&&(y|=4),Iv(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"&&(YR.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 Iv(s,a,u,y){switch(Jy(a)){case 1:var C=lR;break;case 4:C=cR;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=Io(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=kv.get(s);if(de!==void 0){var we=Yf,ke=s;switch(s){case"keypress":if(uc(u)===0)break e;case"keydown":case"keyup":we=ER;break;case"focusin":ke="focus",we=Zf;break;case"focusout":ke="blur",we=Zf;break;case"beforeblur":case"afterblur":we=Zf;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=nv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=fR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=TR;break;case Sv:case Cv:case Ev:we=gR;break;case Nv:we=RR;break;case"scroll":we=uR;break;case"wheel":we=MR;break;case"copy":case"cut":case"paste":we=yR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=ov}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=No(ee,oe),ye!=null&&Te.push(ha(ee,ye,se)))),ft)break;ee=ee.return}0<Te.length&&(de=new we(de,ke,null,u,fe),he.push({event:de,listeners:Te}))}}if((a&7)===0){e:{if(de=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",de&&u!==Hi&&(ke=u.relatedTarget||u.fromElement)&&(Io(ke)||ke[or]))break e;if((we||de)&&(de=fe.window===fe?fe:(de=fe.ownerDocument)?de.defaultView||de.parentWindow:window,we?(ke=u.relatedTarget||u.toElement,we=ie,ke=ke?Io(ke):null,ke!==null&&(ft=$n(ke),ke!==ft||ke.tag!==5&&ke.tag!==6)&&(ke=null)):(we=null,ke=ie),we!==ke)){if(Te=nv,ye="onMouseLeave",oe="onMouseEnter",ee="mouse",(s==="pointerout"||s==="pointerover")&&(Te=ov,ye="onPointerLeave",oe="onPointerEnter",ee="pointer"),ft=we==null?de:Ms(we),se=ke==null?de:Ms(ke),de=new Te(ye,ee+"leave",we,u,fe),de.target=ft,de.relatedTarget=se,ye=null,Io(fe)===ie&&(Te=new Te(oe,ee+"enter",ke,u,fe),Te.target=se,Te.relatedTarget=ft,ye=Te),ft=ye,we&&ke)t:{for(Te=we,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;we!==null&&Mv(he,de,we,Te,!1),ke!==null&&ft!==null&&Mv(he,ft,ke,Te,!0)}}e:{if(de=ie?Ms(ie):window,we=de.nodeName&&de.nodeName.toLowerCase(),we==="select"||we==="input"&&de.type==="file")var Pe=$R;else if(uv(de))if(fv)Pe=BR;else{Pe=zR;var Ie=FR}else(we=de.nodeName)&&we.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Pe=VR);if(Pe&&(Pe=Pe(s,ie))){dv(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?Ms(ie):window,s){case"focusin":(uv(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,bv(he,u,fe);break;case"selectionchange":if(UR)break;case"keydown":case"keyup":bv(he,u,fe)}var Me;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?lv(s,u)&&(Ae="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Ae="onCompositionStart");Ae&&(sv&&u.locale!=="ko"&&(ks||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&ks&&(Me=ev()):($r=fe,Gf="value"in $r?$r.value:$r.textContent,ks=!0)),Ie=yc(ie,Ae),0<Ie.length&&(Ae=new rv(Ae,s,null,u,fe),he.push({event:Ae,listeners:Ie}),Me?Ae.data=Me:(Me=cv(u),Me!==null&&(Ae.data=Me)))),(Me=_R?DR(s,u):jR(s,u))&&(ie=yc(ie,"onBeforeInput"),0<ie.length&&(fe=new rv("onBeforeInput","beforeinput",null,u,fe),he.push({event:fe,listeners:ie}),fe.data=Me))}Rv(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=No(s,u),T!=null&&y.unshift(ha(s,T,C)),T=No(s,a),T!=null&&y.push(ha(s,T,C))),s=s.return}return y}function Rs(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Mv(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=No(u,T),J!=null&&O.unshift(ha(u,J,G))):C||(J=No(u,T),J!=null&&O.push(ha(u,J,G)))),u=u.return}O.length!==0&&s.push({event:a,listeners:O})}var XR=/\r\n?/g,qR=/\u0000|\uFFFD/g;function Av(s){return(typeof s=="string"?s:""+s).replace(XR,`
|
|
6
|
+
`).replace(qR,"")}function vc(s,a,u){if(a=Av(a),Av(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,ZR=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(JR)}:pp;function JR(s){setTimeout(function(){throw s})}function hp(s,a){var u=a,y=0;do{var C=u.nextSibling;if(s.removeChild(u),C&&C.nodeType===8)if(u=C.data,u==="/$"){if(y===0){s.removeChild(C),oa(a);return}y--}else u!=="$"&&u!=="$?"&&u!=="$!"||y++;u=C}while(u);oa(a)}function zr(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return s}function Dv(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,eI="__reactListeners$"+Is,tI="__reactHandles$"+Is;function Io(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=Dv(s);s!==null;){if(u=s[Fn])return u;s=Dv(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 Ms(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function bc(s){return s[ga]||null}var mp=[],As=-1;function Vr(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 Br={},Rt=Vr(Br),zt=Vr(!1),Mo=Br;function _s(s,a){var u=s.type.contextTypes;if(!u)return Br;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 wc(){tt(zt),tt(Rt)}function jv(s,a,u){if(Rt.current!==Br)throw Error(n(168));Ze(Rt,a),Ze(zt,u)}function Ov(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||Br,Mo=Rt.current,Ze(Rt,s),Ze(zt,zt.current),!0}function Lv(s,a,u){var y=s.stateNode;if(!y)throw Error(n(169));u?(s=Ov(s,a,Mo),y.__reactInternalMemoizedMergedChildContext=s,tt(zt),tt(Rt),Ze(Rt,s)):tt(zt),Ze(zt,u)}var sr=null,Cc=!1,yp=!1;function $v(s){sr===null?sr=[s]:sr.push(s)}function nI(s){Cc=!0,$v(s)}function Hr(){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,Hr),C}finally{Ge=a,yp=!1}}return null}var Ds=[],js=0,Ec=null,Nc=0,dn=[],fn=0,Ao=null,ir=1,ar="";function _o(s,a){Ds[js++]=Nc,Ds[js++]=Ec,Ec=s,Nc=a}function Fv(s,a,u){dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=Ao,Ao=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&&(_o(s,1),Fv(s,1,0))}function xp(s){for(;s===Ec;)Ec=Ds[--js],Ds[js]=null,Nc=Ds[--js],Ds[js]=null;for(;s===Ao;)Ao=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 zv(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 Vv(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=zr(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=Ao!==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 bp(s){return(s.mode&1)!==0&&(s.flags&128)===0}function wp(s){if(st){var a=Jt;if(a){var u=a;if(!Vv(s,a)){if(bp(s))throw Error(n(418));a=zr(u.nextSibling);var y=Qt;a&&Vv(s,a)?zv(y,u):(s.flags=s.flags&-4097|2,st=!1,Qt=s)}}else{if(bp(s))throw Error(n(418));s.flags=s.flags&-4097|2,st=!1,Qt=s}}}function Bv(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 Bv(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(bp(s))throw Hv(),Error(n(418));for(;a;)zv(s,a),a=zr(a.nextSibling)}if(Bv(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=zr(s.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}s=s.nextSibling}Jt=null}}else Jt=Qt?zr(s.stateNode.nextSibling):null;return!0}function Hv(){for(var s=Jt;s;)s=zr(s.nextSibling)}function Os(){Jt=Qt=null,st=!1}function Sp(s){bn===null?bn=[s]:bn.push(s)}var rI=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 Wv(s){var a=s._init;return a(s._payload)}function Uv(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=Zr(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===M?fe(oe,ee,se.props.children,ye,se.key):ee!==null&&(ee.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Wv(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=Vo(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 _: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=Vo(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 _: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 we(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 _: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 we(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,Me=ee,Ae=ee=0,St=null;Me!==null&&Ae<se.length;Ae++){Me.index>Ae?(St=Me,Me=null):St=Me.sibling;var Ue=de(oe,Me,se[Ae],ye);if(Ue===null){Me===null&&(Me=St);break}s&&Me&&Ue.alternate===null&&a(oe,Me),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue,Me=St}if(Ae===se.length)return u(oe,Me),st&&_o(oe,Ae),Pe;if(Me===null){for(;Ae<se.length;Ae++)Me=he(oe,se[Ae],ye),Me!==null&&(ee=T(Me,ee,Ae),Ie===null?Pe=Me:Ie.sibling=Me,Ie=Me);return st&&_o(oe,Ae),Pe}for(Me=y(oe,Me);Ae<se.length;Ae++)St=we(Me,oe,Ae,se[Ae],ye),St!==null&&(s&&St.alternate!==null&&Me.delete(St.key===null?Ae:St.key),ee=T(St,ee,Ae),Ie===null?Pe=St:Ie.sibling=St,Ie=St);return s&&Me.forEach(function(Qr){return a(oe,Qr)}),st&&_o(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,Me=ee,Ae=ee=0,St=null,Ue=se.next();Me!==null&&!Ue.done;Ae++,Ue=se.next()){Me.index>Ae?(St=Me,Me=null):St=Me.sibling;var Qr=de(oe,Me,Ue.value,ye);if(Qr===null){Me===null&&(Me=St);break}s&&Me&&Qr.alternate===null&&a(oe,Me),ee=T(Qr,ee,Ae),Ie===null?Pe=Qr:Ie.sibling=Qr,Ie=Qr,Me=St}if(Ue.done)return u(oe,Me),st&&_o(oe,Ae),Pe;if(Me===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&&_o(oe,Ae),Pe}for(Me=y(oe,Me);!Ue.done;Ae++,Ue=se.next())Ue=we(Me,oe,Ae,Ue.value,ye),Ue!==null&&(s&&Ue.alternate!==null&&Me.delete(Ue.key===null?Ae:Ue.key),ee=T(Ue,ee,Ae),Ie===null?Pe=Ue:Ie.sibling=Ue,Ie=Ue);return s&&Me.forEach(function(OI){return a(oe,OI)}),st&&_o(oe,Ae),Pe}function ft(oe,ee,se,ye){if(typeof se=="object"&&se!==null&&se.type===M&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case _:e:{for(var Pe=se.key,Ie=ee;Ie!==null;){if(Ie.key===Pe){if(Pe=se.type,Pe===M){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&&Wv(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===M?(ee=Vo(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 Ls=Uv(!0),Kv=Uv(!1),Pc=Vr(null),Rc=null,$s=null,Cp=null;function Ep(){Cp=$s=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=$s=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},$s===null){if(Rc===null)throw Error(n(308));$s=s,Rc.dependencies={lanes:0,firstContext:s}}else $s=$s.next=s;return a}var Do=null;function Tp(s){Do===null?Do=[s]:Do.push(s)}function Gv(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 Wr=!1;function Pp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yv(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 Ur(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 Xv(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 Mc(s,a,u,y){var C=s.updateQueue;Wr=!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,we=G.eventTime;if((y&de)===de){fe!==null&&(fe=fe.next={eventTime:we,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var ke=s,Te=G;switch(de=a,we=u,Te.tag){case 1:if(ke=Te.payload,typeof ke=="function"){he=ke.call(we,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(we,he,de):ke,de==null)break e;he=q({},he,de);break e;case 2:Wr=!0}}G.callback!==null&&G.lane!==0&&(s.flags|=64,de=C.effects,de===null?C.effects=[G]:de.push(G))}else we={eventTime:we,lane:de,tag:G.tag,payload:G.payload,callback:G.callback,next:null},fe===null?(ie=fe=we,J=he):fe=fe.next=we,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);Lo|=O,s.lanes=O,s.memoizedState=he}}function qv(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=Vr(va),xa=Vr(va),ba=Vr(va);function jo(s){if(s===va)throw Error(n(174));return s}function Rp(s,a){switch(Ze(ba,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(ba)}function Zv(s){jo(ba.current);var a=jo(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=Vr(0);function Ac(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Mp=[];function Ap(){for(var s=0;s<Mp.length;s++)Mp[s]._workInProgressVersionPrimary=null;Mp.length=0}var _c=P.ReactCurrentDispatcher,_p=P.ReactCurrentBatchConfig,Oo=0,ct=null,yt=null,bt=null,Dc=!1,wa=!1,Sa=0,oI=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(Oo=T,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,_c.current=s===null||s.memoizedState===null?lI:cI,s=u(y,C),wa){T=0;do{if(wa=!1,Sa=0,25<=T)throw Error(n(301));T+=1,bt=yt=null,a.updateQueue=null,_c.current=uI,s=u(y,C)}while(wa)}if(_c.current=Lc,a=yt!==null&&yt.next!==null,Oo=0,bt=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 bt===null?ct.memoizedState=bt=s:bt=bt.next=s,bt}function hn(){if(yt===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=yt.next;var a=bt===null?ct.memoizedState:bt.next;if(a!==null)bt=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},bt===null?ct.memoizedState=bt=s:bt=bt.next=s}return bt}function Ca(s,a){return typeof a=="function"?a(s):a}function Lp(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((Oo&fe)===fe)J!==null&&(J=J.next={lane:0,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),y=ie.hasEagerState?ie.eagerState:s(y,ie.action);else{var 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,Lo|=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,Lo|=T,C=C.next;while(C!==s)}else C===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function $p(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 Jv(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(nx.bind(null,u,y,s),[s]),y.getSnapshot!==a||T||bt!==null&&bt.memoizedState.tag&1){if(u.flags|=2048,Ea(9,tx.bind(null,u,y,C,a),void 0,null),wt===null)throw Error(n(349));(Oo&30)!==0||ex(u,a,C)}return C}function ex(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 tx(s,a,u,y){a.value=u,a.getSnapshot=y,rx(a)&&ox(s)}function nx(s,a,u){return u(function(){rx(a)&&ox(s)})}function rx(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!xn(s,u)}catch{return!0}}function ox(s){var a=lr(s,1);a!==null&&En(a,s,1,-1)}function sx(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=aI.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 ix(){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 ax(s,a){return jc(8390656,8,s,a)}function Fp(s,a){return Oc(2048,8,s,a)}function lx(s,a){return Oc(4,2,s,a)}function cx(s,a){return Oc(4,4,s,a)}function ux(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 dx(s,a,u){return u=u!=null?u.concat([s]):null,Oc(4,4,ux.bind(null,a,s),u)}function zp(){}function fx(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 px(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 hx(s,a,u){return(Oo&21)===0?(s.baseState&&(s.baseState=!1,Bt=!0),s.memoizedState=u):(xn(u,a)||(u=Cs(),ct.lanes|=u,Lo|=u,s.baseState=!0),a)}function sI(s,a){var u=Ge;Ge=u!==0&&4>u?u:4,s(!0);var y=_p.transition;_p.transition={};try{s(!1),a()}finally{Ge=u,_p.transition=y}}function gx(){return hn().memoizedState}function iI(s,a,u){var y=Xr(s);if(u={lane:y,action:u,hasEagerState:!1,eagerState:null,next:null},mx(s))yx(a,u);else if(u=Gv(s,a,u,y),u!==null){var C=jt();En(u,s,y,C),vx(u,a,y)}}function aI(s,a,u){var y=Xr(s),C={lane:y,action:u,hasEagerState:!1,eagerState:null,next:null};if(mx(s))yx(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=Gv(s,a,C,y),u!==null&&(C=jt(),En(u,s,y,C),vx(u,a,y))}}function mx(s){var a=s.alternate;return s===ct||a!==null&&a===ct}function yx(s,a){wa=Dc=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function vx(s,a,u){if((u&4194240)!==0){var y=a.lanes;y&=s.pendingLanes,u|=y,a.lanes=u,Bf(s,u)}}var Lc={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},lI={readContext:pn,useCallback:function(s,a){return Vn().memoizedState=[s,a===void 0?null:a],s},useContext:pn,useEffect:ax,useImperativeHandle:function(s,a,u){return u=u!=null?u.concat([s]):null,jc(4194308,4,ux.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=iI.bind(null,ct,s),[y.memoizedState,s]},useRef:function(s){var a=Vn();return s={current:s},a.memoizedState=s},useState:sx,useDebugValue:zp,useDeferredValue:function(s){return Vn().memoizedState=s},useTransition:function(){var s=sx(!1),a=s[0];return s=sI.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(),wt===null)throw Error(n(349));(Oo&30)!==0||ex(y,a,u)}C.memoizedState=u;var T={value:u,getSnapshot:a};return C.queue=T,ax(nx.bind(null,y,T,s),[s]),y.flags|=2048,Ea(9,tx.bind(null,y,T,u,a),void 0,null),u},useId:function(){var s=Vn(),a=wt.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=oI++,a=":"+a+"r"+u.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},cI={readContext:pn,useCallback:fx,useContext:pn,useEffect:Fp,useImperativeHandle:dx,useInsertionEffect:lx,useLayoutEffect:cx,useMemo:px,useReducer:Lp,useRef:ix,useState:function(){return Lp(Ca)},useDebugValue:zp,useDeferredValue:function(s){var a=hn();return hx(a,yt.memoizedState,s)},useTransition:function(){var s=Lp(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:Qv,useSyncExternalStore:Jv,useId:gx,unstable_isNewReconciler:!1},uI={readContext:pn,useCallback:fx,useContext:pn,useEffect:Fp,useImperativeHandle:dx,useInsertionEffect:lx,useLayoutEffect:cx,useMemo:px,useReducer:$p,useRef:ix,useState:function(){return $p(Ca)},useDebugValue:zp,useDeferredValue:function(s){var a=hn();return yt===null?a.memoizedState=s:hx(a,yt.memoizedState,s)},useTransition:function(){var s=$p(Ca)[0],a=hn().memoizedState;return[s,a]},useMutableSource:Qv,useSyncExternalStore:Jv,useId:gx,unstable_isNewReconciler:!1};function wn(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 $c={isMounted:function(s){return(s=s._reactInternals)?$n(s)===s:!1},enqueueSetState:function(s,a,u){s=s._reactInternals;var y=jt(),C=Xr(s),T=cr(y,C);T.payload=a,u!=null&&(T.callback=u),a=Ur(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=Xr(s),T=cr(y,C);T.tag=1,T.payload=a,u!=null&&(T.callback=u),a=Ur(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=Xr(s),C=cr(u,y);C.tag=2,a!=null&&(C.callback=a),a=Ur(s,C,y),a!==null&&(En(a,s,y,u),Ic(a,s,y))}};function xx(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 bx(s,a,u){var y=!1,C=Br,T=a.contextType;return typeof T=="object"&&T!==null?T=pn(T):(C=Vt(a)?Mo:Rt.current,y=a.contextTypes,T=(y=y!=null)?_s(s,C):Br),a=new a(u,T),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=$c,s.stateNode=a,a._reactInternals=s,y&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=C,s.__reactInternalMemoizedMaskedChildContext=T),a}function wx(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&&$c.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)?Mo:Rt.current,C.context=_s(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&&$c.enqueueReplaceState(C,C.state,null),Mc(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
|
+
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 dI=typeof WeakMap=="function"?WeakMap:Map;function Sx(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 Cx(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"&&(Gr===null?Gr=new Set([this]):Gr.add(this));var O=a.stack;this.componentDidCatch(a.value,{componentStack:O!==null?O:""})}),u}function Ex(s,a,u){var y=s.pingCache;if(y===null){y=s.pingCache=new dI;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=NI.bind(null,s,a,u),a.then(s,s))}function Nx(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 kx(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,Ur(u,a,1))),u.lanes|=1),s):(s.flags|=65536,s.lanes=C,s)}var fI=P.ReactCurrentOwner,Bt=!1;function Dt(s,a,u,y){a.child=s===null?Kv(a,null,u,y):Ls(a,s.child,u,y)}function Tx(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 Px(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,Rx(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=Zr(T,y),s.ref=a.ref,s.return=a,a.child=s}function Rx(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 Ix(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 Mx(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)?Mo:Rt.current;return T=_s(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 Ax(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),bx(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)?Mo:Rt.current,ie=_s(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)&&wx(a,O,y,ie),Wr=!1;var de=a.memoizedState;O.state=de,Mc(a,y,O,C),J=a.memoizedState,G!==y||de!==J||zt.current||Wr?(typeof fe=="function"&&(Vp(a,u,fe,y),J=a.memoizedState),(G=Wr||xx(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,Yv(s,a),G=a.memoizedProps,ie=a.type===a.elementType?G:wn(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)?Mo:Rt.current,J=_s(a,J));var we=u.getDerivedStateFromProps;(fe=typeof we=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==he||de!==J)&&wx(a,O,y,J),Wr=!1,de=a.memoizedState,O.state=de,Mc(a,y,O,C);var ke=a.memoizedState;G!==he||de!==ke||zt.current||Wr?(typeof we=="function"&&(Vp(a,u,we,y),ke=a.memoizedState),(ie=Wr||xx(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){Mx(s,a);var O=(a.flags&128)!==0;if(!y&&!O)return C&&Lv(a,u,!1),ur(s,a,T);y=a.stateNode,fI.current=a;var G=O&&typeof u.getDerivedStateFromError!="function"?null:y.render();return a.flags|=1,s!==null&&O?(a.child=Ls(a,s.child,null,T),a.child=Ls(a,null,G,T)):Dt(s,a,G,T),a.memoizedState=y.state,C&&Lv(a,u,!0),a.child}function _x(s){var a=s.stateNode;a.pendingContext?jv(s,a.pendingContext,a.pendingContext!==a.context):a.context&&jv(s,a.context,!1),Rp(s,a.containerInfo)}function Dx(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 jx(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 wp(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=Vo(s,y,u,null),T.return=a,s.return=a,T.sibling=s,a.child=T,a.child.memoizedState=Yp(u),a.memoizedState=Gp,s):Xp(a,O));if(C=s.memoizedState,C!==null&&(G=C.dehydrated,G!==null))return pI(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=Zr(C,J),y.subtreeFlags=C.subtreeFlags&14680064),G!==null?T=Zr(G,T):(T=Vo(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=Zr(T,{mode:"visible",children:y.children}),(a.mode&1)===0&&(y.lanes=u),y.return=a,y.sibling=null,s!==null&&(u=a.deletions,u===null?(a.deletions=[s],a.flags|=16):u.push(s)),a.child=y,a.memoizedState=null,y}function Xp(s,a){return a=Qc({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function Fc(s,a,u,y){return y!==null&&Sp(y),Ls(a,s.child,null,u),s=Xp(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function pI(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=Vo(T,C,O,null),T.flags|=2,y.return=a,T.return=a,y.sibling=T,a.child=y,(a.mode&1)!==0&&Ls(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=wt,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=kI.bind(null,s),C._reactRetry=a,null):(s=T.treeContext,Jt=zr(C.nextSibling),Qt=a,st=!0,bn=null,s!==null&&(dn[fn++]=ir,dn[fn++]=ar,dn[fn++]=Ao,ir=s.id,ar=s.overflow,Ao=a),a=Xp(a,y.children),a.flags|=4096,a)}function Ox(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 Lx(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&&Ox(s,u,a);else if(s.tag===19)Ox(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),Lo|=a.lanes,(u&a.childLanes)===0)return null;if(s!==null&&a.child!==s.child)throw Error(n(153));if(a.child!==null){for(s=a.child,u=Zr(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Zr(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function hI(s,a,u){switch(a.tag){case 3:_x(a),Os();break;case 5:Zv(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?jx(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 Lx(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,Ix(s,a,u)}return ur(s,a,u)}var $x,Zp,Fx,zx;$x=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(){},Fx=function(s,a,u,y){var C=s.memoizedProps;if(C!==y){s=a.stateNode,jo(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)}},zx=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 Mt(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 gI(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 Mt(a),null;case 1:return Vt(a.type)&&wc(),Mt(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),Mt(a),null;case 5:Ip(a);var C=jo(ba.current);if(u=a.type,s!==null&&a.stateNode!=null)Fx(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 Mt(a),null}if(s=jo(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":$e(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),be(y,T,!0);break;case"textarea":me(y),So(y);break;case"select":case"option":break;default:typeof T.onClick=="function"&&(y.onclick=xc)}y=C,a.updateQueue=y,y!==null&&(a.flags|=4)}else{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,$x(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":$e(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),be(s,y,!1);break;case"textarea":me(s),So(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 Mt(a),null;case 6:if(s&&a.stateNode!=null)zx(s,a,s.memoizedProps,y);else{if(typeof y!="string"&&a.stateNode===null)throw Error(n(166));if(u=jo(ba.current),jo(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 Mt(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)Hv(),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;Mt(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),Mt(a),null);case 4:return zs(),Zp(s,a),s===null&&pa(a.stateNode.containerInfo),Mt(a),null;case 10:return Np(a.type._context),Mt(a),null;case 17:return Vt(a.type)&&wc(),Mt(a),null;case 19:if(tt(lt),T=a.memoizedState,T===null)return Mt(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 Mt(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):(Mt(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&&(Mt(a),a.subtreeFlags&6&&(a.flags|=8192)):Mt(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function mI(s,a){switch(xp(a),a.tag){case 1:return Vt(a.type)&&wc(),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,yI=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 Vx=!1;function vI(s,a){if(up=ac,s=xv(),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 we;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),(we=he.firstChild)!==null;)de=he,he=we;for(;;){if(he===s)break t;if(de===u&&++ie===C&&(G=O),de===T&&++fe===y&&(J=O),(we=he.nextSibling)!==null)break;he=de,de=he.parentNode}he=we}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:wn(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=Vx,Vx=!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 Bx(s){var a=s.alternate;a!==null&&(s.alternate=null,Bx(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[eI],delete a[tI])),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 Hx(s){return s.tag===5||s.tag===3||s.tag===4}function Wx(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Hx(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 Kr(s,a,u){for(u=u.child;u!==null;)Ux(s,a,u),u=u.sibling}function Ux(s,a,u){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(Po,u)}catch{}switch(u.tag){case 5:At||Bs(u,a);case 6:var y=Et,C=Sn;Et=null,Kr(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,Kr(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)}Kr(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)}Kr(s,a,u);break;case 21:Kr(s,a,u);break;case 22:u.mode&1?(At=(y=At)||u.memoizedState!==null,Kr(s,a,u),At=y):Kr(s,a,u);break;default:Kr(s,a,u)}}function Kx(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var u=s.stateNode;u===null&&(u=s.stateNode=new yI),a.forEach(function(y){var C=TI.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));Ux(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;)Gx(a,s),a=a.sibling}function Gx(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 we=T.value;we!=null?Je(C,!!T.multiple,we,!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&&Kx(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,we=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){qx(he);continue}}we!==null?(we.return=de,Ee=we):qx(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&&Kx(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(Hx(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=Wx(s);th(s,T,C);break;case 3:case 4:var O=y.stateNode.containerInfo,G=Wx(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 xI(s,a,u){Ee=s,Yx(s)}function Yx(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?Zx(C):J!==null?(J.return=O,Ee=J):Zx(C);for(;T!==null;)Ee=T,Yx(T),T=T.sibling;Ee=C,Vc=G,At=ie}Xx(s)}else(C.subtreeFlags&8772)!==0&&T!==null?(T.return=C,Ee=T):Xx(s)}}function Xx(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:wn(a.type,u.memoizedProps);y.componentDidUpdate(C,u.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var T=a.updateQueue;T!==null&&qv(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}qv(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 qx(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 Zx(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 bI=Math.ceil,Hc=P.ReactCurrentDispatcher,nh=P.ReactCurrentOwner,gn=P.ReactCurrentBatchConfig,We=0,wt=null,ht=null,Nt=0,en=0,Hs=Vr(0),vt=0,Ta=null,Lo=0,Wc=0,rh=0,Pa=null,Ht=null,oh=0,Ws=1/0,dr=null,Uc=!1,sh=null,Gr=null,Kc=!1,Yr=null,Gc=0,Ra=0,ih=null,Yc=-1,Xc=0;function jt(){return(We&6)!==0?at():Yc!==-1?Yc:Yc=at()}function Xr(s){return(s.mode&1)===0?1:(We&2)!==0&&Nt!==0?Nt&-Nt:rI.transition!==null?(Xc===0&&(Xc=Cs()),Xc):(s=Ge,s!==0||(s=window.event,s=s===void 0?16:Jy(s.type)),s)}function En(s,a,u,y){if(50<Ra)throw Ra=0,ih=null,Error(n(185));Ro(s,u,y),((We&2)===0||s!==wt)&&(s===wt&&((We&2)===0&&(Wc|=u),vt===4&&qr(s,Nt)),Wt(s,y),u===1&&We===0&&(a.mode&1)===0&&(Ws=at()+500,Cc&&Hr()))}function Wt(s,a){var u=s.callbackNode;Vf(s,a);var y=Ss(s,s===wt?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?nI(Jx.bind(null,s)):$v(Jx.bind(null,s)),QR(function(){(We&6)===0&&Hr()}),u=null;else{switch(Uy(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=a0(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===wt?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=t0();(wt!==s||Nt!==a)&&(dr=null,Ws=at()+500,Fo(s,a));do try{CI();break}catch(G){e0(s,G)}while(!0);Ep(),Hc.current=T,We=C,ht!==null?a=0:(wt=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,Fo(s,0),qr(s,y),Wt(s,at()),u;if(a===6)qr(s,y);else{if(C=s.current.alternate,(y&30)===0&&!wI(C)&&(a=qc(s,y),a===2&&(T=Qi(s),T!==0&&(y=T,a=ah(s,T))),a===1))throw u=Ta,Fo(s,0),qr(s,y),Wt(s,at()),u;switch(s.finishedWork=C,s.finishedLanes=y,a){case 0:case 1:throw Error(n(345));case 2:zo(s,Ht,dr);break;case 3:if(qr(s,y),(y&130023424)===y&&(a=oh+500-at(),10<a)){if(Ss(s,0)!==0)break;if(C=s.suspendedLanes,(C&y)!==y){jt(),s.pingedLanes|=s.suspendedLanes&C;break}s.timeoutHandle=pp(zo.bind(null,s,Ht,dr),a);break}zo(s,Ht,dr);break;case 4:if(qr(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*bI(y/1960))-y,10<y){s.timeoutHandle=pp(zo.bind(null,s,Ht,dr),y);break}zo(s,Ht,dr);break;case 5:zo(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&&(Fo(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 wI(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 qr(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 Jx(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,Fo(s,0),qr(s,a),Wt(s,at()),u;if(u===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,zo(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&&Hr())}}function $o(s){Yr!==null&&Yr.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&&Hr()}}function uh(){en=Hs.current,tt(Hs)}function Fo(s,a){s.finishedWork=null,s.finishedLanes=0;var u=s.timeoutHandle;if(u!==-1&&(s.timeoutHandle=-1,ZR(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&&wc();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(wt=s,ht=s=Zr(s.current,null),Nt=en=a,vt=0,Ta=null,rh=Wc=Lo=0,Ht=Pa=null,Do!==null){for(a=0;a<Do.length;a++)if(u=Do[a],y=u.interleaved,y!==null){u.interleaved=null;var C=y.next,T=u.pending;if(T!==null){var O=T.next;T.next=C,y.next=O}u.pending=y}Do=null}return s}function e0(s,a){do{var u=ht;try{if(Ep(),_c.current=Lc,Dc){for(var y=ct.memoizedState;y!==null;){var C=y.queue;C!==null&&(C.pending=null),y=y.next}Dc=!1}if(Oo=0,bt=yt=ct=null,wa=!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 we=Nx(O);if(we!==null){we.flags&=-257,kx(we,O,G,T,a),we.mode&1&&Ex(T,ie,a),a=we,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){Ex(T,ie,a),dh();break e}J=Error(n(426))}}else if(st&&G.mode&1){var ft=Nx(O);if(ft!==null){(ft.flags&65536)===0&&(ft.flags|=256),kx(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=Sx(T,J,a);Xv(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"&&(Gr===null||!Gr.has(se)))){T.flags|=65536,a&=-a,T.lanes|=a;var ye=Cx(T,G,a);Xv(T,ye);break e}}T=T.return}while(T!==null)}r0(u)}catch(Pe){a=Pe,ht===u&&u!==null&&(ht=u=u.return);continue}break}while(!0)}function t0(){var s=Hc.current;return Hc.current=Lc,s===null?Lc:s}function dh(){(vt===0||vt===3||vt===2)&&(vt=4),wt===null||(Lo&268435455)===0&&(Wc&268435455)===0||qr(wt,Nt)}function qc(s,a){var u=We;We|=2;var y=t0();(wt!==s||Nt!==a)&&(dr=null,Fo(s,a));do try{SI();break}catch(C){e0(s,C)}while(!0);if(Ep(),We=u,Hc.current=y,ht!==null)throw Error(n(261));return wt=null,Nt=0,vt}function SI(){for(;ht!==null;)n0(ht)}function CI(){for(;ht!==null&&!Df();)n0(ht)}function n0(s){var a=i0(s.alternate,s,en);s.memoizedProps=s.pendingProps,a===null?r0(s):ht=a,nh.current=null}function r0(s){var a=s;do{var u=a.alternate;if(s=a.return,(a.flags&32768)===0){if(u=gI(u,a,en),u!==null){ht=u;return}}else{if(u=mI(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 zo(s,a,u){var y=Ge,C=gn.transition;try{gn.transition=null,Ge=1,EI(s,a,u,y)}finally{gn.transition=C,Ge=y}return null}function EI(s,a,u,y){do Us();while(Yr!==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===wt&&(ht=wt=null,Nt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Kc||(Kc=!0,a0(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,vI(s,u),Gx(u,s),WR(dp),ac=!!up,dp=up=null,s.current=u,xI(u),ec(),We=G,Ge=O,gn.transition=T}else s.current=u;if(Kc&&(Kc=!1,Yr=s,Gc=C),T=s.pendingLanes,T===0&&(Gr=null),Lf(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,Hr(),null}function Us(){if(Yr!==null){var s=Uy(Gc),a=gn.transition,u=Ge;try{if(gn.transition=null,Ge=16>s?16:s,Yr===null)var y=!1;else{if(s=Yr,Yr=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,we=fe.return;if(Bx(fe),fe===ie){Ee=null;break}if(de!==null){de.return=we,Ee=de;break}Ee=we}}}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,Hr(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(Po,s)}catch{}y=!0}return y}finally{Ge=u,gn.transition=a}}return!1}function o0(s,a,u){a=Vs(u,a),a=Sx(s,a,1),s=Ur(s,a,1),a=jt(),s!==null&&(Ro(s,1,a),Wt(s,a))}function ut(s,a,u){if(s.tag===3)o0(s,s,u);else for(;a!==null;){if(a.tag===3){o0(a,s,u);break}else if(a.tag===1){var y=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Gr===null||!Gr.has(y))){s=Vs(u,s),s=Cx(a,s,1),a=Ur(a,s,1),s=jt(),a!==null&&(Ro(a,1,s),Wt(a,s));break}}a=a.return}}function NI(s,a,u){var y=s.pingCache;y!==null&&y.delete(a),a=jt(),s.pingedLanes|=s.suspendedLanes&u,wt===s&&(Nt&u)===u&&(vt===4||vt===3&&(Nt&130023424)===Nt&&500>at()-oh?Fo(s,0):rh|=u),Wt(s,a)}function s0(s,a){a===0&&((s.mode&1)===0?a=1:(a=ws,ws<<=1,(ws&130023424)===0&&(ws=4194304)));var u=jt();s=lr(s,a),s!==null&&(Ro(s,a,u),Wt(s,u))}function kI(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),s0(s,u)}function TI(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),s0(s,u)}var i0;i0=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,hI(s,a,u);Bt=(s.flags&131072)!==0}else Bt=!1,st&&(a.flags&1048576)!==0&&Fv(a,Nc,a.index);switch(a.lanes=0,a.tag){case 2:var y=a.type;zc(s,a),s=a.pendingProps;var C=_s(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=$c,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=RI(y),s=wn(y,s),C){case 0:a=Up(null,a,y,s,u);break e;case 1:a=Ax(null,a,y,s,u);break e;case 11:a=Tx(null,a,y,s,u);break e;case 14:a=Px(null,a,y,wn(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:wn(y,C),Up(s,a,y,C,u);case 1:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:wn(y,C),Ax(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,Yv(s,a),Mc(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=Dx(s,a,y,u,C);break e}else if(y!==C){C=Vs(Error(n(424)),a),a=Dx(s,a,y,u,C);break e}else for(Jt=zr(a.stateNode.containerInfo.firstChild),Qt=a,st=!0,bn=null,u=Kv(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 Zv(a),s===null&&wp(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),Mx(s,a),Dt(s,a,O,u),a.child;case 6:return s===null&&wp(a),null;case 13:return jx(s,a,u);case 4:return Rp(a,a.stateNode.containerInfo),y=a.pendingProps,s===null?a.child=Ls(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:wn(y,C),Tx(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=wn(y,a.pendingProps),C=wn(y.type,C),Px(s,a,y,C,u);case 15:return Rx(s,a,a.type,a.pendingProps,u);case 17:return y=a.type,C=a.pendingProps,C=a.elementType===y?C:wn(y,C),zc(s,a),a.tag=1,Vt(y)?(s=!0,Sc(a)):s=!1,Fs(a,u),bx(a,y,C),Bp(a,y,C,u),Kp(null,a,y,!0,s,u);case 19:return Lx(s,a,u);case 22:return Ix(s,a,u)}throw Error(n(156,a.tag))};function a0(s,a){return Ql(s,a)}function PI(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 PI(s,a,u,y)}function fh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function RI(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 Zr(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 M:return Vo(u.children,C,T,a);case L: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 Vo(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 II(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 II(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 MI(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 l0(s){if(!s)return Br;s=s._reactInternals;e:{if($n(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 Ov(s,u,a)}return a}function c0(s,a,u,y,C,T,O,G,J){return s=gh(u,y,!0,s,C,T,O,G,J),s.context=l0(null),u=s.current,y=jt(),C=Xr(u),T=cr(y,C),T.callback=a??null,Ur(u,T,C),s.current.lanes=C,Ro(s,C,y),Wt(s,y),s}function Jc(s,a,u,y){var C=a.current,T=jt(),O=Xr(C);return u=l0(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=Ur(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 u0(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){u0(s,a),(s=s.alternate)&&u0(s,a)}function AI(){return null}var d0=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=Yy();s={blockedOn:null,target:s,priority:a};for(var u=0;u<Lr.length&&a!==0&&a<Lr[u].priority;u++);Lr.splice(u,0,s),u===0&&Zy(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 f0(){}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=c0(a,y,s,0,null,!1,!1,"",f0);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,"",f0);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)}Ky=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var u=_r(a.pendingLanes);u!==0&&(Bf(a,u|1),Wt(a,at()),(We&6)===0&&(Ws=at()+500,Hr()))}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)}},Gy=function(s){if(s.tag===13){var a=Xr(s),u=lr(s,a);if(u!==null){var y=jt();En(u,s,a,y)}mh(s,a)}},Yy=function(){return Ge},Xy=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=bc(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 DI={usingClientEntryPoint:!1,Events:[ma,Ms,bc,Ul,Kl,ch]},Ia={findFiberByHostInstance:Io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jI={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||AI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Po=ou.inject(jI),un=ou}catch{}}return Ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=DI,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 MI(s,a,null,u)},Ut.createRoot=function(s,a){if(!vh(s))throw Error(n(299));var u=!1,y="",C=d0;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=d0;if(u!=null&&(u.unstable_strictMode===!0&&(C=!0),u.identifierPrefix!==void 0&&(T=u.identifierPrefix),u.onRecoverableError!==void 0&&(O=u.onRecoverableError)),a=c0(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 b0;function a1(){if(b0)return wh.exports;b0=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(),wh.exports=HI(),wh.exports}var w0;function WI(){if(w0)return su;w0=1;var e=a1();return su.createRoot=e.createRoot,su.hydrateRoot=e.hydrateRoot,su}var UI=WI(),Eh={};const _e=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},S0=e=>e==null?"":""+e,KI=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},GI=/###/g,C0=e=>e&&e.indexOf("###")>-1?e.replace(GI,"."):e,E0=e=>!e||_e(e),Ga=(e,t,n)=>{const r=_e(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(E0(e))return{};const i=C0(r[o]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++o}return E0(e)?{}:{obj:e,k:C0(r[o])}},N0=(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},YI=(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]},XI=(e,t,n)=>{const r=Vu(e,n);return r!==void 0?r:Vu(t,n)},l1=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?_e(e[r])||e[r]instanceof String||_e(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):l1(e[r],t[r],n):e[r]=t[r]);return e},Bo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var qI={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ZI=e=>_e(e)?e.replace(/[&<>"'\/]/g,t=>qI[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 JI=[" ",",","?","!",";"],eM=new QI(20),tM=(e,t,n)=>{t=t||"",n=n||"";const r=JI.filter(l=>t.indexOf(l)<0&&n.indexOf(l)<0);if(r.length===0)return!0;const o=eM.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,"-"),nM={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||nM,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:(_e(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 wd{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 k0 extends wd{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):_e(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||!_e(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),N0(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)(_e(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?l1(d,r,i):d={...d,...r},N0(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 c1={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 u1=Symbol("i18next/PATH_KEY");function rM(){const e=[],t=Object.create(null);let n;return t.get=(r,o)=>(n?.revoke?.(),o===u1?e:(e.push(o),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function si(e,t){const{[u1]:n}=e(rM()),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 T0={},Nh=e=>!_e(e)&&typeof e!="boolean"&&typeof e!="number";class Hu extends wd{constructor(t,n={}){super(),KI(["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&&!tM(t,r,o);if(l&&!c){const d=t.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:t,namespaces:_e(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:_e(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 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&&!_e(o.count),_=Hu.hasDefaultValue(o),R=P?this.pluralResolver.getSuffix(h,o.count,o):"",M=o.ordinal&&P?this.pluralResolver.getSuffix(h,o.count,{ordinal:!1}):"",L=P&&!o.ordinal&&o.count===0,D=L&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${R}`]||o[`defaultValue${M}`]||o.defaultValue;let H=S;k&&!S&&_&&(H=D);const j=Nh(H),U=Object.prototype.toString.apply(H);if(k&&H&&j&&w.indexOf(U)<0&&!(_e(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(b,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:b;for(const A in H)if(Object.prototype.hasOwnProperty.call(H,A)){const V=`${B}${l}${A}`;_&&!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&&_e(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)&&_&&(Y=!0,S=D),this.isValidLookup(S)||(I=!0,S=c);const A=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:S,V=_&&D!==S&&this.options.updateMissing;if(I||Y||V){if(this.logger.log(V?"updateKey":"missingKey",h,f,c,V?D:S),l){const $=this.resolve(c,{...o,keySeparator:!1});$&&$.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 $=0;$<W.length;$++)F.push(W[$]);else this.options.saveMissingTo==="all"?F=this.languageUtils.toResolveHierarchy(o.lng||this.language):F.push(o.lng||this.language);const q=($,z,X)=>{const Q=_&&X!==S?X:A;this.options.missingKeyHandler?this.options.missingKeyHandler($,f,z,Q,V,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing($,f,z,Q,V,o),this.emit("missingKey",$,f,z,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach($=>{const z=this.pluralResolver.getSuffixes($,o);L&&o[`defaultValue${this.options.pluralSeparator}zero`]&&z.indexOf(`${this.options.pluralSeparator}zero`)<0&&z.push(`${this.options.pluralSeparator}zero`),z.forEach(X=>{q([$],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=_e(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&&!_e(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=_e(l)?[l]:l;return t!=null&&c?.length&&r.applyPostProcessor!==!1&&(t=c1.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 _e(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&&!_e(n.count),x=v&&!n.ordinal&&n.count===0,S=n.context!==void 0&&(_e(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,!T0[`${b[0]}-${E}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(c)&&(T0[`${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 _=`${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+_)),S){const M=`${g}${this.options.contextSeparator||"_"}${n.context}`;N.push(M),v&&(n.ordinal&&P.indexOf(R)===0&&N.push(M+P.replace(R,this.options.pluralSeparator)),N.push(M+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&&!_e(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 P0{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(_e(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)),_e(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 _e(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))):_e(t)&&i(this.formatLanguageCode(t)),r.forEach(l=>{o.indexOf(l)<0&&i(this.formatLanguageCode(l))}),o}}const R0={zero:0,one:1,two:2,few:3,many:4,other:5},I0={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class oM{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!"),I0;if(!t.match(/-|_/))return I0;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)=>R0[o]-R0[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 M0=(e,t,n,r=".",o=!0)=>{let i=XI(e,t,n);return!i&&o&&_e(n)&&(i=gg(e,n,r),i===void 0&&(i=gg(t,n,r))),i},kh=e=>e.replace(/\$/g,"$$$$");class A0{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:ZI,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=i?Bo(i):l||"{{",this.suffix=c?Bo(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=g?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":g||"",this.nestingPrefix=v?Bo(v):x||Bo("$t("),this.nestingSuffix=S?Bo(S):b||Bo(")"),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=M0(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(M0(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=_e(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!_e(l)&&!this.useRawValueToEscape&&(l=S0(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(`${Bo(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&&!_e(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&&!_e(i))return i;_e(i)||(i=S0(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 sM=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)}},iM=e=>(t,n,r)=>e(Ja(n),r)(t);class aM{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:iM;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}=sM(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 lM=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class cM extends wd{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=>{YI(d.loaded,[i],l),lM(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();_e(t)&&(t=this.languageUtils.toResolveHierarchy(t)),_e(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]),_e(e[1])&&(t.defaultValue=e[1]),_e(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}),D0=e=>(_e(e.ns)&&(e.ns=[e.ns]),_e(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),_e(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=()=>{},uM=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})},d1="__i18next_supportNoticeShown",dM=()=>!!(typeof globalThis<"u"&&globalThis[d1]||typeof process<"u"&&Eh&&Eh.I18NEXT_NO_SUPPORT_NOTICE||typeof process<"u"&&Eh),fM=()=>{typeof globalThis<"u"&&(globalThis[d1]=!0)},pM=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 wd{constructor(t={},n){if(super(),this.options=D0(t),this.services={},this.logger=Un,this.modules={external:[]},uM(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&&(_e(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Th();this.options={...r,...this.options,...D0(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&&!pM(this)&&!dM()&&(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 💙"),fM());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=aM;const g=new P0(this.options);this.store=new k0(this.options.resources,this.options);const h=this.services;h.logger=Un,h.resourceStore=this.store,h.languageUtils=g,h.pluralResolver=new oM(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 A0(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new cM(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=_e(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"&&c1.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=_e(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(_e(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 _e(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?(_e(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();_e(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 P0(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 k0(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 A0(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 hM=(e,t,n,r)=>{const o=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Xo(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},j0={},mg=(e,t,n,r)=>{Xo(n)&&j0[n]||(Xo(n)&&(j0[n]=new Date),hM(e,t,n,r))},f1=(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,f1(e,n))},O0=(e,t,n,r)=>{if(Xo(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return yg(e,n,r);n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,f1(e,r))},gM=(e,t,n={})=>!t.languages||!t.languages.length?(mg(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Xo=e=>typeof e=="string",mM=e=>typeof e=="object"&&e!==null,yM=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,vM={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},xM=e=>vM[e],bM=e=>e.replace(yM,xM);let vg={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:bM};const wM=(e={})=>{vg={...vg,...e}},SM=()=>vg;let p1;const CM=e=>{p1=e},EM=()=>p1,NM={type:"3rdParty",init(e){wM(e.options.react),CM(e)}},h1=m.createContext();class kM{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const TM=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current},g1=(e,t,n,r)=>e.getFixedT(t,n,r),PM=(e,t,n,r)=>m.useCallback(g1(e,t,n,r),[e,t,n,r]),Xe=(e,t={})=>{const{i18n:n}=t,{i18n:r,defaultNS:o}=m.useContext(h1)||{},i=n||r||EM();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new kM),!i){mg(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const P=(R,M)=>Xo(M)?M:mM(M)&&Xo(M.defaultValue)?M.defaultValue:Array.isArray(R)?R[R.length-1]:R,_=[P,{},!1];return _.t=P,_.i18n={},_.ready=!1,_}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={...SM(),...i.options.react,...t},{useSuspense:c,keyPrefix:d}=l;let f=o||i.options?.defaultNS;f=Xo(f)?[f]:f||["translation"],i.reportNamespaces.addUsedNamespaces?.(f);const g=(i.isInitialized||i.initializedStoreOnce)&&f.every(P=>gM(P,i,l)),h=PM(i,t.lng||null,l.nsMode==="fallback"?f:f[0],d),v=()=>h,x=()=>g1(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=TM(E),N=m.useRef(!0);m.useEffect(()=>{const{bindI18n:P,bindI18nStore:_}=l;N.current=!0,!g&&!c&&(t.lng?O0(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),_&&i?.store.on(_,R),()=>{N.current=!1,i&&P&&P?.split(" ").forEach(M=>i.off(M,R)),_&&i&&_.split(" ").forEach(M=>i.store.off(M,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?O0(i,t.lng,f,()=>P()):yg(i,f,()=>P())})};function RM({i18n:e,defaultNS:t,children:n}){const r=m.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return m.createElement(h1.Provider,{value:r},n)}const IM={new:"Neu",open:"Öffnen…",save:"Speichern",undo:"Rückgängig",redo:"Wiederholen",validate:"Validieren"},MM={toggleTheme:"Design wechseln",changeLanguage:"Sprache ändern"},AM={discard:"Nicht gespeicherte Änderungen verwerfen?"},_M={saveFailed:"Speichern fehlgeschlagen",loadFailed:"Laden fehlgeschlagen",error:"Etwas ist schiefgelaufen"},DM={invalidJson:"Ungültiges JSON"},jM={toolbar:IM,a11y:MM,confirm:AM,toast:_M,error:DM},OM={new:"New",open:"Open…",save:"Save",undo:"Undo",redo:"Redo",validate:"Validate"},LM={toggleTheme:"Toggle theme",changeLanguage:"Change language"},$M={discard:"Discard unsaved changes?"},FM={saveFailed:"Save failed",loadFailed:"Load failed",error:"Something went wrong"},zM={invalidJson:"Invalid JSON"},VM={toolbar:OM,a11y:LM,confirm:$M,toast:FM,error:zM},xg="fh-lang";function BM(){return localStorage.getItem(xg)==="de"?"de":"en"}Tt.use(NM).init({resources:{en:{translation:VM},de:{translation:jM}},lng:BM(),fallbackLng:"en",interpolation:{escapeValue:!1}});var xe=(e=>(e.Input="Input",e.Output="Output",e.Logic="Logic",e.Data="Data",e.Trigger="Trigger",e.Tool="Tool",e.AI="AI",e.Function="Function",e))(xe||{}),kr=(e=>(e.Network="Network",e.Pin="Pin",e.Serial="Serial",e))(kr||{});const HM={type:"ReadPin",label:"Read Pin",category:xe.Input,tags:[kr.Pin],description:"Read data from a pin",outputs:[{id:"output",label:"Pin Value",type:"static",dataType:e=>e.signalType==="digital"?"bool":"int"}],parameters:[{id:"pinReference",label:"Pin",description:"IO pin to read from",type:"channelSelect",channelType:e=>e.signalType==="digital"?["GPIOIN"]:["ADC"]},{id:"signalType",label:"Signal Type",description:"Type of signal",type:"selection",default:"digital",options:[{value:"digital",label:"Digital"},{value:"analog",label:"Analog"}]},{id:"toolDescription",label:"Tool Description",description:"Description shown to the agent when this node is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}]},WM={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"}]}]},UM={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}]},KM={type:"SerialRead",label:"Serial Read",category:xe.Input,tags:[kr.Serial],description:"Read string from serial port",outputs:[{id:"output",label:"Serial Data",type:"static",dataType:"string"}],parameters:[{id:"portReference",label:"Port",description:"Serial port to read from",type:"channelSelect",channelType:["UART"]},{id:"prompt",label:"Input prompt",description:"Prompt for the serial read operation",type:"string",optional:!0}]},GM={type:"CameraCapture",label:"Camera Capture",category:xe.Input,description:"Capture a still image from a camera",outputs:[{id:"output",label:"Image",type:"static",dataType:"image"}],parameters:[{id:"cameraReference",label:"Camera",description:"Camera to capture from",type:"channelSelect",channelType:["CAMERA"]}]},YM={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"}]}]},XM={type:"MLInference",label:"ML Inference",category:xe.AI,description:"Runs a machine-learning model on an input and returns its result",outputs:[{id:"output",label:"Result",type:"static",dataType:"string"}],parameters:[{id:"model",label:"Model",description:"ML model to run",type:"modelSelect",modelType:["MLModel"]},{id:"input",label:"Input",description:"Variable whose value is fed to the model",type:"variableSelect"}]},qM={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},ZM={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}]},QM={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"}]},JM={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:[]}]},eA={type:"OnStartup",label:"On Startup",category:xe.Trigger,description:"Fires once when the device powers on",parameters:[],isSingleton:!0},tA={type:"OnPinEdge",label:"On Pin Edge",category:xe.Trigger,tags:[kr.Pin],description:"Fires when a digital pin transitions",parameters:[{id:"pinReference",label:"Pin",description:"Digital pin to watch",type:"channelSelect",channelType:["GPIOIN"]},{id:"edge",label:"Edge",description:"Edge transition that fires the trigger",type:"selection",options:[{value:"rising",label:"Rising"},{value:"falling",label:"Falling"},{value:"both",label:"Both"}],default:"both"}]},nA={type:"OnSerialReceive",label:"On Serial Receive",category:xe.Trigger,tags:[kr.Serial],description:"Fires when serial data arrives",outputs:[{id:"output",label:"Serial Data",type:"static",dataType:"string"}],parameters:[{id:"portReference",label:"Port",description:"Serial port to listen on",type:"channelSelect",channelType:["UART"]}]},rA={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}]},oA={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}]},sA={type:"WritePin",label:"Write Pin",category:xe.Output,tags:[kr.Pin],description:"Write data to a pin",parameters:[{id:"pinReference",label:"Pin",description:"IO pin to write to",type:"channelSelect",channelType:e=>e.signalType==="digital"?["GPIOOUT"]:["PWM","DAC"]},{id:"signalType",label:"Signal Type",description:"Type of signal",type:"selection",default:"digital",options:[{value:"digital",label:"Digital"},{value:"analog",label:"Analog"}]},{id:"value",label:"Value",description:"What value to write to the pin",type:"expression",expressionType:e=>e.signalType==="digital"?"bool":"int",default:{expression:"",references:[],dataType:"bool"}}]},iA={type:"SerialWrite",label:"Serial Write",category:xe.Output,tags:[kr.Serial],description:"Write string to serial port",parameters:[{id:"portReference",label:"Port",description:"Serial port 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"}}]},aA={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"}}]},lA={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"}}]},cA={type:"MqttPublish",label:"MQTT Publish",category:xe.Output,tags:[kr.Network],description:"Publish a value to an MQTT topic",parameters:[{id:"channelReference",label:"Channel",description:"MQTT channel to publish through",type:"channelSelect",channelType:["MQTT"]},{id:"dataType",label:"Data Type",description:"Data type of the value to publish",type:"selection",options:[{value:"int",label:"Integer"},{value:"float",label:"Float"},{value:"bool",label:"Boolean"},{value:"string",label:"String"}],default:"string"},{id:"value",label:"Value",description:"Value to publish",type:"expression",expressionType:e=>e.dataType,default:{expression:"",references:[],dataType:"string"}},{id:"qos",label:"QoS",description:"Quality of Service level",type:"selection",options:[{value:"0",label:"0 - At most once"},{value:"1",label:"1 - At least once"},{value:"2",label:"2 - Exactly once"}],default:"0"},{id:"retain",label:"Retain",description:"Whether the broker should retain the message",type:"bool",default:!1}]},uA={type:"OnMqttMessage",label:"On MQTT Message",category:xe.Trigger,tags:[kr.Network],description:"Fires when a message is received on a subscribed MQTT topic",outputs:[{id:"output",label:"Message Value",type:"static",dataType:e=>e.dataType}],parameters:[{id:"channelReference",label:"Channel",description:"MQTT channel to subscribe through",type:"channelSelect",channelType:["MQTT"]},{id:"dataType",label:"Data Type",description:"Expected data type of the received message value",type:"selection",options:[{value:"int",label:"Integer"},{value:"float",label:"Float"},{value:"bool",label:"Boolean"},{value:"string",label:"String"}],default:"string"}]};class dA{nodes=new Map;initialized=!1;initialize(){this.initialized||(this.register(HM),this.register(KM),this.register(sA),this.register(iA),this.register(YM),this.register(XM),this.register(aA),this.register(lA),this.register(qM),this.register(ZM),this.register(QM),this.register(JM),this.register(eA),this.register(tA),this.register(nA),this.register(rA),this.register(oA),this.register(WM),this.register(UM),this.register(GM),this.register(cA),this.register(uA),this.initialized=!0)}register(t){this.nodes.set(t.type,t)}getAll(){return Array.from(this.nodes.values())}getAllCategories(){const t=new Set(this.getAll().map(n=>n.category));return Array.from(t).sort()}getByType(t){return this.nodes.get(t)}getByCategory(t){return this.getAll().filter(n=>n.category===t)}}const Lt=new dA;Lt.initialize();const fA={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 m1(e){return fA[e]}function dm(e){return e==="control"||e==="agentTask"||e==="agentChoice"||e==="agentDelegate"}function y1(e){return e==="tool"}function L0(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 $0(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 so(e){switch(e.kind){case"node":return`${e.nodeId}:${e.outputId}`;case"declared":return`declared:${e.uid}`;case"fnarg":return`fnarg:${e.uid}`}}function Pi(e){return`declared:${e}`}function fm(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 fm(e.varId);default:return el(e.srcId,e.varId)}}function v1(e){return"uid"in e&&e.uid?e:{uid:an(),name:e.name,dataType:e.dataType}}function F0(e){return e.map(v1)}function Jo(e){return e.uid}function pm(e,t){const n=[],r={},o=new Set;for(const i of t)y1(i.type)&&o.add(i.target);for(const[i,l]of Object.entries(e))l.kind==="node"&&o.has(l.nodeId)||(n.push(l),r[i]=l);return{list:n,lookup:r}}function Ri(e,t){return typeof e=="function"?e(t):e}function Tr(e,t,n){return e.activationRules?.length?e.activationRules.every(r=>{switch(r.type){case"isControlFlow":return!n;case"isToolInput":return n;case"parameterIn":return r.values.includes(t[r.parameterId])}}):!0}function wl(e){return e==null||e===""}function x1(e,t,n=!1){for(const r of t)(r.activationRules?.length&&!Tr(r,e,n)||wl(e[r.id]))&&delete e[r.id]}function b1(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 pA(e,t){return e.capabilities===void 0?void 0:Ri(e.capabilities,t)}function w1(e,t){return Ri(e.channelType,t)}function S1(e,t){return Ri(e.memoryType,t)}function C1(e,t){return Ri(e.modelType,t)}function E1(e,t){return Ri(e.dataType,t)}function Wu(e,t){return e[t]}function N1(e,t){const n=e.arguments;if(e.type==="FunctionCall")return Wu(n,t);const r=Lt.getByType(e.type);if(r?.outputs)for(const o of r.outputs)if(o.type==="static"){if(o.id===t)return Wu(n,o.id)}else{const l=n[o.id]?.find(c=>c.mode==="emit"&&c.uid===t);if(l&&l.mode==="emit")return{active:!0,mode:"emit",name:l.name}}}function 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":case"CameraCapture":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"MLInference":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 k1(e){const t={};if(e.type==="FunctionCall"){for(const o of e.functionInfo.returns)t[o.uid]={name:o.name,dataType:o.dataType};return t}const n=Lt.getByType(e.type);if(!n?.outputs)return t;const r=e.arguments;for(const o of n.outputs)if(o.type==="static")t[o.id]={name:o.id,dataType:E1(o,e.arguments)};else{const i=r[o.id]??[];for(const l of i)l.mode==="emit"&&(t[l.uid]={name:l.name,dataType:l.dataType})}return t}function Uu(e){const t={},n=e.arguments,r=(i,l,c,d)=>{if(!d){t[i]={name:l,dataType:c};return}d.active&&d.mode==="emit"&&(t[i]={name:d.name,dataType:c})};if(e.type==="FunctionCall"){for(const i of e.functionInfo.returns)r(i.uid,i.name,i.dataType,Wu(n,i.uid));return t}const o=Lt.getByType(e.type);if(!o?.outputs)return t;for(const i of o.outputs)if(i.type==="static")r(i.id,i.id,E1(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 hA(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 bg(e,t=n=>n){return{type:"FunctionCall",functionInfo:e,label:e.name,category:xe.Function,description:t("builder.functionCallDesc",{name:e.name}),parameters:[...e.arguments.map(n=>({id:Jo(n),label:n.name,description:t("builder.functionParamDesc",{name:n.name}),type:"expression",expressionType:n.dataType,default:{expression:"",references:[],dataType:n.dataType},activationRules:[{type:"isControlFlow"}]})),{id:"toolDescription",label:"Tool Description",description:"Description shown to the agent when this function is wired as a tool",type:"string",multiline:!0,activationRules:[{type:"isToolInput"}]}],outputs:e.returns.map(n=>({id:Jo(n),label:n.name,type:"static",dataType:n.dataType}))}}function z0(e,t){const n=gA(e,e.position,t);if(e.label&&(n.label=e.label),"arguments"in n&&n.arguments){const r=e.type!=="FunctionCall"?Lt.getByType(e.type):void 0;r&&x1(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 gA(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"MLInference":return{id:e.id,type:e.type,position:t,arguments:{model:e.arguments.model,input:e.arguments.input,output:e.arguments.output}};case"CameraCapture":return{id:e.id,type:e.type,position:t,arguments:{cameraReference:e.arguments.cameraReference,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 V0(e,t){return{...mA(e,t),position:e.position}}function mA(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"MLInference":return{id:e.id,type:e.type,label:e.label,arguments:{model:e.arguments.model??"",input:e.arguments.input,output:e.arguments.output}};case"CameraCapture":return{id:e.id,type:e.type,label:e.label,arguments:{cameraReference:e.arguments.cameraReference??"",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 es(e){return typeof e=="object"&&e!==null&&"expression"in e&&"references"in e}class yA{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 vA{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 xA=new yA;Object.assign(ae,{hooks:xA,plugins:new vA(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(),bA=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(ae).filter(e=>!bA.includes(e)&&nl[e]===void 0).forEach(e=>{nl[e]=ae[e]});nl.Jsep=ae;const wA="ConditionalExpression";var SA={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:wA,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(SA);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=RA(r));let i;try{i=nl(r)}catch(c){return{isValid:!1,inferredType:null,errors:[`Parse error: ${c instanceof Error?c.message:String(c)}`]}}const l=co(i,n,t);return l&&e.expectedType!==l&&(PA(l,e.expectedType)||t.push(`Type mismatch: expression evaluates to '${l}', expected '${e.expectedType}'`)),{isValid:t.length===0&&l!==null,inferredType:l,errors:t}}function co(e,t,n){switch(e.type){case"Literal":return CA(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 EA(e,t,n);case"UnaryExpression":return NA(e,t,n);case"ConditionalExpression":{const r=e;co(r.test,t,n)!=="bool"&&n.push("Ternary condition must be boolean");const i=co(r.consequent,t,n),l=co(r.alternate,t,n);if(i&&l&&i!==l){if(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 TA(e,t,n);default:return n.push(`Unsupported expression type: ${e.type}`),null}}function CA(e){const t=e.value;return typeof t=="boolean"?"bool":typeof t=="number"?Number.isInteger(t)?"int":"float":typeof t=="string"?"string":"int"}function EA(e,t,n){const r=co(e.left,t,n),o=co(e.right,t,n),i=e.operator;return!r||!o?null:i==="+"&&(r==="string"||o==="string")?r==="image"||o==="image"?(n.push("An image value cannot be used in a string expression"),null):"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 NA(e,t,n){const r=co(e.argument,t,n);return r?e.operator==="!"?(r!=="bool"&&n.push(`Logical NOT '!' requires boolean operand (got '${r}')`),"bool"):e.operator==="-"||e.operator==="+"?(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 kA={int:"int",float:"float",bool:"bool",str:"string"};function TA(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=kA[o];return i?e.arguments.length!==1?(n.push(`${o}() expects exactly 1 argument, got ${e.arguments.length}`),null):(co(e.arguments[0],t,n),i):(n.push(`Unknown function '${o}'. Available cast functions: int(), float(), bool(), str()`),null)}function Tn(e){return e==="int"||e==="float"}function PA(e,t){return e===t||Tn(e)&&Tn(t)?!0:e==="image"?!1:t==="string"}function RA(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 T1=["GPIOIN","GPIOOUT","ADC","PWM","DAC","UART","MQTT","LOG","CAMERA"],Ed={parameters:[{id:"type",label:"Type",description:"Channel type",type:"selection",default:"GPIOIN",options:T1.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"]}]},{id:"width",label:"Width (px)",description:"Default capture width in pixels (source's native resolution when empty)",type:"int",optional:!0,activationRules:[{type:"parameterIn",parameterId:"type",values:["CAMERA"]}]},{id:"height",label:"Height (px)",description:"Default capture height in pixels (source's native resolution when empty)",type:"int",optional:!0,activationRules:[{type:"parameterIn",parameterId:"type",values:["CAMERA"]}]}]};function IA(e){const{id:t,label:n,type:r}=e,o={...e.arguments,type:r};switch(x1(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};case"CAMERA":return{type:r,id:t,label:n,width:o.width,height:o.height}}}function MA(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;case"CAMERA":o.width=e.width,o.height=e.height;break}return{id:t,label:n,type:r,arguments:o}}const AA={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}]},_A={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 DA{memories=new Map;initialized=!1;initialize(){this.initialized||(this.register(AA),this.register(_A),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 DA;Nd.initialize();function jA(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 OA(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 LA={type:"LLMModel",label:"Custom LLM Model",description:"A self-hosted or custom LLM the llmproxy doesn't ship by default",parameters:[]},$A={type:"MLModel",label:"ML Model",description:"A machine-learning model served by an inference component (e.g. object detection)",parameters:[]};class FA{models=new Map;initialized=!1;initialize(){this.initialized||(this.register(LA),this.register($A),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 FA;kd.initialize();function zA(e){const{id:t,label:n,type:r,arguments:o}=e;switch(r){case"LLMModel":return{type:r,id:t,label:n,capabilities:o.capabilities??["chat"]};case"MLModel":return{type:r,id:t,label:n}}}function VA(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 BA(e){const t={};for(const n of e.outputs)t[n.uid]=n.expression;return{functionInfo:Td(e),outputAssignments:t}}function HA(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 P1(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),b=Sd(r),E=tl(n,r,g);for(const R of o.parameters){if(!Tr(R,b,E))continue;const M=b[R.id];if(es(M)&&M.expression){const L=Sl(M,i);R.type==="expression"&&(L.expectedType=b1(R,b,i));const D=Cd(L);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 L=es(M)&&!M.expression,D=R.type==="variableSelect"&&(!M||typeof M=="object"&&M!==null&&!M.varId);(wl(M)||L||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"&&M){const L=M;if(L.varId){const D=yr(L);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"&&M){const L=M,D=Object.values(l).find(H=>H.id===L);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 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(M)&&c){const L=M,D=new Set(Object.values(c).filter(j=>j.type==="MemoryFile").map(j=>j.id)),H=L.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"&&M&&c){const L=M,D=Object.values(c).find(H=>H.id===L);D?S1(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"&&M&&d){const L=M,D=Object.values(d).find(H=>H.id===L);D?C1(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(L)&&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=k1(r);for(const L of Object.keys(R)){const D=N1(r,L);if(!D||!D.active||D.mode!=="assign")continue;const H=R[L];if(!D.target.srcId){x.push({severity:"error",category:"assign-type-mismatch",canvasId:t,nodeId:n,outputId:L,message:`Output "${H?.name??L}" 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:L,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:L,message:`Output "${H?.name??L}" assigns to a deleted variable`})}const M=(o.outputs??[]).filter(L=>L.type==="list");for(const L of M){const D=r.arguments[L.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=`${L.id}[${U}]`;if(!j.name||j.name.trim()===""?x.push({severity:"error",category:"missing-required-param",canvasId:t,nodeId:n,outputId:Y,message:`${L.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:`${L.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:`${L.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:`${L.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:`${L.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)),_=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(M=>P.has(M.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)_.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 R1(e){const{canvasId:t,edgeId:n,edgeType:r,edgeData:o,availableVariables:i,sourceControlEdgeCount:l}=e,c=[],d=m1(r);if(d.parameters.length===0)return c;const f=l>1;for(const g of d.parameters){if(g.id==="description"&&!f&&(r==="agentChoice"||r==="agentDelegate"))continue;const h=o?.[g.id];if(g.type==="expression"){const v=h;if(!v?.expression){c.push({severity:"error",category:"missing-required-param",canvasId:t,edgeId:n,paramId:g.id,message:`Missing required parameter "${g.label}" on edge`});continue}if(es(v)){const x=Sl(v,i),S=Cd(x);S.isValid||c.push({severity:"error",category:"invalid-expression",canvasId:t,edgeId:n,paramId:g.id,message:`Invalid expression for "${g.label}": ${S.errors.join(", ")}`})}}else h||c.push({severity:"error",category:"missing-required-param",canvasId:t,edgeId:n,paramId:g.id,message:`Missing required parameter "${g.label}" on edge`})}return c}function I1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",channelId:e.id,message:"Channel has no label"});const n={...e.arguments,type:e.type};for(const r of Ed.parameters){if(r.id==="type"||!Tr(r,n,!1)||r.optional)continue;const o=e.arguments[r.id];wl(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 M1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",memoryId:e.id,message:"Memory has no label"});const n=Nd.getByType(e.type);for(const r of n?.parameters??[]){if(!Tr(r,e.arguments,!1)||r.optional)continue;const o=e.arguments[r.id];wl(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 A1(e){const t=[];(!e.label||e.label.trim()==="")&&t.push({severity:"error",category:"missing-required-param",modelId:e.id,message:"Model has no label"});const n=kd.getByType(e.type);for(const r of n?.parameters??[]){if(!Tr(r,e.arguments,!1)||r.optional)continue;const o=e.arguments[r.id];wl(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 _1(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 WA(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 _1(e.outputs,t))n.push({...r,functionId:e.id});return n}function UA(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Td(r);return t}function KA(e){const t=e.canvases??{},n=e.functions??{},r=UA(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}=pm(S.variables,E),N=[];for(const _ of b){const R=_;let M,L=!1,D=!1;if(R.type==="FunctionCall"){const j=R,U=r[j.functionInfo.id];D=!U,L=U?j.functionInfo.version!==U.version:!1,U?M=bg(U):M=bg(j.functionInfo)}else M=Lt.getByType(R.type);const H=P1({canvasId:x,nodeId:_.id,nodeData:R,nodeDefinition:M,availableVariables:w,channels:o,memory:i,models:l,edges:E,isStale:L,isDeleted:D});N.push(...H)}const k=new Map;for(const _ of E)dm(_.type)&&k.set(_.source,(k.get(_.source)??0)+1);for(const _ of E){const R=_.type??"control",M=R1({canvasId:x,edgeId:_.id,edgeType:R,edgeData:_.data,availableVariables:w,sourceControlEdgeCount:k.get(_.source)??0});N.push(...M)}const P=n[x];if(P)for(const _ of _1(P.outputs,w))N.push({..._,canvasId:x});if(N.length>0){const _=N.filter(L=>L.severity==="error").length,R=N.filter(L=>L.severity==="warning").length,M=x===He?"Main":n[x]?.name??x;c.push({canvasId:x,canvasLabel:M,diagnostics:N,errorCount:_,warningCount:R}),d+=_,f+=R}}const g=[];for(const x of Object.values(o))g.push(...I1(x));for(const x of g)x.severity==="error"?d++:f++;const h=[];for(const x of Object.values(i))h.push(...M1(x));for(const x of h)x.severity==="error"?d++:f++;const v=[];for(const x of Object.values(l))v.push(...A1(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 GA="Node-Bibliothek",YA="Node-Bibliothek",XA="Diagnose",qA="Funktionsdefinition",ZA="Öffnen",QA="Schließen",JA="Speichern",e_="Als JSON exportieren",t_="Versionsverlauf",n_="Testen",r_="Ausführen",o_="Stoppen",s_="Bereitstellen",i_="Konfigurieren",a_="Node hinzufügen",l_="Node löschen",c_="Node duplizieren",u_="Nodes verbinden",d_="Nodes trennen",f_="Vergrößern",p_="Verkleinern",h_="An Ansicht anpassen",g_="Auto-Layout",m_="Raster",y_="Raster anzeigen",v_="Am Raster ausrichten",x_="Rückgängig",b_="Wiederholen",w_="Ausschneiden",S_="Kopieren",C_="Einfügen",E_="Alle auswählen",N_="Auswahl aufheben",k_="Canvas",T_="Parameter",P_="Verbindungen",R_="Validierung",I_="Fehler",M_="Warnungen",A_="Keine Fehler gefunden",__="Unbekannter Nodetyp: {{type}}",D_="Node löschen",j_="Auf neueste Definition aktualisieren",O_="Funktionsaufruf-Nodes aktualisiert",L_="{{count}} Node(s) wurden auf die neueste Funktionsdefinition migriert.",$_="Variablen",F_="KI-Modelle",z_="Agenten",V_="Konversationen",B_="Keine Variablen verfügbar",H_="Fügen Sie Nodes hinzu, um deren Ausgabevariablen zu sehen",W_="AI-Agenten für Ihren Workflow verwalten und konfigurieren",U_="Noch keine Agenten konfiguriert",K_="Agent hinzufügen",G_="Verfügbare Agenten",Y_="Demnächst...",X_="Konversationsabläufe anzeigen und verwalten",q_="Noch keine Konversationen",Z_="Neue Konversation",Q_="Vorlagen",J_="Neuer Workflow",eD="Nodes durchsuchen...",tD="Keine Parameter",nD="+{{count}} weitere",rD="Parameter:",oD="Erforderlich",sD="Optional",iD="Typ:",aD="Standard:",lD="Optionen:",cD="{{count}} Parameter",uD="Text",dD="Zahl",fD="Boolean",pD="Auswahl",hD="Expr",gD="Derzeit sind keine LLM-Modelle verfügbar. Bitte kontaktieren Sie den Support.",mD="Noch keine ML-Modelle angelegt. Fügen Sie eins im KI-Modelle-Panel hinzu.",yD="Noch kein passender Kanal angelegt. Fügen Sie einen im Kanäle-Panel hinzu.",vD="Generierte Konfiguration",xD="Projekt importieren",bD="JSON-Konfiguration",wD="JSON-Konfiguration hier einfügen...",SD="Oder Datei hochladen",CD="Workflow speichern",ED="Projekt erstellen",ND="Erstellen",kD="Ungespeicherter Entwurf",TD="Sie haben ungespeicherte Änderungen, die verloren gehen. Trotzdem verlassen?",PD="Das Projekt konnte nicht erstellt werden. Laden Sie Ihre Arbeit als JSON herunter, um sie nicht zu verlieren.",RD="Als JSON herunterladen",ID="Workflow Name eingeben...",MD="Beschreibung (optional)",AD="Kurze Beschreibung des Workflows...",_D="Speichere...",DD="Agenten-Node testen",jD="Sende einen Prompt an den Agenten und streame die Antwort. Die Kosten werden mit deinem Guthaben verrechnet.",OD="Prompt",LD="Beschreibe die Aufgabe für den Agenten",$D="Wird getestet…",FD="Test starten",zD="Stopp",VD="Agent testen",BD="Max. Durchläufe",HD="Tool-Aufruf: {{name}}",WD="Tool-Ergebnis: {{name}}",UD="Endergebnis ({{turns}} Durchläufe)",KD="Strukturierte Ausgabe",GD="Strukturierte Ausgabe konnte nicht als JSON geparst werden",YD="Roh-JSON",XD="Name",qD="Typ",ZD="Wert",QD="Kein Node gewählt",JD="Bitte wähle einen Ziel-Node im Canvas.",e2="Import Fehler",t2="Ungültiges JSON-Format",n2="Export erfolgreich",r2="Konfiguration wurde heruntergeladen",o2="Kopiert",s2="Konfiguration wurde in die Zwischenablage kopiert",i2="Automatischer Checkpoint",a2="Auto",l2="Version umbenennen",c2="Visuelle Vorschau kommt bald",u2="Lade Versionen...",d2="Keine Versionen vorhanden.",f2="Versionen sind schreibgeschützt und können nicht verändert werden.",p2="Dialoge laden…",h2="Versionen laden…",g2="Testdialog lädt…",m2="Aktuell",y2="Neue Funktion",v2="Ausdruck eingeben...",x2="{{type}}-Ausdruck eingeben...",b2="von {{node}}",w2="Funktion hinzufügen",S2="Wiederverwendbare Funktion erstellen",C2="Nodes hinzufügen, um deren Ausgabevariablen zu sehen",E2="Variable hinzufügen",N2="Mit Warnungen fortfahren",k2="Funktion erstellen",T2="Definierte Variablen",P2="Funktion löschen",R2="Funktion löschen?",I2="Fertig",M2="Funktion bearbeiten",A2="Ausdruck für",_2="Arg",D2="Funktionsargumente",j2="Funktionsnamen, Eingaben und Ausgaben konfigurieren.",O2="Argumente, die beim Aufruf der Funktion übergeben werden",L2="Werte, die die Funktion zurückgibt; jeder ist ein Ausdruck über ihre Eingaben und ihren Rumpf",$2="Funktionsname",F2="Funktionsname eingeben...",z2="Funktionen",V2="Funktion öffnen",B2="Globale Variable",H2="Anfangswert",W2="Eingaben",U2="Node-Ausgabevariablen",K2="Keine Kantenparameter",G2="Keine Funktionsinformationen verfügbar",Y2="Noch keine Funktionen",X2="Keine Eingaben",q2="Keine Probleme gefunden",Z2="Keine Ausgaben",Q2="Ausgaben",J2="Rückgabewert-Zuweisungen",ej="Ausdrücke den Funktions-Rückgabewerten zuweisen",tj="Verbindung löschen",nj="Projekt umbenennen",rj='Die Funktion "{{name}}" aufrufen',oj="Wert für {{name}} eingeben",sj="Name der Ausgabevariable für {{name}} eingeben",ij="Diese Funktion und alle zugehörigen Knoten werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",aj="Knoten",lj="Keine Fehler oder Warnungen in Workflow",cj="Validierungsprobleme",uj="{{errorCount}} Fehler und {{warningCount}} Warnung(en) gefunden. Fehler müssen vor dem Export behoben werden.",dj="{{warningCount}} Warnung(en) gefunden. Sie können trotzdem fortfahren.",fj="Version gespeichert",pj="Version konnte nicht gespeichert werden",hj="Version wiederhergestellt",gj="Version konnte nicht wiederhergestellt werden",mj="Version umbenannt",yj="Version konnte nicht umbenannt werden",vj="Die Embedded-Firmware wurde erfolgreich generiert und heruntergeladen.",xj="C-Code generiert",bj="C-Code Generierung fehlgeschlagen",wj="Der C-Code konnte nicht generiert werden.",Sj="Visueller Builder für Ihre Projekte.",Cj="Projekt nicht gefunden",Ej="Das ausgewählte Projekt existiert nicht.",Nj="Deployment nicht gefunden",kj={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"},Tj={input:"Eingang",output:"Ausgang",logic:"Logik",math:"Mathematik",ai:"KI",control:"Steuerung",sensor:"Sensor",actuator:"Aktor",communication:"Kommunikation",storage:"Speicher",custom:"Benutzerdefiniert"},Pj="Hinzufügen",Rj="Abbrechen",Ij={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"}}}},Mj={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"}},Aj={nodeLibrary:GA,blockLibrary:YA,diagnostics:XA,functionDefinition:qA,open:ZA,close:QA,save:JA,exportAsJSON:e_,versionHistory:t_,test:n_,run:r_,stop:o_,deploy:s_,configure:i_,addBlock:a_,deleteBlock:l_,duplicateBlock:c_,connectBlocks:u_,disconnectBlocks:d_,zoomIn:f_,zoomOut:p_,fitView:h_,autoLayout:g_,grid:m_,showGrid:y_,snapToGrid:v_,undo:x_,redo:b_,cut:w_,copy:S_,paste:C_,selectAll:E_,deselectAll:N_,delete:"Löschen",canvas:k_,parameters:T_,connections:P_,validation:R_,errors:I_,warnings:M_,noErrors:A_,unknownNodeType:__,deleteNode:D_,updateToLatestDefinition:j_,functionCallNodesMigrated:O_,functionCallNodesMigratedDesc:L_,variables:$_,models:F_,agents:z_,conversations:V_,noVariables:B_,addBlocksForVariables:H_,agentsDescription:W_,noAgentsConfigured:U_,addAgent:K_,availableAgents:G_,comingSoon:Y_,conversationsDescription:X_,noConversations:q_,newConversation:Z_,conversationTemplates:Q_,newWorkflow:J_,searchBlocks:eD,noParameters:tD,moreCount:nD,parametersLabel:rD,required:oD,optional:sD,typeLabel:iD,defaultLabel:aD,optionsLabel:lD,parameterCount:cD,paramTypeText:uD,paramTypeNumber:dD,paramTypeBoolean:fD,paramTypeSelection:pD,paramTypeExpression:hD,noLLMModelsAvailable:gD,noMLModelsAvailable:mD,noChannelsAvailable:yD,generatedConfig:vD,importProject:xD,jsonConfig:bD,jsonConfigPlaceholder:wD,orUploadFile:SD,import:"Importieren",saveWorkflow:CD,createProject:ED,create:ND,unsavedDraft:kD,unsavedDraftWarning:TD,saveFailedMessage:PD,downloadAsJSON:RD,namePlaceholder:ID,descriptionOptional:MD,descriptionPlaceholder:AD,saving:_D,testAgentNode:DD,testAgentDescription:jD,prompt:OD,promptPlaceholder:LD,testing:$D,startTest:FD,stopTest:zD,testAgent:VD,maxTurns:BD,toolCall:HD,toolResult:WD,finalOutput:UD,structuredOutput:KD,structuredOutputParseError:GD,rawJson:YD,outputName:XD,outputType:qD,outputValue:ZD,noNodeSelected:QD,selectNodeMessage:JD,importError:e2,invalidJson:t2,exportSuccess:n2,configDownloaded:r2,copied:o2,configCopied:s2,autoVersionMessage:i2,autoVersionLabel:a2,"saveStatus.saved":"Gespeichert","saveStatus.saving":"Speichern...","saveStatus.unsaved":"Ungespeicherte Änderungen",versionRenameTooltip:l2,versionPreviewPlaceholder:c2,"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:u2,noVersions:d2,versionsReadOnly:f2,loadingDialogs:p2,loadingVersions:h2,loadingTest:g2,current:m2,newFunction:y2,enterExpression:v2,enterTypeExpression:x2,fromNode:b2,addFunction:w2,addFunctionHint:S2,addNodesForVariables:C2,addVariable:E2,continueWithWarnings:N2,createFunction:k2,definedVariables:T2,deleteFunction:P2,deleteFunctionTitle:R2,done:I2,editFunction:M2,expressionFor:A2,fnarg:_2,functionArguments:D2,functionDialogDesc:j2,functionInputsDesc:O2,functionOutputsDesc:L2,functionName:$2,functionNamePlaceholder:F2,functions:z2,openFunction:V2,globalVariable:B2,initialValue:H2,inputs:W2,nodeOutputVariables:U2,noEdgeParams:K2,noFunctionInfo:G2,noFunctions:Y2,noInputs:X2,noIssuesFound:q2,noOutputs:Z2,outputs:Q2,returnValueAssignments:J2,returnValueAssignmentsDesc:ej,deleteEdge:tj,renameProject:nj,functionCallDesc:rj,functionParamDesc:oj,functionOutputDesc:sj,deleteFunctionDesc:ij,nodeLabel:aj,validationPassed:lj,validationIssues:cj,validationErrorsDesc:uj,validationWarningsDesc:dj,versionSaved:fj,versionSaveError:pj,versionRestored:hj,versionRestoreError:gj,versionRenamed:mj,versionRenameError:yj,codeGenSuccess:vj,codeGenTitle:xj,codeGenError:bj,codeGenErrorDesc:wj,seoDescription:Sj,projectNotFound:Cj,projectNotFoundDesc:Ej,deploymentNotFound:Nj,deployDialog:kj,blocks:Tj,add:Pj,cancel:Rj,nodes:Ij,edges:Mj},_j="Export as JSON",Dj="Node Library",jj="Node Library",Oj="Diagnostics",Lj="Function Definition",$j="Open",Fj="Close",zj="Save",Vj="Version History",Bj="Test",Hj="Run",Wj="Stop",Uj="Deploy",Kj="Configure",Gj="Add Node",Yj="Delete Node",Xj="Duplicate Node",qj="Connect Nodes",Zj="Disconnect Nodes",Qj="Zoom In",Jj="Zoom Out",eO="Fit to View",tO="Auto Layout",nO="Grid",rO="Show Grid",oO="Snap to Grid",sO="Undo",iO="Redo",aO="Cut",lO="Copy",cO="Paste",uO="Select All",dO="Deselect All",fO="Canvas",pO="Parameters",hO="Connections",gO="Validation",mO="Errors",yO="Warnings",vO="No errors found",xO="Unknown node type: {{type}}",bO="Delete Node",wO="Update to latest definition",SO="Function call nodes updated",CO="{{count}} node(s) were migrated to the latest function definition.",EO="Variables",NO="Agents",kO="Conversations",TO="No variables available",PO="Add nodes to see their output variables",RO="Manage and configure AI agents for your workflow",IO="No agents configured yet",MO="Add Agent",AO="Available Agents",_O="Coming soon...",DO="View and manage conversation flows",jO="No conversations yet",OO="New Conversation",LO="Templates",$O="New Workflow",FO="Search nodes...",zO="No parameters",VO="+{{count}} more",BO="Parameters:",HO="Required",WO="Optional",UO="Type:",KO="Default:",GO="Options:",YO="{{count}} parameter",XO="Text",qO="Number",ZO="Boolean",QO="Selection",JO="Expr",eL="No LLM models are currently available. Please contact support.",tL="No ML models declared yet. Add one in the AI Models panel.",nL="Generated Configuration",rL="Import Project",oL="JSON Configuration",sL="Paste JSON configuration here...",iL="Or upload file",aL="Save Workflow",lL="Create Project",cL="Create",uL="Unsaved draft",dL="You have unsaved changes that will be lost. Leave anyway?",fL="Could not create the project. Download your work as JSON to avoid losing it.",pL="Download as JSON",hL="Enter workflow name...",gL="Description (optional)",mL="Short description of the workflow...",yL="Saving...",vL="Test Agent Node",xL="Send a prompt to the agent and stream the response. Costs are charged to your balance.",bL="Prompt",wL="Describe the task for the agent",SL="Testing...",CL="Start Test",EL="Stop",NL="Test Agent",kL="Max Turns",TL="Tool Call: {{name}}",PL="Tool Result: {{name}}",RL="Final Output ({{turns}} turns)",IL="Structured Output",ML="Could not parse structured output as JSON",AL="Raw JSON",_L="Name",DL="Type",jL="Value",OL="No node selected",LL="Please select a target node on the canvas.",$L="Import Error",FL="Invalid JSON format",zL="Export successful",VL="Configuration was downloaded",BL="Copied",HL="Configuration was copied to clipboard",WL="Automatic checkpoint",UL="Auto",KL="Rename version",GL="Visual preview coming soon",YL="Loading versions...",XL="No versions available.",qL="Versions are read-only and cannot be modified.",ZL="Loading dialogs...",QL="Loading versions...",JL="Loading test dialog...",e$="Current",t$="New Function",n$="Enter expression...",r$="Enter {{type}} expression...",o$="from {{node}}",s$="Add Function",i$="Create a reusable function",a$="Add nodes to see their output variables",l$="Add Variable",c$="Continue with Warnings",u$="Create Function",d$="Defined Variables",f$="Delete Function",p$="Delete Function?",h$="Done",g$="Edit Function",m$="Expression for",y$="Arg",v$="Function Arguments",x$="Configure the function name, inputs and outputs.",b$="Arguments passed in when the function is called",w$="Values the function returns; each is an expression over its inputs and body",S$="Function Name",C$="Enter function name...",E$="Functions",N$="Open function",k$="Global Variable",T$="Data type",P$="Delete variable",R$="Variable name",I$="Name is required",M$="A declared variable you can read and write across this canvas",A$="Initial Value",_$="Inputs",D$="Node Output Variables",j$="No edge parameters",O$="No function information available",L$="No functions yet",$$="No inputs",F$="No channels defined yet",z$="Add channels to declare the hardware interfaces your workflow needs",V$="Channels",B$="Label",H$="Add Channel",W$="Select a channel...",U$="No matching channel declared yet. Add one in the Channels panel.",K$="No memory files yet",G$="Declare durable storage your agents can read or write",Y$="Memory",X$="Add Memory File",q$="Delete memory file",Z$="Memory file name",Q$="Agent-scoped durable storage",J$="Name is required",eF="Name must be unique per agent",tF="No memory files declared yet. Add one from the Memory tab in the sidebar.",nF="Select memory file...",rF="Deleted memory file",oF="Add memory ref",sF="Remove memory ref",iF="Read",aF="Read + Write",lF="No memory declared yet",cF="Declare memory files for agents and vector databases for RAG",uF="Add Vector Database",dF="Select memory...",fF="Memory label",pF="Label is required",hF="Label must be unique per agent",gF="Delete memory",mF="AI Models",yF="No custom models yet",vF="Built-in models are always available. Declare custom or self-hosted models here.",xF="Add LLM Model",bF="Add ML Model",wF="LLM",SF="ML",CF="Select model...",EF="Model label",NF="Label is required",kF="Custom model mapped to a provider at deploy",TF="Delete model",PF="Create new pin...",RF="Capabilities",IF="Protocol",MF="No issues found",AF="No outputs",_F="Outputs",DF="Return Value Assignments",jF="Assign expressions to function return values",OF="Delete Edge",LF="Rename project",$F='Invoke the "{{name}}" function',FF="Enter value for {{name}}",zF="Enter name of output variable for {{name}}",VF="This will permanently delete this function and all its nodes. This action cannot be undone.",BF="Node",HF="No errors or warnings in workflow",WF="Validation Issues",UF="{{errorCount}} error(s) and {{warningCount}} warning(s) found. Fix errors before exporting.",KF="{{warningCount}} warning(s) found. You can still proceed.",GF="Version saved",YF="Version could not be saved",XF="Version restored",qF="Version could not be restored",ZF="Version renamed",QF="Version could not be renamed",JF="Embedded firmware was successfully generated and downloaded.",ez="C code generated",tz="C code generation failed",nz="C code could not be generated.",rz="Visual builder for your projects.",oz="Project not found",sz="The selected project does not exist.",iz="Deployment not found",az={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"},lz={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"},cz={input:"Input",output:"Output",logic:"Logic",math:"Math",ai:"AI",control:"Control",sensor:"Sensor",actuator:"Actuator",communication:"Communication",storage:"Storage",custom:"Custom"},uz="Add",dz="Cancel",fz={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"}}}},pz={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"}},hz={exportAsJSON:_j,nodeLibrary:Dj,blockLibrary:jj,diagnostics:Oj,functionDefinition:Lj,open:$j,close:Fj,save:zj,versionHistory:Vj,test:Bj,run:Hj,stop:Wj,deploy:Uj,configure:Kj,addBlock:Gj,deleteBlock:Yj,duplicateBlock:Xj,connectBlocks:qj,disconnectBlocks:Zj,zoomIn:Qj,zoomOut:Jj,fitView:eO,autoLayout:tO,grid:nO,showGrid:rO,snapToGrid:oO,undo:sO,redo:iO,cut:aO,copy:lO,paste:cO,selectAll:uO,deselectAll:dO,delete:"Delete",canvas:fO,parameters:pO,connections:hO,validation:gO,errors:mO,warnings:yO,noErrors:vO,unknownNodeType:xO,deleteNode:bO,updateToLatestDefinition:wO,functionCallNodesMigrated:SO,functionCallNodesMigratedDesc:CO,variables:EO,agents:NO,conversations:kO,noVariables:TO,addBlocksForVariables:PO,agentsDescription:RO,noAgentsConfigured:IO,addAgent:MO,availableAgents:AO,comingSoon:_O,conversationsDescription:DO,noConversations:jO,newConversation:OO,conversationTemplates:LO,newWorkflow:$O,searchBlocks:FO,noParameters:zO,moreCount:VO,parametersLabel:BO,required:HO,optional:WO,typeLabel:UO,defaultLabel:KO,optionsLabel:GO,parameterCount:YO,paramTypeText:XO,paramTypeNumber:qO,paramTypeBoolean:ZO,paramTypeSelection:QO,paramTypeExpression:JO,noLLMModelsAvailable:eL,noMLModelsAvailable:tL,generatedConfig:nL,importProject:rL,jsonConfig:oL,jsonConfigPlaceholder:sL,orUploadFile:iL,import:"Import",saveWorkflow:aL,createProject:lL,create:cL,unsavedDraft:uL,unsavedDraftWarning:dL,saveFailedMessage:fL,downloadAsJSON:pL,namePlaceholder:hL,descriptionOptional:gL,descriptionPlaceholder:mL,saving:yL,testAgentNode:vL,testAgentDescription:xL,prompt:bL,promptPlaceholder:wL,testing:SL,startTest:CL,stopTest:EL,testAgent:NL,maxTurns:kL,toolCall:TL,toolResult:PL,finalOutput:RL,structuredOutput:IL,structuredOutputParseError:ML,rawJson:AL,outputName:_L,outputType:DL,outputValue:jL,noNodeSelected:OL,selectNodeMessage:LL,importError:$L,invalidJson:FL,exportSuccess:zL,configDownloaded:VL,copied:BL,configCopied:HL,autoVersionMessage:WL,autoVersionLabel:UL,"saveStatus.saved":"Saved","saveStatus.saving":"Saving...","saveStatus.unsaved":"Unsaved changes",versionRenameTooltip:KL,versionPreviewPlaceholder:GL,"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:YL,noVersions:XL,versionsReadOnly:qL,loadingDialogs:ZL,loadingVersions:QL,loadingTest:JL,current:e$,newFunction:t$,enterExpression:n$,enterTypeExpression:r$,fromNode:o$,addFunction:s$,addFunctionHint:i$,addNodesForVariables:a$,addVariable:l$,continueWithWarnings:c$,createFunction:u$,definedVariables:d$,deleteFunction:f$,deleteFunctionTitle:p$,done:h$,editFunction:g$,expressionFor:m$,fnarg:y$,functionArguments:v$,functionDialogDesc:x$,functionInputsDesc:b$,functionOutputsDesc:w$,functionName:S$,functionNamePlaceholder:C$,functions:E$,openFunction:N$,globalVariable:k$,dataType:T$,deleteVariable:P$,variableName:R$,variableNameRequired:I$,variableDescription:M$,initialValue:A$,inputs:_$,nodeOutputVariables:D$,noEdgeParams:j$,noFunctionInfo:O$,noFunctions:L$,noInputs:$$,noChannels:F$,noChannelsHint:z$,channels:V$,channelLabelHeading:B$,addChannel:H$,selectChannel:W$,noChannelsAvailable:U$,noMemoryFiles:K$,noMemoryFilesHint:G$,memoryFiles:Y$,addMemoryFile:X$,deleteMemoryFile:q$,memoryFileName:Z$,memoryFileDescription:Q$,memoryFileNameRequired:J$,memoryFileNameDuplicate:eF,noMemoryFilesForAgent:tF,selectMemoryFile:nF,memoryRefStale:rF,addMemoryRef:oF,removeMemoryRef:sF,memoryModeRead:iF,memoryModeReadWrite:aF,noMemory:lF,noMemoryHint:cF,addVectorDatabase:uF,selectMemory:dF,memoryLabel:fF,memoryLabelRequired:pF,memoryLabelDuplicate:hF,deleteMemory:gF,models:mF,noModels:yF,noModelsHint:vF,addLLMModel:xF,addMLModel:bF,modelLLMBadge:wF,modelMLBadge:SF,selectModel:CF,modelLabel:EF,modelLabelRequired:NF,modelCustomDescription:kF,deleteModel:TF,createNewPin:PF,capabilities:RF,protocol:IF,noIssuesFound:MF,noOutputs:AF,outputs:_F,returnValueAssignments:DF,returnValueAssignmentsDesc:jF,deleteEdge:OF,renameProject:LF,functionCallDesc:$F,functionParamDesc:FF,functionOutputDesc:zF,deleteFunctionDesc:VF,nodeLabel:BF,validationPassed:HF,validationIssues:WF,validationErrorsDesc:UF,validationWarningsDesc:KF,versionSaved:GF,versionSaveError:YF,versionRestored:XF,versionRestoreError:qF,versionRenamed:ZF,versionRenameError:QF,codeGenSuccess:JF,codeGenTitle:ez,codeGenError:tz,codeGenErrorDesc:nz,seoDescription:rz,projectNotFound:oz,projectNotFoundDesc:sz,deploymentNotFound:iz,deployDialog:az,pinMapping:lz,blocks:cz,add:uz,cancel:dz,nodes:fz,edges:pz},gz={de:{translation:Aj},en:{translation:hz}},gr=Tt.createInstance();gr.init({resources:gz,fallbackLng:"en",lng:"en",interpolation:{escapeValue:!1},defaultNS:"translation",react:{useSuspense:!1,bindI18n:"languageChanged"}});const mz=1,yz=1e6;let Ph=0;function vz(){return Ph=(Ph+1)%Number.MAX_SAFE_INTEGER,Ph.toString()}const Rh=new Map;function B0(e){if(Rh.has(e))return;const t=setTimeout(()=>{Rh.delete(e),Xa({type:"REMOVE_TOAST",toastId:e})},yz);Rh.set(e,t)}const xz=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,mz)};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?B0(n):e.toasts.forEach(r=>B0(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 Mu={toasts:[]};function Xa(e){Mu=xz(Mu,e),Iu.forEach(t=>t(Mu))}function Kt({...e}){const t=vz(),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 bz(){const[e,t]=m.useState(Mu);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 wz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),D1=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var Sz={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 Cz=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,...Sz,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:D1("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(Cz,{ref:i,iconNode:t,className:D1(`lucide-${wz(e)}`,r),...o}));return n.displayName=`${e}`,n};const H0=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Ez=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 Nz=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 kz=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 Tz=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 j1=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 Pz=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 Rz=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 O1=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 Iz=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 L1=je("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const $1=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 wg=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 F1=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 Mz=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 Az=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 _z=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 Dz=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 jz=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 Oz=je("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Lz=je("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const $z=je("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const fo=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Fz=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 zz=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 Vz=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 z1=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Bz=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 V1=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 Hz=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 Wz=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 Sr=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 W0=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 Uz=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 Kz=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 Gz=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 Yz=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 B1(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=B1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function H1(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=B1(e))&&(r&&(r+=" "),r+=t);return r}const U0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,K0=H1,yo=(e,t)=>n=>{var r;if(t?.variants==null)return K0(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=U0(g)||U0(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 K0(e,l,d,n?.class,n?.className)},hm="-",Xz=e=>{const t=Zz(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const c=l.split(hm);return c[0]===""&&c.length!==1&&c.shift(),W1(c,t)||qz(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&r[l]?[...d,...r[l]]:d}}},W1=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?W1(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(hm);return t.validators.find(({validator:l})=>l(i))?.classGroupId},G0=/^\[(.+)\]$/,qz=e=>{if(G0.test(e)){const t=G0.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 Jz(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:Y0(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Qz(o)){Sg(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{Sg(l,Y0(t,i),n,r)})})},Y0=(e,t)=>{let n=e;return t.split(hm).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Qz=e=>e.isThemeGetter,Jz=(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,e5=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)}}},U1="!",t5=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(U1),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},n5=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},r5=e=>({cache:e5(e.cacheSize),parseClassName:t5(e),...Xz(e)}),o5=/\s+/,s5=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(o5);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=n5(g).join(":"),w=h?E+U1: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 _=k[P];i.push(w+_)}c=f+(c.length>0?" "+c:c)}return c};function i5(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=K1(t))&&(r&&(r+=" "),r+=n);return r}const K1=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=K1(e[r]))&&(n&&(n+=" "),n+=t);return n};function a5(e,...t){let n,r,o,i=l;function l(d){const f=t.reduce((g,h)=>h(g),e());return n=r5(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=s5(d,n);return o(d,g),g}return function(){return i(i5.apply(null,arguments))}}const nt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},G1=/^\[(?:([a-z-]+):)?(.+)\]$/i,l5=/^\d+\/\d+$/,c5=new Set(["px","full","screen"]),u5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,d5=/\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$/,f5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,p5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,h5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fr=e=>ii(e)||c5.has(e)||l5.test(e),Jr=e=>Mi(e,"length",S5),ii=e=>!!e&&!Number.isNaN(Number(e)),Ih=e=>Mi(e,"number",ii),_a=e=>!!e&&Number.isInteger(Number(e)),g5=e=>e.endsWith("%")&&ii(e.slice(0,-1)),Le=e=>G1.test(e),eo=e=>u5.test(e),m5=new Set(["length","size","percentage"]),y5=e=>Mi(e,m5,Y1),v5=e=>Mi(e,"position",Y1),x5=new Set(["image","url"]),b5=e=>Mi(e,x5,E5),w5=e=>Mi(e,"",C5),Da=()=>!0,Mi=(e,t,n)=>{const r=G1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},S5=e=>d5.test(e)&&!f5.test(e),Y1=()=>!1,C5=e=>p5.test(e),E5=e=>h5.test(e),N5=()=>{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"),_=nt("sepia"),R=nt("skew"),M=nt("space"),L=nt("translate"),D=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",Le,t],U=()=>[Le,t],Y=()=>["",fr,Jr],I=()=>["auto",ii,Le],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",Le],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[ii,Le];return{cacheSize:500,separator:":",theme:{colors:[Da],spacing:[fr,Jr],blur:["none","",eo,Le],brightness:$(),borderColor:[e],borderRadius:["none","","full",eo,Le],borderSpacing:U(),borderWidth:Y(),contrast:$(),grayscale:W(),hueRotate:$(),invert:W(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[g5,Jr],inset:j(),margin:j(),opacity:$(),padding:U(),saturate:$(),scale:$(),sepia:W(),skew:$(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",Le]}],container:["container"],columns:[{columns:[eo]}],"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(),Le]}],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",_a,Le]}],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",Le]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",_a,Le]}],"grid-cols":[{"grid-cols":[Da]}],"col-start-end":[{col:["auto",{span:["full",_a,Le]},Le]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Da]}],"row-start-end":[{row:["auto",{span:[_a,Le]},Le]}],"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",Le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Le]}],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":[M]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[M]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Le,t]}],"min-w":[{"min-w":[Le,t,"min","max","fit"]}],"max-w":[{"max-w":[Le,t,"none","full","min","max","fit","prose",{screen:[eo]},eo]}],h:[{h:[Le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",eo,Jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ih]}],"font-family":[{font:[Da]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Le]}],"line-clamp":[{"line-clamp":["none",ii,Ih]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,Le]}],"list-image":[{"list-image":["none",Le]}],"list-style-type":[{list:["none","disc","decimal",Le]}],"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,Jr]}],"underline-offset":[{"underline-offset":["auto",fr,Le]}],"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",Le]}],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",Le]}],"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(),v5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",y5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},b5]}],"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,Le]}],"outline-w":[{outline:[fr,Jr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[fr,Jr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",eo,w5]}],"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",eo,Le]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[h]}],saturate:[{saturate:[k]}],sepia:[{sepia:[_]}],"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":[_]}],"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",Le]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",Le]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",Le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[_a,Le]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"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",Le]}],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",Le]}],"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",Le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[fr,Jr,Ih]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},k5=a5(N5);function Ce(...e){return k5(H1(e))}const T5=yo("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function po({className:e,variant:t,...n}){return p.jsx("div",{className:Ce(T5({variant:t}),e),...n})}function X0(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=X0(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():X0(e[o],null)}}}}function De(...e){return m.useCallback(Yt(...e),e)}var P5=Symbol.for("react.lazy"),Gu=bd[" use ".trim().toString()];function R5(e){return typeof e=="object"&&e!==null&&"then"in e}function X1(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===P5&&"_payload"in e&&R5(e._payload)}function gm(e){const t=M5(e),n=m.forwardRef((r,o)=>{let{children:i,...l}=r;X1(i)&&typeof Gu=="function"&&(i=Gu(i._payload));const c=m.Children.toArray(i),d=c.find(_5);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 I5=gm("Slot");function M5(e){const t=m.forwardRef((n,r)=>{let{children:o,...i}=n;if(X1(o)&&typeof Gu=="function"&&(o=Gu(o._payload)),m.isValidElement(o)){const l=j5(o),c=D5(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 A5=Symbol("radix.slottable");function _5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A5}function D5(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 j5(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 mm=yo("inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"glass-forest-button-primary hover:scale-[1.02]",destructive:"glass-forest-button bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"glass-forest-button hover:bg-primary/10 hover:text-primary",secondary:"glass-forest-button bg-secondary/50 text-secondary-foreground hover:bg-secondary/70",ghost:"hover:glass-forest-button hover:bg-primary/10",link:"text-primary underline-offset-4 hover:underline",glass:"glass-forest-button text-foreground","glass-primary":"glass-forest-button-primary","glass-cyan":"glass-forest-button bg-primary text-primary-foreground hover:scale-[1.02]",success:"glass-forest-button bg-success text-success-foreground hover:bg-success/90",warning:"glass-forest-button bg-warning text-warning-foreground hover:bg-warning/90"},size:{default:"h-10 px-6 py-2 text-sm rounded-full",sm:"h-9 px-4 text-sm rounded-full",lg:"h-11 px-8 text-base rounded-full",xl:"h-12 px-10 text-base rounded-full",icon:"h-10 w-10 rounded-full"}},defaultVariants:{variant:"default",size:"default"}}),gt=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,loading:o,children:i,disabled:l,...c},d)=>{const f=r?I5:"button";return p.jsxs(f,{className:Ce(mm({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 O5(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 $t(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,L5(o,...t)]}function L5(...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:()=>{},$5=bd[" useId ".trim().toString()]||(()=>{}),F5=0;function kt(e){const[t,n]=m.useState($5());return xt(()=>{n(r=>r??String(F5++))},[e]),t?`radix-${t}`:""}var z5=bd[" useInsertionEffect ".trim().toString()]||xt;function ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,l]=V5({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=B5(g)?g(e):g;h!==e&&l.current?.(h)}else i(g)},[c,e,i,l]);return[d,f]}function V5({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return z5(()=>{i.current=t},[t]),m.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function B5(e){return typeof e=="function"}var ps=a1();const H5=um(ps);function W5(e){const t=U5(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(G5);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 U5(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=X5(o),c=Y5(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 K5=Symbol("radix.slottable");function G5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===K5}function Y5(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 X5(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 q5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=q5.reduce((e,t)=>{const n=W5(`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 ym(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 Z5(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 Q5="DismissableLayer",Cg="dismissableLayer.update",J5="dismissableLayer.pointerDownOutside",e3="dismissableLayer.focusOutside",q0,q1=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(q1),[g,h]=m.useState(null),v=g?.ownerDocument??globalThis?.document,[,x]=m.useState({}),S=De(t,M=>h(M)),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,_=n3(M=>{const L=M.target,D=[...f.branches].some(H=>H.contains(L));!P||D||(o?.(M),l?.(M),M.defaultPrevented||c?.())},v),R=r3(M=>{const L=M.target;[...f.branches].some(H=>H.contains(L))||(i?.(M),l?.(M),M.defaultPrevented||c?.())},v);return Z5(M=>{N===f.layers.size-1&&(r?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))},v),m.useEffect(()=>{if(g)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(q0=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(g)),f.layers.add(g),Z0(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=q0)}},[g,v,n,f]),m.useEffect(()=>()=>{g&&(f.layers.delete(g),f.layersWithOutsidePointerEventsDisabled.delete(g),Z0())},[g,f]),m.useEffect(()=>{const M=()=>x({});return document.addEventListener(Cg,M),()=>document.removeEventListener(Cg,M)},[]),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,_.onPointerDownCapture)})});Ai.displayName=Q5;var t3="DismissableLayerBranch",Z1=m.forwardRef((e,t)=>{const n=m.useContext(q1),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})});Z1.displayName=t3;function n3(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(){Q1(J5,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 r3(e,t=globalThis?.document){const n=pt(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&Q1(e3,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 Z0(){const e=new CustomEvent(Cg);document.dispatchEvent(e)}function Q1(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?ym(o,i):o.dispatchEvent(i)}var o3=Ai,s3=Z1,Mh="focusScope.autoFocusOnMount",Ah="focusScope.autoFocusOnUnmount",Q0={bubbles:!1,cancelable:!0},i3="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:oo(h.current,{select:!0})},E=function(k){if(x.paused||!c)return;const P=k.relatedTarget;P!==null&&(c.contains(P)||oo(h.current,{select:!0}))},w=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&oo(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){eb.add(x);const b=document.activeElement;if(!c.contains(b)){const w=new CustomEvent(Mh,Q0);c.addEventListener(Mh,f),c.dispatchEvent(w),w.defaultPrevented||(a3(f3(J1(c)),{select:!0}),document.activeElement===b&&oo(c))}return()=>{c.removeEventListener(Mh,f),setTimeout(()=>{const w=new CustomEvent(Ah,Q0);c.addEventListener(Ah,g),c.dispatchEvent(w),w.defaultPrevented||oo(b??document.body,{select:!0}),c.removeEventListener(Ah,g),eb.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]=l3(N);k&&P?!b.shiftKey&&w===P?(b.preventDefault(),n&&oo(k,{select:!0})):b.shiftKey&&w===k&&(b.preventDefault(),n&&oo(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=i3;function a3(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(oo(r,{select:t}),document.activeElement!==n)return}function l3(e){const t=J1(e),n=J0(t,e),r=J0(t.reverse(),e);return[n,r]}function J1(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 J0(e,t){for(const n of e)if(!c3(n,{upTo:t}))return n}function c3(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 u3(e){return e instanceof HTMLInputElement&&"select"in e}function oo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&u3(e)&&t&&e.select()}}var eb=d3();function d3(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=tb(e,t),e.unshift(t)},remove(t){e=tb(e,t),e[0]?.resume()}}}function tb(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function f3(e){return e.filter(t=>t.tagName!=="A")}var p3="Portal",_i=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?H5.createPortal(p.jsx(Ne.div,{...r,ref:t}),l):null});_i.displayName=p3;function h3(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Pt=e=>{const{present:t,children:n}=e,r=g3(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=De(r.ref,m3(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Pt.displayName="Presence";function g3(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),l=e?"mounted":"unmounted",[c,d]=h3(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 m3(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 _h=0;function vm(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nb()),document.body.insertAdjacentElement("beforeend",e[1]??nb()),_h++,()=>{_h===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_h--}},[])}function nb(){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 eS(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 y3(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",_u="width-before-scroll-bar",v3="with-scroll-bars-hidden",x3="--removed-body-scroll-bar-size";function Dh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function b3(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 w3=typeof window<"u"?m.useLayoutEffect:m.useEffect,rb=new WeakMap;function S3(e,t){var n=b3(null,function(r){return e.forEach(function(o){return Dh(o,r)})});return w3(function(){var r=rb.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)})}rb.set(n,e)},[e]),n}function C3(e){return e}function E3(e,t){t===void 0&&(t=C3);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 N3(e){e===void 0&&(e={});var t=E3(null);return t.options=Wn({async:!0,ssr:!1},e),t}var tS=function(e){var t=e.sideCar,n=eS(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))};tS.isSideCarExport=!0;function k3(e,t){return e.useMedium(t),tS}var nS=N3(),jh=function(){},Md=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=eS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=v,R=S3([n,t]),M=Wn(Wn({},P),o);return m.createElement(m.Fragment,null,g&&m.createElement(_,{sideCar:nS,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({},M),{ref:R})):m.createElement(N,Wn({},M,{className:d,ref:R}),c))});Md.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Md.classNames={fullWidth:_u,zeroRight:Au};var T3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function P3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=T3();return t&&e.setAttribute("nonce",t),e}function R3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function I3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var M3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=P3())&&(R3(t,n),I3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},A3=function(){var e=M3();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},rS=function(){var e=A3(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},_3={left:0,top:0,right:0,gap:0},Oh=function(e){return parseInt(e||"",10)||0},D3=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)]},j3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _3;var t=D3(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])}},O3=rS(),ai="data-scroll-locked",L3=function(e,t,n,r){var o=e.left,i=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
10
|
+
.`.concat(v3,` {
|
|
11
|
+
overflow: hidden `).concat(r,`;
|
|
12
|
+
padding-right: `).concat(c,"px ").concat(r,`;
|
|
13
|
+
}
|
|
14
|
+
body[`).concat(ai,`] {
|
|
15
|
+
overflow: hidden `).concat(r,`;
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
18
|
+
padding-left: `.concat(o,`px;
|
|
19
|
+
padding-top: `).concat(i,`px;
|
|
20
|
+
padding-right: `).concat(l,`px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: `).concat(c,"px ").concat(r,`;
|
|
24
|
+
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(Au,` {
|
|
28
|
+
right: `).concat(c,"px ").concat(r,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(_u,` {
|
|
32
|
+
margin-right: `).concat(c,"px ").concat(r,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.`).concat(Au," .").concat(Au,` {
|
|
36
|
+
right: 0 `).concat(r,`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.`).concat(_u," .").concat(_u,` {
|
|
40
|
+
margin-right: 0 `).concat(r,`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[`).concat(ai,`] {
|
|
44
|
+
`).concat(x3,": ").concat(c,`px;
|
|
45
|
+
}
|
|
46
|
+
`)},ob=function(){var e=parseInt(document.body.getAttribute(ai)||"0",10);return isFinite(e)?e:0},$3=function(){m.useEffect(function(){return document.body.setAttribute(ai,(ob()+1).toString()),function(){var e=ob()-1;e<=0?document.body.removeAttribute(ai):document.body.setAttribute(ai,e.toString())}},[])},F3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;$3();var i=m.useMemo(function(){return j3(o)},[o]);return m.createElement(O3,{styles:L3(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,z3=function(e){return e.tagName==="TEXTAREA"},oS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!z3(e)&&n[t]==="visible")},V3=function(e){return oS(e,"overflowY")},B3=function(e){return oS(e,"overflowX")},sb=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=sS(e,r);if(o){var i=iS(e,r),l=i[1],c=i[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},H3=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},W3=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},sS=function(e,t){return e==="v"?V3(t):B3(t)},iS=function(e,t){return e==="v"?H3(t):W3(t)},U3=function(e,t){return e==="h"&&t==="rtl"?-1:1},K3=function(e,t,n,r,o){var i=U3(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=iS(e,c),S=x[0],b=x[1],E=x[2],w=b-E-i*S;(S||w)&&sS(e,c)&&(h+=w,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]},ib=function(e){return[e.deltaX,e.deltaY]},ab=function(e){return e&&"current"in e?e.current:e},G3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Y3=function(e){return`
|
|
47
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
49
|
+
`)},X3=0,Gs=[];function q3(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(X3++)[0],i=m.useState(rS)[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=y3([e.lockRef.current],(e.shards||[]).map(ab),!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],_,R=b.target,M=Math.abs(k)>Math.abs(P)?"h":"v";if("touches"in b&&M==="h"&&R.type==="range")return!1;var L=window.getSelection(),D=L&&L.anchorNode,H=D?D===R||D.contains(R):!1;if(H)return!1;var j=sb(M,R);if(!j)return!0;if(j?_=M:(_=M==="v"?"h":"v",j=sb(M,R)),!j)return!1;if(!r.current&&"changedTouches"in b&&(k||P)&&(r.current=_),!_)return!0;var U=r.current||_;return K3(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?ib(E):cu(E),N=t.current.filter(function(_){return _.name===E.type&&(_.target===E.target||E.target===_.shadowParent)&&G3(_.delta,w)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(l.current.shards||[]).map(ab).filter(Boolean).filter(function(_){return _.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:Z3(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,ib(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:Y3(o)}):null,x?m.createElement(F3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Z3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Q3=k3(nS,q3);var Ad=m.forwardRef(function(e,t){return m.createElement(Md,Wn({},e,{ref:t,sideCar:Q3}))});Ad.classNames=Md.classNames;var J3=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={},Lh=0,aS=function(e){return e&&(e.host||aS(e.parentNode))},e4=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=aS(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})},t4=function(e,t,n,r){var o=e4(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(),Lh++,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)}),Lh--,Lh||(Ys=new WeakMap,Ys=new WeakMap,uu=new WeakMap,du={})}},xm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=J3(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),t4(r,o,n,"aria-hidden")):function(){return null}};function n4(e){const t=r4(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(s4);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 r4(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=a4(o),c=i4(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 o4=Symbol("radix.slottable");function s4(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===o4}function i4(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 a4(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 _d="Dialog",[lS,cS]=$t(_d),[l4,jn]=lS(_d),uS=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:_d});return p.jsx(l4,{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})};uS.displayName=_d;var dS="DialogTrigger",fS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(dS,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":Sm(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)})});fS.displayName=dS;var bm="DialogPortal",[c4,pS]=lS(bm,{forceMount:void 0}),hS=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=jn(bm,t);return p.jsx(c4,{scope:t,forceMount:n,children:m.Children.map(r,l=>p.jsx(Pt,{present:n||i.open,children:p.jsx(_i,{asChild:!0,container:o,children:l})}))})};hS.displayName=bm;var Yu="DialogOverlay",gS=m.forwardRef((e,t)=>{const n=pS(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(d4,{...o,ref:t})}):null});gS.displayName=Yu;var u4=n4("DialogOverlay.RemoveScroll"),d4=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(Yu,n);return p.jsx(Ad,{as:u4,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(Ne.div,{"data-state":Sm(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ts="DialogContent",mS=m.forwardRef((e,t)=>{const n=pS(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(f4,{...o,ref:t}):p.jsx(p4,{...o,ref:t})})});mS.displayName=ts;var f4=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 xm(i)},[]),p.jsx(yS,{...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())})}),p4=m.forwardRef((e,t)=>{const n=jn(ts,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return p.jsx(yS,{...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()}})}),yS=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 vm(),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":Sm(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(g4,{titleId:c.titleId}),p.jsx(y4,{contentRef:d,descriptionId:c.descriptionId})]})]})}),wm="DialogTitle",vS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(wm,n);return p.jsx(Ne.h2,{id:o.titleId,...r,ref:t})});vS.displayName=wm;var xS="DialogDescription",bS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(xS,n);return p.jsx(Ne.p,{id:o.descriptionId,...r,ref:t})});bS.displayName=xS;var wS="DialogClose",SS=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=jn(wS,n);return p.jsx(Ne.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});SS.displayName=wS;function Sm(e){return e?"open":"closed"}var CS="DialogTitleWarning",[h4,ES]=O5(CS,{contentName:ts,titleName:wm,docsSlug:"dialog"}),g4=({titleId:e})=>{const t=ES(CS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
50
|
+
|
|
51
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
52
|
+
|
|
53
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},m4="DialogDescriptionWarning",y4=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ES(m4).contentName}}.`;return m.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Cm=uS,v4=fS,Em=hS,Dd=gS,jd=mS,Nm=vS,km=bS,Tm=SS;const NS=Cm,x4=Em,kS=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}));kS.displayName=Dd.displayName;const Pm=m.forwardRef(({className:e,children:t,variant:n="surface",...r},o)=>p.jsxs(x4,{children:[p.jsx(kS,{}),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(Tm,{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"})]})]})]}));Pm.displayName=jd.displayName;const TS=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});TS.displayName="DialogHeader";const PS=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});PS.displayName="DialogFooter";const RS=m.forwardRef(({className:e,...t},n)=>p.jsx(Nm,{ref:n,className:Ce("font-heading text-lg font-semibold leading-none tracking-tight",e),...t}));RS.displayName=Nm.displayName;const IS=m.forwardRef(({className:e,...t},n)=>p.jsx(km,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));IS.displayName=km.displayName;function b4({open:e,onOpenChange:t,validation:n,onContinue:r,onSelectDiagnostic:o}){const{t:i}=Xe(),l=n.totalErrors>0;return p.jsx(NS,{open:e,onOpenChange:t,children:p.jsxs(Pm,{className:"max-w-lg max-h-[80vh] flex flex-col",children:[p.jsxs(TS,{children:[p.jsxs(RS,{className:"flex items-center gap-2",children:[l?p.jsx(Sr,{className:"w-5 h-5 text-destructive"}):p.jsx(Pd,{className:"w-5 h-5 text-warning"}),i("validationIssues")]}),p.jsx(IS,{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(PS,{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(po,{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(po,{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(Sr,{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"},Rm=10,qo=m.useLayoutEffect,lb=bd.useId,w4=typeof lb=="function"?lb:()=>null;let S4=0;function Im(e=null){const t=w4(),n=m.useRef(e||t||null);return n.current===null&&(n.current=""+S4++),e??n.current}function MS({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:_,isPanelCollapsed:R,reevaluatePanelConstraints:M,registerPanel:L,resizePanel:D,unregisterPanel:H}=E,j=Im(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}),qo(()=>{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)&&M(U.current,A)}),qo(()=>{const I=U.current;return L(I),()=>{H(I)}},[v,j,L,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 Y=P(U.current,o);return m.createElement(S,{...b,children:e,className:t,id:j,style:{...Y,...x},[dt.groupId]:_,[dt.panel]:"",[dt.panelCollapsible]:r||void 0,[dt.panelId]:j,[dt.panelSize]:parseFloat(""+Y.flexGrow).toFixed(1)})}const AS=m.forwardRef((e,t)=>m.createElement(MS,{...e,forwardedRef:t}));MS.displayName="Panel";AS.displayName="forwardRef(Panel)";let Ng=null,Du=-1,io=null;function C4(e,t){if(t){const n=(t&LS)!==0,r=(t&$S)!==0,o=(t&FS)!==0,i=(t&zS)!==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 E4(){io!==null&&(document.head.removeChild(io),Ng=null,io=null,Du=-1)}function $h(e,t){var n,r;const o=C4(e,t);if(Ng!==o){if(Ng=o,io===null&&(io=document.createElement("style"),document.head.appendChild(io)),Du>=0){var i;(i=io.sheet)===null||i===void 0||i.removeRule(Du)}Du=(n=(r=io.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function _S(e){return e.type==="keydown"}function DS(e){return e.type.startsWith("pointer")}function jS(e){return e.type.startsWith("mouse")}function Ld(e){if(DS(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(jS(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function N4(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function k4(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 T4(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:db(e),b:db(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:ub(cb(n.a)),b:ub(cb(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 P4=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function R4(e){var t;const n=getComputedStyle((t=OS(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function I4(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||R4(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"||P4.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function cb(e){let t=e.length;for(;t--;){const n=e[t];if(Fe(n,"Missing node"),I4(n))return n}return null}function ub(e){return e&&Number(getComputedStyle(e).zIndex)||0}function db(e){const t=[];for(;e;)t.push(e),e=OS(e);return t}function OS(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const LS=1,$S=2,FS=4,zS=8,M4=N4()==="coarse";let Mn=[],li=!1,Ko=new Map,$d=new Map;const rl=new Set;function A4(e,t,n,r,o){var i;const{ownerDocument:l}=t,c={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},d=(i=Ko.get(l))!==null&&i!==void 0?i:0;return Ko.set(l,d+1),rl.add(c),Xu(),function(){var g;$d.delete(e),rl.delete(c);const h=(g=Ko.get(l))!==null&&g!==void 0?g:1;if(Ko.set(l,h-1),Xu(),h===1&&Ko.delete(l),Mn.includes(c)){const v=Mn.indexOf(c);v>=0&&Mn.splice(v,1),Am(),o("up",!0,null)}}}function _4(e){const{target:t}=e,{x:n,y:r}=Ld(e);li=!0,Mm({target:t,x:n,y:r}),Xu(),Mn.length>0&&(qu("down",e),e.preventDefault(),VS(t)||e.stopImmediatePropagation())}function Fh(e){const{x:t,y:n}=Ld(e);if(li&&e.buttons===0&&(li=!1,qu("up",e)),!li){const{target:r}=e;Mm({target:r,x:t,y:n})}qu("move",e),Am(),Mn.length>0&&e.preventDefault()}function zh(e){const{target:t}=e,{x:n,y:r}=Ld(e);$d.clear(),li=!1,Mn.length>0&&(e.preventDefault(),VS(t)||e.stopImmediatePropagation()),qu("up",e),Mm({target:t,x:n,y:r}),Am(),Xu()}function VS(e){let t=e;for(;t;){if(t.hasAttribute(dt.resizeHandle))return!0;t=t.parentElement}return!1}function Mm({target:e,x:t,y:n}){Mn.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),rl.forEach(o=>{const{element:i,hitAreaMargins:l}=o,c=i.getBoundingClientRect(),{bottom:d,left:f,right:g,top:h}=c,v=M4?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)&&T4(r,i)>0){let S=r,b=!1;for(;S&&!S.contains(i);){if(k4(S.getBoundingClientRect(),c)){b=!0;break}S=S.parentElement}if(b)return}Mn.push(o)}})}function Vh(e,t){$d.set(e,t)}function Am(){let e=!1,t=!1;Mn.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;$d.forEach(r=>{n|=r}),e&&t?$h("intersection",n):e?$h("horizontal",n):t?$h("vertical",n):E4()}let Bh=new AbortController;function Xu(){Bh.abort(),Bh=new AbortController;const e={capture:!0,signal:Bh.signal};rl.size&&(li?(Mn.length>0&&Ko.forEach((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",zh,e),r.addEventListener("pointerleave",Fh,e),r.addEventListener("pointermove",Fh,e))}),window.addEventListener("pointerup",zh,e),window.addEventListener("pointercancel",zh,e)):Ko.forEach((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",_4,e),r.addEventListener("pointermove",Fh,e))}))}function qu(e,t){rl.forEach(n=>{const{setResizeHandlerState:r}=n,o=Mn.includes(n);r(e,o,t)})}function D4(){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=Rm){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function hr(e,t,n=Rm){return ns(e,t,n)===0}function tn(e,t,n){return ns(e,t,n)===0}function j4(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(Rm)),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(j4(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 O4({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 BS(e,t,n=document){const o=ol(e,n).findIndex(i=>i.getAttribute(dt.resizeHandleId)===t);return o??null}function HS(e,t,n){const r=BS(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function WS(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 L4(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 $4({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:l}){m.useRef({didWarnAboutMissingResizeHandle:!1}),qo(()=>{if(!i)return;const c=ol(n,i);for(let d=0;d<o.length-1;d++){const{valueMax:f,valueMin:g,valueNow:h}=O4({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=WS(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]=L4(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:_=0,collapsible:R,minSize:M=0}=k.constraints;if(P!=null&&R){const L=za({delta:tn(P,_)?M-_:_-P,initialLayout:r,panelConstraints:d.map(D=>D.constraints),pivotIndices:HS(n,x,i),prevLayout:r,trigger:"keyboard"});r!==L&&l(L)}}break}}};return v.addEventListener("keydown",E),()=>{v.removeEventListener("keydown",E)}});return()=>{h.forEach(v=>v())}},[i,e,t,n,r,o,l])}function fb(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 US(e,t){const n=e==="horizontal",{x:r,y:o}=Ld(t);return n?r:o}function F4(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=US(n,e),g=WS(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 z4(e,t,n,r,o,i){if(_S(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:F4(e,t,n,r,i)}function V4({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 B4({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 H4(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function pb(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 KS(e){return`react-resizable-panels:${e}`}function GS(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 YS(e,t){try{const n=KS(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function W4(e,t,n){var r,o;const i=(r=YS(e,n))!==null&&r!==void 0?r:{},l=GS(t);return(o=i[l])!==null&&o!==void 0?o:null}function U4(e,t,n,r,o){var i;const l=KS(e),c=GS(t),d=(i=YS(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 hb({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 K4=100,Va={getItem:e=>(pb(Va),Va.getItem(e)),setItem:(e,t)=>{pb(Va),Va.setItem(e,t)}},gb={};function XS({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=Im(i),x=m.useRef(null),[S,b]=m.useState(null),[E,w]=m.useState([]),N=D4(),k=m.useRef({}),P=m.useRef(new Map),_=m.useRef(0),R=m.useRef({autoSaveId:e,direction:r,dragState:S,id:v,keyboardResizeBy:c,onLayout:l,storage:d}),M=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}=M.current;return X},setLayout:X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=M.current,Z=hb({layout:X,panelConstraints:ne.map(K=>K.constraints)});fb(te,Z)||(w(Z),M.current.layout=Z,Q&&Q(Z),Xs(ne,Z,k.current))}}),[]),qo(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=S,R.current.id=v,R.current.onLayout=l,R.current.storage=d}),$4({committedValuesRef:R,eagerValuesRef:M,groupId:v,layout:E,panelDataArray:M.current.panelDataArray,setLayout:w,panelGroupElement:x.current}),m.useEffect(()=>{const{panelDataArray:X}=M.current;if(e){if(E.length===0||E.length!==X.length)return;let Q=gb[e];Q==null&&(Q=H4(U4,K4),gb[e]=Q);const te=[...X],ne=new Map(P.current);Q(e,te,ne,E,d)}},[e,E,d]),m.useEffect(()=>{});const L=m.useCallback(X=>{const{onLayout:Q}=R.current,{layout:te,panelDataArray:ne}=M.current;if(X.constraints.collapsible){const Z=ne.map(me=>me.constraints),{collapsedSize:K=0,panelSize:re,pivotIndices:ce}=Ho(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),M.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}=M.current;if(X.constraints.collapsible){const K=Z.map(Re=>Re.constraints),{collapsedSize:re=0,panelSize:ce=0,minSize:me=0,pivotIndices:ge}=Ho(Z,X,ne),pe=Q??me;if(hr(ce,re)){const Re=P.current.get(X.id),$e=Re!=null&&Re>=pe?Re:pe,le=Js(Z,X)===Z.length-1?ce-$e:$e-ce,be=za({delta:le,initialLayout:ne,panelConstraints:K,pivotIndices:ge,prevLayout:ne,trigger:"imperative-api"});pu(ne,be)||(w(be),M.current.layout=be,te&&te(be),Xs(Z,be,k.current))}}},[]),H=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=M.current,{panelSize:ne}=Ho(te,X,Q);return Fe(ne!=null,`Panel size not found for panel "${X.id}"`),ne},[]),j=m.useCallback((X,Q)=>{const{panelDataArray:te}=M.current,ne=Js(te,X);return B4({defaultSize:Q,dragState:S,layout:E,panelData:te,panelIndex:ne})},[S,E]),U=m.useCallback(X=>{const{layout:Q,panelDataArray:te}=M.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Ho(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}=M.current,{collapsedSize:ne=0,collapsible:Z,panelSize:K}=Ho(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}=M.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}),M.current.panelDataArrayChanged=!0,N()},[N]);qo(()=>{if(M.current.panelDataArrayChanged){M.current.panelDataArrayChanged=!1;const{autoSaveId:X,onLayout:Q,storage:te}=R.current,{layout:ne,panelDataArray:Z}=M.current;let K=null;if(X){const ce=W4(X,Z,te);ce&&(P.current=new Map(Object.entries(ce.expandToSizes)),K=ce.layout)}K==null&&(K=V4({panelDataArray:Z}));const re=hb({layout:K,panelConstraints:Z.map(ce=>ce.constraints)});fb(ne,re)||(w(re),M.current.layout=re,Q&&Q(re),Xs(Z,re,k.current))}}),qo(()=>{const X=M.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:$e}=M.current,{initialLayout:ze}=ce??{},le=HS(me,X,K);let be=z4(Z,X,re,ce,ge,K);const Oe=re==="horizontal";Oe&&Q&&(be=-be);const ot=$e.map(Ke=>Ke.constraints),Je=za({delta:be,initialLayout:ze??Re,panelConstraints:ot,pivotIndices:le,prevLayout:Re,trigger:_S(Z)?"keyboard":"mouse-or-touch"}),Ct=!pu(Re,Je);(DS(Z)||jS(Z))&&_.current!=be&&(_.current=be,!Ct&&be!==0?Oe?Vh(X,be<0?LS:$S):Vh(X,be<0?FS:zS):Vh(X,0)),Ct&&(w(Je),M.current.layout=Je,pe&&pe(Je),Xs($e,Je,k.current))}},[]),A=m.useCallback((X,Q)=>{const{onLayout:te}=R.current,{layout:ne,panelDataArray:Z}=M.current,K=Z.map(Re=>Re.constraints),{panelSize:re,pivotIndices:ce}=Ho(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),M.current.layout=pe,te&&te(pe),Xs(Z,pe,k.current))},[]),V=m.useCallback((X,Q)=>{const{layout:te,panelDataArray:ne}=M.current,{collapsedSize:Z=0,collapsible:K}=Q,{collapsedSize:re=0,collapsible:ce,maxSize:me=100,minSize:ge=0}=X.constraints,{panelSize:pe}=Ho(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}=M.current;if(!x.current)return;const Z=Fd(X,x.current);Fe(Z,`Drag handle element not found for id "${X}"`);const K=US(te,Q);b({dragHandleId:X,dragHandleRect:Z.getBoundingClientRect(),initialCursorPosition:K,initialLayout:ne})},[]),W=m.useCallback(()=>{b(null)},[]),q=m.useCallback(X=>{const{panelDataArray:Q}=M.current,te=Js(Q,X);te>=0&&(Q.splice(te,1),delete k.current[X.id],M.current.panelDataArrayChanged=!0,N())},[N]),$=m.useMemo(()=>({collapsePanel:L,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}),[L,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:$},m.createElement(g,{...h,children:t,className:n,id:i,ref:x,style:{...z,...f},[dt.group]:"",[dt.groupDirection]:r,[dt.groupId]:v}))}const qS=m.forwardRef((e,t)=>m.createElement(XS,{...e,forwardedRef:t}));XS.displayName="PanelGroup";qS.displayName="forwardRef(PanelGroup)";function Js(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Ho(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 G4({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=BS(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 ZS({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:_,registerResizeHandle:R,startDragging:M,stopDragging:L,panelGroupElement:D}=k,H=Im(o),[j,U]=m.useState("inactive"),[Y,I]=m.useState(!1),[B,A]=m.useState(null),V=m.useRef({state:j});qo(()=>{V.current.state=j}),m.useEffect(()=>{if(n)A(null);else{const $=R(H);A(()=>$)}},[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 $=w.current;Fe($,"Element ref not attached");let z=!1;return A4(H,$,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'),M(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"),L();const{onClick:Z,onDragging:K,onPointerUp:re}=N.current;K?.(!1),re?.(),z||Z?.();break}}})},[F,P,n,W,R,H,B,M,L]),G4({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]:_,[dt.resizeHandle]:"",[dt.resizeHandleActive]:j==="drag"?"pointer":Y?"keyboard":void 0,[dt.resizeHandleEnabled]:!n,[dt.resizeHandleId]:H,[dt.resizeHandleState]:j})}ZS.displayName="PanelResizeHandle";const Y4=({className:e,...t})=>p.jsx(qS,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),mb=AS,X4=({withHandle:e,className:t,...n})=>p.jsx(ZS,{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(_z,{className:"h-2.5 w-2.5"})})});var q4=m.createContext(void 0);function Nl(e){const t=m.useContext(q4);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",[QS]=$t(_m),[Q4,vn]=QS(_m),JS=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),[_,R]=m.useState(!1),[M,L]=m.useState(!1),D=De(t,j=>d(j)),H=Nl(o);return p.jsx(Q4,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:c,viewport:f,onViewportChange:g,content:h,onContentChange:v,scrollbarX:x,onScrollbarXChange:S,scrollbarXEnabled:_,onScrollbarXEnabledChange:R,scrollbarY:b,onScrollbarYChange:E,scrollbarYEnabled:M,onScrollbarYEnabledChange:L,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}})})});JS.displayName=_m;var eC="ScrollAreaViewport",tC=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,l=vn(eC,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})})]})});tC.displayName=eC;var Qn="ScrollAreaScrollbar",Dm=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(J4,{...r,ref:t,forceMount:n}):o.type==="scroll"?p.jsx(eV,{...r,ref:t,forceMount:n}):o.type==="auto"?p.jsx(nC,{...r,ref:t,forceMount:n}):o.type==="always"?p.jsx(jm,{...r,ref:t}):null});Dm.displayName=Qn;var J4=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(nC,{"data-state":i?"visible":"hidden",...r,ref:t})})}),eV=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(jm,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ve(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:ve(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),nC=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(jm,{"data-state":i?"visible":"hidden",...o,ref:t})})}),jm=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=aC(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 iV(v,l.current,c,x)}return n==="horizontal"?p.jsx(tV,{...g,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const v=o.viewport.scrollLeft,x=yb(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(nV,{...g,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const v=o.viewport.scrollTop,x=yb(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}),tV=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(oC,{"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),cC(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)}})}})}),nV=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(oC,{"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),cC(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)}})}})}),[rV,rC]=QS(Qn),oC=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,_=pt(g),R=pt(d),M=Vd(h,10);function L(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)&&_(H,P)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[k,S,P,_]),m.useEffect(R,[r,R]),pi(S,M),pi(x.content,M),p.jsx(rV,{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"),L(D))}),onPointerMove:ve(e.onPointerMove,L),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",sC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=rC(Zu,e.__scopeScrollArea);return p.jsx(Pt,{present:n||o.hasThumb,children:p.jsx(oV,{ref:t,...r})})}),oV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=vn(Zu,n),l=rC(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=aV(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)})});sC.displayName=Zu;var Om="ScrollAreaCorner",iC=m.forwardRef((e,t)=>{const n=vn(Om,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(sV,{...e,ref:t}):null});iC.displayName=Om;var sV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=vn(Om,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 aC(e,t){const n=e/t;return isNaN(n)?0:n}function zd(e){const t=aC(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function iV(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 lC([d,f],h)(e)}function yb(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 lC([0,l],[0,c])(f)}function lC(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 cC(e,t){return e>0&&e<t}var aV=(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 uC=JS,lV=tC,cV=iC;const Di=m.forwardRef(({className:e,children:t,viewportRef:n,viewportClassName:r,type:o="hover",...i},l)=>p.jsxs(uC,{ref:l,type:o,className:Ce("relative overflow-hidden",e),...i,children:[p.jsx(lV,{ref:n,className:Ce("h-full w-full rounded-[inherit]",r),children:t}),p.jsx(Tg,{}),p.jsx(Tg,{orientation:"horizontal"}),p.jsx(cV,{className:"bg-transparent"})]}));Di.displayName=uC.displayName;const Tg=m.forwardRef(({className:e,orientation:t="vertical",...n},r)=>p.jsx(Dm,{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(sC,{className:Ce("relative flex-1 rounded-full bg-muted-foreground/30 transition-colors","hover:bg-muted-foreground/55")})}));Tg.displayName=Dm.displayName;const uV=["top","right","bottom","left"],ho=Math.min,nn=Math.max,Ju=Math.round,hu=Math.floor,Gn=e=>({x:e,y:e}),dV={left:"right",right:"left",bottom:"top",top:"bottom"};function Pg(e,t,n){return nn(e,ho(t,n))}function Cr(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function ji(e){return e.split("-")[1]}function Lm(e){return e==="x"?"y":"x"}function $m(e){return e==="y"?"height":"width"}function Kn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Fm(e){return Lm(Kn(e))}function fV(e,t,n){n===void 0&&(n=!1);const r=ji(e),o=Fm(e),i=$m(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 pV(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 vb=["left","right"],xb=["right","left"],hV=["top","bottom"],gV=["bottom","top"];function mV(e,t,n){switch(e){case"top":case"bottom":return n?t?xb:vb:t?vb:xb;case"left":case"right":return t?hV:gV;default:return[]}}function yV(e,t,n,r){const o=ji(e);let i=mV(Er(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Rg)))),i}function ed(e){const t=Er(e);return dV[t]+e.slice(t.length)}function vV(e){return{top:0,right:0,bottom:0,left:0,...e}}function dC(e){return typeof e!="number"?vV(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 bb(e,t,n){let{reference:r,floating:o}=e;const i=Kn(t),l=Fm(t),c=$m(l),d=Er(t),f=i==="y",g=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,v=r[c]/2-o[c]/2;let x;switch(d){case"top":x={x:g,y:r.y-o.height};break;case"bottom":x={x:g,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:h};break;case"left":x={x:r.x-o.width,y:h};break;default:x={x:r.x,y:r.y}}switch(ji(t)){case"start":x[l]-=v*(n&&f?-1:1);break;case"end":x[l]+=v*(n&&f?-1:1);break}return x}async function xV(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:h="floating",altBoundary:v=!1,padding:x=0}=Cr(t,e),S=dC(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},_=td(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:k,strategy:d}):N);return{top:(w.top-_.top+S.top)/P.y,bottom:(_.bottom-w.bottom+S.bottom)/P.y,left:(w.left-_.left+S.left)/P.x,right:(_.right-w.right+S.right)/P.x}}const bV=50,wV=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:xV},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}=bb(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:_,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],..._},R&&x<bV&&(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}=bb(f,v,d)),b=-1)}return{x:g,y:h,placement:v,strategy:o,middlewareData:S}},SV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:d}=t,{element:f,padding:g=0}=Cr(e,t)||{};if(f==null)return{};const h=dC(g),v={x:n,y:r},x=Fm(o),S=$m(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],_=v[x]-i.reference[x],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let M=R?R[k]:0;(!M||!await(l.isElement==null?void 0:l.isElement(R)))&&(M=c.floating[k]||i.floating[S]);const L=P/2-_/2,D=M/2-b[S]/2-1,H=ho(h[w],D),j=ho(h[N],D),U=H,Y=M-b[S]-j,I=M/2-b[S]/2+L,B=Pg(U,I,Y),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-Y:0;return{[x]:v[x]+V,data:{[x]:B,centerOffset:I-B-V,...A&&{alignmentOffset:V}},reset:A}}}),CV=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}=Cr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Er(o),N=Kn(c),k=Er(c)===c,P=await(d.isRTL==null?void 0:d.isRTL(f.floating)),_=v||(k||!b?[ed(c)]:pV(c)),R=S!=="none";!v&&R&&_.push(...yV(c,b,S,P));const M=[c,..._],L=await d.detectOverflow(t,E),D=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(g&&D.push(L[w]),h){const I=fV(o,l,P);D.push(L[I[0]],L[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=M[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 wb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sb(e){return uV.some(t=>e[t]>=0)}const EV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Cr(e,t);switch(o){case"referenceHidden":{const l=await r.detectOverflow(t,{...i,elementContext:"reference"}),c=wb(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Sb(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...i,altBoundary:!0}),c=wb(l,n.floating);return{data:{escapedOffsets:c,escaped:Sb(c)}}}default:return{}}}}},fC=new Set(["left","top"]);async function NV(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Er(n),c=ji(n),d=Kn(n)==="y",f=fC.has(l)?-1:1,g=i&&d?-1:1,h=Cr(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:S}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof S=="number"&&(x=c==="end"?S*-1:S),d?{x:x*g,y:v*f}:{x:v*f,y:x*g}}const kV=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 NV(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}}}}},TV=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}=Cr(e,t),g={x:n,y:r},h=await i.detectOverflow(t,f),v=Kn(Er(o)),x=Lm(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}}}}}},PV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=Cr(e,t),g={x:n,y:r},h=Kn(o),v=Lm(h);let x=g[v],S=g[h];const b=Cr(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,_=i.reference[v]+i.reference[k]-E.mainAxis;x<P?x=P:x>_&&(x=_)}if(f){var w,N;const k=v==="y"?"width":"height",P=fC.has(Er(o)),_=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<_?S=_:S>R&&(S=R)}return{[v]:x,[h]:S}}}},RV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:c}=t,{apply:d=()=>{},...f}=Cr(e,t),g=await l.detectOverflow(t,f),h=Er(o),v=ji(o),x=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=ho(b-g[E],N),_=ho(S-g[w],k),R=!t.middlewareData.shift;let M=P,L=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=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?L=S-2*(H!==0||j!==0?H+j:nn(g.left,g.right)):M=b-2*(U!==0||Y!==0?U+Y:nn(g.top,g.bottom))}await d({...t,availableWidth:L,availableHeight:M});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 pC(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=(pC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pC(e){return Bd()?e instanceof Node||e instanceof on(e).Node:!1}function _n(e){return Bd()?e instanceof Element||e instanceof on(e).Element:!1}function Pr(e){return Bd()?e instanceof HTMLElement||e instanceof on(e).HTMLElement:!1}function Cb(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 IV(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 MV=/transform|translate|scale|rotate|perspective|filter/,AV=/paint|layout|strict|content/,Wo=e=>!!e&&e!=="none";let Hh;function zm(e){const t=_n(e)?Dn(e):e;return Wo(t.transform)||Wo(t.translate)||Wo(t.scale)||Wo(t.rotate)||Wo(t.perspective)||!Vm()&&(Wo(t.backdropFilter)||Wo(t.filter))||MV.test(t.willChange||"")||AV.test(t.contain||"")}function _V(e){let t=go(e);for(;Pr(t)&&!hi(t);){if(zm(t))return t;if(Hd(t))return null;t=go(t)}return null}function Vm(){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 _n(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function go(e){if(Oi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Cb(e)&&e.host||Jn(e);return Cb(t)?t.host:t}function hC(e){const t=go(e);return hi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pr(t)&&kl(t)?t:hC(t)}function sl(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=hC(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 gC(e){const t=Dn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Pr(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=Ju(n)!==i||Ju(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function Bm(e){return _n(e)?e:e.contextElement}function ci(e){const t=Bm(e);if(!Pr(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gC(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 DV=Gn(0);function mC(e){const t=on(e);return!Vm()||!t.visualViewport?DV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jV(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=Bm(e);let l=Gn(1);t&&(r?_n(r)&&(l=ci(r)):l=ci(e));const c=jV(i,n,r)?mC(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&&_n(r)?on(r):r;let S=v,b=Ig(S);for(;b&&r&&x!==S;){const E=ci(b),w=b.getBoundingClientRect(),N=Dn(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 yC(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 OV(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=Pr(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?yC(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 LV(e){return Array.from(e.getClientRects())}function $V(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 Eb=25;function FV(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=Vm();(!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<=Eb&&(i-=S)}else f<=Eb&&(i+=f);return{width:i,height:l,x:c,y:d}}function zV(e,t){const n=rs(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Pr(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 Nb(e,t,n){let r;if(t==="viewport")r=FV(e,n);else if(t==="document")r=$V(Jn(e));else if(_n(t))r=zV(t,n);else{const o=mC(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return td(r)}function vC(e,t){const n=go(e);return n===t||!_n(n)||hi(n)?!1:Dn(n).position==="fixed"||vC(n,t)}function VV(e,t){const n=t.get(e);if(n)return n;let r=sl(e,[],!1).filter(c=>_n(c)&&Oi(c)!=="body"),o=null;const i=Dn(e).position==="fixed";let l=i?go(e):e;for(;_n(l)&&!hi(l);){const c=Dn(l),d=zm(l);!d&&c.position==="fixed"&&(o=null),(i?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||kl(l)&&!d&&vC(e,l))?r=r.filter(g=>g!==l):o=c,l=go(l)}return t.set(e,r),r}function BV(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?Hd(t)?[]:VV(t,this._c):[].concat(n),r],c=Nb(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=Nb(t,l[v],o);d=nn(x.top,d),f=ho(x.right,f),g=ho(x.bottom,g),h=nn(x.left,h)}return{width:f-h,height:g-d,x:h,y:d}}function HV(e){const{width:t,height:n}=gC(e);return{width:t,height:n}}function WV(e,t,n){const r=Pr(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?yC(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 kb(e,t){if(!Pr(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 xC(e,t){const n=on(e);if(Hd(e))return n;if(!Pr(e)){let o=go(e);for(;o&&!hi(o);){if(_n(o)&&!Wh(o))return o;o=go(o)}return n}let r=kb(e,t);for(;r&&IV(r)&&Wh(r);)r=kb(r,t);return r&&hi(r)&&Wh(r)&&!zm(r)?n:r||_V(e)||n}const UV=async function(e){const t=this.getOffsetParent||xC,n=this.getDimensions,r=await n(e.floating);return{reference:WV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function KV(e){return Dn(e).direction==="rtl"}const GV={convertOffsetParentRelativeRectToViewportRelativeRect:OV,getDocumentElement:Jn,getClippingRect:BV,getOffsetParent:xC,getElementRects:UV,getClientRects:LV,getDimensions:HV,getScale:ci,isElement:_n,isRTL:KV};function bC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function YV(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,ho(1,d))||1};let P=!0;function _(R){const M=R[0].intersectionRatio;if(M!==d){if(!P)return l();M?l(!1,M):r=setTimeout(()=>{l(!1,1e-7)},1e3)}M===1&&!bC(f,e.getBoundingClientRect())&&l(),P=!1}try{n=new IntersectionObserver(_,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,k)}n.observe(e)}return l(!0),i}function XV(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=Bm(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?YV(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&&!bC(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 qV=kV,ZV=TV,QV=CV,JV=RV,eB=EV,Tb=SV,tB=PV,nB=(e,t,n)=>{const r=new Map,o={platform:GV,...n},i={...o.platform,_c:r};return wV(e,t,{...o,platform:i})};var rB=typeof document<"u",oB=function(){},ju=rB?m.useLayoutEffect:oB;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 wC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pb(e,t){const n=wC(e);return Math.round(t*n)/n}function Uh(e){const t=m.useRef(e);return ju(()=>{t.current=e}),t}function sB(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!==M.current&&(M.current=F,w(F))},[]),P=i||S,_=l||E,R=m.useRef(null),M=m.useRef(null),L=m.useRef(g),D=d!=null,H=Uh(d),j=Uh(o),U=Uh(f),Y=m.useCallback(()=>{if(!R.current||!M.current)return;const F={placement:t,strategy:n,middleware:v};j.current&&(F.platform=j.current),nB(R.current,M.current,F).then(W=>{const q={...W,isPositioned:U.current!==!1};I.current&&!nd(L.current,q)&&(L.current=q,ps.flushSync(()=>{h(q)}))})},[v,t,n,j,U]);ju(()=>{f===!1&&L.current.isPositioned&&(L.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=_),P&&_){if(H.current)return H.current(P,_,Y);Y()}},[P,_,Y,H,D]);const B=m.useMemo(()=>({reference:R,floating:M,setReference:N,setFloating:k}),[N,k]),A=m.useMemo(()=>({reference:P,floating:_}),[P,_]),V=m.useMemo(()=>{const F={position:n,left:0,top:0};if(!A.floating)return F;const W=Pb(A.floating,g.x),q=Pb(A.floating,g.y);return c?{...F,transform:"translate("+W+"px, "+q+"px)",...wC(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 iB=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?Tb({element:r.current,padding:o}).fn(n):{}:r?Tb({element:r,padding:o}).fn(n):{}}}},aB=(e,t)=>{const n=qV(e);return{name:n.name,fn:n.fn,options:[e,t]}},lB=(e,t)=>{const n=ZV(e);return{name:n.name,fn:n.fn,options:[e,t]}},cB=(e,t)=>({fn:tB(e).fn,options:[e,t]}),uB=(e,t)=>{const n=QV(e);return{name:n.name,fn:n.fn,options:[e,t]}},dB=(e,t)=>{const n=JV(e);return{name:n.name,fn:n.fn,options:[e,t]}},fB=(e,t)=>{const n=eB(e);return{name:n.name,fn:n.fn,options:[e,t]}},pB=(e,t)=>{const n=iB(e);return{name:n.name,fn:n.fn,options:[e,t]}};var hB="Arrow",SC=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"})})});SC.displayName=hB;var gB=SC;function Hm(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 Wm="Popper",[CC,Li]=$t(Wm),[mB,EC]=CC(Wm),NC=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return p.jsx(mB,{scope:t,anchor:r,onAnchorChange:o,children:n})};NC.displayName=Wm;var kC="PopperAnchor",TC=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=EC(kC,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})});TC.displayName=kC;var Um="PopperContent",[yB,vB]=CC(Um),PC=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=EC(Um,n),[w,N]=m.useState(null),k=De(t,Z=>N(Z)),[P,_]=m.useState(null),R=Hm(P),M=R?.width??0,L=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(bB),altBoundary:U},{refs:I,floatingStyles:B,placement:A,isPositioned:V,middlewareData:F}=sB({strategy:"fixed",placement:D,whileElementsMounted:(...Z)=>XV(...Z,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[aB({mainAxis:o+L,alignmentAxis:l}),d&&lB({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?cB():void 0,...Y}),d&&uB({...Y}),dB({...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&&pB({element:P,padding:c}),wB({arrowWidth:M,arrowHeight:L}),v&&fB({strategy:"referenceHidden",...Y})]}),[W,q]=MC(A),$=pt(S);xt(()=>{V&&$?.()},[V,$]);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(yB,{scope:n,placedSide:W,onArrowChange:_,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"}})})})});PC.displayName=Um;var RC="PopperArrow",xB={top:"bottom",right:"left",bottom:"top",left:"right"},IC=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=vB(RC,r),l=xB[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(gB,{...o,ref:n,style:{...o.style,display:"block"}})})});IC.displayName=RC;function bB(e){return e!==null}var wB=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]=MC(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 MC(e){const[t,n="center"]=e.split("-");return[t,n]}var Km=NC,Gm=TC,Ym=PC,Xm=IC,SB=Symbol("radix.slottable");function CB(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=SB,t}var AC=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"}),EB="VisuallyHidden",Kd=m.forwardRef((e,t)=>p.jsx(Ne.span,{...e,ref:t,style:{...AC,...e.style}}));Kd.displayName=EB;var NB=Kd,[Gd]=$t("Tooltip",[Li]),Yd=Li(),_C="TooltipProvider",kB=700,Mg="tooltip.open",[TB,qm]=Gd(_C),DC=e=>{const{__scopeTooltip:t,delayDuration:n=kB,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(TB,{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})};DC.displayName=_C;var il="Tooltip",[PB,Tl]=Gd(il),jC=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:l,delayDuration:c}=e,d=qm(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:M=>{M?(d.onOpen(),document.dispatchEvent(new CustomEvent(Mg))):d.onClose(),i?.(M)},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.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(Km,{...f,children:p.jsx(PB,{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?_():(window.clearTimeout(x.current),x.current=0)},[_,S]),onOpen:P,onClose:_,disableHoverableContent:S,children:n})})};jC.displayName=il;var Ag="TooltipTrigger",OC=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Tl(Ag,n),i=qm(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(Gm,{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)})})});OC.displayName=Ag;var Zm="TooltipPortal",[RB,IB]=Gd(Zm,{forceMount:void 0}),LC=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Tl(Zm,t);return p.jsx(RB,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(_i,{asChild:!0,container:o,children:r})})})};LC.displayName=Zm;var gi="TooltipContent",$C=m.forwardRef((e,t)=>{const n=IB(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(FC,{side:o,...i,ref:t}):p.jsx(MB,{side:o,...i,ref:t})})}),MB=m.forwardRef((e,t)=>{const n=Tl(gi,e.__scopeTooltip),r=qm(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=OB(w,E.getBoundingClientRect()),k=LB(w,N),P=$B(b.getBoundingClientRect()),_=zB([...k,...P]);c(_),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=!FB(w,l);N?v():k&&(v(),f())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[d,g,l,f,v]),p.jsx(FC,{...e,ref:i})}),[AB,_B]=Gd(il,{isInside:!1}),DB=CB("TooltipContent"),FC=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(Mg,g),()=>document.removeEventListener(Mg,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(Ym,{"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(DB,{children:r}),p.jsx(AB,{scope:n,isInside:!0,children:p.jsx(NB,{id:d.contentId,role:"tooltip",children:o||r})})]})})});$C.displayName=gi;var zC="TooltipArrow",jB=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Yd(n);return _B(zC,n).isInside?null:p.jsx(Xm,{...o,...r,ref:t})});jB.displayName=zC;function OB(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 LB(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 $B(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 FB(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 zB(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),VB(t)}function VB(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 BB=DC,HB=jC,WB=OC,UB=LC,VC=$C;const BC=BB,al=HB,ll=WB,mi=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(UB,{children:p.jsx(VC,{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=VC.displayName;const Rb=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},KB=(e=>e?Rb(e):Rb),GB=e=>e;function YB(e,t=GB){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 Ib=e=>{const t=KB(e),n=r=>YB(t,r);return Object.assign(n,t),n},Xd=(e=>e?Ib(e):Ib),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}})})),XB=(e={})=>t=>{const{limit:n=50,partialize:r=i=>i,equality:o=(i,l)=>JSON.stringify(i)===JSON.stringify(l)}=e;return(i,l,c)=>({...t(i,l,c),_history_past:[],_history_future:[],mutationCount:0,takeCheckpoint:()=>{const f=r(l());i(g=>({...g,_history_past:[...g._history_past,{state:f,timestamp:Date.now()}].slice(-n),_history_future:[],mutationCount:g.mutationCount+1}))},withCheckpoint:f=>{const g=r(l()),h=f(),v=r(l());return o(g,v)||i(S=>({...S,_history_past:[...S._history_past,{state:g,timestamp:Date.now()}].slice(-n),_history_future:[],mutationCount:S.mutationCount+1})),h},undo:()=>{const f=l();if(f._history_past.length===0)return;const g=[...f._history_past],h=g.pop(),v=r(f);i({...f,...h.state,_history_past:g,_history_future:[...f._history_future,{state:v,timestamp:Date.now()}],mutationCount:f.mutationCount+1})},redo:()=>{const f=l();if(f._history_future.length===0)return;const g=[...f._history_future],h=g.pop(),v=r(f);i({...f,...h.state,_history_past:[...f._history_past,{state:v,timestamp:Date.now()}].slice(-n),_history_future:g,mutationCount:f.mutationCount+1})},clearHistory:()=>{i(f=>({...f,_history_past:[],_history_future:[],mutationCount:f.mutationCount+1}))},canUndo:()=>l()._history_past.length>0,canRedo:()=>l()._history_future.length>0,exportHistory:()=>({past:[...l()._history_past],future:[...l()._history_future]}),importHistory:f=>{i(g=>({...g,_history_past:[...f.past],_history_future:[...f.future],mutationCount:g.mutationCount+1}))}})},lo=1,qa=1,qB=[];function ZB(e){const t=new Map;for(const n of e){if(!Number.isInteger(n.from)||n.from<qa||n.from>=lo)throw new Error(`[migration] from must be an integer in [${qa}, ${lo}), got ${n.from}`);if(t.has(n.from))throw new Error(`[migration] duplicate migration from ${n.from}`);t.set(n.from,n)}for(let n=qa;n<lo;n++)if(!t.has(n))throw new Error(`[migration] missing migration from ${n} -> ${n+1}`);return t}const QB=ZB(qB);function JB(e){const t=e.schemaVersion;return typeof t=="number"&&Number.isInteger(t)&&t>=qa?t:qa}function eH(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=JB(t);if(n>lo)throw new Error(`[migration] schemaVersion ${n} is newer than this build supports (${lo})`);for(let r=n;r<lo;r++)t=QB.get(r).migrate(t);return t.schemaVersion=lo,t}const tH=new Set(T1);function nH(e){const t=e.canvases[He];if(!t)throw new Error("Main canvas missing");const n=t.nodes.map(f=>z0(f,tl(f.id,f,t.edges))),r=t.edges.map(L0),o=Ab(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}=BA(g);i.push({functionInfo:v,outputAssignments:x,nodes:h.nodes.map(S=>z0(S,tl(S.id,S,h.edges))),edges:h.edges.map(L0),declaredVariables:Ab(h.variables)})}const l=Object.values(e.channels).map(IA),c=Object.values(e.memory).map(jA),d=Object.values(e.models).map(zA);return{schemaVersion:lo,nodes:n,edges:r,functions:i,declaredVariables:o,channels:l,memory:c,models:d}}function rH(e){const t={},n={},r={};for(const h of e.functions??[])r[h.functionInfo.id]={...h.functionInfo,arguments:F0(h.functionInfo.arguments),returns:F0(h.functionInfo.returns)};const o=h=>r[h],i=e.nodes.map(h=>V0(h,o)),l=e.edges.map($0),c=e.declaredVariables??[];t[He]={nodes:i,edges:l,variables:Mb(i,[],c)};for(const h of e.functions??[]){const v=r[h.functionInfo.id],x=HA(v,h.outputAssignments??{});n[x.id]=x;const S=h.nodes.map(E=>V0(E,o)),b=h.edges.map($0);t[x.id]={nodes:S,edges:b,variables:Mb(S,x.arguments,h.declaredVariables??[])}}const d={};for(const h of e.channels??[]){if(!tH.has(h.type))continue;const v=MA(h);d[v.id]=v}const f={};for(const h of e.memory??[]){const v=OA(h);f[v.id]=v}const g={};for(const h of e.models??[]){const v=VA(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 Mb(e,t,n){const r=qd(e);for(const o of t)r[fm(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 Ab(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 oH(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[fm(o.uid)]={kind:"fnarg",uid:o.uid,name:o.name,dataType:o.dataType};return r})}const sH=50,_g=new Set;function Zd(){_g.forEach(e=>e())}function _b(e){return _g.add(e),()=>_g.delete(e)}const vr=new Map;vr.set(He,Qm());function Qm(){const e=Xd(XB({limit:sH,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 Jm(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 ey(){const e={};return vr.forEach((t,n)=>{e[n]=t}),e}function iH(e){e!==He&&(vr.delete(e),Zd())}function Db(){vr.clear(),vr.set(He,Qm()),Zd()}const ja={kind:"none"};function qs(e){Jm(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 ty(e){return bg(e,gr.t.bind(gr))}const ny=()=>{const e=Lt.getAll(),{functions:t}=Qd(),n=m.useMemo(()=>Object.values(t).map(l=>ty(Td(l))),[t]),r=m.useCallback(l=>{if(l.type==="FunctionCall"){const c=l;return n.find(d=>d.type==="FunctionCall"&&d.functionInfo.id===c.functionInfo.id)}return Lt.getByType(l.type)},[n]),o=m.useCallback(l=>{const c=Lt.getByCategory(l);return l===xe.Function?[...c,...n]:c},[n]),i=m.useCallback(()=>{const l=Lt.getAllCategories(),c=new Set([...l]);return n.length>0&&c.add(xe.Function),[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output].filter(f=>c.has(f))},[n]);return{nodeDefinitions:[...e,...n],getAllCategories:i,getNodeDefinition:r,getNodeDefinitionsByCategory:o}},aH=({canvasId:e,onSelectNode:t,onSelectEdge:n})=>{const{t:r}=Xe(),{getNodeDefinition:o}=ny(),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(_=>_.id===h),S=x?d.find(_=>_.id===x.source):void 0,b=x?d.find(_=>_.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(_=>_.severity==="error").length,warningCount:v.filter(_=>_.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(L1,{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(lH,{group:h,onSelect:()=>h.entityType==="node"?t(h.entityId):n(h.entityId)},`${h.entityType}-${h.entityId}`))})};function lH({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(po,{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(po,{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(Sr,{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=fo,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(Sr,{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 cH=({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:V1,emptyText:n("noFunctions"),emptyHint:n("addFunctionHint"),addActions:[{label:n("addFunction"),icon:fo,onAdd:()=>t()}]})};var ef="Collapsible",[uH]=$t(ef),[dH,ry]=uH(ef),HC=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(dH,{scope:n,disabled:i,contentId:kt(),open:d,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),children:p.jsx(Ne.div,{"data-state":sy(d),"data-disabled":i?"":void 0,...c,ref:t})})});HC.displayName=ef;var WC="CollapsibleTrigger",UC=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ry(WC,n);return p.jsx(Ne.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":sy(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ve(e.onClick,o.onOpenToggle)})});UC.displayName=WC;var oy="CollapsibleContent",KC=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ry(oy,e.__scopeCollapsible);return p.jsx(Pt,{present:n||o.open,children:({present:i})=>p.jsx(fH,{...r,ref:t,present:i})})});KC.displayName=oy;var fH=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,l=ry(oy,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":sy(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 sy(e){return e?"open":"closed"}var pH=HC;const hH=pH,gH=UC,mH=KC,yH=yo("flex w-full bg-field border border-input rounded-2xl placeholder:text-muted-foreground/60 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground transition-all duration-300",{variants:{size:{sm:"h-9 px-3 py-1.5 text-sm",md:"h-10 px-4 py-2 text-sm",lg:"h-11 px-5 py-2.5 text-base"},variant:{default:"",subtle:"bg-muted/30 border-transparent backdrop-blur-md",ghost:"bg-transparent border-transparent hover:bg-card/40 hover:backdrop-blur-lg"},status:{none:"",success:"border-success focus:border-success focus:shadow-[0_0_0_3px_rgba(50,166,118,0.1)]",error:"border-destructive focus:border-destructive focus:shadow-[0_0_0_3px_rgba(220,38,38,0.1)]"}},defaultVariants:{size:"md",variant:"default",status:"none"}}),_t=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(yH({size:n,variant:r,status:o}),e),ref:c,...l}));_t.displayName="Input";const iy={[xe.Input]:jz,[xe.Logic]:Pz,[xe.Data]:Ku,[xe.Output]:Bz,[xe.AI]:Nz,[xe.Trigger]:Yz,[xe.Tool]:Gz,[xe.Function]:kz},vH={[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 GC(e,t){return e(`nodes.${t.type}.description`,{defaultValue:t.description})}function xH(e,t,n){return n.description?e(`${t}.params.${n.id}.description`,{defaultValue:n.description}):""}function bH(e,t,n){return e(`edges.${n}.description`,{defaultValue:t.description})}const wH=e=>{switch(e){case"string":return W0;case"number":case"int":case"float":return Dz;case"boolean":case"bool":return Wz;case"dropdown":case"selection":return Ii;default:return W0}},SH=(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}},CH=({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=wH(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(po,{variant:"secondary",className:"text-xs",children:t("optional")}):p.jsx(po,{variant:"destructive",className:"text-xs",children:t("required")})]}),p.jsxs("div",{className:"text-xs text-muted-foreground pl-5",children:[t("typeLabel")," ",SH(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)})]}),EH=({onAddNode:e,nodeDefinitions:t,getAllCategories:n,functions:r,isFunctionCanvas:o})=>{const{t:i}=Xe(),l=ue(w=>On(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(z1,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),p.jsx(_t,{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(BC,{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=iy[w],_=vH[w]??"bg-muted text-muted-foreground border-border";return p.jsxs(hH,{open:k,onOpenChange:()=>S(w),children:[p.jsxs(gH,{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(mH,{children:p.jsx("div",{className:"grid grid-cols-2 gap-1.5 px-1 pt-1.5 pb-2",children:N.map(R=>{const M=R.parameters,L=`${R.type}-${"functionInfo"in R?R.functionInfo.id:""}`,D=M.length>0,H=GC(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 ${_}`,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(po,{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(CH,{parameters:M,t:i})]})})]},L):p.jsx(qe.Fragment,{children:U},L)})})})]},w)})]})})})]})};function YC(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 XC(e){const t={type:e},n={};for(const r of Ed.parameters)r.id!=="type"&&(r.activationRules?.length&&!Tr(r,t,!1)||"default"in r&&r.default!==void 0&&(n[r.id]=r.default));return n}function NH(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:XC(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(XC(i)))l[c]===void 0&&(l[c]=d);return{...r,[n]:{...o,...t.label!==void 0?{label:t.label}:{},type:i,arguments:l}}})}function kH(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 TH=()=>{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:$1,emptyText:e("noChannels"),emptyHint:e("noChannelsHint"),addActions:[{label:e("addChannel"),icon:fo,onAdd:()=>r(NH("GPIOIN").id)}]})},PH={MemoryFile:"memory",VectorDatabase:"vectordb"};function RH(e){const t=an(),n=Object.values(ue.getState().memory).map(o=>o.label),r={id:t,label:yi(PH[e],n),type:e,arguments:YC(Nd.getByType(e)?.parameters??[])};return ue.getState().setMemory(o=>({...o,[t]:r})),r}function jb(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 IH(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 MH={MemoryFile:"File",VectorDatabase:"Vector"},AH=()=>{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(RH(l).id);return p.jsx(Jd,{items:Object.values(t),selectedId:n.kind==="memory"?n.id:null,onSelect:r,diagnosticsSlot:o,badge:l=>MH[l.type],emptyIcon:wg,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:F1,onAdd:()=>i("MemoryFile")},{label:e("addVectorDatabase","Add Vector Database"),icon:wg,onAdd:()=>i("VectorDatabase")}]})},_H={LLMModel:"llm-model",MLModel:"ml-model"};function Ob(e){const t=an(),n=Object.values(ue.getState().models).map(o=>o.label),r={id:t,label:yi(_H[e],n),type:e,arguments:YC(kd.getByType(e)?.parameters??[])};return ue.getState().setModels(o=>({...o,[t]:r})),r}function Lb(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 DH(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 jH=()=>{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:i=>i.type==="MLModel"?e("modelMLBadge","ML"):e("modelLLMBadge","LLM"),emptyIcon:j1,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("addLLMModel","Add LLM Model"),icon:fo,onAdd:()=>r(Ob("LLMModel").id)},{label:e("addMLModel","Add ML Model"),icon:fo,onAdd:()=>r(Ob("MLModel").id)}]})},$i=(e=He)=>{const t=Qe(e),n=t(o=>o.variables),r=t(o=>o.edges);return m.useMemo(()=>pm(n,r),[n,r])};function OH(e){let t=1;for(;e.includes(`var${t}`);)t++;return`var${t}`}function LH(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:OH(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 $H(e,t,n){Ba(e,t,{dataType:n,initialValue:void 0})}function FH(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 zH=({canvasId:e,onSelectNode:t})=>{const n=ue(w=>On(w.builderMode)),{t:r}=Xe(),{list:o}=$i(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=LH(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 VH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],BH=VH.reduce((e,t)=>{const n=gm(`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}},{}),HH="Label",qC=m.forwardRef((e,t)=>p.jsx(BH.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));qC.displayName=HH;var ZC=qC;const WH=yo("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),vi=m.forwardRef(({className:e,...t},n)=>p.jsx(ZC,{ref:n,className:Ce(WH(),e),...t}));vi.displayName=ZC.displayName;function ay(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",[UH]=$t(tf),[KH,GH]=UH(tf),QC=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(KH,{scope:n,checked:w,disabled:c,children:[p.jsx(Ne.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":nE(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(tE,{control:v,bubbles:!b.current,name:r,value:d,checked:w,required:l,disabled:c,form:g,style:{transform:"translateX(-100%)"}})]})});QC.displayName=tf;var JC="SwitchThumb",eE=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=GH(JC,n);return p.jsx(Ne.span,{"data-state":nE(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});eE.displayName=JC;var YH="SwitchBubbleInput",tE=m.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},i)=>{const l=m.useRef(null),c=De(l,i),d=ay(n),f=Hm(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}})});tE.displayName=YH;function nE(e){return e?"checked":"unchecked"}var rE=QC,XH=eE;const nf=m.forwardRef(({className:e,...t},n)=>p.jsx(rE,{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(XH,{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=rE.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 qH(){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 ZH=()=>{const{t:e}=Xe(),t=ss(o=>o.context),n=ss(o=>o.updateContextVar),r=qH();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(_t,{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(_t,{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(_t,{value:String(c??""),onChange:d=>n(o,d.target.value),className:"h-8 font-mono text-sm"})]},o)})})},QH=({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:Ez,label:x("nodeLibrary")},{id:"variables",icon:Ku,label:x("variables")},{id:"channels",icon:$1,label:x("channels")},{id:"memory",icon:wg,label:x("memoryFiles","Memory")},{id:"models",icon:j1,label:x("models","AI Models")},{id:"functions",icon:Tz,label:x("functions")},{id:"diagnostics",icon:Sr,label:x("diagnostics")}],[x]),b=m.useMemo(()=>[{id:"debug-context",icon:Rz,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}),_=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}),M=Ye(I=>{let B=0;for(const A of Object.values(I.byModelId))for(const V of A)V.severity==="warning"&&B++;return B}),L=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(EH,{onAddNode:r,nodeDefinitions:o,getAllCategories:i,functions:f,isFunctionCanvas:!!d});case"variables":return p.jsx(zH,{canvasId:e,onSelectNode:l});case"channels":return p.jsx(TH,{});case"memory":return p.jsx(AH,{});case"models":return p.jsx(jH,{});case"functions":return p.jsx(cH,{onOpenFunction:g,onCreateFunction:h});case"diagnostics":return p.jsx(aH,{canvasId:e,onSelectNode:l,onSelectEdge:c});case"debug-context":return p.jsx(ZH,{});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=w):I.id==="channels"?(V=N,F=k):I.id==="memory"?(V=P,F=_):I.id==="models"?(V=R,F=M):I.id==="functions"&&(V=L,F=D);const W=V+F,q=W>0,$=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":$??"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()})]})})]})},JH=({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,_=P?E:E+1,R=P?w.left-N.left:w.right-N.left,M=Math.round(Math.max(0,Math.min(R,i.current.clientWidth-2)));f(_),h(M)},[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(Kz,{className:"w-3.5 h-3.5 shrink-0"}):p.jsx(V1,{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 oE(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 e8(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"&&!Lt.getByType(e.type)?.canBranch&&n.some(i=>i.source===e.id&&i.sourceHandle===t)||o.type==="control"&&oE(e.id,e,n))}function t8(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 sE=(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"&&e8(c.id,c.data,i)||v==="control"&&oE(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 n8={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 r8(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=r8(e+"",n),o,i=-1,l=r.length;if(arguments.length<2){for(;++i<l;)if((o=(e=r[i]).type)&&(o=o8(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]=$b(n[o],e.name,t);else if(t==null)for(o in n)n[o]=$b(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 o8(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function $b(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=n8,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 Fb={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)),Fb.hasOwnProperty(t)?{space:Fb[t],local:e}:e}function s8(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 i8(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iE(e){var t=of(e);return(t.local?i8:s8)(t)}function a8(){}function ly(e){return e==null?a8:function(){return this.querySelector(e)}}function l8(e){typeof e!="function"&&(e=ly(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 c8(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function u8(){return[]}function aE(e){return e==null?u8:function(){return this.querySelectorAll(e)}}function d8(e){return function(){return c8(e.apply(this,arguments))}}function f8(e){typeof e=="function"?e=d8(e):e=aE(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 lE(e){return function(){return this.matches(e)}}function cE(e){return function(t){return t.matches(e)}}var p8=Array.prototype.find;function h8(e){return function(){return p8.call(this.children,e)}}function g8(){return this.firstElementChild}function m8(e){return this.select(e==null?g8:h8(typeof e=="function"?e:cE(e)))}var y8=Array.prototype.filter;function v8(){return Array.from(this.children)}function x8(e){return function(){return y8.call(this.children,e)}}function b8(e){return this.selectAll(e==null?v8:x8(typeof e=="function"?e:cE(e)))}function w8(e){typeof e!="function"&&(e=lE(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 uE(e){return new Array(e.length)}function S8(){return new cn(this._enter||this._groups.map(uE),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 C8(e){return function(){return e}}function E8(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 N8(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 k8(e){return e.__data__}function T8(e,t){if(!arguments.length)return Array.from(this,k8);var n=t?N8:E8,r=this._parents,o=this._groups;typeof e!="function"&&(e=C8(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=P8(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,_;N<S;++N)if(P=b[N]){for(N>=k&&(k=N+1);!(_=E[k])&&++k<S;);P._next=_||null}}return l=new cn(l,r),l._enter=c,l._exit=d,l}function P8(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function R8(){return new cn(this._exit||this._groups.map(uE),this._parents)}function I8(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 M8(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 A8(){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 _8(e){e||(e=D8);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 D8(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function j8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function O8(){return Array.from(this)}function L8(){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 $8(){let e=0;for(const t of this)++e;return e}function F8(){return!this.node()}function z8(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 V8(e){return function(){this.removeAttribute(e)}}function B8(e){return function(){this.removeAttributeNS(e.space,e.local)}}function H8(e,t){return function(){this.setAttribute(e,t)}}function W8(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function U8(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function K8(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 G8(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?B8:V8:typeof t=="function"?n.local?K8:U8:n.local?W8:H8)(n,t))}function dE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Y8(e){return function(){this.style.removeProperty(e)}}function X8(e,t,n){return function(){this.style.setProperty(e,t,n)}}function q8(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Z8(e,t,n){return arguments.length>1?this.each((t==null?Y8:typeof t=="function"?q8:X8)(e,t,n??"")):xi(this.node(),e)}function xi(e,t){return e.style.getPropertyValue(t)||dE(e).getComputedStyle(e,null).getPropertyValue(t)}function Q8(e){return function(){delete this[e]}}function J8(e,t){return function(){this[e]=t}}function e6(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function t6(e,t){return arguments.length>1?this.each((t==null?Q8:typeof t=="function"?e6:J8)(e,t)):this.node()[e]}function fE(e){return e.trim().split(/^|\s+/)}function cy(e){return e.classList||new pE(e)}function pE(e){this._node=e,this._names=fE(e.getAttribute("class")||"")}pE.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 hE(e,t){for(var n=cy(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function gE(e,t){for(var n=cy(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function n6(e){return function(){hE(this,e)}}function r6(e){return function(){gE(this,e)}}function o6(e,t){return function(){(t.apply(this,arguments)?hE:gE)(this,e)}}function s6(e,t){var n=fE(e+"");if(arguments.length<2){for(var r=cy(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?o6:t?n6:r6)(n,t))}function i6(){this.textContent=""}function a6(e){return function(){this.textContent=e}}function l6(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function c6(e){return arguments.length?this.each(e==null?i6:(typeof e=="function"?l6:a6)(e)):this.node().textContent}function u6(){this.innerHTML=""}function d6(e){return function(){this.innerHTML=e}}function f6(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function p6(e){return arguments.length?this.each(e==null?u6:(typeof e=="function"?f6:d6)(e)):this.node().innerHTML}function h6(){this.nextSibling&&this.parentNode.appendChild(this)}function g6(){return this.each(h6)}function m6(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function y6(){return this.each(m6)}function v6(e){var t=typeof e=="function"?e:iE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function x6(){return null}function b6(e,t){var n=typeof e=="function"?e:iE(e),r=t==null?x6:typeof t=="function"?t:ly(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function w6(){var e=this.parentNode;e&&e.removeChild(this)}function S6(){return this.each(w6)}function C6(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function E6(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function N6(e){return this.select(e?E6:C6)}function k6(e){return arguments.length?this.property("__data__",e):this.node().__data__}function T6(e){return function(t){e.call(this,t,this.__data__)}}function P6(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 R6(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 I6(e,t,n){return function(){var r=this.__on,o,i=T6(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 M6(e,t,n){var r=P6(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?I6:R6,o=0;o<i;++o)this.each(c(r[o],t,n));return this}function mE(e,t,n){var r=dE(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 A6(e,t){return function(){return mE(this,e,t)}}function _6(e,t){return function(){return mE(this,e,t.apply(this,arguments))}}function D6(e,t){return this.each((typeof t=="function"?_6:A6)(e,t))}function*j6(){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 yE=[null];function cn(e,t){this._groups=e,this._parents=t}function Pl(){return new cn([[document.documentElement]],yE)}function O6(){return this}cn.prototype=Pl.prototype={constructor:cn,select:l8,selectAll:f8,selectChild:m8,selectChildren:b8,filter:w8,data:T8,enter:S8,exit:R8,join:I8,merge:M8,selection:O6,order:A8,sort:_8,call:j8,nodes:O8,node:L8,size:$8,empty:F8,each:z8,attr:G8,style:Z8,property:t6,classed:s6,text:c6,html:p6,raise:g6,lower:y6,append:v6,insert:b6,remove:S6,clone:N6,datum:k6,on:M6,dispatch:D6,[Symbol.iterator]:j6};function rn(e){return typeof e=="string"?new cn([[document.querySelector(e)]],[document.documentElement]):new cn([[e]],yE)}function L6(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kn(e,t){if(e=L6(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 $6={passive:!1},cl={capture:!0,passive:!1};function Gh(e){e.stopImmediatePropagation()}function ui(e){e.preventDefault(),e.stopImmediatePropagation()}function vE(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 xE(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 F6(e){return!e.ctrlKey&&!e.button}function z6(){return this.parentNode}function V6(e,t){return t??{x:e.x,y:e.y}}function B6(){return navigator.maxTouchPoints||"ontouchstart"in this}function bE(){var e=F6,t=z6,n=V6,r=B6,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,$6).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(P,_){if(!(g||!e.call(this,P,_))){var R=k(this,t.call(this,P,_),P,_,"mouse");R&&(rn(P.view).on("mousemove.drag",S,cl).on("mouseup.drag",b,cl),vE(P.view),Gh(P),f=!1,c=P.clientX,d=P.clientY,R("start",P))}}function S(P){if(ui(P),!f){var _=P.clientX-c,R=P.clientY-d;f=_*_+R*R>h}o.mouse("drag",P)}function b(P){rn(P.view).on("mousemove.drag mouseup.drag",null),xE(P.view,f),ui(P),o.mouse("end",P)}function E(P,_){if(e.call(this,P,_)){var R=P.changedTouches,M=t.call(this,P,_),L=R.length,D,H;for(D=0;D<L;++D)(H=k(this,M,P,_,R[D].identifier,R[D]))&&(Gh(P),H("start",P,R[D]))}}function w(P){var _=P.changedTouches,R=_.length,M,L;for(M=0;M<R;++M)(L=o[_[M].identifier])&&(ui(P),L("drag",P,_[M]))}function N(P){var _=P.changedTouches,R=_.length,M,L;for(g&&clearTimeout(g),g=setTimeout(function(){g=null},500),M=0;M<R;++M)(L=o[_[M].identifier])&&(Gh(P),L("end",P,_[M]))}function k(P,_,R,M,L,D){var H=i.copy(),j=kn(D||R,_),U,Y,I;if((I=n.call(P,new Og("beforestart",{sourceEvent:R,target:v,identifier:L,active:l,x:j[0],y:j[1],dx:0,dy:0,dispatch:H}),M))!=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[L]=B,q=l++;break;case"end":delete o[L],--l;case"drag":j=kn(F||V,_),q=l;break}H.call(A,P,new Og(A,{sourceEvent:V,subject:I,target:v,identifier:L,active:q,x:j[0]+U,y:j[1]+Y,dx:j[0]-W[0],dy:j[1]-W[1],dispatch:H}),M)}}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 uy(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wE(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*",H6=/^#([0-9a-f]{3,8})$/,W6=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),U6=new RegExp(`^rgb\\(${Yn},${Yn},${Yn}\\)$`),K6=new RegExp(`^rgba\\(${di},${di},${di},${dl}\\)$`),G6=new RegExp(`^rgba\\(${Yn},${Yn},${Yn},${dl}\\)$`),Y6=new RegExp(`^hsl\\(${dl},${Yn},${Yn}\\)$`),X6=new RegExp(`^hsla\\(${dl},${Yn},${Yn},${dl}\\)$`),zb={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};uy(Rl,is,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vb,formatHex:Vb,formatHex8:q6,formatHsl:Z6,formatRgb:Bb,toString:Bb});function Vb(){return this.rgb().formatHex()}function q6(){return this.rgb().formatHex8()}function Z6(){return SE(this).formatHsl()}function Bb(){return this.rgb().formatRgb()}function is(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=H6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Hb(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=W6.exec(e))?new Gt(t[1],t[2],t[3],1):(t=U6.exec(e))?new Gt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=K6.exec(e))?mu(t[1],t[2],t[3],t[4]):(t=G6.exec(e))?mu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Y6.exec(e))?Kb(t[1],t[2]/100,t[3]/100,1):(t=X6.exec(e))?Kb(t[1],t[2]/100,t[3]/100,t[4]):zb.hasOwnProperty(e)?Hb(zb[e]):e==="transparent"?new Gt(NaN,NaN,NaN,0):null}function Hb(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 Q6(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 Lg(e,t,n,r){return arguments.length===1?Q6(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}uy(Gt,Lg,wE(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(Zo(this.r),Zo(this.g),Zo(this.b),sd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Wb,formatHex:Wb,formatHex8:J6,formatRgb:Ub,toString:Ub}));function Wb(){return`#${Go(this.r)}${Go(this.g)}${Go(this.b)}`}function J6(){return`#${Go(this.r)}${Go(this.g)}${Go(this.b)}${Go((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ub(){const e=sd(this.opacity);return`${e===1?"rgb(":"rgba("}${Zo(this.r)}, ${Zo(this.g)}, ${Zo(this.b)}${e===1?")":`, ${e})`}`}function sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Go(e){return e=Zo(e),(e<16?"0":"")+e.toString(16)}function Kb(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 SE(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 eW(e,t,n,r){return arguments.length===1?SE(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}uy(Pn,eW,wE(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(Gb(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("}${Gb(this.h)}, ${yu(this.s)*100}%, ${yu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Gb(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 dy=e=>()=>e;function tW(e,t){return function(n){return e+n*t}}function nW(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 rW(e){return(e=+e)==1?CE:function(t,n){return n-t?nW(t,n,e):dy(isNaN(t)?n:t)}}function CE(e,t){var n=t-e;return n?tW(e,n):dy(isNaN(e)?t:e)}const id=(function e(t){var n=rW(t);function r(o,i){var l=n((o=Lg(o)).r,(i=Lg(i)).r),c=n(o.g,i.g),d=n(o.b,i.b),f=CE(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 oW(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 sW(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function iW(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 aW(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 lW(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 $g=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xh=new RegExp($g.source,"g");function cW(e){return function(){return e}}function uW(e){return function(t){return e(t)+""}}function EE(e,t){var n=$g.lastIndex=Xh.lastIndex=0,r,o,i,l=-1,c=[],d=[];for(e=e+"",t=t+"";(r=$g.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]?uW(d[0].x):cW(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"?dy(t):(n==="number"?Hn:n==="string"?(r=is(t))?(t=r,id):EE:t instanceof is?id:t instanceof Date?aW:sW(t)?oW:Array.isArray(t)?iW:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lW:Hn)(e,t)}var Yb=180/Math.PI,Fg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function NE(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)*Yb,skewX:Math.atan(d)*Yb,scaleX:l,scaleY:c}}var vu;function dW(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fg:NE(t.a,t.b,t.c,t.d,t.e,t.f)}function fW(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,NE(e.a,e.b,e.c,e.d,e.e,e.f))}function kE(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 pW=kE(dW,"px, ","px)","deg)"),hW=kE(fW,", ",")",")"),gW=1e-12;function Xb(e){return((e=Math.exp(e))+1/e)/2}function mW(e){return((e=Math.exp(e))-1/e)/2}function yW(e){return((e=Math.exp(2*e))-1)/(e+1)}const Lu=(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<gW)w=Math.log(v/f)/t,E=function(M){return[c+M*x,d+M*S,f*Math.exp(t*M*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),_=Math.log(Math.sqrt(k*k+1)-k),R=Math.log(Math.sqrt(P*P+1)-P);w=(R-_)/t,E=function(M){var L=M*w,D=Xb(_),H=f/(n*N)*(D*yW(t*L+_)-mW(_));return[c+H*x,d+H*S,f*D/Xb(t*L+_)]}}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 bi=0,Ha=0,Oa=0,TE=1e3,ad,Wa,ld=0,as=0,sf=0,fl=typeof performance=="object"&&performance.now?performance:Date,PE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function fy(){return as||(PE(vW),as=fl.now()+sf)}function vW(){as=0}function cd(){this._call=this._time=this._next=null}cd.prototype=RE.prototype={constructor:cd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?fy():+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 RE(e,t,n){var r=new cd;return r.restart(e,t,n),r}function xW(){fy(),++bi;for(var e=ad,t;e;)(t=as-e._time)>=0&&e._call.call(void 0,t),e=e._next;--bi}function qb(){as=(ld=fl.now())+sf,bi=Ha=0;try{xW()}finally{bi=0,wW(),as=0}}function bW(){var e=fl.now(),t=e-ld;t>TE&&(sf-=t,ld=e)}function wW(){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(!bi){Ha&&(Ha=clearTimeout(Ha));var t=e-as;t>24?(e<1/0&&(Ha=setTimeout(qb,e-fl.now()-sf)),Oa&&(Oa=clearInterval(Oa))):(Oa||(ld=fl.now(),Oa=setInterval(bW,TE)),bi=1,PE(qb))}}function Zb(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 SW=rf("start","end","cancel","interrupt"),CW=[],IE=0,Qb=1,Vg=2,$u=3,Jb=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;EW(e,n,{name:t,index:r,group:o,on:SW,tween:CW,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:IE})}function py(e,t){var n=Ln(e,t);if(n.state>IE)throw new Error("too late; already scheduled");return n}function er(e,t){var n=Ln(e,t);if(n.state>$u)throw new Error("too late; already running");return n}function Ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function EW(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=RE(i,0,n.time);function i(f){n.state=Qb,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!==Qb)return d();for(g in r)if(x=r[g],x.name===n.name){if(x.state===$u)return Zb(l);x.state===Jb?(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(Zb(function(){n.state===$u&&(n.state=Jb,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=$u,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 NW(e){return this.each(function(){zu(this,e)})}function kW(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 TW(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 PW(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ln(this.node(),n).tween,o=0,i=r.length,l;o<i;++o)if((l=r[o]).name===e)return l.value;return null}return this.each((t==null?kW:TW)(n,e,t))}function hy(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 Ln(o,r).value[t]}}function ME(e,t){var n;return(typeof t=="number"?Hn:t instanceof is?id:(n=is(t))?(t=n,id):EE)(e,t)}function RW(e){return function(){this.removeAttribute(e)}}function IW(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MW(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 AW(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 _W(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 DW(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 jW(e,t){var n=of(e),r=n==="transform"?hW:ME;return this.attrTween(e,typeof t=="function"?(n.local?DW:_W)(n,r,hy(this,"attr."+e,t)):t==null?(n.local?IW:RW)(n):(n.local?AW:MW)(n,r,t))}function OW(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function LW(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $W(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&LW(e,i)),n}return o._value=t,o}function FW(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&OW(e,i)),n}return o._value=t,o}function zW(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?$W:FW)(r,t))}function VW(e,t){return function(){py(this,e).delay=+t.apply(this,arguments)}}function BW(e,t){return t=+t,function(){py(this,e).delay=t}}function HW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?VW:BW)(t,e)):Ln(this.node(),t).delay}function WW(e,t){return function(){er(this,e).duration=+t.apply(this,arguments)}}function UW(e,t){return t=+t,function(){er(this,e).duration=t}}function KW(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?WW:UW)(t,e)):Ln(this.node(),t).duration}function GW(e,t){if(typeof t!="function")throw new Error;return function(){er(this,e).ease=t}}function YW(e){var t=this._id;return arguments.length?this.each(GW(t,e)):Ln(this.node(),t).ease}function XW(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;er(this,e).ease=n}}function qW(e){if(typeof e!="function")throw new Error;return this.each(XW(this._id,e))}function ZW(e){typeof e!="function"&&(e=lE(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],l=i.length,c=r[o]=[],d,f=0;f<l;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&c.push(d);return new Nr(r,this._parents,this._name,this._id)}function QW(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),l=new Array(r),c=0;c<i;++c)for(var d=t[c],f=n[c],g=d.length,h=l[c]=new Array(g),v,x=0;x<g;++x)(v=d[x]||f[x])&&(h[x]=v);for(;c<r;++c)l[c]=t[c];return new Nr(l,this._parents,this._name,this._id)}function JW(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 eU(e,t,n){var r,o,i=JW(t)?py:er;return function(){var l=i(this,e),c=l.on;c!==r&&(o=(r=c).copy()).on(t,n),l.on=o}}function tU(e,t){var n=this._id;return arguments.length<2?Ln(this.node(),n).on.on(e):this.each(eU(n,e,t))}function nU(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function rU(){return this.on("end.remove",nU(this._id))}function oU(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ly(e));for(var r=this._groups,o=r.length,i=new Array(o),l=0;l<o;++l)for(var c=r[l],d=c.length,f=i[l]=new Array(d),g,h,v=0;v<d;++v)(g=c[v])&&(h=e.call(g,g.__data__,v,c))&&("__data__"in g&&(h.__data__=g.__data__),f[v]=h,af(f[v],t,n,v,f,Ln(g,n)));return new Nr(i,this._parents,t,n)}function sU(e){var t=this._name,n=this._id;typeof e!="function"&&(e=aE(e));for(var r=this._groups,o=r.length,i=[],l=[],c=0;c<o;++c)for(var d=r[c],f=d.length,g,h=0;h<f;++h)if(g=d[h]){for(var v=e.call(g,g.__data__,h,d),x,S=Ln(g,n),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 Nr(i,l,t,n)}var iU=Pl.prototype.constructor;function aU(){return new iU(this._groups,this._parents)}function lU(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 AE(e){return function(){this.style.removeProperty(e)}}function cU(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 uU(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 dU(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=AE(t)):void 0;(f!==n||o!==g)&&(r=(n=f).copy()).on(l,o=g),d.on=r}}function fU(e,t,n){var r=(e+="")=="transform"?pW:ME;return t==null?this.styleTween(e,lU(e,r)).on("end.style."+e,AE(e)):typeof t=="function"?this.styleTween(e,uU(e,r,hy(this,"style."+e,t))).each(dU(this._id,e)):this.styleTween(e,cU(e,r,t),n).on("end.style."+e,null)}function pU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function hU(e,t,n){var r,o;function i(){var l=t.apply(this,arguments);return l!==o&&(r=(o=l)&&pU(e,l,n)),r}return i._value=t,i}function gU(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,hU(e,t,n??""))}function mU(e){return function(){this.textContent=e}}function yU(e){return function(){var t=e(this);this.textContent=t??""}}function vU(e){return this.tween("text",typeof e=="function"?yU(hy(this,"text",e)):mU(e==null?"":e+""))}function xU(e){return function(t){this.textContent=e.call(this,t)}}function bU(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&xU(o)),t}return r._value=e,r}function wU(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,bU(e))}function SU(){for(var e=this._name,t=this._id,n=_E(),r=this._groups,o=r.length,i=0;i<o;++i)for(var l=r[i],c=l.length,d,f=0;f<c;++f)if(d=l[f]){var g=Ln(d,t);af(d,e,n,f,l,{time:g.time+g.delay+g.duration,delay:0,duration:g.duration,ease:g.ease})}return new Nr(r,this._parents,e,n)}function CU(){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 EU=0;function Nr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function _E(){return++EU}var pr=Pl.prototype;Nr.prototype={constructor:Nr,select:oU,selectAll:sU,selectChild:pr.selectChild,selectChildren:pr.selectChildren,filter:ZW,merge:QW,selection:aU,transition:SU,call:pr.call,nodes:pr.nodes,node:pr.node,size:pr.size,empty:pr.empty,each:pr.each,on:tU,attr:jW,attrTween:zW,style:fU,styleTween:gU,text:vU,textTween:wU,remove:rU,tween:PW,delay:HW,duration:KW,ease:YW,easeVarying:qW,end:CU,[Symbol.iterator]:pr[Symbol.iterator]};function NU(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kU={time:null,delay:0,duration:250,ease:NU};function TU(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 PU(e){var t,n;e instanceof Nr?(t=e._id,e=e._name):(t=_E(),(n=kU).time=fy(),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||TU(d,t));return new Nr(r,this._parents,e,t)}Pl.prototype.interrupt=NW;Pl.prototype.transition=PU;const xu=e=>()=>e;function RU(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);DE.prototype=mr.prototype;function DE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lf;return e.__zoom}function qh(e){e.stopImmediatePropagation()}function La(e){e.preventDefault(),e.stopImmediatePropagation()}function IU(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function MU(){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 ew(){return this.__zoom||lf}function AU(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _U(){return navigator.maxTouchPoints||"ontouchstart"in this}function DU(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 jE(){var e=IU,t=MU,n=DU,r=AU,o=_U,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,d=Lu,f=rf("start","zoom","end"),g,h,v,x=500,S=150,b=0,E=10;function w(I){I.property("__zoom",ew).on("wheel.zoom",L,{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)")}w.transform=function(I,B,A,V){var F=I.selection?I.selection():I;F.property("__zoom",ew),I!==F?_(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,$=W.invert(q),z=typeof B=="function"?B.apply(this,arguments):B;return n(k(N(W,z),q,$),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,$=V==null?P(W):typeof V=="function"?V.apply(this,arguments):V;return n(lf.translate($[0],$[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 _(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),$=t.apply(F,W),z=A==null?P($):typeof A=="function"?A.apply(F,W):A,X=Math.max($[1][0]-$[0][0],$[1][1]-$[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 M(I,B)}function M(I,B){this.that=I,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,B),this.taps=0}M.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 RU(I,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:f}),B)}};function L(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()}La(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,$=I.clientY;vE(I.view),qh(I),V.mouse=[W,this.__zoom.invert(W)],zu(this),V.start();function z(Q){if(La(Q),!V.moved){var te=Q.clientX-q,ne=Q.clientY-$;V.moved=te*te+ne*ne>b}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),xE(Q.view,V.moved),La(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);La(I),c>0?rn(this).transition().duration(c).call(_,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,$,z;for(qh(I),q=0;q<V;++q)$=A[q],z=kn($,this),z=[z,this.__zoom.invert(z),$.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,$,z;for(La(I),W=0;W<F;++W)q=V[W],$=kn(q,this),A.touch0&&A.touch0[2]===q.identifier?A.touch0[0]=$:A.touch1&&A.touch1[2]===q.identifier&&(A.touch1[0]=$);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)),$=[(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)$=A.touch0[0],z=A.touch0[1];else return;A.zoom("touch",n(k(q,$,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 $=rn(this).on("dblclick.zoom");$&&$.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]],OE=["Enter"," ","Escape"],LE={"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 wi;(function(e){e.Strict="strict",e.Loose="loose"})(wi||(wi={}));var Qo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Qo||(Qo={}));var Si;(function(e){e.Partial="partial",e.Full="full"})(Si||(Si={}));const $E={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ao;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ao||(ao={}));var ud;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ud||(ud={}));var Se;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Se||(Se={}));const tw={[Se.Left]:Se.Right,[Se.Right]:Se.Left,[Se.Top]:Se.Bottom,[Se.Bottom]:Se.Top};function FE(e){return e===null?null:e?"valid":"invalid"}const zE=e=>"id"in e&&"source"in e&&"target"in e,jU=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),gy=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Il=(e,t=[0,0])=>{const{width:n,height:r}=Rr(e),o=e.origin??t,i=n*o[0],l=r*o[1];return{x:e.position.x-i,y:e.position.y-l}},OU=(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):gy(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)},Ml=(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}},my=(e,t,[n,r,o]=[0,0,1],i=!1,l=!1)=>{const c={..._l(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},LU=(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 $U(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 FU({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},l){if(e.size===0)return Promise.resolve(!0);const c=$U(e,l),d=Ml(c),f=yy(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 VE({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 zU({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=LU(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 BE(e,t,n){const{width:r,height:o}=Rr(n),{x:i,y:l}=n.internals.positionAbsolute;return ls(e,[[i,l],[i+r,l+o]],t)}const nw=(e,t,n)=>e<t?Ci(Math.abs(e-t),1,t)/t:e>n?-Ci(Math.abs(e-n),1,t)/t:0,HE=(e,t,n=15,r=40)=>{const o=nw(e.x,r,t.width-r)*n,i=nw(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}=gy(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}=gy(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)}},WE=(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)},rw=e=>Rn(e.width)&&Rn(e.height)&&Rn(e.x)&&Rn(e.y),Rn=e=>!isNaN(e)&&isFinite(e),VU=(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])}),_l=({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 BU(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 HU(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 yy=(e,t,n,r,o,i)=>{const l=BU(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=HU(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 Rr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function vy(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function UE(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 ow(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function WU(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function UU(e){return{...LE,...e||{}}}function Qa(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:l}=In(e),c=_l({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 xy=e=>({width:e.offsetWidth,height:e.offsetHeight}),KE=e=>e?.getRootNode?.()||window?.document,KU=["INPUT","SELECT","TEXTAREA"];function GE(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:KU.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const YE=e=>"clientX"in e,In=(e,t)=>{const n=YE(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)}},sw=(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,...xy(l)}})};function XE({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 bu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function iw({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Se.Left:return[t-bu(t-r,i),n];case Se.Right:return[t+bu(r-t,i),n];case Se.Top:return[t,n-bu(n-o,i)];case Se.Bottom:return[t,n+bu(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]=iw({pos:n,x1:e,y1:t,x2:r,y2:o,c:l}),[f,g]=iw({pos:i,x1:r,y1:o,x2:e,y2:t,c:l}),[h,v,x,S]=XE({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 qE({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 GU({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 YU({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 XU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,qU=(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)),ZE=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||XU;let o;return zE(e)?o={...e}:o={...e,id:r(e)},qU(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function QE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,l,c]=qE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,l,c]}const aw={[Se.Left]:{x:-1,y:0},[Se.Right]:{x:1,y:0},[Se.Top]:{x:0,y:-1},[Se.Bottom]:{x:0,y:1}},ZU=({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},lw=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function QU({source:e,sourcePosition:t=Se.Bottom,target:n,targetPosition:r=Se.Top,center:o,offset:i,stepPosition:l}){const c=aw[t],d=aw[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=ZU({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]=qE({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 L=[{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"?L:D:S=v==="x"?D:L}else{const L=[{x:f.x,y:g.y}],D=[{x:g.x,y:f.y}];if(v==="x"?S=c.x===x?D:L:S=c.y===x?L: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"?L: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)),Y=Math.max(Math.abs(H.y-S[0].y),Math.abs(j.y-S[0].y));U>=Y?(b=(H.x+j.x)/2,E=S[0].y):(b=S[0].x,E=(H.y+j.y)/2)}const _={x:f.x+w.x,y:f.y+w.y},R={x:g.x+N.x,y:g.y+N.y};return[[e,..._.x!==S[0].x||_.y!==S[0].y?[_]:[],...S,...R.x!==S[S.length-1].x||R.y!==S[S.length-1].y?[R]:[],n],b,E,k,P]}function JU(e,t,n,r){const o=Math.min(lw(e,t)/2,lw(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]=QU({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+=JU(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 cw(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function e9(e){const{sourceNode:t,targetNode:n}=e;if(!cw(t)||!cw(n))return null;const r=t.internals.handleBounds||uw(t.handles),o=n.internals.handleBounds||uw(n.handles),i=dw(r?.source??[],e.sourceHandle),l=dw(e.connectionMode===wi.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 uw(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??Rr(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 dw(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 t9(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 JE=1e3,n9=10,by={nodeOrigin:[0,0],nodeExtent:pl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},r9={...by,checkEquality:!0};function wy(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function o9(e,t,n){const r=wy(by,n);for(const o of e.values())if(o.parentId)Cy(o,e,t,r);else{const i=Il(o,r.nodeOrigin),l=Ni(o.extent)?o.extent:r.nodeExtent,c=ls(i,l,Rr(o));o.internals.positionAbsolute=c}}function s9(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 Sy(e){return e==="manual"}function Kg(e,t,n,r={}){const o=wy(r9,r),i={i:0},l=new Map(t),c=o?.elevateNodesOnSelect&&!Sy(o.zIndexMode)?JE: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,Rr(g));h={...o.defaults,...g,measured:{width:g.measured?.width,height:g.measured?.height},internals:{positionAbsolute:S,handleBounds:s9(g,h),z:eN(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&&Cy(h,t,n,r,i),f||=g.selected??!1}return{nodesInitialized:d,hasSelectedNodes:f}}function i9(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 Cy(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:l,nodeExtent:c,zIndexMode:d}=wy(by,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}i9(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*n9),o&&g.internals.rootParentIndex!==void 0&&(o.i=g.internals.rootParentIndex);const h=i&&!Sy(d)?JE:0,{x:v,y:x,z:S}=a9(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 eN(e,t,n){const r=Rn(e.zIndex)?e.zIndex:0;return Sy(n)?r:r+(e.selected?t:0)}function a9(e,t,n,r,o,i){const{x:l,y:c}=t.internals.positionAbsolute,d=Rr(e),f=Il(e,n),g=Ni(e.extent)?ls(f,e.extent,d):f;let h=ls({x:l+g.x,y:c+g.y},r,d);e.extent==="parent"&&(h=BE(h,d,t));const v=eN(e,o,i),x=t.internals.z??0;return{x:h.x,y:h.y,z:x>=v?x+1:v}}function Ey(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=WE(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{const f=c.internals.positionAbsolute,g=Rr(c),h=c.origin??r,v=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,x=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,S=Math.max(g.width,Math.round(l.width)),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 l9(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=xy(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=BE(P,b,t.get(S.parentId)):k&&(P=ls(P,k,b));const _={...S,measured:b,internals:{...S.internals,positionAbsolute:P,handleBounds:{source:sw("source",x.nodeElement,N,h,S.id),target:sw("target",x.nodeElement,N,h,S.id)}}};t.set(S.id,_),S.parentId&&Cy(_,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(_,o)}))}}if(v.length>0){const x=Ey(v,t,n,o);f.push(...x)}return{changes:f,updatedInternals:d}}async function c9({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 fw(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 tN(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}`;fw("source",d,g,e,o,l),fw("target",d,f,e,i,c),t.set(r.id,r)}}function nN(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:nN(n,t):!1}function pw(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 u9(e,t,n,r){const o=new Map;for(const[i,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!nN(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 d9({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 f9({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:_,nodeId:R,nodeClickDistance:M=0}){v=rn(P);function L({x:U,y:Y}){const{nodeLookup:I,nodeExtent:B,snapGrid:A,snapToGrid:V,nodeOrigin:F,onNodeDrag:W,onSelectionDrag:q,onError:$,updateNodePositions:z}=t();i={x:U,y:Y};let X=!1;const Q=c.size>1,te=Q&&B?Hg(Ml(c)):null,ne=Q&&V?d9({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],$e=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],[$e,le]]}const{position:me,positionAbsolute:ge}=VE({nodeId:Z,nextPosition:re,nodeLookup:I,nodeExtent:ce||B,nodeOrigin:F,onError:$});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:Y,autoPanSpeed:I,autoPanOnNodeDrag:B}=t();if(!B){d=!1,cancelAnimationFrame(l);return}const[A,V]=HE(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})&&L(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:$,unselectNodesAndEdges:z}=t();h=!0,(!W||!_)&&!I&&R&&(Y.get(R)?.selected||z()),_&&W&&R&&e?.(R);const X=Qa(U.sourceEvent,{transform:A,snapGrid:V,snapToGrid:F,containerBounds:g});if(i=X,c=u9(Y,B,X,R),c.size>0&&(n||q||!R&&$)){const[Q,te]=Zh({nodeId:R,dragItems:c,nodeLookup:Y});n?.(U.sourceEvent,c,Q,te),q?.(U.sourceEvent,Q,te),R||$?.(U.sourceEvent,te)}}const j=bE().clickDistance(M).on("start",U=>{const{domNode:Y,nodeDragThreshold:I,transform:B,snapGrid:A,snapToGrid:V}=t();g=Y?.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=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(b=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),$=q.x-f.x,z=q.y-f.y;Math.sqrt($*$+z*z)>V&&H(U)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&c&&h&&(f=In(U.sourceEvent,g),L(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||!pw(Y,`.${N}`,P))&&(!k||pw(Y,k,P))});v.call(j)}function w(){v?.on(".drag",null)}return{update:E,destroy:w}}function p9(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 h9=250;function g9(e,t,n,r){let o=[],i=1/0;const l=p9(e,n,t+h9);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 rN(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 oN(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function m9(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const sN=()=>!0;function y9(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=sN,onReconnectEnd:N,updateConnection:k,getTransform:P,getFromHandle:_,autoPanSpeed:R,dragThreshold:M=1,handleDomNode:L}){const D=KE(e.target);let H=0,j;const{x:U,y:Y}=In(e),I=oN(i,L),B=c?.getBoundingClientRect();let A=!1;if(!B||!I)return;const V=rN(o,I,r,d,t);if(!V)return;let F=In(e,B),W=!1,q=null,$=!1,z=null;function X(){if(!g||!B)return;const[me,ge]=HE(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:tw[Q.position],toNode:null,pointer:F};function K(){A=!0,k(Z),S?.(e,{nodeId:o,handleId:r,handleType:I})}M===0&&K();function re(me){if(!A){const{x:le,y:be}=In(me),Oe=le-U,ot=be-Y;if(!(Oe*Oe+ot*ot>M*M))return;K()}if(!_()||!Q){ce(me);return}const ge=P();F=In(me,B),j=g9(_l(F,ge,!1,[1,1]),n,d,Q),W||(X(),W=!0);const pe=iN(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,$=m9(!!j,pe.isValid);const Re=d.get(o),$e=Re?cs(Re,Q,Se.Left,!0):Z.from,ze={...Z,from:$e,isValid:$,to:pe.toHandle&&$?fd({x:pe.toHandle.x,y:pe.toHandle.y},ge):F,toHandle:pe.toHandle,toPosition:$&&pe.toHandle?pe.toHandle.position:tw[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&&$&&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,$=!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 iN(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:l,lib:c,flowId:d,isValidConnection:f=sN,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),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=oN(void 0,E),k=E.getAttribute("data-nodeid"),P=E.getAttribute("data-handleid"),_=E.classList.contains("connectable"),R=E.classList.contains("connectableend");if(!k||!N)return w;const M={source:h?k:r,sourceHandle:h?P:o,target:h?r:k,targetHandle:h?o:P};w.connection=M;const D=_&&R&&(n===wi.Strict?h&&N==="source"||!h&&N==="target":k!==r||P!==o);w.isValid=D&&f(M),w.toHandle=rN(k,N,P,g,n,!0)}return w}const Gg={onPointerDown:y9,isValid:iN};function v9({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(),_=k.sourceEvent.ctrlKey&&gl()?10:1,R=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*g,M=P[2]*Math.pow(2,R*_);t.scaleTo(M)};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 _=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],R=[_[0]-b[0],_[1]-b[1]];b=_;const M=r()*Math.max(P[2],Math.log(P[2]))*(x?-1:1),L={x:P[0]-R[0]*M,y:P[1]-R[1]*M},D=[[0,0],[d,f]];t.setViewportConstrained({x:L.x,y:L.y,zoom:P[2]},D,c)},N=jE().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: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}`),aN=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x9=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Jh=(e,t=0,n=x9,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},lN=e=>{const t=e.ctrlKey&&gl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function b9({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),w=lN(g),N=h*Math.pow(2,w);r.scaleTo(n,N,E,g);return}const v=g.deltaMode===1?20:1;let x=o===Qo.Vertical?0:g.deltaX*v,S=o===Qo.Horizontal?0:g.deltaY*v;!gl()&&g.shiftKey&&o!==Qo.Vertical&&(x=g.deltaY*v,S=0),r.translateBy(n,-(x/h)*i,-(S/h)*i,{internal:!0});const 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 w9({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 S9({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 C9({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&aN(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 E9({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return l=>{if(!l.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&aN(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 N9({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 k9({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=jE().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(lN);function b(j,U){return v?new Promise(Y=>{h?.interpolate(U?.interpolate==="linear"?Za:Lu).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:$,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:!Rn(Z)||Z<0?0:Z);const ce=re?b9({zoomPanValues:f,noWheelClassName:j,d3Selection:v,d3Zoom:h,panOnScrollMode:V,panOnScrollSpeed:F,zoomOnPinch:q,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):w9({noWheelClassName:j,preventScrolling:W,d3ZoomHandler:x});if(v.on("wheel.zoom",ce,{passive:!1}),!I){const ge=S9({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:l});h.on("start",ge);const pe=C9({zoomPanValues:f,panOnDrag:A,onPaneContextMenu:!!Y,onPanZoom:i,onTransformChange:te});h.on("zoom",pe);const Re=E9({zoomPanValues:f,panOnDrag:A,panOnScroll:B,onPaneContextMenu:Y,onPanZoomEnd:c,onDraggingChange:d});h.on("end",Re)}const me=N9({zoomActivationKeyPressed:X,panOnDrag:A,zoomOnScroll:$,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,Y){const I=Qh(j),B=h?.constrain()(I,U,Y);return B&&await b(B),new Promise(A=>A(B))}async function k(j,U){const Y=Qh(j);return await b(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 _(){const j=v?DE(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:Lu).scaleTo(Jh(v,U?.duration,U?.ease,()=>Y(!0)),j)}):Promise.resolve(!1)}function M(j,U){return v?new Promise(Y=>{h?.interpolate(U?.interpolate==="linear"?Za:Lu).scaleBy(Jh(v,U?.duration,U?.ease,()=>Y(!0)),j)}):Promise.resolve(!1)}function L(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:w,setViewport:k,setViewportConstrained:N,getViewport:_,scaleTo:R,scaleBy:M,setScaleExtent:L,setTranslateExtent:D,syncViewport:P,setClickDistance:H}}var ki;(function(e){e.Line="line",e.Handle="handle"})(ki||(ki={}));function T9({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 hw(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function to(e,t){return Math.max(0,t-e)}function no(e,t){return Math.max(0,e-t)}function wu(e,t,n){return Math.max(0,t-e,e-n)}function gw(e,t){return e?!t:t}function P9(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:_,height:R,aspectRatio:M}=e;let L=Math.floor(g?x-e.pointerX:0),D=Math.floor(h?S-e.pointerY:0);const H=_+(d?-L:L),j=R+(f?-D:D),U=-i[0]*_,Y=-i[1]*R;let I=wu(H,b,E),B=wu(j,w,N);if(l){let F=0,W=0;d&&L<0?F=to(k+L+U,l[0][0]):!d&&L>0&&(F=no(k+H+U,l[1][0])),f&&D<0?W=to(P+D+Y,l[0][1]):!f&&D>0&&(W=no(P+j+Y,l[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(c){let F=0,W=0;d&&L>0?F=no(k+L,c[0][0]):!d&&L<0&&(F=to(k+H,c[1][0])),f&&D>0?W=no(P+D,c[0][1]):!f&&D<0&&(W=to(P+j,c[1][1])),I=Math.max(I,F),B=Math.max(B,W)}if(o){if(g){const F=wu(H/M,w,N)*M;if(I=Math.max(I,F),l){let W=0;!d&&!f||d&&!f&&v?W=no(P+Y+H/M,l[1][1])*M:W=to(P+Y+(d?L:-L)/M,l[0][1])*M,I=Math.max(I,W)}if(c){let W=0;!d&&!f||d&&!f&&v?W=to(P+H/M,c[1][1])*M:W=no(P+(d?L:-L)/M,c[0][1])*M,I=Math.max(I,W)}}if(h){const F=wu(j*M,b,E)/M;if(B=Math.max(B,F),l){let W=0;!d&&!f||f&&!d&&v?W=no(k+j*M+U,l[1][0])/M:W=to(k+(f?D:-D)*M+U,l[0][0])/M,B=Math.max(B,W)}if(c){let W=0;!d&&!f||f&&!d&&v?W=to(k+j*M,c[1][0])/M:W=no(k+(f?D:-D)*M,c[0][0])/M,B=Math.max(B,W)}}}D=D+(D<0?B:-B),L=L+(L<0?I:-I),o&&(v?H>j*M?D=(gw(d,f)?-L:L)/M:L=(gw(d,f)?-D:D)*M:g?(D=L/M,f=d):(L=D*M,d=f));const A=d?k+L:k,V=f?P+D:P;return{width:_+(d?-L:L),height:R+(f?-D:D),x:i[0]*L*(d?-1:1)+A,y:i[1]*D*(f?-1:1)+V}}const cN={width:0,height:0,x:0,y:0},R9={...cN,pointerX:0,pointerY:0,aspectRatio:1};function I9(e){return[[0,0],[e.measured.width,e.measured.height]]}function M9(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 A9({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=rn(e);let l={controlDirection:hw("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={...cN},N={...R9};l={boundaries:g,resizeDirection:v,keepAspectRatio:h,controlDirection:hw(f)};let k,P=null,_=[],R,M,L,D=!1;const H=bE().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});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),M=R&&k.extent==="parent"?I9(R):void 0),_=[],L=void 0;for(const[q,$]of U)if($.parentId===t&&(_.push({id:q,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const z=M9($,k,$.origin??A);L?L=[[Math.min(z[0][0],L[0][0]),Math.min(z[0][1],L[0][1])],[Math.max(z[1][0],L[1][0]),Math.max(z[1][1],L[1][1])]]:L=z}x?.(j,{...w})}).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:$}=w,z={},X=k.origin??B,{width:Q,height:te,x:ne,y:Z}=P9(N,l.controlDirection,A,l.boundaries,l.keepAspectRatio,X,M,L),K=Q!==q,re=te!==$,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,_.length>0)){const $e=ne-F,ze=Z-W;for(const le of _)le.position={x:le.position.x-$e+X[0]*(Q-q),y:le.position.y-ze+X[1]*(te-$)},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 $e=X[0]*(z.width??0);z.x&&z.x<$e&&(w.x=$e,N.x=N.x-(z.x-$e));const ze=X[1]*(z.height??0);z.y&&z.y<ze&&(w.y=ze,N.y=N.y-(z.y-ze))}const ge=T9({width:w.width,prevWidth:q,height:w.height,prevHeight:$,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 mw;function _9(){if(mw)return rg;mw=1;var e=bl();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 yw;function D9(){return yw||(yw=1,ng.exports=_9()),ng.exports}var vw;function j9(){if(vw)return tg;vw=1;var e=bl(),t=D9();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 M=b.value;if(x(M,R))return P=M}return P=R}if(M=P,r(k,R))return M;var L=v(R);return x!==void 0&&x(M,L)?(k=R,M):(k=R,P=L)}var N=!1,k,P,_=h===void 0?null:h;return[function(){return w(g())},_===null?void 0:function(){return w(_())}]},[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 xw;function O9(){return xw||(xw=1,eg.exports=j9()),eg.exports}var L9=O9();const $9=um(L9),F9={},bw=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:()=>{(F9?"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},z9=e=>e?bw(e):bw,{useDebugValue:V9}=qe,{useSyncExternalStoreWithSelector:B9}=$9,H9=e=>e;function uN(e,t=H9,n){const r=B9(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return V9(r),r}const ww=(e,t)=>{const n=z9(e),r=(o,i=t)=>uN(n,o,i);return Object.assign(r,n),r},W9=(e,t)=>e?ww(e,t):ww;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),U9=ff.Provider,dN=Zn.error001();function Be(e,t){const n=m.useContext(ff);if(n===null)throw new Error(dN);return uN(n,e,t)}function it(){const e=m.useContext(ff);if(e===null)throw new Error(dN);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Sw={display:"none"},K9={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fN="react-flow__node-desc",pN="react-flow__edge-desc",G9="react-flow__aria-live",Y9=e=>e.ariaLiveMessage,X9=e=>e.ariaLabelConfig;function q9({rfId:e}){const t=Be(Y9);return p.jsx("div",{id:`${G9}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:K9,children:t})}function Z9({rfId:e,disableKeyboardA11y:t}){const n=Be(X9);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${fN}-${e}`,style:Sw,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${pN}-${e}`,style:Sw,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(q9,{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 Q9({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 J9=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 e7(e,t){return rt(e.selectedNodes.map(Su),t.selectedNodes.map(Su))&&rt(e.selectedEdges.map(Su),t.selectedEdges.map(Su))}function t7({onSelectionChange:e}){const t=it(),{selectedNodes:n,selectedEdges:r}=Be(J9,e7);return m.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const n7=e=>!!e.onSelectionChangeHandlers;function r7({onSelectionChange:e}){const t=Be(n7);return e||t?p.jsx(t7,{onSelectionChange:e}):null}const Yg=typeof window<"u"?m.useLayoutEffect:m.useEffect,hN=[0,0],o7={x:0,y:0,zoom:1},s7=["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"],Cw=[...s7,"rfId"],i7=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}),Ew={translateExtent:pl,nodeOrigin:hN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function a7(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:d}=Be(i7,rt),f=it();Yg(()=>(d(e.defaultNodes,e.defaultEdges),()=>{g.current=Ew,c()}),[]);const g=m.useRef(Ew);return Yg(()=>{for(const h of Cw){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:UU(v)}):h==="fitView"?f.setState({fitViewQueued:v}):h==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[h]:v})))}g.current=e},Cw.map(h=>e[h])),null}function Nw(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function l7(e){const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const r=Nw(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:Nw()?.matches?"dark":"light"}const kw=typeof document<"u"?document:null;function ml(e=null,t={target:kw,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),o=m.useRef(!1),i=m.useRef(new Set([])),[l,c]=m.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
|
|
54
|
+
`).replace(`
|
|
55
|
+
|
|
56
|
+
`,`
|
|
57
|
+
+`).split(`
|
|
58
|
+
`)),g=f.reduce((h,v)=>h.concat(...v),[]);return[f,g]}return[[],[]]},[e]);return m.useEffect(()=>{const d=t?.target??kw,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)&&GE(x))return!1;const b=Pw(x.code,c);if(i.current.add(x[b]),Tw(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=Pw(x.code,c);Tw(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 Tw(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Pw(e,t){return t.includes(e)?"code":"key"}const c7=()=>{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=yy(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 _l(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 gN(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)u7(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 u7(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 mN(e,t){return gN(e,t)}function yN(e,t){return gN(e,t)}function Uo(e,t){return{id:e,type:"select",selected:t}}function oi(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const l=t.has(o);!(i.selected===void 0&&!l)&&i.selected!==l&&(n&&(i.selected=l),r.push(Uo(i.id,l)))}return r}function Rw({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 Iw(e){return{id:e.id,type:"remove"}}const Mw=e=>jU(e),d7=e=>zE(e);function vN(e){return m.forwardRef(e)}function Aw(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>f7(()=>n(o=>o+BigInt(1))));return Yg(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function f7(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const xN=m.createContext(null);function p7({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=Rw({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=Aw(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(Rw({items:x,lookup:v}))},[]),i=Aw(o),l=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return p.jsx(xN.Provider,{value:l,children:e})}function h7(){const e=m.useContext(xN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const g7=e=>!!e.panZoom;function hf(){const e=c7(),t=it(),n=h7(),r=Be(g7),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=Mw(h)?h:v.get(h.id),b=S.parentId?UE(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&&Mw(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&&d7(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:_,edges:R}=await zU({nodesToRemove:h,edgesToRemove:v,nodes:x,edges:S,onBeforeDelete:P}),M=R.length>0,L=_.length>0;if(M){const D=R.map(Iw);E?.(R),N(D)}if(L){const D=_.map(Iw);b?.(_),w(D)}return(L||M)&&k?.({nodes:_,edges:R}),{deletedNodes:_,deletedEdges:R}},getIntersectingNodes:(h,v=!0,x)=>{const S=rw(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=rw(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 OU(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??WU();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 _w=e=>e.selected,m7=typeof window<"u"?window:void 0;function y7({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=it(),{deleteElements:r}=hf(),o=ml(e,{actInsideInputWithModifier:!1}),i=ml(t,{target:m7});m.useEffect(()=>{if(o){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(_w),edges:l.filter(_w)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function v7(e){const t=it();m.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=xy(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},x7=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function b7({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Qo.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:d,translateExtent:f,minZoom:g,maxZoom:h,zoomActivationKeyCode:v,preventScrolling:x=!0,children:S,noWheelClassName:b,noPanClassName:E,onViewportChange:w,isControlledViewport:N,paneClickDistance:k,selectionOnDrag:P}){const _=it(),R=m.useRef(null),{userSelectionActive:M,lib:L,connectionInProgress:D}=Be(x7,rt),H=ml(v),j=m.useRef();v7(R);const U=m.useCallback(Y=>{w?.({x:Y[0],y:Y[1],zoom:Y[2]}),N||_.setState({transform:Y})},[w,N]);return m.useEffect(()=>{if(R.current){j.current=k9({domNode:R.current,minZoom:g,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:A=>_.setState(V=>V.paneDragging===A?V:{paneDragging:A}),onPanZoomStart:(A,V)=>{const{onViewportChangeStart:F,onMoveStart:W}=_.getState();W?.(A,V),F?.(V)},onPanZoom:(A,V)=>{const{onViewportChange:F,onMove:W}=_.getState();W?.(A,V),F?.(V)},onPanZoomEnd:(A,V)=>{const{onViewportChangeEnd:F,onMoveEnd:W}=_.getState();W?.(A,V),F?.(V)}});const{x:Y,y:I,zoom:B}=j.current.getViewport();return _.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:M,noWheelClassName:b,lib:L,onTransformChange:U,connectionInProgress:D,selectionOnDrag:P,paneClickDistance:k})},[e,t,n,r,o,i,l,c,H,x,E,M,b,L,U,D,P,k]),p.jsx("div",{className:"react-flow__renderer",ref:R,style:gf,children:S})}const w7=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function S7(){const{userSelectionActive:e,userSelectionRect:t}=Be(w7,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)},C7=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function E7({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(C7,rt),P=w&&(e||E),_=m.useRef(null),R=m.useRef(),M=m.useRef(new Set),L=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,Y=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===_.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);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:$,edgeLookup:z,connectionLookup:X,triggerNodeChanges:Q,triggerEdgeChanges:te,defaultEdgeOptions:ne,resetSelectedElements:Z}=b.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=M.current,Re=L.current;M.current=new Set(my($,ge,q,n===Si.Partial,!0).map(ze=>ze.id)),L.current=new Set;const $e=ne?.selectable??!0;for(const ze of M.current){const le=X.get(ze);if(le)for(const{edgeId:be}of le.values()){const Oe=z.get(be);Oe&&(Oe.selectable??$e)&&L.current.add(be)}}if(!ow(pe,M.current)){const ze=oi($,M.current,!0);Q(ze)}if(!ow(Re,L.current)){const ze=oi(z,L.current);te(ze)}b.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})},A=F=>{F.button===0&&(F.target?.releasePointerCapture?.(F.pointerId),!E&&F.target===_.current&&b.getState().userSelectionRect&&H?.(F),b.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c?.(F),b.setState({nodesSelectionActive:M.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,_),onContextMenu:og(j,_),onWheel:og(U,_),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:_,style:gf,children:[S,p.jsx(S7,{})]})}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 bN({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=f9({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 N7=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function wN(){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=N7(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}=VE({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 Ny=m.createContext(null),k7=Ny.Provider;Ny.Consumer;const SN=()=>m.useContext(Ny),T7=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),P7=(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===wi.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:g&&f}};function R7({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=SN(),{connectOnClick:N,noPanClassName:k,rfId:P}=Be(T7,rt),{connectingFrom:_,connectingTo:R,clickConnecting:M,isPossibleEndHandle:L,connectionInProcess:D,clickConnectionInProcess:H,valid:j}=Be(P7(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:$}=E.getState();$(ZE(W,q))}V?.(W),c?.(W)},Y=B=>{if(!w)return;const A=YE(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:$,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=KE(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:$,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:M,connectingfrom:_,connectingto:R,valid:j,connectionindicator:r&&(!D||L)&&(D||H?i:o)}]),onMouseDown:Y,onTouchStart:Y,onClick:N?I:void 0,ref:x,...v,children:d})}const yl=m.memo(vN(R7));function I7({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 M7({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 A7(){return null}function _7({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}},Dw={input:I7,default:M7,output:_7,group:A7};function D7(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 j7=e=>{const{width:t,height:n,x:r,y:o}=Ml(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 O7({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=it(),{width:o,height:i,transformString:l,userSelectionActive:c}=Be(j7,rt),d=wN(),f=m.useRef(null);m.useEffect(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const g=!c&&o!==null&&i!==null;if(bN({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 jw=typeof window<"u"?window:void 0,L7=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function CN({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:_,panOnScrollMode:R,zoomOnDoubleClick:M,panOnDrag:L,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:$}=Be(L7,rt),z=ml(f,{target:jw}),X=ml(b,{target:jw}),Q=X||L,te=X||P,ne=g&&Q!==!0,Z=z||$||ne;return y7({deleteKeyCode:d,multiSelectionKeyCode:S}),p.jsx(b7,{onPaneContextMenu:i,elementsSelectable:w,zoomOnScroll:N,zoomOnPinch:k,panOnScroll:te,panOnScrollSpeed:_,panOnScrollMode:R,zoomOnDoubleClick:M,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(E7,{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(O7,{onSelectionContextMenu:I,noPanClassName:A,disableKeyboardA11y:V})]})})}CN.displayName="FlowRenderer";const $7=m.memo(CN),F7=e=>t=>e?my(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 z7(e){return Be(m.useCallback(F7(e),[e]),rt)}const V7=e=>e.updateNodeInternals;function B7(){const e=Be(V7),[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 H7({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 W7({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:_}=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",M=E?.[R]||Dw[R];M===void 0&&(N?.("003",Zn.error003(R)),R="default",M=E?.default||Dw.default);const L=!!(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=vy(k),I=H7({node:k,nodeType:R,hasDimensions:Y,resizeObserver:h}),B=bN({nodeRef:I,disabled:k.hidden||!L,noDragClassName:v,handleSelector:k.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:w}),A=wN();if(k.hidden)return null;const V=Rr(k),F=D7(k),W=D||L||t||n||r||o,q=n?K=>n(K,{...P.userNode}):void 0,$=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||!L||ce>0)&&Xg({id:e,store:U,nodeRef:I}),t&&t(K,{...P.userNode})},ne=K=>{if(!(GE(K.nativeEvent)||S)){if(OE.includes(K.key)&&D){const re=K.key==="Escape";Xg({id:e,store:U,unselect:re,nodeRef:I})}else if(L&&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;my(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]:L},k.className,{selected:k.selected,selectable:D,parent:_,draggable:L,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:$,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:`${fN}-${b}`,"aria-label":k.ariaLabel,...k.domAttributes,children:p.jsx(k7,{value:e,children:p.jsx(M,{id:e,data:k.data,type:R,positionAbsoluteX:P.positionAbsolute.x,positionAbsoluteY:P.positionAbsolute.y,selected:k.selected??!1,selectable:D,draggable:L,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 U7=m.memo(W7);const K7=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function EN(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=Be(K7,rt),l=z7(e.onlyRenderVisibleElements),c=B7();return p.jsx("div",{className:"react-flow__nodes",style:gf,children:l.map(d=>p.jsx(U7,{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))})}EN.displayName="NodeRenderer";const G7=m.memo(EN);function Y7(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&&YU({sourceNode:i,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),rt)}const X7=({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"})},q7=({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"})},Ow={[ud.Arrow]:X7,[ud.ArrowClosed]:q7};function Z7(e){const t=it();return m.useMemo(()=>Object.prototype.hasOwnProperty.call(Ow,e)?Ow[e]:(t.getState().onError?.("009",Zn.error009(e)),null),[e])}const Q7=({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=Z7(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},NN=({defaultColor:e,rfId:t})=>{const n=Be(i=>i.edges),r=Be(i=>i.defaultEdgeOptions),o=m.useMemo(()=>t9(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(Q7,{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};NN.displayName="MarkerDefinitions";var J7=m.memo(NN);function kN({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}kN.displayName="EdgeText";const eK=m.memo(kN);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(eK,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:d}):null]})}function Lw({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 TN({sourceX:e,sourceY:t,sourcePosition:n=Se.Bottom,targetX:r,targetY:o,targetPosition:i=Se.Top}){const[l,c]=Lw({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=Lw({pos:i,x1:r,y1:o,x2:e,y2:t}),[g,h,v,x]=XE({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 PN(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]=TN({sourceX:n,sourceY:r,sourcePosition:l,targetX:o,targetY:i,targetPosition:c}),_=e.isInternal?void 0:t;return p.jsx(Dl,{id:_,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 tK=PN({isInternal:!1}),RN=PN({isInternal:!0});tK.displayName="SimpleBezierEdge";RN.displayName="SimpleBezierEdgeInternal";function IN(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,_]=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:_,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:h,style:v,markerEnd:b,markerStart:E,interactionWidth:N})})}const MN=IN({isInternal:!1}),AN=IN({isInternal:!0});MN.displayName="SmoothStepEdge";AN.displayName="SmoothStepEdgeInternal";function _N(e){return m.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return p.jsx(MN,{...n,id:r,pathOptions:m.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const nK=_N({isInternal:!1}),DN=_N({isInternal:!0});nK.displayName="StepEdge";DN.displayName="StepEdgeInternal";function jN(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]=QE({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 rK=jN({isInternal:!1}),ON=jN({isInternal:!0});rK.displayName="StraightEdge";ON.displayName="StraightEdgeInternal";function LN(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,_]=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:_,label:d,labelStyle:f,labelShowBg:g,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:x,style:S,markerEnd:b,markerStart:E,interactionWidth:N})})}const oK=LN({isInternal:!1}),$N=LN({isInternal:!0});oK.displayName="BezierEdge";$N.displayName="BezierEdgeInternal";const $w={default:$N,straight:ON,step:DN,smoothstep:AN,simplebezier:RN},Fw={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},sK=(e,t,n)=>n===Se.Left?e-t:n===Se.Right?e+t:e,iK=(e,t,n)=>n===Se.Top?e-t:n===Se.Bottom?e+t:e,zw="react-flow__edgeupdater";function Vw({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([zw,`${zw}-${c}`]),cx:sK(t,r,e),cy:iK(n,r,e),r,stroke:"transparent",fill:"transparent"})}function aK({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,_)=>{if(P.button!==0)return;const{autoPanOnConnect:R,domNode:M,connectionMode:L,connectionRadius:D,lib:H,onConnectStart:j,cancelConnection:U,nodeLookup:Y,rfId:I,panBy:B,updateConnection:A}=S.getState(),V=_.type==="target",F=($,z)=>{v(!1),h?.($,n,_.type,z)},W=$=>f?.(n,$),q=($,z)=>{v(!0),g?.(P,n,_.type),j?.($,z)};Gg.onPointerDown(P.nativeEvent,{autoPanOnConnect:R,connectionMode:L,connectionRadius:D,domNode:M,handleId:_.id,nodeId:_.nodeId,nodeLookup:Y,isTarget:V,edgeUpdaterType:_.type,lib:H,flowId:I,cancelConnection:U,panBy:B,isValidConnection:(...$)=>S.getState().isValidConnection?.(...$)??!0,onConnect:W,onConnectStart:q,onConnectEnd:(...$)=>S.getState().onConnectEnd?.(...$),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(Vw,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:N,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&p.jsx(Vw,{position:d,centerX:i,centerY:l,radius:t,onMouseDown:w,onMouseEnter:N,onMouseOut:k,type:"target"})]})}function lK({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 _=k.type||"default",R=b?.[_]||$w[_];R===void 0&&(w?.("011",Zn.error011(_)),_="default",R=b?.default||$w.default);const M=!!(k.focusable||t&&typeof k.focusable>"u"),L=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:$,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,...Fw};const $e=e9({id:e,sourceNode:pe,targetNode:Re,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ge.connectionMode,onError:w});return{zIndex:GU({selected:k.selected,zIndex:k.zIndex,sourceNode:pe,targetNode:Re,elevateOnSelect:ge.elevateEdgesOnSelect,zIndexMode:ge.zIndexMode}),...$e||Fw}},[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:$e}=B.getState();D&&(B.setState({nodesSelectionActive:!1}),k.selected&&$e?(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&&OE.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-${_}`,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:M?me:void 0,tabIndex:M?0:void 0,role:k.ariaRole??(M?"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":M?`${pN}-${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:$,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}),L&&p.jsx(aK,{edge:k,isReconnectable:L,reconnectRadius:g,onReconnect:h,onReconnectStart:v,onReconnectEnd:x,sourceX:V,sourceY:F,targetX:W,targetY:q,sourcePosition:$,targetPosition:z,setUpdateHover:U,setReconnecting:I})]})})}var cK=m.memo(lK);const uK=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function FN({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(uK,rt),P=Y7(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(J7,{defaultColor:e,rfId:n}),P.map(_=>p.jsx(cK,{id:_,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},_))]})}FN.displayName="EdgeRenderer";const dK=m.memo(FN),fK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function pK({children:e}){const t=Be(fK);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function hK(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 gK=e=>e.panZoom?.syncViewport;function mK(e){const t=Be(gK),n=it();return m.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function yK(e){return e.connection.inProgress?{...e.connection,to:_l(e.connection.to,e.transform)}:{...e.connection}}function vK(e){return yK}function xK(e){const t=vK();return Be(t,rt)}const bK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function wK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:l,isValid:c,inProgress:d}=Be(bK,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",FE(c)]),children:p.jsx(zN,{style:t,type:n,CustomComponent:r,isValid:c})})})}const zN=({style:e,type:t=ao.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:l,fromHandle:c,fromPosition:d,to:f,toNode:g,toHandle:h,toPosition:v,pointer:x}=xK();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:FE(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 ao.Bezier:[S]=pd(b);break;case ao.SimpleBezier:[S]=TN(b);break;case ao.Step:[S]=Wg({...b,borderRadius:0});break;case ao.SmoothStep:[S]=Wg(b);break;default:[S]=QE(b)}return p.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};zN.displayName="ConnectionLine";const SK={};function Bw(e=SK){m.useRef(e),it(),m.useEffect(()=>{},[e])}function CK(){it(),m.useRef(!1),m.useEffect(()=>{},[])}function VN({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:_,panActivationKeyCode:R,zoomActivationKeyCode:M,deleteKeyCode:L,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:$,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:$e,reconnectRadius:ze,onReconnect:le,onReconnectStart:be,onReconnectEnd:Oe,noDragClassName:ot,noWheelClassName:Je,noPanClassName:Ct,disableKeyboardA11y:Ke,nodeExtent:ms,rfId:So,viewport:tr,onViewportChange:nr}){return Bw(e),Bw(t),CK(),hK(n),mK(tr),p.jsx($7,{onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ne,onPaneMouseLeave:Z,onPaneContextMenu:re,onPaneScroll:K,paneClickDistance:ce,deleteKeyCode:L,selectionKeyCode:N,selectionOnDrag:k,selectionMode:P,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:_,panActivationKeyCode:R,zoomActivationKeyCode:M,elementsSelectable:H,zoomOnScroll:V,zoomOnPinch:F,zoomOnDoubleClick:z,panOnScroll:W,panOnScrollSpeed:q,panOnScrollMode:$,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(pK,{children:[p.jsx(dK,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:l,onReconnect:le,onReconnectStart:be,onReconnectEnd:Oe,onlyRenderVisibleElements:D,onEdgeContextMenu:ge,onEdgeMouseEnter:pe,onEdgeMouseMove:Re,onEdgeMouseLeave:$e,reconnectRadius:ze,defaultMarkerColor:A,noPanClassName:Ct,disableKeyboardA11y:Ke,rfId:So}),p.jsx(wK,{style:b,type:S,component:E,containerStyle:w}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(G7,{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:So}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}VN.displayName="GraphView";const EK=m.memo(VN),Hw=({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;tN(b,E,w);const{nodesInitialized:_}=Kg(N,x,S,{nodeOrigin:k,nodeExtent:P,zIndexMode:v});let R=[0,0,1];if(l&&o&&i){const M=Ml(x,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:L,y:D,zoom:H}=yy(M,o,i,d,f,c?.padding??.1);R=[L,D,H]}return{rfId:"1",width:o??0,height:i??0,transform:R,nodes:N,nodesInitialized:_,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:wi.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:{...$E},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:VU,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:LE,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},NK=({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})=>W9((x,S)=>{async function b(){const{nodeLookup:E,panZoom:w,fitViewOptions:N,fitViewResolver:k,width:P,height:_,minZoom:R,maxZoom:M}=S();w&&(await FU({nodes:E,width:P,height:_,panZoom:w,minZoom:R,maxZoom:M},N),k?.resolve(!0),x({fitViewResolver:null}))}return{...Hw({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:_,zIndexMode:R,nodesSelectionActive:M}=S(),{nodesInitialized:L,hasSelectedNodes:D}=Kg(E,w,N,{nodeOrigin:k,nodeExtent:h,elevateNodesOnSelect:P,checkEquality:!0,zIndexMode:R}),H=M&&D;_&&L?(b(),x({nodes:E,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:H})):x({nodes:E,nodesInitialized:L,nodesSelectionActive:H})},setEdges:E=>{const{connectionLookup:w,edgeLookup:N}=S();tN(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:_,nodeExtent:R,debug:M,fitViewQueued:L,zIndexMode:D}=S(),{changes:H,updatedInternals:j}=l9(E,N,k,P,_,R,D);j&&(o9(N,k,{nodeOrigin:_,nodeExtent:R,zIndexMode:D}),L?(b(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),H?.length>0&&(M&&console.log("React Flow: trigger node changes",H),w?.(H)))},updateNodePositions:(E,w=!1)=>{const N=[];let k=[];const{nodeLookup:P,triggerNodeChanges:_,connection:R,updateConnection:M,onNodesChangeMiddlewareMap:L}=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:w};if(j&&R.inProgress&&R.fromNode.id===j.id){const I=cs(j,R.fromHandle,Se.Left,!0);M({...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=Ey(N,P,D,H);k.push(...j)}for(const D of L.values())k=D(k);_(k)},triggerNodeChanges:E=>{const{onNodesChange:w,setNodes:N,nodes:k,hasDefaultNodes:P,debug:_}=S();if(E?.length){if(P){const R=mN(E,k);N(R)}_&&console.log("React Flow: trigger node changes",E),w?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:w,setEdges:N,edges:k,hasDefaultEdges:P,debug:_}=S();if(E?.length){if(P){const R=yN(E,k);N(R)}_&&console.log("React Flow: trigger edge changes",E),w?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:_}=S();if(w){const R=E.map(M=>Uo(M,!0));P(R);return}P(oi(k,new Set([...E]),!0)),_(oi(N))},addSelectedEdges:E=>{const{multiSelectionActive:w,edgeLookup:N,nodeLookup:k,triggerNodeChanges:P,triggerEdgeChanges:_}=S();if(w){const R=E.map(M=>Uo(M,!0));_(R);return}_(oi(N,new Set([...E]))),P(oi(k,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:w}={})=>{const{edges:N,nodes:k,nodeLookup:P,triggerNodeChanges:_,triggerEdgeChanges:R}=S(),M=E||k,L=w||N,D=[];for(const j of M){if(!j.selected)continue;const U=P.get(j.id);U&&(U.selected=!1),D.push(Uo(j.id,!1))}const H=[];for(const j of L)j.selected&&H.push(Uo(j.id,!1));_(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 _=w.reduce((M,L)=>L.selected?[...M,Uo(L.id,!1)]:M,[]),R=E.reduce((M,L)=>L.selected?[...M,Uo(L.id,!1)]:M,[]);N(_),k(R)},setNodeExtent:E=>{const{nodes:w,nodeLookup:N,parentLookup:k,nodeOrigin:P,elevateNodesOnSelect:_,nodeExtent:R,zIndexMode:M}=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:_,checkEquality:!1,zIndexMode:M}),x({nodeExtent:E}))},panBy:E=>{const{transform:w,width:N,height:k,panZoom:P,translateExtent:_}=S();return c9({delta:E,panZoom:P,transform:w,translateExtent:_,width:N,height:k})},setCenter:async(E,w,N)=>{const{width:k,height:P,maxZoom:_,panZoom:R}=S();if(!R)return Promise.resolve(!1);const M=typeof N?.zoom<"u"?N.zoom:_;return await R.setViewport({x:k/2-E*M,y:P/2-w*M,zoom:M},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...$E}})},updateConnection:E=>{x({connection:E})},reset:()=>x({...Hw()})}},Object.is);function BN({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(()=>NK({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(U9,{value:S,children:p.jsx(p7,{children:x})})}function kK({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(BN,{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 TK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function PK({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:_,onNodeDoubleClick:R,onNodeDragStart:M,onNodeDrag:L,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:$,connectionLineType:z=ao.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:$e=!1,selectNodesOnDrag:ze,nodesDraggable:le,autoPanOnNodeFocus:be,nodesConnectable:Oe,nodesFocusable:ot,nodeOrigin:Je=hN,edgesFocusable:Ct,edgesReconnectable:Ke,elementsSelectable:ms=!0,defaultViewport:So=o7,minZoom:tr=.5,maxZoom:nr=2,translateExtent:Co=pl,preventScrolling:Vl=!0,nodeExtent:rr,defaultMarkerColor:Eo="#b1b1b7",zoomOnScroll:Tf=!0,zoomOnPinch:Bl=!0,panOnScroll:Hl=!1,panOnScrollSpeed:Pf=.5,panOnScrollMode:Vi=Qo.Free,zoomOnDoubleClick:Bi=!0,panOnDrag:Hi=!0,onPaneClick:Wi,onPaneMouseEnter:Ui,onPaneMouseMove:Mr,onPaneMouseLeave:Ar,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl=1,nodeClickDistance:Gl=0,children:Yl,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:No,onEdgeContextMenu:Gi,onEdgeDoubleClick:ko,onEdgeMouseEnter:Rf,onEdgeMouseMove:To,onEdgeMouseLeave:ys,reconnectRadius:vs=10,onNodesChange:Yi,onEdgesChange:If,noDragClassName:Mf="nodrag",noWheelClassName:Af="nowheel",noPanClassName:$n="nopan",fitView:Xi,fitViewOptions:qi,connectOnClick:_f,attributionPosition:ql,proOptions:Zl,defaultEdgeOptions:Ql,elevateNodesOnSelect:Jl=!0,elevateEdgesOnSelect:Df=!1,disableKeyboardA11y:ec=!1,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,connectionRadius:tc,isValidConnection:xs,onError:Of,style:nc,id:Po,nodeDragThreshold:un,connectionDragThreshold:Lf,viewport:qt,onViewportChange:$f,width:Ff,height:zf,colorMode:bs="light",debug:ws,onScroll:_r,ariaLabelConfig:Ss,zIndexMode:rc="basic",...Vf},Qi){const Cs=Po||"1",Ji=l7(bs),Ro=m.useCallback(oc=>{oc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_r?.(oc)},[_r]);return p.jsx("div",{"data-testid":"rf__wrapper",...Vf,onScroll:Ro,style:{...nc,...TK},ref:Qi,className:mt(["react-flow",o,Ji]),id:Po,role:"application",children:p.jsxs(kK,{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(a7,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:w,nodesDraggable:le,autoPanOnNodeFocus:be,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:$,translateExtent:Co,connectOnClick:_f,defaultEdgeOptions:Ql,fitView:Xi,fitViewOptions:qi,onNodesDelete:H,onEdgesDelete:j,onDelete:U,onNodeDragStart:M,onNodeDrag:L,onNodeDragStop:D,onSelectionDrag:B,onSelectionDragStart:I,onSelectionDragStop:A,onMove:g,onMoveStart:h,onMoveEnd:v,noPanClassName:$n,nodeOrigin:Je,rfId:Cs,autoPanOnConnect:at,autoPanOnNodeDrag:jf,autoPanSpeed:Zi,onError:Of,connectionRadius:tc,isValidConnection:xs,selectNodesOnDrag:ze,nodeDragThreshold:un,connectionDragThreshold:Lf,onBeforeDelete:q,debug:ws,ariaLabelConfig:Ss,zIndexMode:rc}),p.jsx(EK,{onInit:f,onNodeClick:c,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:k,onNodeMouseLeave:P,onNodeContextMenu:_,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:$e,defaultViewport:So,translateExtent:Co,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:Mr,onPaneMouseLeave:Ar,onPaneScroll:Wl,onPaneContextMenu:Ul,paneClickDistance:Kl,nodeClickDistance:Gl,onSelectionContextMenu:V,onSelectionStart:F,onSelectionEnd:W,onReconnect:Ki,onReconnectStart:Xl,onReconnectEnd:No,onEdgeContextMenu:Gi,onEdgeDoubleClick:ko,onEdgeMouseEnter:Rf,onEdgeMouseMove:To,onEdgeMouseLeave:ys,reconnectRadius:vs,defaultMarkerColor:Eo,noDragClassName:Mf,noWheelClassName:Af,noPanClassName:$n,rfId:Cs,disableKeyboardA11y:ec,nodeExtent:rr,viewport:qt,onViewportChange:$f}),p.jsx(r7,{onSelectionChange:Y}),Yl,p.jsx(Q9,{proOptions:Zl,position:ql}),p.jsx(Z9,{rfId:Cs,disableKeyboardA11y:ec})]})})}var RK=vN(PK);const IK=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function MK({children:e}){const t=Be(IK);return t?ps.createPortal(e,t):null}const AK=e=>e.edges;function _K(){return Be(AK,rt)}const DK=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||!vy(n.userNode))return!1;return!0};function jK(e={includeHiddenNodes:!1}){return Be(DK(e))}function OK({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 LK({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 $K={[xr.Dots]:1,[xr.Lines]:1,[xr.Cross]:6},FK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function HN({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(FK,rt),S=r||$K[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],_=E?[k,k]:N,R=[P[0]*v[2]||1+_[0]/2,P[1]*v[2]||1+_[1]/2],M=`${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:M,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(LK,{radius:k/2,className:g}):p.jsx(OK,{dimensions:_,lineWidth:o,variant:t,className:g})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}HN.displayName="Background";const zK=m.memo(HN);function VK(){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 BK(){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 HK(){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 WK(){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 UK(){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 KK=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function WN({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(KK,rt),{zoomIn:k,zoomOut:P,fitView:_}=hf(),R=()=>{k(),i?.()},M=()=>{P(),l?.()},L=()=>{_(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(VK,{})}),p.jsx(Cu,{onClick:M,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:E,children:p.jsx(BK,{})})]}),n&&p.jsx(Cu,{className:"react-flow__controls-fitview",onClick:L,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:p.jsx(HK,{})}),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(UK,{}):p.jsx(WK,{})}),g]})}WN.displayName="Controls";const GK=m.memo(WN);function YK({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 XK=m.memo(YK),qK=e=>e.nodes.map(t=>t.id),sg=e=>e instanceof Function?e:()=>e;function ZK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=XK,onClick:l}){const c=Be(qK,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(JK,{id:v,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:g,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:l,shapeRendering:h},v))})}function QK({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}=Rr(E);return{node:E,x:w,y:N,width:k,height:P}},rt);return!f||f.hidden||!vy(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 JK=m.memo(QK);var eG=m.memo(ZK);const tG=200,nG=150,rG=e=>!e.hidden,oG=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?WE(Ml(e.nodeLookup,{filter:rG}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},sG="react-flow__minimap-desc";function UN({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 _=it(),R=m.useRef(null),{boundingRect:M,viewBB:L,rfId:D,panZoom:H,translateExtent:j,flowWidth:U,flowHeight:Y,ariaLabelConfig:I}=Be(oG,rt),B=e?.width??tG,A=e?.height??nG,V=M.width/B,F=M.height/A,W=Math.max(V,F),q=W*B,$=W*A,z=P*W,X=M.x-(q-M.width)/2-z,Q=M.y-($-M.height)/2-z,te=q+z*2,ne=$+z*2,Z=`${sG}-${D}`,K=m.useRef(0),re=m.useRef();K.current=W,m.useEffect(()=>{if(R.current&&H)return re.current=v9({domNode:R.current,panZoom:H,getTransform:()=>_.getState().transform,getViewScale:()=>K.current}),()=>{re.current?.destroy()}},[H]),m.useEffect(()=>{re.current?.update({translateExtent:j,width:U,height:Y,inversePan:N,pannable:b,zoomStep:k,zoomable:E})},[b,E,N,k,j,U,Y]);const ce=x?pe=>{const[Re,$e]=re.current?.pointer(pe)||[0,0];x(pe,{x:Re,y:$e})}:void 0,me=S?m.useCallback((pe,Re)=>{const $e=_.getState().nodeLookup.get(Re).internals.userNode;S(pe,$e)},[]):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(eG,{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${L.x},${L.y}h${L.width}v${L.height}h${-L.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}UN.displayName="MiniMap";const iG=m.memo(UN),aG=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,lG={[ki.Line]:"right",[ki.Handle]:"bottom-right"};function cG({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=SN(),k=typeof e=="string"?e:N,P=it(),_=m.useRef(null),R=n===ki.Handle,M=Be(m.useCallback(aG(R&&x),[R,x]),rt),L=m.useRef(null),D=t??lG[n];m.useEffect(()=>{if(!(!_.current||!k))return L.current||(L.current=A9({domNode:_.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,$=j.width??W.measured.width??0,z=j.height??W.measured.height??0,X={id:W.id,parentId:W.parentId,rect:{width:$,height:z,...UE({x:j.x??W.position.x,y:j.y??W.position.y},{width:$,height:z},W.parentId,I,q)}},Q=Ey([X],I,B,A);V.push(...Q),F.x=j.x?Math.max(q[0]*$,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 $={id:k,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:j.width,height:j.height}};V.push($)}for(const q of U){const $={...q,type:"position"};V.push($)}Y(V)},onEnd:({width:j,height:U})=>{const Y={id:k,type:"dimensions",resizing:!1,dimensions:{width:j,height:U}};P.getState().triggerNodeChanges([Y])}})),L.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}),()=>{L.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:_,style:{...o,scale:M,...l&&{[R?"backgroundColor":"borderColor"]:l}},children:i})}m.memo(cG);function KN(){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(fo,{className:"w-2.5 h-2.5",strokeWidth:3})})]})};function uG(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 dG(e){let t=e.expression;return e.variables.forEach(n=>{t=t.replace(/\$\{\}/,n?.name||"unknown")}),t}const GN=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 be=le.phase;return(be.status==="paused"||be.status==="stepping")&&be.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}=$i(g),N=m.useMemo(()=>{const le={};for(const be of Object.values(x))le[be.id]=be.label;return le},[x]),k=m.useMemo(()=>{const le={};for(const be of Object.values(S))le[be.id]=be.label;return le},[S]),{modelLabels:P,availableModelIds:_}=m.useMemo(()=>{const le={},be=new Set;for(const Oe of E)le[Oe.id]=Oe.label,be.add(Oe.id);for(const Oe of Object.values(b))le[Oe.id]=Oe.label;return{modelLabels:le,availableModelIds:be}},[E,b]),R=m.useMemo(()=>An(l),[l]),{executionInputs:M,toolInputs:L,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 be of r?.parameters??[])Tr(be,U,j)||le.add(be.id);return le.size>0?le:null},[j,r,U]),I=r?.category,B=m.useMemo(()=>P1({canvasId:g,nodeId:e,nodeData:l,nodeDefinition:r,availableVariables:w,channels:x,memory:S,models:b,availableModelIds:_,edges:v,isStale:o,isDeleted:i}),[g,e,l,r,w,x,S,b,_,v,o,i]),A=m.useMemo(()=>{const le={},be=r?.parameters??[];for(const Oe of be){if(Y?.has(Oe.id))continue;const ot=U[Oe.id];if(es(ot)){const Je=Sl(ot,w),Ct=Cd(Je);le[Oe.id]={expr:Je,parseRes:Ct}}}return le},[U,w,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 $=m.useMemo(()=>v.some(le=>le.source===e?D.some(be=>be.id===le.sourceHandle):le.target===e?M.some(be=>be.id===le.targetHandle):!1),[v,e,M,D]),z=I?iy[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(be=>!Y.has(be.id)):le},[r,Y]),Z=m.useMemo(()=>{const le=Math.min(ne.length,3),be=ne.length>3?1:0;return le+be},[ne]),K=Math.max(M.length,D.length),re=200,ce=24,me=16,ge=50,pe=m.useMemo(()=>{const le=Z*me,be=ge+le;return X==="tapered-right"?Math.max(be,60+Math.max(K,1)*40):Math.max(be,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,be)=>be===1?pe/2:20+(pe-40)/(be+1)*(le+1),$e=(le,be)=>be===1?re/2:20+(re-40)/(be+1)*(le+1),ze=()=>{const le=`node-gradient-${l.id}`,be=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=be/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
|
+
M ${12+Ke} ${0+Ke}
|
|
61
|
+
L ${re-ce-Ke} ${0+Ke}
|
|
62
|
+
L ${re-Ke} ${pe/2}
|
|
63
|
+
L ${re-ce-Ke} ${pe-Ke}
|
|
64
|
+
L ${12+Ke} ${pe-Ke}
|
|
65
|
+
Q ${0+Ke} ${pe-Ke} ${0+Ke} ${pe-12-Ke}
|
|
66
|
+
L ${0+Ke} ${12+Ke}
|
|
67
|
+
Q ${0+Ke} ${0+Ke} ${12+Ke} ${0+Ke}
|
|
68
|
+
Z
|
|
69
|
+
`,fill:`url(#${le})`,stroke:V?"hsl(var(--destructive))":te?`hsl(var(${Q})/0.5)`:"hsl(var(--edge-default))",strokeWidth:be})]})}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:be/2,y:be/2,width:re-be,height:pe-be,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:be})]})};return p.jsxs("div",{className:"relative z-0",style:{height:`${pe}px`,width:`${re}px`},children:[L.map((le,be)=>p.jsx(Eu,{id:le.id,type:"target",position:Se.Top,portType:le.type,label:le.label,disabled:$,style:{left:`${$e(be,L.length)}px`}},le.id)),M.map((le,be)=>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(be,M.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(Sr,{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(po,{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 be=U[le.id],Oe=A[le.id],ot=Oe?null:uG(le,be,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?dG(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,be)=>{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(be,D.length)}px`,right:"0"}},le.id)}),H.map((le,be)=>{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:`${$e(be,H.length)}px`,bottom:0}},le.id)})]})}),Nu=m.memo(e=>{const t=e.data,n=m.useMemo(()=>Lt.getByType(t.type),[t.type]);return p.jsx(GN,{...e,nodeDefinition:n})}),fG=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 ty({...t.functionInfo,name:c})},[t.functionInfo,r?.name]);return p.jsx(GN,{...e,nodeDefinition:l,isStale:i,isDeleted:o})}),ku="hsl(var(--edge-default))",Tu="hsl(var(--node-agent))",ag="hsl(var(--destructive))";function pG(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 $a=({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=_K(),v=ue.getState().activeCanvasId,{lookup:x}=$i(v),S=h.filter(U=>U.source===t&&dm(U.type)).length,b=m.useMemo(()=>R1({canvasId:v,edgeId:e,edgeType:g,edgeData:c,availableVariables:x,sourceControlEdgeCount:S}),[g,S,c,x,v,e]),E=b.length>0,w=Ye(U=>U.setEdgeDiagnostics),N=Ye(U=>U.clearEdgeDiagnostics);m.useEffect(()=>(w(e,b),()=>N(e)),[e,b,w,N]);const k=()=>{if(y1(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,_,R]=k(),M=E?{source:ag,target:ag}:pG(g),L=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:M.source}),p.jsx("stop",{offset:"100%",stopColor:M.target})]})}),p.jsx(Dl,{id:e,path:P,style:{stroke:`url(#${D})`,strokeWidth:L,strokeDasharray:"none"}})]}),p.jsx(MK,{children:p.jsx("div",{style:{position:"absolute",transform:`translate(-50%, -50%) translate(${_}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(Sr,{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:b[0]?.message??"This edge has errors"})]})})})]})},hG={Standard:Nu,FunctionCall:fG,[xe.Trigger]:Nu,[xe.Tool]:Nu,[xe.AI]:Nu},gG={control:$a,tool:$a,agentTask:$a,agentChoice:$a,agentDelegate:$a},mG=({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=KN(),{screenToFlowPosition:h,getViewport:v,fitView:x}=hf(),S=jK(),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:$}=v();return{x:(-W+V/2)/$-90,y:(-q+F/2)/$-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),_=E(A=>A.setViewport),R=m.useRef(E.getState().viewport).current,[M,L]=m.useState(R!=null);m.useEffect(()=>{if(M||R!=null)return;if(w.length===0){L(!0);return}if(!S)return;x({padding:.15,maxZoom:1});const A=requestAnimationFrame(()=>{_(v()),L(!0)});return()=>cancelAnimationFrame(A)},[M,R,w.length,S,x,v,_]);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=>mN(A,V))},[k]),j=m.useCallback(A=>{P(V=>yN(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:b,className:"w-full h-full",style:{opacity:M?1:0},children:p.jsxs(RK,{nodes:w,edges:N,onNodesChange:H,onEdgesChange:j,onConnect:t,isValidConnection:A=>!!sE(A.source,A.target,A.sourceHandle,A.targetHandle,w,N),onPaneClick:i,onNodeDragStart:c,onSelectionChange:n,onSelectionStart:r,onSelectionEnd:o,onMoveEnd:(A,V)=>_(V),nodeTypes:hG,edgeTypes:gG,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(zK,{variant:xr.Dots,color:"hsl(var(--muted-foreground))",gap:24,size:1.5,className:"opacity-40"}),p.jsx(GK,{className:"glass-forest-panel !border !shadow-lg [&_button]:glass-forest-button [&_button]:!text-foreground hover:[&_button]:!scale-105"}),p.jsx(iG,{nodeColor:D,className:"glass-forest-panel !border !shadow-lg",maskColor:"hsl(var(--primary) / 0.15)",nodeBorderRadius:12,nodeStrokeWidth:2,style:{width:120,height:80}})]})})},yG=e=>p.jsx("div",{className:"w-full h-full overflow-hidden overscroll-contain",children:p.jsx(BN,{children:p.jsx(mG,{...e})})});var Ww=1,vG=.9,xG=.8,bG=.17,lg=.1,cg=.999,wG=.9999,SG=.99,CG=/[\\\/_+.#"@\[\(\{&]/,EG=/[\\\/_+.#"@\[\(\{&]/g,NG=/[\s-]/,YN=/[\s-]/g;function qg(e,t,n,r,o,i,l){if(i===t.length)return o===e.length?Ww:SG;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*=Ww:CG.test(e.charAt(f-1))?(h*=xG,x=e.slice(o,f-1).match(EG),x&&o>0&&(h*=Math.pow(cg,x.length))):NG.test(e.charAt(f-1))?(h*=vG,S=e.slice(o,f-1).match(YN),S&&o>0&&(h*=Math.pow(cg,S.length))):(h*=bG,o>0&&(h*=Math.pow(cg,f-o))),e.charAt(f)!==t.charAt(i)&&(h*=wG)),(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 Uw(e){return e.toLowerCase().replace(YN," ")}function kG(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,qg(e,t,Uw(e),Uw(t),0,0,{})}var Fa='[cmdk-group=""]',ug='[cmdk-group-items=""]',TG='[cmdk-group-heading=""]',XN='[cmdk-item=""]',Kw=`${XN}:not([aria-disabled="true"])`,Zg="cmdk-item-select",ei="data-value",PG=(e,t,n)=>kG(e,t,n),qN=m.createContext(void 0),jl=()=>m.useContext(qN),ZN=m.createContext(void 0),ky=()=>m.useContext(ZN),QN=m.createContext(void 0),JN=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=ek(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.useRef(null),R=FG();us(()=>{if(g!==void 0){let z=g.trim();n.current.value=z,M.emit()}},[g]),us(()=>{R(6,Y)},[]);let M=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,M.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}}M.emit()}},emit:()=>{l.current.forEach(z=>z())}}),[]),L=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(),M.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(),M.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(),M.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:_}),[]);function D(z,X){var Q,te;let ne=(te=(Q=c.current)==null?void 0:Q.filter)!=null?te:PG;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=_.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=_.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);M.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(TG))==null||Q.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function I(){var z;return(z=_.current)==null?void 0:z.querySelector(`${XN}[aria-selected="true"]`)}function B(){var z;return Array.from(((z=_.current)==null?void 0:z.querySelectorAll(Kw))||[])}function A(z){let X=B()[z];X&&M.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&&M.setState("value",Z.getAttribute(ei))}function F(z){let X=I(),Q=X?.closest(Fa),te;for(;Q&&!te;)Q=z>0?LG(Q,Fa):$G(Q,Fa),te=Q?.querySelector(Kw);te?M.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)},$=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&&$(z);break}case"ArrowUp":{$(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:L.inputId,id:L.labelId,style:VG},d),mf(e,z=>m.createElement(ZN.Provider,{value:M},m.createElement(qN.Provider,{value:L},z))))}),RG=m.forwardRef((e,t)=>{var n,r;let o=kt(),i=m.useRef(null),l=m.useContext(QN),c=jl(),d=ek(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=tk(o,i,[e.value,e.children,i],e.keywords),h=ky(),v=mo(R=>R.value&&R.value===g.current),x=mo(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,M;b(),(M=(R=d.current).onSelect)==null||M.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,..._}=e;return m.createElement(Ne.div,{ref:Yt(i,t),..._,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)}),IG=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=mo(x=>o||g.filter()===!1?!0:x.search?x.filtered.groups.has(l):!0);us(()=>g.group(l),[]),tk(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(QN.Provider,{value:v},x))))}),MG=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),i=mo(l=>!l.search);return!n&&!i?null:m.createElement(Ne.div,{ref:Yt(o,t),...r,"cmdk-separator":"",role:"separator"})}),AG=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=ky(),l=mo(f=>f.search),c=mo(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)}})}),_G=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=m.useRef(null),l=m.useRef(null),c=mo(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)))}),DG=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:l,...c}=e;return m.createElement(Cm,{open:n,onOpenChange:r},m.createElement(Em,{container:l},m.createElement(Dd,{"cmdk-overlay":"",className:o}),m.createElement(jd,{"aria-label":e.label,"cmdk-dialog":"",className:i},m.createElement(JN,{ref:t,...c}))))}),jG=m.forwardRef((e,t)=>mo(n=>n.filtered.count===0)?m.createElement(Ne.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),OG=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(JN,{List:_G,Item:RG,Input:AG,Group:IG,Separator:MG,Dialog:DG,Empty:jG,Loading:OG});function LG(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function $G(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ek(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 mo(e){let t=ky(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function tk(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 FG=()=>{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 zG(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(zG(t),{ref:t.ref},n(t.props.children)):n(t)}var VG={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const nk=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}));nk.displayName=Xt.displayName;const BG=({children:e,...t})=>p.jsx(NS,{...t,children:p.jsx(Pm,{className:"overflow-hidden p-0 shadow-lg",children:p.jsx(nk,{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})})}),rk=m.forwardRef(({className:e,...t},n)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(z1,{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})]}));rk.displayName=Xt.Input.displayName;const ok=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}));ok.displayName=Xt.List.displayName;const sk=m.forwardRef((e,t)=>p.jsx(Xt.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));sk.displayName=Xt.Empty.displayName;const ik=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}));ik.displayName=Xt.Group.displayName;const HG=m.forwardRef(({className:e,...t},n)=>p.jsx(Xt.Separator,{ref:n,className:Ce("-mx-1 h-px bg-border",e),...t}));HG.displayName=Xt.Separator.displayName;const ak=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}));ak.displayName=Xt.Item.displayName;const WG=[xe.Trigger,xe.Input,xe.Logic,xe.Data,xe.Function,xe.AI,xe.Tool,xe.Output];function UG({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(BG,{open:e,onOpenChange:t,children:[p.jsx(rk,{placeholder:o("nodePickerSearch","Search nodes..."),value:i,onValueChange:l}),p.jsxs(ok,{children:[p.jsx(sk,{children:o("nodePickerEmpty","No compatible nodes found.")}),WG.filter(d=>c.has(d)).map(d=>{const f=iy[d];return p.jsx(ik,{heading:d,children:c.get(d).map(g=>p.jsxs(ak,{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 KG=({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 t8(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(M=>M.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(M=>M.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(yG,{canvasId:e,onConnect:r,onSelectionChange:l,onSelectionStart:()=>f(!0),onSelectionStop:()=>f(!1),onPaneClick:c,onAddNode:o,onNodeDragStart:d,viewportCenterRef:t})}),p.jsx(UG,{open:h!==null,onOpenChange:E=>{E||v(null)},compatibleDefs:S,onSelect:b})]})};var GG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YG=GG.reduce((e,t)=>{const n=gm(`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}},{}),XG="Separator",Gw="horizontal",qG=["horizontal","vertical"],lk=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Gw,...o}=e,i=ZG(r)?r:Gw,c=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(YG.div,{"data-orientation":i,...c,...o,ref:t})});lk.displayName=XG;function ZG(e){return qG.includes(e)}var ck=lk;const Ot=m.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>p.jsx(ck,{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=ck.displayName;const QG=yo("flex w-full rounded-md border ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive",{variants:{size:{sm:"min-h-[72px] px-3 py-2 text-sm",md:"min-h-[80px] px-3 py-2 text-sm",lg:"min-h-[96px] px-4 py-3 text-base"},variant:{default:"border-input bg-field",subtle:"border-transparent bg-muted focus-visible:border-input",ghost:"border-border bg-transparent focus-visible:bg-background/60"},status:{none:"",success:"border-success focus-visible:ring-success",error:"border-destructive focus-visible:ring-destructive"}},defaultVariants:{size:"md",variant:"default",status:"none"}}),uk=m.forwardRef(({className:e,size:t,variant:n,status:r,...o},i)=>p.jsx("textarea",{className:Ce(QG({size:t,variant:n,status:r}),e),ref:i,...o}));uk.displayName="Textarea";function Yw(e){const t=JG(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(tY);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 JG(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=rY(o),c=nY(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 eY=Symbol("radix.slottable");function tY(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eY}function nY(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 rY(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]=$t(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=Yw(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=Yw(g),x=qe.forwardRef((b,E)=>{const{scope:w,children:N,...k}=b,P=qe.useRef(null),_=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:_,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,M)=>k.indexOf(R.ref.current)-k.indexOf(M.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},S,r]}function oY(e){const t=sY(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(aY);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 sY(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=cY(o),c=lY(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 iY=Symbol("radix.slottable");function aY(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===iY}function lY(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 cY(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 uY=[" ","Enter","ArrowUp","ArrowDown"],dY=[" ","Enter"],ds="Select",[vf,xf,fY]=yf(ds),[Fi]=$t(ds,[fY,Li]),bf=Li(),[pY,vo]=Fi(ds),[hY,gY]=Fi(ds),dk=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=bf(t),[E,w]=m.useState(null),[N,k]=m.useState(null),[P,_]=m.useState(!1),R=Nl(f),[M,L]=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(Km,{...b,children:p.jsxs(pY,{required:x,scope:t,trigger:E,onTriggerChange:w,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:P,onValueNodeHasChildrenChange:_,contentId:kt(),value:D,onValueChange:H,open:M,onOpenChange:L,dir:R,triggerPointerDownPosRef:j,disabled:v,children:[p.jsx(vf.Provider,{scope:t,children:p.jsx(hY,{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(jk,{"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]})})};dk.displayName=ds;var fk="SelectTrigger",pk=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=bf(n),l=vo(fk,n),c=l.disabled||r,d=De(t,l.onTriggerChange),f=xf(n),g=m.useRef("touch"),[h,v,x]=Lk(b=>{const E=f().filter(k=>!k.disabled),w=E.find(k=>k.value===l.value),N=$k(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(Gm,{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":Ok(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===" ")&&uY.includes(b.key)&&(S(),b.preventDefault())})})})});pk.displayName=fk;var hk="SelectValue",gk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:l="",...c}=e,d=vo(hk,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:Ok(d.value)?p.jsx(p.Fragment,{children:l}):i})});gk.displayName=hk;var mY="SelectIcon",mk=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});mk.displayName=mY;var yY="SelectPortal",yk=e=>p.jsx(_i,{asChild:!0,...e});yk.displayName=yY;var fs="SelectContent",vk=m.forwardRef((e,t)=>{const n=vo(fs,e.__scopeSelect),[r,o]=m.useState();if(xt(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ps.createPortal(p.jsx(xk,{scope:e.__scopeSelect,children:p.jsx(vf.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),i):null}return p.jsx(bk,{...e,ref:t})});vk.displayName=fs;var Nn=10,[xk,xo]=Fi(fs),vY="SelectContentImpl",xY=oY("SelectContent.RemoveScroll"),bk=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=vo(fs,n),[k,P]=m.useState(null),[_,R]=m.useState(null),M=De(t,Z=>P(Z)),[L,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 xm(k)},[k]),vm();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&&_&&(_.scrollTop=0),ge===ce&&_&&(_.scrollTop=_.scrollHeight),ge?.focus(),document.activeElement!==me))return},[U,_]),V=m.useCallback(()=>A([L,k]),[A,L,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,$]=Lk(Z=>{const K=U().filter(me=>!me.disabled),re=K.find(me=>me.ref.current===document.activeElement),ce=$k(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:wk,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(xk,{scope:n,content:k,viewport:_,onViewportChange:R,itemRefCallback:z,selectedItem:L,onItemLeave:X,itemTextRefCallback:Q,focusSelectedItem:V,selectedItemText:H,position:r,isPositioned:Y,searchRef:q,children:p.jsx(Ad,{as:xY,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:M,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&&$(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()}})})})})})})});bk.displayName=vY;var bY="SelectItemAlignedPosition",wk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=vo(fs,n),l=xo(fs,n),[c,d]=m.useState(null),[f,g]=m.useState(null),h=De(t,M=>g(M)),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 M=i.trigger.getBoundingClientRect(),L=f.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),H=w.getBoundingClientRect();if(i.dir!=="rtl"){const me=H.left-L.left,ge=D.left-me,pe=M.left-ge,Re=M.width+pe,$e=Math.max(Re,L.width),ze=window.innerWidth-Nn,le=kg(ge,[Nn,Math.max(Nn,ze-$e)]);c.style.minWidth=Re+"px",c.style.left=le+"px"}else{const me=L.right-H.right,ge=window.innerWidth-D.right-me,pe=window.innerWidth-M.right-ge,Re=M.width+pe,$e=Math.max(Re,L.width),ze=window.innerWidth-Nn,le=kg(ge,[Nn,Math.max(Nn,ze-$e)]);c.style.minWidth=Re+"px",c.style.right=le+"px"}const j=v(),U=window.innerHeight-Nn*2,Y=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+Y+F+V,q=Math.min(E.offsetHeight*5,W),$=window.getComputedStyle(b),z=parseInt($.paddingTop,10),X=parseInt($.paddingBottom,10),Q=M.top+M.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-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=`${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,b,E,w,i.dir,r]);xt(()=>k(),[k]);const[P,_]=m.useState();xt(()=>{f&&_(window.getComputedStyle(f).zIndex)},[f]);const R=m.useCallback(M=>{M&&S.current===!0&&(k(),N?.(),S.current=!1)},[k,N]);return p.jsx(SY,{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}})})})});wk.displayName=bY;var wY="SelectPopperPosition",Qg=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Nn,...i}=e,l=bf(n);return p.jsx(Ym,{...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=wY;var[SY,Ty]=Fi(fs,{}),Jg="SelectViewport",Sk=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=xo(Jg,n),l=Ty(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,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})})})]})});Sk.displayName=Jg;var Ck="SelectGroup",[CY,EY]=Fi(Ck),NY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=kt();return p.jsx(CY,{scope:n,id:o,children:p.jsx(Ne.div,{role:"group","aria-labelledby":o,...r,ref:t})})});NY.displayName=Ck;var Ek="SelectLabel",Nk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=EY(Ek,n);return p.jsx(Ne.div,{id:o.id,...r,ref:t})});Nk.displayName=Ek;var gd="SelectItem",[kY,kk]=Fi(gd),Tk=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...l}=e,c=vo(gd,n),d=xo(gd,n),f=c.value===r,[g,h]=m.useState(i??""),[v,x]=m.useState(!1),S=De(t,N=>d.itemRefCallback?.(N,r,o)),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(kY,{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===" "||(dY.includes(N.key)&&w(),N.key===" "&&N.preventDefault())})})})})});Tk.displayName=gd;var Ua="SelectItemText",Pk=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,l=vo(Ua,n),c=xo(Ua,n),d=kk(Ua,n),f=gY(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]})});Pk.displayName=Ua;var Rk="SelectItemIndicator",Ik=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return kk(Rk,n).isSelected?p.jsx(Ne.span,{"aria-hidden":!0,...r,ref:t}):null});Ik.displayName=Rk;var em="SelectScrollUpButton",Mk=m.forwardRef((e,t)=>{const n=xo(em,e.__scopeSelect),r=Ty(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(_k,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Mk.displayName=em;var tm="SelectScrollDownButton",Ak=m.forwardRef((e,t)=>{const n=xo(tm,e.__scopeSelect),r=Ty(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(_k,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});Ak.displayName=tm;var _k=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=xo("SelectScrollButton",n),l=m.useRef(null),c=xf(n),d=m.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return m.useEffect(()=>()=>d(),[d]),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()})})}),TY="SelectSeparator",Dk=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(Ne.div,{"aria-hidden":!0,...r,ref:t})});Dk.displayName=TY;var nm="SelectArrow",PY=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=bf(n),i=vo(nm,n),l=xo(nm,n);return i.open&&l.position==="popper"?p.jsx(Xm,{...o,...r,ref:t}):null});PY.displayName=nm;var RY="SelectBubbleInput",jk=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=m.useRef(null),i=De(r,o),l=ay(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:{...AC,...n.style},ref:i,defaultValue:t})});jk.displayName=RY;function Ok(e){return e===""||e===void 0}function Lk(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 $k(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=IY(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 IY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var MY=dk,Fk=pk,AY=gk,_Y=mk,DY=yk,zk=vk,jY=Sk,Vk=Nk,Bk=Tk,OY=Pk,LY=Ik,Hk=Mk,Wk=Ak,Uk=Dk;const br=MY,wr=AY,Xn=m.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Fk,{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(_Y,{asChild:!0,children:p.jsx(Ii,{className:"h-4 w-4 opacity-50"})})]}));Xn.displayName=Fk.displayName;const Kk=m.forwardRef(({className:e,...t},n)=>p.jsx(Hk,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(Iz,{className:"h-4 w-4"})}));Kk.displayName=Hk.displayName;const Gk=m.forwardRef(({className:e,...t},n)=>p.jsx(Wk,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(Ii,{className:"h-4 w-4"})}));Gk.displayName=Wk.displayName;const qn=m.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(DY,{children:p.jsxs(zk,{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(Kk,{}),p.jsx(jY,{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(Gk,{})]})}));qn.displayName=zk.displayName;const $Y=m.forwardRef(({className:e,...t},n)=>p.jsx(Vk,{ref:n,className:Ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));$Y.displayName=Vk.displayName;const sn=m.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Bk,{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(LY,{children:p.jsx(O1,{className:"h-4 w-4"})})}),p.jsx(OY,{children:t})]}));sn.displayName=Bk.displayName;const FY=m.forwardRef(({className:e,...t},n)=>p.jsx(Uk,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));FY.displayName=Uk.displayName;const zY=yo("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),rm=m.forwardRef(({className:e,variant:t,...n},r)=>p.jsx("div",{ref:r,role:"alert",className:Ce(zY({variant:t}),e),...n}));rm.displayName="Alert";const VY=m.forwardRef(({className:e,...t},n)=>p.jsx("h5",{ref:n,className:Ce("mb-1 font-medium leading-none tracking-tight",e),...t}));VY.displayName="AlertTitle";const om=m.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:Ce("text-sm [&_p]:leading-relaxed",e),...t}));om.displayName="AlertDescription";var dg="rovingFocusGroup.onEntryFocus",BY={bubbles:!1,cancelable:!0},Ol="RovingFocusGroup",[sm,Yk,HY]=yf(Ol),[WY,wf]=$t(Ol,[HY]),[UY,KY]=WY(Ol),Xk=m.forwardRef((e,t)=>p.jsx(sm.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(sm.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(GY,{...e,ref:t})})}));Xk.displayName=Ol;var GY=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=Yk(n),_=m.useRef(!1),[R,M]=m.useState(0);return m.useEffect(()=>{const L=v.current;if(L)return L.addEventListener(dg,k),()=>L.removeEventListener(dg,k)},[k]),p.jsx(UY,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:b,onItemFocus:m.useCallback(L=>E(L),[E]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>M(L=>L+1),[]),onFocusableItemRemove:m.useCallback(()=>M(L=>L-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,()=>{_.current=!0}),onFocus:ve(e.onFocus,L=>{const D=!_.current;if(L.target===L.currentTarget&&D&&!w){const H=new CustomEvent(dg,BY);if(L.currentTarget.dispatchEvent(H),!H.defaultPrevented){const j=P().filter(A=>A.focusable),U=j.find(A=>A.active),Y=j.find(A=>A.id===b),B=[U,Y,...j].filter(Boolean).map(A=>A.ref.current);Qk(B,g)}}_.current=!1}),onBlur:ve(e.onBlur,()=>N(!1))})})}),qk="RovingFocusGroupItem",Zk=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=KY(qk,n),h=g.currentTabStopId===f,v=Yk(n),{onFocusableItemAdd:x,onFocusableItemRemove:S,currentTabStopId:b}=g;return m.useEffect(()=>{if(r)return x(),()=>S()},[r,x,S]),p.jsx(sm.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=qY(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?ZY(k,P+1):k.slice(P+1)}setTimeout(()=>Qk(k))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:b!=null}):l})})});Zk.displayName=qk;var YY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function XY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qY(e,t,n){const r=XY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return YY[r]}function Qk(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ZY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Jk=Xk,eT=Zk,tT="Toggle",Py=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:o,...i}=e,[l,c]=ln({prop:n,onChange:o,defaultProp:r??!1,caller:tT});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)})})});Py.displayName=tT;var nT=Py,bo="ToggleGroup",[rT]=$t(bo,[wf]),oT=wf(),Ry=qe.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const o=r;return p.jsx(QY,{...o,ref:t})}if(n==="multiple"){const o=r;return p.jsx(JY,{...o,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${bo}\``)});Ry.displayName=bo;var[sT,iT]=rT(bo),QY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??"",onChange:o,caller:bo});return p.jsx(sT,{scope:e.__scopeToggleGroup,type:"single",value:qe.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:qe.useCallback(()=>c(""),[c]),children:p.jsx(aT,{...i,ref:t})})}),JY=qe.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[l,c]=ln({prop:n,defaultProp:r??[],onChange:o,caller:bo}),d=qe.useCallback(g=>c((h=[])=>[...h,g]),[c]),f=qe.useCallback(g=>c((h=[])=>h.filter(v=>v!==g)),[c]);return p.jsx(sT,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:d,onItemDeactivate:f,children:p.jsx(aT,{...i,ref:t})})});Ry.displayName=bo;var[eX,tX]=rT(bo),aT=qe.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:o=!0,orientation:i,dir:l,loop:c=!0,...d}=e,f=oT(n),g=Nl(l),h={role:"group",dir:g,...d};return p.jsx(eX,{scope:n,rovingFocus:o,disabled:r,children:o?p.jsx(Jk,{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",lT=qe.forwardRef((e,t)=>{const n=iT(md,e.__scopeToggleGroup),r=tX(md,e.__scopeToggleGroup),o=oT(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(eT,{asChild:!0,...o,focusable:!l,active:i,ref:d,children:p.jsx(Xw,{...c,ref:t})}):p.jsx(Xw,{...c,ref:t})});lT.displayName=md;var Xw=qe.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...o}=e,i=iT(md,n),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},c=i.type==="single"?l:void 0;return p.jsx(Py,{...c,...o,ref:t,onPressedChange:d=>{d?i.onItemActivate(r):i.onItemDeactivate(r)}})}),cT=Ry,uT=lT;const dT=yo("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-primary/20 hover:text-foreground data-[state=on]:relative data-[state=on]:z-10 data-[state=on]:border-primary"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),nX=m.forwardRef(({className:e,variant:t,size:n,...r},o)=>p.jsx(nT,{ref:o,className:Ce(dT({variant:t,size:n,className:e})),...r}));nX.displayName=nT.displayName;const fT=m.createContext({size:"default",variant:"default"}),yd=m.forwardRef(({className:e,variant:t,size:n,children:r,...o},i)=>p.jsx(cT,{ref:i,className:Ce("flex items-center justify-center gap-1",e),...o,children:p.jsx(fT.Provider,{value:{variant:t,size:n},children:r})}));yd.displayName=cT.displayName;const Yo=m.forwardRef(({className:e,children:t,variant:n,size:r,...o},i)=>{const l=m.useContext(fT);return p.jsx(uT,{ref:i,className:Ce(dT({variant:l.variant||n,size:l.size||r}),e),...o,children:t})});Yo.displayName=uT.displayName;const pT=({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.useRef(!1),R=m.useMemo(()=>d.filter(A=>A.name.toLowerCase().includes(b.toLowerCase())),[d,b]),M=ue(A=>A.activeCanvasId),L=m.useMemo(()=>{const A={};if(!h)return A;for(const V of Qe(M).getState().nodes)A[V.id]=V.data.label??Lt.getByType(V.data.type)?.label??V.data.type;return A},[h,M]),D=m.useCallback(A=>d.find(V=>V.name===A),[d]),H=m.useCallback(A=>{const V=[],F=/\$\{([^}]+)\}/g;let W,q=A;const $=[];for(;(W=F.exec(A))!==null;)$.push({name:W[1]??"",start:W.index,end:W.index+W[0].length});let z=0;for(const X of $){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(_.current)return;const A=j(c);A!==f&&g(A)},[c,j,f]);const U=A=>{_.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 $=W.slice(q+1);if(!($.startsWith("{")&&$.includes("}"))&&($===""||$.startsWith("{")||/^[a-zA-Z_]/.test($))){const X=$.replace(/^\{?/,"");E(X),S(q),v(!0),N(0);return}}v(!1),t(H(V))},Y=()=>{_.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 $=V.length+A.name.length+3;k.current?.setSelectionRange($,$)},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: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===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:L[A.nodeId]??A.nodeId}):A.kind==="declared"?i("globalVariable"):i("fnarg")})]}),p.jsx("span",{className:"text-xs text-muted-foreground",children:A.dataType})]},so(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(br,{value:c,onValueChange:d=>i(d===l?void 0:d),disabled:r,children:[p.jsx(Xn,{children:p.jsx(wr,{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 rX(e){switch(e){case"int":case"float":return"${var1} + ${var2}";case"bool":return"${var1} > ${var2}";case"string":return"hello ${var1}";default:return"${var1}"}}const Iy=({canvasId:e,parameter:t,value:n,allArguments:r,onChange:o,errors:i,translationPrefix:l})=>{const{t:c}=Xe(),d=n,{list:f,lookup:g}=$i(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(_=>({value:so(_),label:`${_.name} (${_.dataType})`}));return p.jsx(Pu,{value:N,options:P,isStale:k,placeholder:"Select variable...",onChange:_=>{if(!_){o(void 0);return}const R=g[_];if(!R)return;const M=R.kind==="node"?{srcId:R.nodeId,varId:R.outputId}:R.kind==="declared"?{srcId:"declared",varId:R.uid}:{srcId:"fnarg",varId:R.uid};o(M)}})}case"expression":{const N=b1(t,r,g),k=d&&typeof d=="object"&&"expression"in d?d:{expression:"",references:[],dataType:N};return p.jsx(pT,{value:k,onChange:o,expressionType:N,availableVariables:g,placeholder:rX(N)})}case"string":return t.multiline?p.jsx(uk,{value:d||"",onChange:w=>o(w.target.value),placeholder:String(t.default??""),rows:4}):p.jsx(_t,{value:d||"",onChange:w=>o(w.target.value),placeholder:String(t.default??"")});case"int":return p.jsx(_t,{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(_t,{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(br,{value:N,onValueChange:k=>o(k===w?void 0:k),children:[p.jsx(Xn,{children:p.jsx(wr,{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=S1(t,r),k=Object.values(v).filter(M=>N.includes(M.type)),P=d,_=!!(P&&!k.some(M=>M.id===P)),R=k.map(M=>({value:M.id,label:M.label}));return p.jsx(Pu,{value:P,options:R,isStale:_,placeholder:c("selectMemory","Select memory..."),onChange:M=>o(M)})}case"modelSelect":{const w=t,N=C1(w,r),k=pA(w,r),P=j=>!k?.length||k.every(U=>j.includes(U)),_=N.includes("LLMModel")?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})),M=new Set(_.map(j=>j.value)),L=[..._,...R.filter(j=>!M.has(j.value))],D=d,H=!!(D&&!L.some(j=>j.value===D));if(L.length===0){const j=N.includes("LLMModel")?c("noLLMModelsAvailable"):c("noMLModelsAvailable");return p.jsxs(rm,{variant:"destructive",children:[p.jsx(Sr,{className:"h-4 w-4"}),p.jsx(om,{children:j})]})}return p.jsx(Pu,{value:D,options:L,isStale:H,placeholder:c("selectModel","Select model..."),onChange:j=>o(j)})}case"time":return p.jsx(_t,{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 _=N.includes(P)?N.filter(R=>R!==P):[...N,P];o(_)};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(L=>L.type==="MemoryFile"),k=new Map(N.map(L=>[L.id,L])),P=(L,D)=>o(w.map((H,j)=>j===L?D:H)),_=L=>o(w.filter((D,H)=>H!==L)),R=()=>{const L=new Set(w.map(H=>H.id)),D=N.find(H=>!L.has(H.id));o([...w,{id:D?.id??"",mode:"r"}])},M=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((L,D)=>{const H=L.id?k.get(L.id):void 0,j=!!(L.id&&!H),U=new Set(w.filter((I,B)=>B!==D).map(I=>I.id)),Y=N.filter(I=>I.id===L.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(br,{value:L.id||void 0,onValueChange:I=>P(D,{...L,id:I}),children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(wr,{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:()=>_(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:L.mode,onValueChange:I=>I&&P(D,{...L,mode:I}),className:"gap-0 justify-start",children:[p.jsx(Yo,{value:"r",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-r-none",children:c("memoryModeRead","Read")}),p.jsx(Yo,{value:"rw",size:"sm",variant:"outline",className:"h-7 px-3 text-xs rounded-l-none -ml-px",children:c("memoryModeReadWrite","Read + Write")})]})]},D)}),M&&p.jsx(os,{onClick:R,children:c("addMemoryRef","Add memory ref")})]})}case"channelSelect":{const N=w1(t,r),k=Object.values(h).filter(M=>N.includes(M.type)),P=d,_=!!(P&&!k.some(M=>M.id===P)),R=k.map(M=>({value:M.id,label:M.label}));return R.length===0?p.jsxs(rm,{variant:"destructive",children:[p.jsx(Sr,{className:"h-4 w-4"}),p.jsx(om,{children:c("noChannelsAvailable")})]}):p.jsx(Pu,{value:P,options:R,isStale:_,placeholder:c("selectChannel"),onChange:M=>o(M)})}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?xH(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 My(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 Ll(){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 Ay=({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=>On(P.builderMode)),w=My(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(Ll,{}),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(Iy,{canvasId:b,parameter:P,value:c(P),allArguments:d,onChange:_=>f(P.id,_),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})]})]})})},oX=({channel:e,onClose:t})=>{const{t:n}=Xe(),r={...e.arguments,type:e.type},o=Ed.parameters.filter(c=>Tr(c,r,!1)),i=Ye(c=>c.byChannelId[e.id]),l=(c,d)=>{c==="type"?Kh(e.id,{type:d}):Kh(e.id,{arguments:{[c]:d}})};return p.jsx(Ay,{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:()=>kH(e.id),onClose:t})},sX=({canvasId:e,onStep:t,getNodeCategory:n})=>{const{t:r}=Xe(),o=ss(w=>w.phase),i=aX(o),c=Qe(e)(w=>i?w.nodes.find(N=>N.id===i)?.data??null:null),d=m.useMemo(()=>c?hA(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(iX,{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(Oz,{className:"w-4 h-4 animate-spin"}),r("debug.stepping")]}):p.jsxs(p.Fragment,{children:[p.jsx($z,{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 iX({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(_t,{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(_t,{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 aX(e){return e.status==="paused"||e.status==="stepping"?e.cursorNodeId:null}const lX=({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=m1(n),h=Ye(S=>S.byEdgeId[t]),v=My(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:bH(d,g,n)})]}),p.jsx(gt,{variant:"ghost",size:"icon",onClick:c,children:p.jsx(Cl,{className:"h-4 w-4"})})]}),f&&p.jsx(Ll,{}),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(Iy,{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 cX=Symbol("radix.slottable");function uX(e){const t=({children:n})=>p.jsx(p.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=cX,t}var hT="AlertDialog",[dX]=$t(hT,[cS]),Ir=cS(),gT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ir(t);return p.jsx(Cm,{...r,...n,modal:!0})};gT.displayName=hT;var fX="AlertDialogTrigger",pX=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(v4,{...o,...r,ref:t})});pX.displayName=fX;var hX="AlertDialogPortal",mT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ir(t);return p.jsx(Em,{...r,...n})};mT.displayName=hX;var gX="AlertDialogOverlay",yT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Dd,{...o,...r,ref:t})});yT.displayName=gX;var fi="AlertDialogContent",[mX,yX]=dX(fi),vX=uX("AlertDialogContent"),vT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Ir(n),l=m.useRef(null),c=De(t,l),d=m.useRef(null);return p.jsx(h4,{contentName:fi,titleName:xT,docsSlug:"alert-dialog",children:p.jsx(mX,{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(vX,{children:r}),p.jsx(bX,{contentRef:l})]})})})});vT.displayName=fi;var xT="AlertDialogTitle",bT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Nm,{...o,...r,ref:t})});bT.displayName=xT;var wT="AlertDialogDescription",ST=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(km,{...o,...r,ref:t})});ST.displayName=wT;var xX="AlertDialogAction",CT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ir(n);return p.jsx(Tm,{...o,...r,ref:t})});CT.displayName=xX;var ET="AlertDialogCancel",NT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=yX(ET,n),i=Ir(n),l=De(t,o);return p.jsx(Tm,{...i,...r,ref:l})});NT.displayName=ET;var bX=({contentRef:e})=>{const t=`\`${fi}\` requires a description for the component to be accessible for screen reader users.
|
|
70
|
+
|
|
71
|
+
You can add a description to the \`${fi}\` by passing a \`${wT}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
72
|
+
|
|
73
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${fi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
74
|
+
|
|
75
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},wX=gT,SX=mT,kT=yT,TT=vT,PT=CT,RT=NT,IT=bT,MT=ST;const CX=wX,EX=SX,AT=m.forwardRef(({className:e,...t},n)=>p.jsx(kT,{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}));AT.displayName=kT.displayName;const _T=m.forwardRef(({className:e,...t},n)=>p.jsxs(EX,{children:[p.jsx(AT,{}),p.jsx(TT,{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})]}));_T.displayName=TT.displayName;const DT=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});DT.displayName="AlertDialogHeader";const jT=({className:e,...t})=>p.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jT.displayName="AlertDialogFooter";const OT=m.forwardRef(({className:e,...t},n)=>p.jsx(IT,{ref:n,className:Ce("font-heading text-lg font-semibold",e),...t}));OT.displayName=IT.displayName;const LT=m.forwardRef(({className:e,...t},n)=>p.jsx(MT,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));LT.displayName=MT.displayName;const $T=m.forwardRef(({className:e,...t},n)=>p.jsx(PT,{ref:n,className:Ce(mm(),e),...t}));$T.displayName=PT.displayName;const FT=m.forwardRef(({className:e,...t},n)=>p.jsx(RT,{ref:n,className:Ce(mm({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));FT.displayName=RT.displayName;const NX=["int","float","bool","string"];function kX({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(_t,{className:"h-7 text-xs flex-1",value:e.name,placeholder:"name",onChange:l=>t({name:l.target.value})}),p.jsxs(br,{value:e.dataType,onValueChange:l=>t({dataType:l}),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(wr,{})}),p.jsx(qn,{children:NX.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 qw({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(kX,{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 TX=e=>({expression:"",references:[],dataType:e});function PX(e){const t=Jm(e.id);t&&oH(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&&PX(r)}function RX(){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 IX(e){ue.getState().setFunctions(n=>{const{[e]:r,...o}=n;return o}),iH(e);const t=ue.getState().selection;t.kind==="function"&&t.id===e&&ue.getState().clearSelection()}function MX(e,t){wo(e,n=>({...n,name:t}),!1)}function AX(e){wo(e,t=>({...t,arguments:[...t.arguments,v1({name:`input${t.arguments.length+1}`,dataType:"string"})]}),!0)}function _X(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 DX(e,t){wo(e,n=>({...n,arguments:n.arguments.filter((r,o)=>o!==t)}),!0)}function jX(e){wo(e,t=>{const n="string";return{...t,outputs:[...t.outputs,{uid:an(),name:`output${t.outputs.length+1}`,dataType:n,expression:TX(n)}]}},!0)}function OX(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 LX(e,t){wo(e,n=>({...n,outputs:n.outputs.filter((r,o)=>o!==t)}),!0)}function $X(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 FX=({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}=$i(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),MX(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(Ll,{}),p.jsxs("div",{className:`space-y-4 ${r?"pointer-events-none opacity-60":""}`,children:[p.jsx(Ot,{}),p.jsx(qw,{title:n("inputs"),description:n("functionInputsDesc"),addLabel:n("add"),emptyText:n("noInputs"),ports:i,onAdd:()=>AX(o),onUpdate:(S,b)=>_X(o,S,b),onRemove:S=>DX(o,S)}),p.jsx(Ot,{}),p.jsx(qw,{title:n("outputs"),description:n("functionOutputsDesc"),addLabel:n("add"),emptyText:n("noOutputs"),ports:l,onAdd:()=>jX(o),onUpdate:(S,b)=>OX(o,S,b),onRemove:S=>LX(o,S),errorsFor:S=>x.get(S.uid)??[],renderExtra:(S,b)=>p.jsx(pT,{value:S.expression,onChange:E=>$X(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(CX,{open:c,onOpenChange:d,children:p.jsxs(_T,{children:[p.jsxs(DT,{children:[p.jsx(OT,{children:n("deleteFunctionTitle")}),p.jsx(LT,{children:n("deleteFunctionDesc")})]}),p.jsxs(jT,{children:[p.jsx(FT,{children:n("cancel")}),p.jsx($T,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{IX(o),d(!1),t()},children:n("delete")})]})]})})]})},zX=({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(Ay,{resetKey:e.id,label:e.label,labelTitle:n("memoryLabel","Memory label"),onLabelChange:f=>jb(e.id,{label:f}),description:o?.description??"",belowLabel:d,parameters:o?.parameters??[],getValue:f=>e.arguments[f.id],allArguments:{...e.arguments},onParamChange:(f,g)=>jb(e.id,{arguments:{[f]:g}}),diagnostics:i,translationPrefix:"memory",deleteLabel:n("deleteMemory","Delete memory"),onDelete:()=>IH(e.id),onClose:t})},VX=({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(Ay,{resetKey:e.id,label:e.label,labelTitle:n("modelLabel","Model label"),onLabelChange:l=>Lb(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)=>Lb(e.id,{arguments:{[l]:c}}),diagnostics:o,translationPrefix:"models",deleteLabel:n("deleteModel","Delete model"),onDelete:()=>DH(e.id),onClose:t})};var Sf="Checkbox",[BX]=$t(Sf),[HX,_y]=BX(Sf);function WX(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:uo(o)?!1:o,isFormControl:k,bubbleInput:E,setBubbleInput:w};return p.jsx(HX,{scope:t,...P,children:UX(h)?h(P):r})}var zT="CheckboxTrigger",VT=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(zT,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":uo(d)?"mixed":d,"aria-required":f,"data-state":KT(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=>uo(N)?!0:!N),S&&x&&(v.current=w.isPropagationStopped(),v.current||w.stopPropagation())})})});VT.displayName=zT;var Dy=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(WX,{__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(VT,{...h,ref:t,__scopeCheckbox:n}),v&&p.jsx(UT,{__scopeCheckbox:n})]})})});Dy.displayName=Sf;var BT="CheckboxIndicator",HT=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=_y(BT,n);return p.jsx(Pt,{present:r||uo(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{"data-state":KT(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});HT.displayName=BT;var WT="CheckboxBubbleInput",UT=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(WT,e),S=De(n,x),b=ay(i),E=Hm(r);m.useEffect(()=>{const N=v;if(!N)return;const k=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(k,"checked").set,R=!o.current;if(b!==i&&_){const M=new Event("click",{bubbles:R});N.indeterminate=uo(i),_.call(N,uo(i)?!1:i),N.dispatchEvent(M)}},[v,b,i,o]);const w=m.useRef(uo(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%)"}})});UT.displayName=WT;function UX(e){return typeof e=="function"}function uo(e){return e==="indeterminate"}function KT(e){return uo(e)?"indeterminate":e?"checked":"unchecked"}const GT=m.forwardRef(({className:e,...t},n)=>p.jsx(Dy,{ref:n,className:Ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:p.jsx(HT,{className:Ce("flex items-center justify-center text-current"),children:p.jsx(O1,{className:"h-4 w-4"})})}));GT.displayName=Dy.displayName;function YT(e){const t=e.getState().variables;return new Set(Object.values(t).map(n=>n.name))}function XT(e,t){const n=e.arguments,r=i=>{const l=n[i];if(!l||!l.active||l.mode!=="emit"||!t.has(l.name))return;const c=yi(l.name,t);t.add(c),n[i]={active:!0,mode:"emit",name:c}};if(e.type==="FunctionCall"){for(const i of e.functionInfo.returns)r(Jo(i));return}const o=Lt.getByType(e.type);if(o?.outputs)for(const i of o.outputs)if(i.type==="static")r(i.id);else{const l=n[i.id]??[];for(const c of l){if(c.mode!=="emit"||!t.has(c.name))continue;const d=yi(c.name,t);t.add(d),c.name=d}}}function qT(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 Zw(e,t,n){if(!qT(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[Jo(b)]={expression:"",references:[],dataType:b.dataType};for(const b of x.functionInfo.returns)o[Jo(b)]={active:!0,mode:"emit",name:b.name}}const l=YT(e);XT(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:JT(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 ZT(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 Qw(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 KX(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 Jw(e,t){const{nodes:n,edges:r,setEdges:o}=e.getState(),i=sE(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=KX(i,l,c);return o(f=>ZE({...t,type:d},f)),d}function GX(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 e1(e,t){const{setEdges:n}=e.getState(),r=new Set(t);n(o=>o.filter(i=>!r.has(i.id)))}function YX(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?qT(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=QT(Sd(E),g),{...S,id:b,position:{x:S.position.x+n.x,y:S.position.y+n.y},data:E,selected:!0}}),v=YT(e);for(const S of h)XT(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&&es(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 QT(e,t){const n={};for(const[r,o]of Object.entries(e))if(es(o)){const i={expression:o.expression,dataType:o.dataType,references:o.references.map(l=>({srcId:t.get(l.srcId)??l.srcId,varId:l.varId}))};n[r]=i}else Array.isArray(o)?n[r]=o.map(i=>es(i)?{expression:i.expression,dataType:i.dataType,references:i.references.map(l=>({srcId:t.get(l.srcId)??l.srcId,varId:l.varId}))}:i):o!==null&&typeof o=="object"?n[r]=QT(o,t):n[r]=o;return n}function JT(e){if(e==="FunctionCall")return"FunctionCall";const t=Lt.getByType(e)?.category??"Uncategorized";switch(t){case xe.Trigger:case xe.Tool:case xe.AI:return t;default:return"Standard"}}function XX(e,t){const n=e.arguments,r={};for(const o of t.arguments){const i=Jo(o),l=n[i];r[i]=l?{...l,dataType:o.dataType}:{expression:"",references:[],dataType:o.dataType}}for(const o of t.returns){const i=Jo(o),l=n[i];r[i]=l??{active:!0,mode:"emit",name:o.name}}return{functionInfo:{...t},arguments:r}}function eP(){const e=ey(),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||(ZT(r,i.id,XX(l,c)),n++))}}n>0&&Kt({title:gr.t("functionCallNodesMigrated"),description:gr.t("functionCallNodesMigratedDesc",{count:n})})}let t1=ue.getState().functions;ue.subscribe(e=>{e.functions!==t1&&(t1=e.functions,eP())});const qX=({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(),b=x?S(x):void 0,E=t.type!=="FunctionCall"||!b?!1:t.functionInfo.version!==b.version,w=t.type==="FunctionCall"?ty({...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]),_=Ye(H=>H.byNodeId[t.id]),R=My(_);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 M=Sd(t),L=w.parameters.filter(H=>Tr(H,M,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:GC(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(Ll,{}),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:L.map(H=>p.jsx(Iy,{canvasId:e,parameter:H,value:M[H.id],allArguments:M,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:()=>eP(),children:[p.jsx(zz,{className:"w-4 h-4 mr-2"}),c("updateToLatestDefinition")]})]}),!d&&D&&!P&&p.jsxs(p.Fragment,{children:[p.jsx(Ot,{}),p.jsx(eq,{canvasId:e,node:t,nodeDefinition:w,onNodeUpdate:n,nodeDiags:_})]}),!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")})]})]})})},ZX=["int","float","bool","string"],QX={int:"int",float:"float",bool:"bool",string:"string",image:"image"};function JX(e,t){return`${e}[${t}]`}function n1(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 eq({canvasId:e,node:t,nodeDefinition:n,onNodeUpdate:r,nodeDiags:o}){const{t:i}=Xe(),{list:l}=$i(e),c=m.useMemo(()=>k1(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=N1(t,w)??{active:!0,mode:"emit",name:N.name},_=x(N.dataType),R=g.get(w),M=!!R?.length,L=P.active,D=j=>{j!==L&&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 ${M?"border-destructive ring-1 ring-destructive":"border-border"}`,children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(GT,{checked:L,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 ${L?"":"opacity-50"}`,children:k}),p.jsx("span",{className:`text-xs text-muted-foreground ${L?"":"opacity-50"}`,children:QX[N.dataType]})]}),p.jsxs("div",{className:L?"":"opacity-50",children:[p.jsxs("div",{className:`flex items-center gap-2 ${L?"":"pointer-events-none"}`,children:[p.jsxs(yd,{type:"single",value:P.mode,onValueChange:j=>j&&H(j),className:"gap-0",children:[p.jsx(Yo,{value:"emit",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-r-none","aria-label":i("outputBinding.emit","Emit"),title:i("outputBinding.emit","Emit"),children:p.jsx(fo,{className:"w-3.5 h-3.5"})}),p.jsx(Yo,{value:"assign",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-l-none -ml-px","aria-label":i("outputBinding.assign","Assign"),title:i("outputBinding.assign","Assign"),children:p.jsx(H0,{className:"w-3.5 h-3.5"})})]}),P.mode==="emit"?p.jsx(_t,{className:"h-7 text-xs flex-1",value:P.name,disabled:!L,onChange:j=>h(w,{active:P.active,mode:"emit",name:j.target.value})}):_.length>0?p.jsxs(br,{value:P.target.srcId?yr(P.target):"",onValueChange:j=>{const U=l.find(Y=>so(Y)===j);U&&h(w,{active:P.active,mode:"assign",target:n1(U)})},disabled:!L,children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(wr,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:_.map(j=>p.jsx(sn,{value:so(j),children:j.name},so(j)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),M&&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 _=x(P.dataType),R=JX(w,k),M=g.get(R),L=!!M?.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}),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 ${L?"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(_t,{className:"h-7 text-xs flex-1",value:P.name,placeholder:i("outputBinding.name","Name"),onChange:I=>U(I.target.value)}),p.jsxs(br,{value:P.dataType,onValueChange:I=>Y(I),children:[p.jsx(Xn,{className:"h-7 text-xs w-20",children:p.jsx(wr,{})}),p.jsx(qn,{children:ZX.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(Yo,{value:"emit",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-r-none","aria-label":i("outputBinding.emit","Emit"),title:i("outputBinding.emit","Emit"),children:p.jsx(fo,{className:"w-3.5 h-3.5"})}),p.jsx(Yo,{value:"assign",size:"sm",variant:"outline",className:"h-7 w-7 p-0 rounded-l-none -ml-px","aria-label":i("outputBinding.assign","Assign"),title:i("outputBinding.assign","Assign"),children:p.jsx(H0,{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")}):_.length>0?p.jsxs(br,{value:P.target.srcId?yr(P.target):"",onValueChange:I=>{const B=l.find(A=>so(A)===I);B&&D({...P,target:n1(B)})},children:[p.jsx(Xn,{className:"h-7 text-xs flex-1",children:p.jsx(wr,{placeholder:i("outputBinding.selectVariable","Select variable...")})}),p.jsx(qn,{children:_.map(I=>p.jsx(sn,{value:so(I),children:I.name},so(I)))})]}):p.jsx("span",{className:"text-xs text-muted-foreground italic flex-1",children:i("outputBinding.noCompatibleVariables","No compatible variables")})]}),L&&p.jsx("div",{className:"space-y-0.5",children:M.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 tq=["int","float","bool","string"],nq=({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(br,{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(wr,{})}),p.jsxs(qn,{children:[p.jsx(sn,{value:"false",children:"false"}),p.jsx(sn,{value:"true",children:"true"})]})]});case"string":return p.jsx(_t,{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(_t,{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(Ll,{}),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(br,{value:t.dataType,onValueChange:f=>$H(e,t.uid,f),children:[p.jsx(Xn,{className:"h-8 text-sm",children:p.jsx(wr,{})}),p.jsx(qn,{children:tq.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:()=>FH(e,t.uid),children:r("deleteVariable","Delete variable")})]})]})})},rq=({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),b=ue(Y=>Y.models),E=ue(Y=>Y.functions),w=Qe(e),N=w(m.useCallback(Y=>h.kind!=="graph"||h.nodeIds.length!==1?null:Y.nodes.find(B=>B.id===h.nodeIds[0])?.data??null,[h])),k=w(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=w(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])),_=P?{id:P.id,source:P.source,type:P.type??"control",data:P.data??{}}:null,R=w(m.useCallback(Y=>_?Y.edges.filter(I=>I.source===_.source&&dm(I.type)).length:0,[_?.source])),M=m.useMemo(()=>h.kind==="channel"?Object.values(x).find(Y=>Y.id===h.id)??null:null,[h,x]),L=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(b).find(Y=>Y.id===h.id)??null:null,[h,b]),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(ro,{bg:"bg-background",pad:!0,children:p.jsx(sX,{canvasId:e,onStep:g??(()=>{}),getNodeCategory:j})}):null:N?p.jsx(ro,{children:p.jsx(qX,{canvasId:e,selectedNode:N,onNodeUpdate:o,onNodeDelete:i,onClose:d,onOpenTest:U,getNodeDef:r})}):_?p.jsx(ro,{children:p.jsx(lX,{canvasId:e,edgeId:_.id,edgeType:_.type,edgeData:_.data,sourceControlEdgeCount:R,onEdgeUpdate:l,onEdgeDelete:c,onClose:d})}):k?p.jsx(ro,{children:p.jsx(nq,{canvasId:e,variable:k,onClose:v})}):M?p.jsx(ro,{children:p.jsx(oX,{channel:M,onClose:v})}):L?p.jsx(ro,{children:p.jsx(zX,{memory:L,onClose:v})}):D?p.jsx(ro,{children:p.jsx(VX,{model:D,onClose:v})}):H?p.jsx(ro,{children:p.jsx(FX,{func:H,onClose:v})}):null},ro=({bg:e="bg-card",pad:t=!1,children:n})=>p.jsx(Di,{className:Ce("w-80 border-l border-border",e),viewportClassName:t?"p-3":void 0,children:n}),oq=(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}},r1={current:null},sq=(e=He,t=!1)=>{const n=Qe(e),r=n(N=>N.nodes),o=n(N=>N.edges),{withCheckpoint:i}=n,{getNodeDefinition:l}=ny(),c=m.useCallback(N=>{if(!t)return i(N)},[t,i]),d=m.useCallback((N,k)=>c(()=>Zw(n,N,k))??null,[n,c]),f=m.useCallback((N,k)=>{c(()=>ZT(n,N,k))},[n,c]),g=m.useCallback(N=>{c(()=>Qw(n,N,l))},[n,l,c]),h=m.useCallback(N=>c(()=>Jw(n,N))??!1,[n,c]),v=m.useCallback((N,k)=>{c(()=>GX(n,N,k))},[n,c]),x=m.useCallback(N=>{c(()=>e1(n,N))},[n,c]),S=m.useCallback((N,k)=>{N.length===0&&k.length===0||c(()=>{for(const P of N)Qw(n,P,l);k.length>0&&e1(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))),_=o.filter(R=>k.has(R.source)&&k.has(R.target)).map(R=>JSON.parse(JSON.stringify(R)));r1.current={nodes:P,edges:_}},[r,o]),E=m.useCallback(N=>{const k=r1.current;if(k)return c(()=>YX(n,k,N,l))},[n,l,c]),w=m.useCallback((N,k,P)=>c(()=>{const _=Zw(n,N,k);return _==null?null:(Jw(n,{...P,target:_}),_)})??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}},iq=()=>{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(aq,{entry:o},o.id))})})]})};function aq({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 lq=({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:b}=ny(),E=sq(f,h),{undo:w,redo:N,takeCheckpoint:k,canUndo:P,canRedo:_}=oq(f),R=ue(K=>K.selection),M=ue(K=>K.selectGraph),L=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=>M([K],[]),[M]),A=m.useCallback(K=>M([],[K]),[M]),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})=>{L(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(),_()&&(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(JH,{tabs:r,activeTabId:f,onTabChange:o,onTabClose:i,onTabReorder:l}),p.jsx("div",{className:"flex-1 relative",children:p.jsx(KG,{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(QH,{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(Y4,{direction:"vertical",children:[p.jsx(mb,{defaultSize:75,minSize:30,children:Z}),p.jsx(X4,{withHandle:!0}),p.jsx(mb,{defaultSize:25,minSize:10,children:p.jsx(iq,{})})]}):Z}),p.jsx(rq,{canvasId:f,isDebugMode:v,selectionDrag:U,getNodeDef:S,onNodeUpdate:E.updateNode,onNodeDelete:E.deleteNode,onEdgeUpdate:E.updateEdge,onEdgeDelete:$,onClearSelection:D,onTestNode:c,onDebugStep:d})]})})};var jy="ToastProvider",[Oy,cq,uq]=yf("Toast"),[tP]=$t("Toast",[uq]),[dq,Cf]=tP(jy),nP=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 \`${jy}\`. Expected non-empty \`string\`.`),p.jsx(Oy.Provider,{scope:t,children:p.jsx(dq,{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})})};nP.displayName=jy;var rP="ToastViewport",fq=["F8"],im="toast.viewportPause",am="toast.viewportResume",oP=m.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=fq,label:o="Notifications ({hotkey})",...i}=e,l=Cf(rP,n),c=cq(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(im);w.dispatchEvent(R),l.isClosePausedRef.current=!0}},k=()=>{if(l.isClosePausedRef.current){const R=new CustomEvent(am);w.dispatchEvent(R),l.isClosePausedRef.current=!1}},P=R=>{!E.contains(R.relatedTarget)&&k()},_=()=>{E.contains(document.activeElement)||k()};return E.addEventListener("focusin",N),E.addEventListener("focusout",P),E.addEventListener("pointermove",N),E.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",k),()=>{E.removeEventListener("focusin",N),E.removeEventListener("focusout",P),E.removeEventListener("pointermove",N),E.removeEventListener("pointerleave",_),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,_=[P,...Nq(P)];return E==="forwards"?_:_.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 _=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===_);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(s3,{ref:d,role:"region","aria-label":o.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&p.jsx(lm,{ref:f,onFocusFromOutsideViewport:()=>{const E=b({tabbingDirection:"forwards"});fg(E)}}),p.jsx(Oy.Slot,{scope:n,children:p.jsx(Ne.ol,{tabIndex:-1,...i,ref:v})}),S&&p.jsx(lm,{ref:g,onFocusFromOutsideViewport:()=>{const E=b({tabbingDirection:"backwards"});fg(E)}})]})});oP.displayName=rP;var sP="ToastFocusProxy",lm=m.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=Cf(sP,n);return p.jsx(Kd,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:l=>{const c=l.relatedTarget;!i.viewport?.contains(c)&&r()}})});lm.displayName=sP;var $l="Toast",pq="toast.swipeStart",hq="toast.swipeMove",gq="toast.swipeCancel",mq="toast.swipeEnd",iP=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:$l});return p.jsx(Pt,{present:n||c,children:p.jsx(xq,{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)})})})});iP.displayName=$l;var[yq,vq]=tP($l,{onClose(){}}),xq=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($l,n),[E,w]=m.useState(null),N=De(t,I=>w(I)),k=m.useRef(null),P=m.useRef(null),_=o||b.duration,R=m.useRef(0),M=m.useRef(_),L=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(L.current),R.current=new Date().getTime(),L.current=window.setTimeout(j,I))},[j]);m.useEffect(()=>{const I=b.viewport;if(I){const B=()=>{U(M.current),f?.()},A=()=>{const V=new Date().getTime()-R.current;M.current=M.current-V,window.clearTimeout(L.current),d?.()};return I.addEventListener(im,A),I.addEventListener(am,B),()=>{I.removeEventListener(im,A),I.removeEventListener(am,B)}}},[b.viewport,_,d,f,U]),m.useEffect(()=>{i&&!b.isClosePausedRef.current&&U(_)},[i,_,b.isClosePausedRef,U]),m.useEffect(()=>(D(),()=>H()),[D,H]);const Y=m.useMemo(()=>E?pP(E):null,[E]);return b.viewport?p.jsxs(p.Fragment,{children:[Y&&p.jsx(bq,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:Y}),p.jsx(yq,{scope:n,onClose:j,children:ps.createPortal(p.jsx(Oy.ItemSlot,{scope:n,children:p.jsx(o3,{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,$=F?0:W(0,A),z=I.pointerType==="touch"?10:2,X={x:q,y:$},Q={originalEvent:I,delta:X};V?(P.current=X,Ru(hq,h,Q,{discrete:!1})):o1(X,b.swipeDirection,z)?(P.current=X,Ru(pq,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};o1(B,b.swipeDirection,b.swipeThreshold)?Ru(mq,x,F,{discrete:!0}):Ru(gq,v,F,{discrete:!0}),V.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),bq=e=>{const{__scopeToast:t,children:n,...r}=e,o=Cf($l,t),[i,l]=m.useState(!1),[c,d]=m.useState(!1);return Cq(()=>l(!0)),m.useEffect(()=>{const f=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:p.jsx(_i,{asChild:!0,children:p.jsx(Kd,{...r,children:i&&p.jsxs(p.Fragment,{children:[o.label," ",n]})})})},wq="ToastTitle",aP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});aP.displayName=wq;var Sq="ToastDescription",lP=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});lP.displayName=Sq;var cP="ToastAction",uP=m.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?p.jsx(fP,{altText:n,asChild:!0,children:p.jsx(Ly,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${cP}\`. Expected non-empty \`string\`.`),null)});uP.displayName=cP;var dP="ToastClose",Ly=m.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=vq(dP,n);return p.jsx(fP,{asChild:!0,children:p.jsx(Ne.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,o.onClose)})})});Ly.displayName=dP;var fP=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 pP(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),Eq(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(...pP(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?ym(o,i):o.dispatchEvent(i)}var o1=(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 Cq(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 Eq(e){return e.nodeType===e.ELEMENT_NODE}function Nq(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 kq=nP,hP=oP,gP=iP,mP=aP,yP=lP,vP=uP,xP=Ly;const Tq=kq,bP=m.forwardRef(({className:e,...t},n)=>p.jsx(hP,{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}));bP.displayName=hP.displayName;const Pq=yo("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),wP=m.forwardRef(({className:e,variant:t,...n},r)=>p.jsx(gP,{ref:r,className:Ce(Pq({variant:t}),e),...n}));wP.displayName=gP.displayName;const Rq=m.forwardRef(({className:e,...t},n)=>p.jsx(vP,{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}));Rq.displayName=vP.displayName;const SP=m.forwardRef(({className:e,...t},n)=>p.jsx(xP,{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"})}));SP.displayName=xP.displayName;const CP=m.forwardRef(({className:e,...t},n)=>p.jsx(mP,{ref:n,className:Ce("text-sm font-semibold",e),...t}));CP.displayName=mP.displayName;const EP=m.forwardRef(({className:e,...t},n)=>p.jsx(yP,{ref:n,className:Ce("text-sm opacity-90",e),...t}));EP.displayName=yP.displayName;function Iq(){const{toasts:e}=bz();return p.jsxs(Tq,{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(CP,{children:n}),r&&p.jsx(EP,{children:r})]}),o,p.jsx(SP,{})]},t)}),p.jsx(bP,{})]})}const Mq=()=>{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 Aq(){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=Jm(r),l=i?pm(i.getState().variables,i.getState().edges).lookup:void 0;t.setFunctionDiagnostics(r,WA(o,l))}for(const r of Object.keys(t.byFunctionId))n.has(r)||t.clearFunctionDiagnostics(r)},[e])}function _q(){const e=KN();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 Dq=({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=RX();return e(l.id,l.name),r(l.id),l.id},[e,r]);return{functions:t,openFunction:o,createFunction:i}};function jq(){const e=m.useCallback(r=>{const o=rH(eH(r));Db();for(const[d,f]of Object.entries(o.canvases)){const g=Qe(d),h=f.nodes.map(x=>({id:x.id,type:JT(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(()=>nH(NP()),[]),n=m.useCallback(()=>{Db();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 NP(){const e={};for(const[o,i]of Object.entries(ey())){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 Oq=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}=jq();_q(),pg({selectItems:D=>D.channels,validate:I1,getStored:D=>D.byChannelId,set:(D,H,j)=>D.setChannelDiagnostics(H,j),clear:(D,H)=>D.clearChannelDiagnostics(H)}),pg({selectItems:D=>D.memory,validate:M1,getStored:D=>D.byMemoryId,set:(D,H,j)=>D.setMemoryDiagnostics(H,j),clear:(D,H)=>D.clearMemoryDiagnostics(H)}),pg({selectItems:D=>D.models,validate:A1,getStored:D=>D.byModelId,set:(D,H,j)=>D.setModelDiagnostics(H,j),clear:(D,H)=>D.clearModelDiagnostics(H)}),Aq(),m.useEffect(()=>{ue.getState().setAvailableModels(i??[])},[i]);const b=Mq(),E=Dq({onOpenTab:b.openTab}),[w,N]=m.useState(null),k=m.useCallback(()=>{const D=KA(NP());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.useRef(!1);m.useEffect(()=>{if(!_.current){_.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=m.useRef(g);R.current=f,M.current=g;const L=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,L.current||R.current?.())});D.push(F)}function U(){for(const A of Object.values(ey()))j(A)}U();const Y=_b(()=>{U()});D.push(Y);let I=ue.getState().mutationCount;const B=ue.subscribe(A=>{A.mutationCount!==I&&(I=A.mutationCount,L.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,M.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=_b(Y);return()=>{j?.(),B(),A()}},[]),m.useImperativeHandle(n,()=>({loadWorkflow:D=>{L.current=!0;try{v(D)}catch(H){h?.(H instanceof Error?H:new Error(String(H)))}finally{L.current=!1}},exportWorkflow:()=>x(),clear:()=>{L.current=!0;try{S()}finally{L.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(RM,{i18n:gr,children:p.jsx(BC,{delayDuration:300,children:p.jsxs("div",{className:"fh-builder h-full w-full bg-background text-foreground font-sans antialiased",children:[p.jsx(lq,{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(Iq,{}),w&&p.jsx(b4,{open:!0,onOpenChange:D=>{D||N(null)},validation:w,onSelectDiagnostic:P})]})})})}),kP=[{id:"claude-sonnet-4-6",label:"Claude Sonnet 4.6",capabilities:["chat"],provider:"Anthropic"},{id:"claude-opus-4-6",label:"Claude Opus 4.6",capabilities:["chat"],provider:"Anthropic"},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",capabilities:["chat"],provider:"Anthropic"},{id:"gpt-5.4",label:"GPT-5.4",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-5.2",label:"GPT-5.2",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-5.1",label:"GPT-5.1",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-5",label:"GPT-5",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-5-mini",label:"GPT-5 Mini",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-5-nano",label:"GPT-5 Nano",capabilities:["chat"],provider:"OpenAI"},{id:"gpt-4.1-nano",label:"GPT-4.1 Nano",capabilities:["chat"],provider:"OpenAI"},{id:"text-embedding-3-small",label:"text-embedding-3-small (OpenAI)",capabilities:["embedding"],provider:"OpenAI"},{id:"text-embedding-3-large",label:"text-embedding-3-large (OpenAI)",capabilities:["embedding"],provider:"OpenAI"},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",capabilities:["chat"],provider:"Gemini"},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",capabilities:["chat"],provider:"Gemini"},{id:"gemini-embedding-001",label:"Gemini Embedding 001",capabilities:["embedding"],provider:"Gemini"},{id:"mistral-large-latest",label:"Mistral Large",capabilities:["chat"],provider:"Mistral"},{id:"mistral-medium-latest",label:"Mistral Medium",capabilities:["chat"],provider:"Mistral"},{id:"mistral-small-latest",label:"Mistral Small",capabilities:["chat"],provider:"Mistral"},{id:"ministral-8b-latest",label:"Ministral 8B",capabilities:["chat"],provider:"Mistral"},{id:"ministral-3b-latest",label:"Ministral 3B",capabilities:["chat"],provider:"Mistral"},{id:"pixtral-large-latest",label:"Pixtral Large",capabilities:["chat"],provider:"Mistral"},{id:"codestral-latest",label:"Codestral",capabilities:["chat"],provider:"Mistral"},{id:"mistral-embed",label:"Mistral Embed",capabilities:["embedding"],provider:"Mistral"}];[...new Set(kP.map(e=>e.provider))];function Lq({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(Hz,{className:"w-5 h-5"}):p.jsx(Lz,{className:"w-5 h-5"})})}function $q(e){const t=Fq(e),n=m.forwardRef((r,o)=>{const{children:i,...l}=r,c=m.Children.toArray(i),d=c.find(Vq);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 Fq(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const l=Hq(o),c=Bq(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 zq=Symbol("radix.slottable");function Vq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zq}function Bq(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 Hq(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 cm=["Enter"," "],Wq=["ArrowDown","PageUp","Home"],TP=["ArrowUp","PageDown","End"],Uq=[...Wq,...TP],Kq={ltr:[...cm,"ArrowRight"],rtl:[...cm,"ArrowLeft"]},Gq={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fl="Menu",[vl,Yq,Xq]=yf(Fl),[hs,PP]=$t(Fl,[Xq,Li,wf]),Ef=Li(),RP=wf(),[qq,gs]=hs(Fl),[Zq,zl]=hs(Fl),IP=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(Km,{...c,children:p.jsx(qq,{scope:t,open:n,onOpenChange:h,content:d,onContentChange:f,children:p.jsx(Zq,{scope:t,onClose:m.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:g,dir:v,modal:l,children:r})})})};IP.displayName=Fl;var Qq="MenuAnchor",$y=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Gm,{...o,...r,ref:t})});$y.displayName=Qq;var Fy="MenuPortal",[Jq,MP]=hs(Fy,{forceMount:void 0}),AP=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=gs(Fy,t);return p.jsx(Jq,{scope:t,forceMount:n,children:p.jsx(Pt,{present:n||i.open,children:p.jsx(_i,{asChild:!0,container:o,children:r})})})};AP.displayName=Fy;var yn="MenuContent",[eZ,zy]=hs(yn),_P=m.forwardRef((e,t)=>{const n=MP(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(tZ,{...o,ref:t}):p.jsx(nZ,{...o,ref:t})})})})}),tZ=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 xm(i)},[]),p.jsx(Vy,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),nZ=m.forwardRef((e,t)=>{const n=gs(yn,e.__scopeMenu);return p.jsx(Vy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),rZ=$q("MenuContent.ScrollLock"),Vy=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=RP(n),P=Yq(n),[_,R]=m.useState(null),M=m.useRef(null),L=De(t,M,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:rZ,allowPinchZoom:!0}:void 0,V=W=>{const q=H.current+W,$=P().filter(Z=>!Z.disabled),z=document.activeElement,X=$.find(Z=>Z.ref.current===z)?.textValue,Q=$.map(Z=>Z.textValue),te=gZ(Q,q,X),ne=$.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),[]),vm();const F=m.useCallback(W=>Y.current===U.current?.side&&yZ(W,U.current?.area),[]);return p.jsx(eZ,{scope:n,searchRef:H,onItemEnter:m.useCallback(W=>{F(W)&&W.preventDefault()},[F]),onItemLeave:m.useCallback(W=>{F(W)||(M.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(),M.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(Jk,{asChild:!0,...k,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:R,onEntryFocus:ve(d,W=>{w.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Ym,{role:"menu","aria-orientation":"vertical","data-state":XP(E.open),"data-radix-menu-content":"",dir:w.dir,...N,...b,ref:L,style:{outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,W=>{const $=W.target.closest("[data-radix-menu-content]")===W.currentTarget,z=W.ctrlKey||W.altKey||W.metaKey,X=W.key.length===1;$&&(W.key==="Tab"&&W.preventDefault(),!z&&X&&V(W.key));const Q=M.current;if(W.target!==Q||!Uq.includes(W.key))return;W.preventDefault();const ne=P().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);TP.includes(W.key)&&ne.reverse(),pZ(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,$=I.current!==W.clientX;if(W.currentTarget.contains(q)&&$){const z=W.clientX>I.current?"right":"left";Y.current=z,I.current=W.clientX}}))})})})})})})});_P.displayName=yn;var oZ="MenuGroup",By=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"group",...r,ref:t})});By.displayName=oZ;var sZ="MenuLabel",DP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{...r,ref:t})});DP.displayName=sZ;var vd="MenuItem",s1="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=zy(vd,e.__scopeMenu),d=De(t,i),f=m.useRef(!1),g=()=>{const h=i.current;if(!n&&h){const v=new CustomEvent(s1,{bubbles:!0,cancelable:!0});h.addEventListener(s1,x=>r?.(x),{once:!0}),ym(h,v),v.defaultPrevented?f.current=!1:l.onClose()}};return p.jsx(jP,{...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===" "||cm.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Nf.displayName=vd;var jP=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,l=zy(vd,n),c=RP(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(eT,{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))})})})}),iZ="MenuCheckboxItem",OP=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(VP,{scope:e.__scopeMenu,checked:n,children:p.jsx(Nf,{role:"menuitemcheckbox","aria-checked":xd(n)?"mixed":n,...o,ref:t,"data-state":Wy(n),onSelect:ve(o.onSelect,()=>r?.(xd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});OP.displayName=iZ;var LP="MenuRadioGroup",[aZ,lZ]=hs(LP,{value:void 0,onValueChange:()=>{}}),$P=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=pt(r);return p.jsx(aZ,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(By,{...o,ref:t})})});$P.displayName=LP;var FP="MenuRadioItem",zP=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=lZ(FP,e.__scopeMenu),i=n===o.value;return p.jsx(VP,{scope:e.__scopeMenu,checked:i,children:p.jsx(Nf,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Wy(i),onSelect:ve(r.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});zP.displayName=FP;var Hy="MenuItemIndicator",[VP,cZ]=hs(Hy,{checked:!1}),BP=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=cZ(Hy,n);return p.jsx(Pt,{present:r||xd(i.checked)||i.checked===!0,children:p.jsx(Ne.span,{...o,ref:t,"data-state":Wy(i.checked)})})});BP.displayName=Hy;var uZ="MenuSeparator",HP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});HP.displayName=uZ;var dZ="MenuArrow",WP=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ef(n);return p.jsx(Xm,{...o,...r,ref:t})});WP.displayName=dZ;var fZ="MenuSub",[mQ,UP]=hs(fZ),Ka="MenuSubTrigger",KP=m.forwardRef((e,t)=>{const n=gs(Ka,e.__scopeMenu),r=zl(Ka,e.__scopeMenu),o=UP(Ka,e.__scopeMenu),i=zy(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($y,{asChild:!0,...f,children:p.jsx(jP,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":XP(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===" "||Kq[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});KP.displayName=Ka;var GP="MenuSubContent",YP=m.forwardRef((e,t)=>{const n=MP(yn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=gs(yn,e.__scopeMenu),l=zl(yn,e.__scopeMenu),c=UP(GP,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(Vy,{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=Gq[l.dir].includes(g.key);h&&v&&(i.onOpenChange(!1),c.trigger?.focus(),g.preventDefault())})})})})})});YP.displayName=GP;function XP(e){return e?"open":"closed"}function xd(e){return e==="indeterminate"}function Wy(e){return xd(e)?"indeterminate":e?"checked":"unchecked"}function pZ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function hZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function gZ(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=hZ(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 mZ(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 yZ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mZ(n,t)}function xl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var vZ=IP,xZ=$y,bZ=AP,wZ=_P,SZ=By,CZ=DP,EZ=Nf,NZ=OP,kZ=$P,TZ=zP,PZ=BP,RZ=HP,IZ=WP,MZ=KP,AZ=YP,kf="DropdownMenu",[_Z]=$t(kf,[PP]),Ft=PP(),[DZ,qP]=_Z(kf),ZP=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(DZ,{scope:t,triggerId:kt(),triggerRef:f,contentId:kt(),open:g,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(v=>!v),[h]),modal:c,children:p.jsx(vZ,{...d,open:g,onOpenChange:h,dir:r,modal:c,children:n})})};ZP.displayName=kf;var QP="DropdownMenuTrigger",JP=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=qP(QP,n),l=Ft(n);return p.jsx(xZ,{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())})})})});JP.displayName=QP;var jZ="DropdownMenuPortal",eR=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ft(t);return p.jsx(bZ,{...r,...n})};eR.displayName=jZ;var tR="DropdownMenuContent",nR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=qP(tR,n),i=Ft(n),l=m.useRef(!1);return p.jsx(wZ,{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)"}})});nR.displayName=tR;var OZ="DropdownMenuGroup",LZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(SZ,{...o,...r,ref:t})});LZ.displayName=OZ;var $Z="DropdownMenuLabel",FZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(CZ,{...o,...r,ref:t})});FZ.displayName=$Z;var zZ="DropdownMenuItem",rR=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(EZ,{...o,...r,ref:t})});rR.displayName=zZ;var VZ="DropdownMenuCheckboxItem",BZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(NZ,{...o,...r,ref:t})});BZ.displayName=VZ;var HZ="DropdownMenuRadioGroup",WZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(kZ,{...o,...r,ref:t})});WZ.displayName=HZ;var UZ="DropdownMenuRadioItem",KZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(TZ,{...o,...r,ref:t})});KZ.displayName=UZ;var GZ="DropdownMenuItemIndicator",YZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(PZ,{...o,...r,ref:t})});YZ.displayName=GZ;var XZ="DropdownMenuSeparator",qZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(RZ,{...o,...r,ref:t})});qZ.displayName=XZ;var ZZ="DropdownMenuArrow",QZ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(IZ,{...o,...r,ref:t})});QZ.displayName=ZZ;var JZ="DropdownMenuSubTrigger",eQ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(MZ,{...o,...r,ref:t})});eQ.displayName=JZ;var tQ="DropdownMenuSubContent",nQ=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ft(n);return p.jsx(AZ,{...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)"}})});nQ.displayName=tQ;var rQ=ZP,oQ=JP,sQ=eR,iQ=nR,aQ=rR;const hg=[{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"en",name:"English",flag:"🇺🇸"}];function lQ({language:e,onChange:t}){const{t:n}=Xe(),r=hg.find(o=>o.code===e)??hg[1];return p.jsxs(rQ,{children:[p.jsx(oQ,{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(Az,{className:"h-4 w-4"}),p.jsx("span",{className:"hidden sm:inline text-sm",children:r.flag})]})}),p.jsx(sQ,{children:p.jsx(iQ,{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(aQ,{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 Ti=new URLSearchParams(window.location.search).get("file"),cQ=e=>e.split(/[\\/]/).pop()??e,uQ=typeof window<"u"&&"showOpenFilePicker"in window,dQ=typeof window<"u"&&"showSaveFilePicker"in window,fQ=Ti?{kind:"path",path:Ti}:null,pQ=Ti?cQ(Ti):null,i1=[{description:"Workflow JSON",accept:{"application/json":[".json"]}}];function hQ(){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(fQ),[E,w]=m.useState(pQ);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),w(U),b(Y)},[e]),k=m.useCallback(async()=>{if(!(o&&!window.confirm(e("confirm.discard")))){if(uQ){try{const[j]=await window.showOpenFilePicker({types:i1});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.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(dQ){try{const A=await window.showSaveFilePicker({suggestedName:E??"workflow.json",types:i1}),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 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),b(null),w(null))},[o,e]),M=m.useCallback(()=>{t.current?.validate()},[]),L=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(),_())};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[_]),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:F1,onClick:R,children:e("toolbar.new")}),p.jsx(Qs,{icon:Mz,onClick:k,children:e("toolbar.open")}),p.jsx(Qs,{icon:Vz,variant:"primary",onClick:_,children:e("toolbar.save")}),p.jsx(Qs,{icon:L1,onClick:M,children:e("toolbar.validate")}),p.jsx("div",{className:"mx-1 h-5 w-px bg-border","aria-hidden":!0}),p.jsx(Qs,{icon:Uz,onClick:()=>t.current?.undo(),disabled:!l,children:e("toolbar.undo")}),p.jsx(Qs,{icon:Fz,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(Lq,{theme:g,onToggle:()=>h(j=>j==="dark"?"light":"dark")}),p.jsx(lQ,{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(Oq,{ref:t,models:kP,language:v,onChange:L,onHistoryChange:D,onError:H})})]})}const oR=document.getElementById("root");if(!oR)throw new Error("#root not found");UI.createRoot(oR).render(p.jsx(m.StrictMode,{children:p.jsx(hQ,{})}));
|