diff --git a/frontend/dist/assets/index-CSv49ImW.js b/frontend/dist/assets/index-CSv49ImW.js new file mode 100644 index 0000000..c415209 --- /dev/null +++ b/frontend/dist/assets/index-CSv49ImW.js @@ -0,0 +1,380 @@ +var sp=s=>{throw TypeError(s)};var pu=(s,o,i)=>o.has(s)||sp("Cannot "+i);var S=(s,o,i)=>(pu(s,o,"read from private field"),i?i.call(s):o.get(s)),be=(s,o,i)=>o.has(s)?sp("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(s):o.set(s,i),oe=(s,o,i,u)=>(pu(s,o,"write to private field"),u?u.call(s,i):o.set(s,i),i),_e=(s,o,i)=>(pu(s,o,"access private method"),i);var Xl=(s,o,i,u)=>({set _(d){oe(s,o,d,i)},get _(){return S(s,o,u)}});function dx(s,o){for(var i=0;iu[d]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const g of f.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&u(g)}).observe(document,{childList:!0,subtree:!0});function i(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(d){if(d.ep)return;d.ep=!0;const f=i(d);fetch(d.href,f)}})();function ih(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var hu={exports:{}},No={},mu={exports:{}},Ce={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var op;function fx(){if(op)return Ce;op=1;var s=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),g=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),j=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=j&&E[j]||E["@@iterator"],typeof E=="function"?E:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,w={};function C(E,k,G){this.props=E,this.context=k,this.refs=w,this.updater=G||O}C.prototype.isReactComponent={},C.prototype.setState=function(E,k){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,k,"setState")},C.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function _(){}_.prototype=C.prototype;function $(E,k,G){this.props=E,this.context=k,this.refs=w,this.updater=G||O}var V=$.prototype=new _;V.constructor=$,A(V,C.prototype),V.isPureReactComponent=!0;var z=Array.isArray,L=Object.prototype.hasOwnProperty,B={current:null},J={key:!0,ref:!0,__self:!0,__source:!0};function te(E,k,G){var X,Z={},ie=null,he=null;if(k!=null)for(X in k.ref!==void 0&&(he=k.ref),k.key!==void 0&&(ie=""+k.key),k)L.call(k,X)&&!J.hasOwnProperty(X)&&(Z[X]=k[X]);var xe=arguments.length-2;if(xe===1)Z.children=G;else if(1>>1,k=Q[E];if(0>>1;Ed(Z,q))ied(he,Z)?(Q[E]=he,Q[ie]=q,E=ie):(Q[E]=Z,Q[X]=q,E=X);else if(ied(he,q))Q[E]=he,Q[ie]=q,E=ie;else break e}}return ce}function d(Q,ce){var q=Q.sortIndex-ce.sortIndex;return q!==0?q:Q.id-ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;s.unstable_now=function(){return f.now()}}else{var g=Date,h=g.now();s.unstable_now=function(){return g.now()-h}}var v=[],x=[],b=1,j=null,M=3,O=!1,A=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function V(Q){for(var ce=i(x);ce!==null;){if(ce.callback===null)u(x);else if(ce.startTime<=Q)u(x),ce.sortIndex=ce.expirationTime,o(v,ce);else break;ce=i(x)}}function z(Q){if(w=!1,V(Q),!A)if(i(v)!==null)A=!0,Me(L);else{var ce=i(x);ce!==null&&Pe(z,ce.startTime-Q)}}function L(Q,ce){A=!1,w&&(w=!1,_(te),te=-1),O=!0;var q=M;try{for(V(ce),j=i(v);j!==null&&(!(j.expirationTime>ce)||Q&&!ge());){var E=j.callback;if(typeof E=="function"){j.callback=null,M=j.priorityLevel;var k=E(j.expirationTime<=ce);ce=s.unstable_now(),typeof k=="function"?j.callback=k:j===i(v)&&u(v),V(ce)}else u(v);j=i(v)}if(j!==null)var G=!0;else{var X=i(x);X!==null&&Pe(z,X.startTime-ce),G=!1}return G}finally{j=null,M=q,O=!1}}var B=!1,J=null,te=-1,re=5,ee=-1;function ge(){return!(s.unstable_now()-eeQ||125E?(Q.sortIndex=q,o(x,Q),i(v)===null&&Q===i(x)&&(w?(_(te),te=-1):w=!0,Pe(z,q-E))):(Q.sortIndex=k,o(v,Q),A||O||(A=!0,Me(L))),Q},s.unstable_shouldYield=ge,s.unstable_wrapCallback=function(Q){var ce=M;return function(){var q=M;M=ce;try{return Q.apply(this,arguments)}finally{M=q}}}})(yu)),yu}var cp;function gx(){return cp||(cp=1,xu.exports=mx()),xu.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dp;function xx(){if(dp)return jt;dp=1;var s=sc(),o=gx();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,x=/^[: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]*$/,b={},j={};function M(e){return v.call(j,e)?!0:v.call(b,e)?!1:x.test(e)?j[e]=!0:(b[e]=!0,!1)}function O(e,t,r,l){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,l){if(t===null||typeof t>"u"||O(e,t,r,l))return!0;if(l)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function w(e,t,r,l,a,c,p){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=p}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new w(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new w(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function $(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(_,$);C[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function V(e,t,r,l){var a=C.hasOwnProperty(t)?C[t]:null;(a!==null?a.type!==0:l||!(2y||a[p]!==c[y]){var N=` +`+a[p].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=p&&0<=y);break}}}finally{G=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?k(e):""}function Z(e){switch(e.tag){case 5:return k(e.type);case 16:return k("Lazy");case 13:return k("Suspense");case 19:return k("SuspenseList");case 0:case 2:case 15:return e=X(e.type,!1),e;case 11:return e=X(e.type.render,!1),e;case 1:return e=X(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case J:return"Fragment";case B:return"Portal";case re:return"Profiler";case te:return"StrictMode";case Ae:return"Suspense";case Ee:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ge:return(e.displayName||"Context")+".Consumer";case ee:return(e._context.displayName||"Context")+".Provider";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case De:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Me:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function he(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===te?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function F(e){var t=U(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,c=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(p){l=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(p){l=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function we(e){e._valueTracker||(e._valueTracker=F(e))}function at(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),l="";return e&&(l=U(e)?e.checked?"true":"false":e.value),e=l,e!==r?(t.setValue(e),!0):!1}function Ct(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Et(e,t){var r=t.checked;return q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Pt(e,t){var r=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;r=xe(t.value!=null?t.value:r),e._wrapperState={initialChecked:l,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Fs(e,t){t=t.checked,t!=null&&V(e,"checked",t,!1)}function $n(e,t){Fs(e,t);var r=xe(t.value),l=t.type;if(r!=null)l==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Bn(e,t.type,r):t.hasOwnProperty("defaultValue")&&Bn(e,t.type,xe(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Bn(e,t,r){(t!=="number"||Ct(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Cr=Array.isArray;function ur(e,t,r,l){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Fe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function cr(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var dr={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},Ni=["Webkit","ms","Moz","O"];Object.keys(dr).forEach(function(e){Ni.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),dr[t]=dr[e]})});function yc(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||dr.hasOwnProperty(e)&&dr[e]?(""+t).trim():t+"px"}function vc(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var l=r.indexOf("--")===0,a=yc(r,t[r],l);r==="float"&&(r="cssFloat"),l?e.setProperty(r,a):e[r]=a}}var gm=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 Si(e,t){if(t){if(gm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function Ci(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ei=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _i=null,Wn=null,Vn=null;function bc(e){if(e=ao(e)){if(typeof _i!="function")throw Error(i(280));var t=e.stateNode;t&&(t=hl(t),_i(e.stateNode,e.type,t))}}function wc(e){Wn?Vn?Vn.push(e):Vn=[e]:Wn=e}function jc(){if(Wn){var e=Wn,t=Vn;if(Vn=Wn=null,bc(e),t)for(e=0;e>>=0,e===0?32:31-(Em(e)/Pm|0)|0}var Zo=64,Yo=4194304;function Ws(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jo(e,t){var r=e.pendingLanes;if(r===0)return 0;var l=0,a=e.suspendedLanes,c=e.pingedLanes,p=r&268435455;if(p!==0){var y=p&~a;y!==0?l=Ws(y):(c&=p,c!==0&&(l=Ws(c)))}else p=r&~a,p!==0?l=Ws(p):c!==0&&(l=Ws(c));if(l===0)return 0;if(t!==0&&t!==l&&(t&a)===0&&(a=l&-l,c=t&-t,a>=c||a===16&&(c&4194240)!==0))return t;if((l&4)!==0&&(l|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0r;r++)t.push(e);return t}function Vs(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Wt(t),e[t]=r}function Om(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0=Xs),Zc=" ",Yc=!1;function Jc(e,t){switch(e){case"keyup":return lg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qn=!1;function ag(e,t){switch(e){case"compositionend":return Xc(t);case"keypress":return t.which!==32?null:(Yc=!0,Zc);case"textInput":return e=t.data,e===Zc&&Yc?null:e;default:return null}}function ug(e,t){if(Qn)return e==="compositionend"||!Ki&&Jc(e,t)?(e=Wc(),nl=$i=Rr=null,Qn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ld(r)}}function ad(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ad(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ud(){for(var e=window,t=Ct();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Ct(e.document)}return t}function Zi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function yg(e){var t=ud(),r=e.focusedElem,l=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&ad(r.ownerDocument.documentElement,r)){if(l!==null&&Zi(r)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,c=Math.min(l.start,a);l=l.end===void 0?c:Math.min(l.end,a),!e.extend&&c>l&&(a=l,l=c,c=a),a=id(r,c);var p=id(r,l);a&&p&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==p.node||e.focusOffset!==p.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),c>l?(e.addRange(t),e.extend(p.node,p.offset)):(t.setEnd(p.node,p.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,qn=null,Yi=null,no=null,Ji=!1;function cd(e,t,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ji||qn==null||qn!==Ct(l)||(l=qn,"selectionStart"in l&&Zi(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),no&&ro(no,l)||(no=l,l=dl(Yi,"onSelect"),0es||(e.current=ca[es],ca[es]=null,es--)}function Ue(e,t){es++,ca[es]=e.current,e.current=t}var Ar={},ut=Tr(Ar),xt=Tr(!1),dn=Ar;function ts(e,t){var r=e.type.contextTypes;if(!r)return Ar;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var a={},c;for(c in r)a[c]=t[c];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function yt(e){return e=e.childContextTypes,e!=null}function ml(){Be(xt),Be(ut)}function Sd(e,t,r){if(ut.current!==Ar)throw Error(i(168));Ue(ut,t),Ue(xt,r)}function Cd(e,t,r){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return r;l=l.getChildContext();for(var a in l)if(!(a in t))throw Error(i(108,he(e)||"Unknown",a));return q({},r,l)}function gl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ar,dn=ut.current,Ue(ut,e),Ue(xt,xt.current),!0}function Ed(e,t,r){var l=e.stateNode;if(!l)throw Error(i(169));r?(e=Cd(e,t,dn),l.__reactInternalMemoizedMergedChildContext=e,Be(xt),Be(ut),Ue(ut,e)):Be(xt),Ue(xt,r)}var pr=null,xl=!1,da=!1;function Pd(e){pr===null?pr=[e]:pr.push(e)}function Mg(e){xl=!0,Pd(e)}function zr(){if(!da&&pr!==null){da=!0;var e=0,t=Ie;try{var r=pr;for(Ie=1;e>=p,a-=p,hr=1<<32-Wt(t)+a|r<Ne?(rt=ve,ve=null):rt=ve.sibling;var ze=H(R,ve,D[Ne],Y);if(ze===null){ve===null&&(ve=rt);break}e&&ve&&ze.alternate===null&&t(R,ve),P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze,ve=rt}if(Ne===D.length)return r(R,ve),We&&pn(R,Ne),pe;if(ve===null){for(;NeNe?(rt=ve,ve=null):rt=ve.sibling;var Vr=H(R,ve,ze.value,Y);if(Vr===null){ve===null&&(ve=rt);break}e&&ve&&Vr.alternate===null&&t(R,ve),P=c(Vr,P,Ne),ye===null?pe=Vr:ye.sibling=Vr,ye=Vr,ve=rt}if(ze.done)return r(R,ve),We&&pn(R,Ne),pe;if(ve===null){for(;!ze.done;Ne++,ze=D.next())ze=K(R,ze.value,Y),ze!==null&&(P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze);return We&&pn(R,Ne),pe}for(ve=l(R,ve);!ze.done;Ne++,ze=D.next())ze=se(ve,R,Ne,ze.value,Y),ze!==null&&(e&&ze.alternate!==null&&ve.delete(ze.key===null?Ne:ze.key),P=c(ze,P,Ne),ye===null?pe=ze:ye.sibling=ze,ye=ze);return e&&ve.forEach(function(cx){return t(R,cx)}),We&&pn(R,Ne),pe}function Ze(R,P,D,Y){if(typeof D=="object"&&D!==null&&D.type===J&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case L:e:{for(var pe=D.key,ye=P;ye!==null;){if(ye.key===pe){if(pe=D.type,pe===J){if(ye.tag===7){r(R,ye.sibling),P=a(ye,D.props.children),P.return=R,R=P;break e}}else if(ye.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===Me&&Td(pe)===ye.type){r(R,ye.sibling),P=a(ye,D.props),P.ref=uo(R,ye,D),P.return=R,R=P;break e}r(R,ye);break}else t(R,ye);ye=ye.sibling}D.type===J?(P=wn(D.props.children,R.mode,Y,D.key),P.return=R,R=P):(Y=Vl(D.type,D.key,D.props,null,R.mode,Y),Y.ref=uo(R,P,D),Y.return=R,R=Y)}return p(R);case B:e:{for(ye=D.key;P!==null;){if(P.key===ye)if(P.tag===4&&P.stateNode.containerInfo===D.containerInfo&&P.stateNode.implementation===D.implementation){r(R,P.sibling),P=a(P,D.children||[]),P.return=R,R=P;break e}else{r(R,P);break}else t(R,P);P=P.sibling}P=au(D,R.mode,Y),P.return=R,R=P}return p(R);case Me:return ye=D._init,Ze(R,P,ye(D._payload),Y)}if(Cr(D))return de(R,P,D,Y);if(ce(D))return fe(R,P,D,Y);wl(R,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,P!==null&&P.tag===6?(r(R,P.sibling),P=a(P,D),P.return=R,R=P):(r(R,P),P=iu(D,R.mode,Y),P.return=R,R=P),p(R)):r(R,P)}return Ze}var os=Ad(!0),zd=Ad(!1),jl=Tr(null),kl=null,ls=null,xa=null;function ya(){xa=ls=kl=null}function va(e){var t=jl.current;Be(jl),e._currentValue=t}function ba(e,t,r){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===r)break;e=e.return}}function is(e,t){kl=e,xa=ls=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(vt=!0),e.firstContext=null)}function It(e){var t=e._currentValue;if(xa!==e)if(e={context:e,memoizedValue:t,next:null},ls===null){if(kl===null)throw Error(i(308));ls=e,kl.dependencies={lanes:0,firstContext:e}}else ls=ls.next=e;return t}var hn=null;function wa(e){hn===null?hn=[e]:hn.push(e)}function Ld(e,t,r,l){var a=t.interleaved;return a===null?(r.next=r,wa(t)):(r.next=a.next,a.next=r),t.interleaved=r,gr(e,l)}function gr(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Lr=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Id(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function xr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ir(e,t,r){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Te&2)!==0){var a=l.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),l.pending=t,gr(e,r)}return a=l.interleaved,a===null?(t.next=t,wa(l)):(t.next=a.next,a.next=t),l.interleaved=t,gr(e,r)}function Nl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,zi(e,r)}}function Fd(e,t){var r=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var a=null,c=null;if(r=r.firstBaseUpdate,r!==null){do{var p={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};c===null?a=c=p:c=c.next=p,r=r.next}while(r!==null);c===null?a=c=t:c=c.next=t}else a=c=t;r={baseState:l.baseState,firstBaseUpdate:a,lastBaseUpdate:c,shared:l.shared,effects:l.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Sl(e,t,r,l){var a=e.updateQueue;Lr=!1;var c=a.firstBaseUpdate,p=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var N=y,I=N.next;N.next=null,p===null?c=I:p.next=I,p=N;var W=e.alternate;W!==null&&(W=W.updateQueue,y=W.lastBaseUpdate,y!==p&&(y===null?W.firstBaseUpdate=I:y.next=I,W.lastBaseUpdate=N))}if(c!==null){var K=a.baseState;p=0,W=I=N=null,y=c;do{var H=y.lane,se=y.eventTime;if((l&H)===H){W!==null&&(W=W.next={eventTime:se,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var de=e,fe=y;switch(H=t,se=r,fe.tag){case 1:if(de=fe.payload,typeof de=="function"){K=de.call(se,K,H);break e}K=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=fe.payload,H=typeof de=="function"?de.call(se,K,H):de,H==null)break e;K=q({},K,H);break e;case 2:Lr=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,H=a.effects,H===null?a.effects=[y]:H.push(y))}else se={eventTime:se,lane:H,tag:y.tag,payload:y.payload,callback:y.callback,next:null},W===null?(I=W=se,N=K):W=W.next=se,p|=H;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;H=y,y=H.next,H.next=null,a.lastBaseUpdate=H,a.shared.pending=null}}while(!0);if(W===null&&(N=K),a.baseState=N,a.firstBaseUpdate=I,a.lastBaseUpdate=W,t=a.shared.interleaved,t!==null){a=t;do p|=a.lane,a=a.next;while(a!==t)}else c===null&&(a.shared.lanes=0);xn|=p,e.lanes=p,e.memoizedState=K}}function Ud(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var l=Ea.transition;Ea.transition={};try{e(!1),t()}finally{Ie=r,Ea.transition=l}}function of(){return Ft().memoizedState}function Tg(e,t,r){var l=Br(e);if(r={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null},lf(e))af(t,r);else if(r=Ld(e,t,r,l),r!==null){var a=mt();Zt(r,e,l,a),uf(r,t,l)}}function Ag(e,t,r){var l=Br(e),a={lane:l,action:r,hasEagerState:!1,eagerState:null,next:null};if(lf(e))af(t,a);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,y=c(p,r);if(a.hasEagerState=!0,a.eagerState=y,Vt(y,p)){var N=t.interleaved;N===null?(a.next=a,wa(t)):(a.next=N.next,N.next=a),t.interleaved=a;return}}catch{}finally{}r=Ld(e,t,a,l),r!==null&&(a=mt(),Zt(r,e,l,a),uf(r,t,l))}}function lf(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function af(e,t){ho=Pl=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function uf(e,t,r){if((r&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,r|=l,t.lanes=r,zi(e,r)}}var Rl={readContext:It,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},zg={readContext:It,useCallback:function(e,t){return rr().memoizedState=[e,t===void 0?null:t],e},useContext:It,useEffect:Yd,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_l(4194308,4,ef.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _l(4194308,4,e,t)},useInsertionEffect:function(e,t){return _l(4,2,e,t)},useMemo:function(e,t){var r=rr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var l=rr();return t=r!==void 0?r(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=Tg.bind(null,Ge,e),[l.memoizedState,e]},useRef:function(e){var t=rr();return e={current:e},t.memoizedState=e},useState:qd,useDebugValue:Ta,useDeferredValue:function(e){return rr().memoizedState=e},useTransition:function(){var e=qd(!1),t=e[0];return e=Dg.bind(null,e[1]),rr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var l=Ge,a=rr();if(We){if(r===void 0)throw Error(i(407));r=r()}else{if(r=t(),tt===null)throw Error(i(349));(gn&30)!==0||Wd(l,t,r)}a.memoizedState=r;var c={value:r,getSnapshot:t};return a.queue=c,Yd(Gd.bind(null,l,c,e),[e]),l.flags|=2048,xo(9,Vd.bind(null,l,c,r,t),void 0,null),r},useId:function(){var e=rr(),t=tt.identifierPrefix;if(We){var r=mr,l=hr;r=(l&~(1<<32-Wt(l)-1)).toString(32)+r,t=":"+t+"R"+r,r=mo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=p.createElement(r,{is:l.is}):(e=p.createElement(r),r==="select"&&(p=e,l.multiple?p.multiple=!0:l.size&&(p.size=l.size))):e=p.createElementNS(e,r),e[er]=t,e[io]=l,_f(e,t,!1,!1),t.stateNode=e;e:{switch(p=Ci(r,l),r){case"dialog":$e("cancel",e),$e("close",e),a=l;break;case"iframe":case"object":case"embed":$e("load",e),a=l;break;case"video":case"audio":for(a=0;afs&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304)}else{if(!l)if(e=Cl(p),e!==null){if(t.flags|=128,l=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),yo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!We)return dt(t),null}else 2*qe()-c.renderingStartTime>fs&&r!==1073741824&&(t.flags|=128,l=!0,yo(c,!1),t.lanes=4194304);c.isBackwards?(p.sibling=t.child,t.child=p):(r=c.last,r!==null?r.sibling=p:t.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=qe(),t.sibling=null,r=Ve.current,Ue(Ve,l?r&1|2:r&1),t):(dt(t),null);case 22:case 23:return su(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(Ot&1073741824)!==0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function Wg(e,t){switch(pa(t),t.tag){case 1:return yt(t.type)&&ml(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return as(),Be(xt),Be(ut),Ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Na(t),null;case 13:if(Be(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ss()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Be(Ve),null;case 4:return as(),null;case 10:return va(t.type._context),null;case 22:case 23:return su(),null;case 24:return null;default:return null}}var Al=!1,ft=!1,Vg=typeof WeakSet=="function"?WeakSet:Set,ae=null;function cs(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(l){Ke(e,t,l)}else r.current=null}function Ga(e,t,r){try{r()}catch(l){Ke(e,t,l)}}var Of=!1;function Gg(e,t){if(sa=tl,e=ud(),Zi(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var a=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{r.nodeType,c.nodeType}catch{r=null;break e}var p=0,y=-1,N=-1,I=0,W=0,K=e,H=null;t:for(;;){for(var se;K!==r||a!==0&&K.nodeType!==3||(y=p+a),K!==c||l!==0&&K.nodeType!==3||(N=p+l),K.nodeType===3&&(p+=K.nodeValue.length),(se=K.firstChild)!==null;)H=K,K=se;for(;;){if(K===e)break t;if(H===r&&++I===a&&(y=p),H===c&&++W===l&&(N=p),(se=K.nextSibling)!==null)break;K=H,H=K.parentNode}K=se}r=y===-1||N===-1?null:{start:y,end:N}}else r=null}r=r||{start:0,end:0}}else r=null;for(oa={focusedElem:e,selectionRange:r},tl=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var de=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(de!==null){var fe=de.memoizedProps,Ze=de.memoizedState,R=t.stateNode,P=R.getSnapshotBeforeUpdate(t.elementType===t.type?fe:Kt(t.type,fe),Ze);R.__reactInternalSnapshotBeforeUpdate=P}break;case 3:var D=t.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Y){Ke(t,t.return,Y)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return de=Of,Of=!1,de}function vo(e,t,r){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var a=l=l.next;do{if((a.tag&e)===e){var c=a.destroy;a.destroy=void 0,c!==void 0&&Ga(t,r,c)}a=a.next}while(a!==l)}}function zl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var l=r.create;r.destroy=l()}r=r.next}while(r!==t)}}function Ka(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Df(e){var t=e.alternate;t!==null&&(e.alternate=null,Df(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[io],delete t[ua],delete t[Pg],delete t[_g])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tf(e){return e.tag===5||e.tag===3||e.tag===4}function Af(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qa(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=pl));else if(l!==4&&(e=e.child,e!==null))for(Qa(e,t,r),e=e.sibling;e!==null;)Qa(e,t,r),e=e.sibling}function qa(e,t,r){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(qa(e,t,r),e=e.sibling;e!==null;)qa(e,t,r),e=e.sibling}var st=null,Qt=!1;function Fr(e,t,r){for(r=r.child;r!==null;)zf(e,t,r),r=r.sibling}function zf(e,t,r){if(Xt&&typeof Xt.onCommitFiberUnmount=="function")try{Xt.onCommitFiberUnmount(qo,r)}catch{}switch(r.tag){case 5:ft||cs(r,t);case 6:var l=st,a=Qt;st=null,Fr(e,t,r),st=l,Qt=a,st!==null&&(Qt?(e=st,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):st.removeChild(r.stateNode));break;case 18:st!==null&&(Qt?(e=st,r=r.stateNode,e.nodeType===8?aa(e.parentNode,r):e.nodeType===1&&aa(e,r),Zs(e)):aa(st,r.stateNode));break;case 4:l=st,a=Qt,st=r.stateNode.containerInfo,Qt=!0,Fr(e,t,r),st=l,Qt=a;break;case 0:case 11:case 14:case 15:if(!ft&&(l=r.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){a=l=l.next;do{var c=a,p=c.destroy;c=c.tag,p!==void 0&&((c&2)!==0||(c&4)!==0)&&Ga(r,t,p),a=a.next}while(a!==l)}Fr(e,t,r);break;case 1:if(!ft&&(cs(r,t),l=r.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=r.memoizedProps,l.state=r.memoizedState,l.componentWillUnmount()}catch(y){Ke(r,t,y)}Fr(e,t,r);break;case 21:Fr(e,t,r);break;case 22:r.mode&1?(ft=(l=ft)||r.memoizedState!==null,Fr(e,t,r),ft=l):Fr(e,t,r);break;default:Fr(e,t,r)}}function Lf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Vg),t.forEach(function(l){var a=tx.bind(null,e,l);r.has(l)||(r.add(l),l.then(a,a))})}}function qt(e,t){var r=t.deletions;if(r!==null)for(var l=0;la&&(a=p),l&=~c}if(l=a,l=qe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Qg(l/1960))-l,10e?16:e,$r===null)var l=!1;else{if(e=$r,$r=null,$l=0,(Te&6)!==0)throw Error(i(331));var a=Te;for(Te|=4,ae=e.current;ae!==null;){var c=ae,p=c.child;if((ae.flags&16)!==0){var y=c.deletions;if(y!==null){for(var N=0;Nqe()-Ja?vn(e,0):Ya|=r),wt(e,t)}function Zf(e,t){t===0&&((e.mode&1)===0?t=1:(t=Yo,Yo<<=1,(Yo&130023424)===0&&(Yo=4194304)));var r=mt();e=gr(e,t),e!==null&&(Vs(e,t,r),wt(e,r))}function ex(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Zf(e,r)}function tx(e,t){var r=0;switch(e.tag){case 13:var l=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(t),Zf(e,r)}var Yf;Yf=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||xt.current)vt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return vt=!1,Bg(e,t,r);vt=(e.flags&131072)!==0}else vt=!1,We&&(t.flags&1048576)!==0&&_d(t,vl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;Tl(e,t),e=t.pendingProps;var a=ts(t,ut.current);is(t,r),a=_a(null,t,l,e,a,r);var c=Ma();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yt(l)?(c=!0,gl(t)):c=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ja(t),a.updater=Ol,t.stateNode=a,a._reactInternals=t,za(t,l,e,r),t=Ua(null,t,l,!0,c,r)):(t.tag=0,We&&c&&fa(t),ht(null,t,a,r),t=t.child),t;case 16:l=t.elementType;e:{switch(Tl(e,t),e=t.pendingProps,a=l._init,l=a(l._payload),t.type=l,a=t.tag=nx(l),e=Kt(l,e),a){case 0:t=Fa(null,t,l,e,r);break e;case 1:t=kf(null,t,l,e,r);break e;case 11:t=yf(null,t,l,e,r);break e;case 14:t=vf(null,t,l,Kt(l.type,e),r);break e}throw Error(i(306,l,""))}return t;case 0:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),Fa(e,t,l,a,r);case 1:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),kf(e,t,l,a,r);case 3:e:{if(Nf(t),e===null)throw Error(i(387));l=t.pendingProps,c=t.memoizedState,a=c.element,Id(e,t),Sl(t,l,null,r);var p=t.memoizedState;if(l=p.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:p.cache,pendingSuspenseBoundaries:p.pendingSuspenseBoundaries,transitions:p.transitions},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){a=us(Error(i(423)),t),t=Sf(e,t,l,r,a);break e}else if(l!==a){a=us(Error(i(424)),t),t=Sf(e,t,l,r,a);break e}else for(Rt=Dr(t.stateNode.containerInfo.firstChild),Mt=t,We=!0,Gt=null,r=zd(t,null,l,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ss(),l===a){t=yr(e,t,r);break e}ht(e,t,l,r)}t=t.child}return t;case 5:return $d(t),e===null&&ma(t),l=t.type,a=t.pendingProps,c=e!==null?e.memoizedProps:null,p=a.children,la(l,a)?p=null:c!==null&&la(l,c)&&(t.flags|=32),jf(e,t),ht(e,t,p,r),t.child;case 6:return e===null&&ma(t),null;case 13:return Cf(e,t,r);case 4:return ka(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=os(t,null,l,r):ht(e,t,l,r),t.child;case 11:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),yf(e,t,l,a,r);case 7:return ht(e,t,t.pendingProps,r),t.child;case 8:return ht(e,t,t.pendingProps.children,r),t.child;case 12:return ht(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(l=t.type._context,a=t.pendingProps,c=t.memoizedProps,p=a.value,Ue(jl,l._currentValue),l._currentValue=p,c!==null)if(Vt(c.value,p)){if(c.children===a.children&&!xt.current){t=yr(e,t,r);break e}}else for(c=t.child,c!==null&&(c.return=t);c!==null;){var y=c.dependencies;if(y!==null){p=c.child;for(var N=y.firstContext;N!==null;){if(N.context===l){if(c.tag===1){N=xr(-1,r&-r),N.tag=2;var I=c.updateQueue;if(I!==null){I=I.shared;var W=I.pending;W===null?N.next=N:(N.next=W.next,W.next=N),I.pending=N}}c.lanes|=r,N=c.alternate,N!==null&&(N.lanes|=r),ba(c.return,r,t),y.lanes|=r;break}N=N.next}}else if(c.tag===10)p=c.type===t.type?null:c.child;else if(c.tag===18){if(p=c.return,p===null)throw Error(i(341));p.lanes|=r,y=p.alternate,y!==null&&(y.lanes|=r),ba(p,r,t),p=c.sibling}else p=c.child;if(p!==null)p.return=c;else for(p=c;p!==null;){if(p===t){p=null;break}if(c=p.sibling,c!==null){c.return=p.return,p=c;break}p=p.return}c=p}ht(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,l=t.pendingProps.children,is(t,r),a=It(a),l=l(a),t.flags|=1,ht(e,t,l,r),t.child;case 14:return l=t.type,a=Kt(l,t.pendingProps),a=Kt(l.type,a),vf(e,t,l,a,r);case 15:return bf(e,t,t.type,t.pendingProps,r);case 17:return l=t.type,a=t.pendingProps,a=t.elementType===l?a:Kt(l,a),Tl(e,t),t.tag=1,yt(l)?(e=!0,gl(t)):e=!1,is(t,r),df(t,l,a),za(t,l,a,r),Ua(null,t,l,!0,e,r);case 19:return Pf(e,t,r);case 22:return wf(e,t,r)}throw Error(i(156,t.tag))};function Jf(e,t){return Mc(e,t)}function rx(e,t,r,l){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $t(e,t,r,l){return new rx(e,t,r,l)}function lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nx(e){if(typeof e=="function")return lu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===De)return 14}return 2}function Wr(e,t){var r=e.alternate;return r===null?(r=$t(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Vl(e,t,r,l,a,c){var p=2;if(l=e,typeof e=="function")lu(e)&&(p=1);else if(typeof e=="string")p=5;else e:switch(e){case J:return wn(r.children,a,c,t);case te:p=8,a|=8;break;case re:return e=$t(12,r,t,a|2),e.elementType=re,e.lanes=c,e;case Ae:return e=$t(13,r,t,a),e.elementType=Ae,e.lanes=c,e;case Ee:return e=$t(19,r,t,a),e.elementType=Ee,e.lanes=c,e;case Pe:return Gl(r,a,c,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:p=10;break e;case ge:p=9;break e;case ue:p=11;break e;case De:p=14;break e;case Me:p=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=$t(p,r,t,a),t.elementType=e,t.type=l,t.lanes=c,t}function wn(e,t,r,l){return e=$t(7,e,l,t),e.lanes=r,e}function Gl(e,t,r,l){return e=$t(22,e,l,t),e.elementType=Pe,e.lanes=r,e.stateNode={isHidden:!1},e}function iu(e,t,r){return e=$t(6,e,null,t),e.lanes=r,e}function au(e,t,r){return t=$t(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sx(e,t,r,l,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ai(0),this.expirationTimes=Ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ai(0),this.identifierPrefix=l,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function uu(e,t,r,l,a,c,p,y,N){return e=new sx(e,t,r,y,N),t===1?(t=1,c===!0&&(t|=8)):t=0,c=$t(3,null,null,t),e.current=c,c.stateNode=e,c.memoizedState={element:l,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ja(c),e}function ox(e,t,r){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(o){console.error(o)}}return s(),gu.exports=xx(),gu.exports}var pp;function yx(){if(pp)return ei;pp=1;var s=uh();return ei.createRoot=s.createRoot,ei.hydrateRoot=s.hydrateRoot,ei}var vx=yx();const bx=ih(vx);var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Sn,Zr,js,Yp,wx=(Yp=class extends Ho{constructor(){super();be(this,Sn);be(this,Zr);be(this,js);oe(this,js,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){S(this,Zr)||this.setEventListener(S(this,js))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Zr))==null||o.call(this),oe(this,Zr,void 0))}setEventListener(o){var i;oe(this,js,o),(i=S(this,Zr))==null||i.call(this),oe(this,Zr,o(u=>{typeof u=="boolean"?this.setFocused(u):this.onFocus()}))}setFocused(o){S(this,Sn)!==o&&(oe(this,Sn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(i=>{i(o)})}isFocused(){var o;return typeof S(this,Sn)=="boolean"?S(this,Sn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},Sn=new WeakMap,Zr=new WeakMap,js=new WeakMap,Yp),lc=new wx,jx={setTimeout:(s,o)=>setTimeout(s,o),clearTimeout:s=>clearTimeout(s),setInterval:(s,o)=>setInterval(s,o),clearInterval:s=>clearInterval(s)},Yr,nc,Jp,kx=(Jp=class{constructor(){be(this,Yr,jx);be(this,nc,!1)}setTimeoutProvider(s){oe(this,Yr,s)}setTimeout(s,o){return S(this,Yr).setTimeout(s,o)}clearTimeout(s){S(this,Yr).clearTimeout(s)}setInterval(s,o){return S(this,Yr).setInterval(s,o)}clearInterval(s){S(this,Yr).clearInterval(s)}},Yr=new WeakMap,nc=new WeakMap,Jp),Nn=new kx;function Nx(s){setTimeout(s,0)}var Sx=typeof window>"u"||"Deno"in globalThis;function Nt(){}function Cx(s,o){return typeof s=="function"?s(o):s}function Ru(s){return typeof s=="number"&&s>=0&&s!==1/0}function ch(s,o){return Math.max(s+(o||0)-Date.now(),0)}function sn(s,o){return typeof s=="function"?s(o):s}function Tt(s,o){return typeof s=="function"?s(o):s}function hp(s,o){const{type:i="all",exact:u,fetchStatus:d,predicate:f,queryKey:g,stale:h}=s;if(g){if(u){if(o.queryHash!==ic(g,o.options))return!1}else if(!Mo(o.queryKey,g))return!1}if(i!=="all"){const v=o.isActive();if(i==="active"&&!v||i==="inactive"&&v)return!1}return!(typeof h=="boolean"&&o.isStale()!==h||d&&d!==o.state.fetchStatus||f&&!f(o))}function mp(s,o){const{exact:i,status:u,predicate:d,mutationKey:f}=s;if(f){if(!o.options.mutationKey)return!1;if(i){if(_o(o.options.mutationKey)!==_o(f))return!1}else if(!Mo(o.options.mutationKey,f))return!1}return!(u&&o.state.status!==u||d&&!d(o))}function ic(s,o){return((o==null?void 0:o.queryKeyHashFn)||_o)(s)}function _o(s){return JSON.stringify(s,(o,i)=>Du(i)?Object.keys(i).sort().reduce((u,d)=>(u[d]=i[d],u),{}):i)}function Mo(s,o){return s===o?!0:typeof s!=typeof o?!1:s&&o&&typeof s=="object"&&typeof o=="object"?Object.keys(o).every(i=>Mo(s[i],o[i])):!1}var Ex=Object.prototype.hasOwnProperty;function dh(s,o,i=0){if(s===o)return s;if(i>500)return o;const u=gp(s)&&gp(o);if(!u&&!(Du(s)&&Du(o)))return o;const f=(u?s:Object.keys(s)).length,g=u?o:Object.keys(o),h=g.length,v=u?new Array(h):{};let x=0;for(let b=0;b{Nn.setTimeout(o,s)})}function Tu(s,o,i){return typeof i.structuralSharing=="function"?i.structuralSharing(s,o):i.structuralSharing!==!1?dh(s,o):o}function _x(s,o,i=0){const u=[...s,o];return i&&u.length>i?u.slice(1):u}function Mx(s,o,i=0){const u=[o,...s];return i&&u.length>i?u.slice(0,-1):u}var ac=Symbol();function fh(s,o){return!s.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!s.queryFn||s.queryFn===ac?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function ph(s,o){return typeof s=="function"?s(...o):!!s}function Rx(s,o,i){let u=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??(d=o()),u||(u=!0,d.aborted?i():d.addEventListener("abort",i,{once:!0})),d)}),s}var Ro=(()=>{let s=()=>Sx;return{isServer(){return s()},setIsServer(o){s=o}}})();function Au(){let s,o;const i=new Promise((d,f)=>{s=d,o=f});i.status="pending",i.catch(()=>{});function u(d){Object.assign(i,d),delete i.resolve,delete i.reject}return i.resolve=d=>{u({status:"fulfilled",value:d}),s(d)},i.reject=d=>{u({status:"rejected",reason:d}),o(d)},i}var Ox=Nx;function Dx(){let s=[],o=0,i=h=>{h()},u=h=>{h()},d=Ox;const f=h=>{o?s.push(h):d(()=>{i(h)})},g=()=>{const h=s;s=[],h.length&&d(()=>{u(()=>{h.forEach(v=>{i(v)})})})};return{batch:h=>{let v;o++;try{v=h()}finally{o--,o||g()}return v},batchCalls:h=>(...v)=>{f(()=>{h(...v)})},schedule:f,setNotifyFunction:h=>{i=h},setBatchNotifyFunction:h=>{u=h},setScheduler:h=>{d=h}}}var lt=Dx(),ks,Jr,Ns,Xp,Tx=(Xp=class extends Ho{constructor(){super();be(this,ks,!0);be(this,Jr);be(this,Ns);oe(this,Ns,o=>{if(typeof window<"u"&&window.addEventListener){const i=()=>o(!0),u=()=>o(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",u,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",u)}}})}onSubscribe(){S(this,Jr)||this.setEventListener(S(this,Ns))}onUnsubscribe(){var o;this.hasListeners()||((o=S(this,Jr))==null||o.call(this),oe(this,Jr,void 0))}setEventListener(o){var i;oe(this,Ns,o),(i=S(this,Jr))==null||i.call(this),oe(this,Jr,o(this.setOnline.bind(this)))}setOnline(o){S(this,ks)!==o&&(oe(this,ks,o),this.listeners.forEach(u=>{u(o)}))}isOnline(){return S(this,ks)}},ks=new WeakMap,Jr=new WeakMap,Ns=new WeakMap,Xp),hi=new Tx;function Ax(s){return Math.min(1e3*2**s,3e4)}function hh(s){return(s??"online")==="online"?hi.isOnline():!0}var zu=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function mh(s){let o=!1,i=0,u;const d=Au(),f=()=>d.status!=="pending",g=w=>{var C;if(!f()){const _=new zu(w);M(_),(C=s.onCancel)==null||C.call(s,_)}},h=()=>{o=!0},v=()=>{o=!1},x=()=>lc.isFocused()&&(s.networkMode==="always"||hi.isOnline())&&s.canRun(),b=()=>hh(s.networkMode)&&s.canRun(),j=w=>{f()||(u==null||u(),d.resolve(w))},M=w=>{f()||(u==null||u(),d.reject(w))},O=()=>new Promise(w=>{var C;u=_=>{(f()||x())&&w(_)},(C=s.onPause)==null||C.call(s)}).then(()=>{var w;u=void 0,f()||(w=s.onContinue)==null||w.call(s)}),A=()=>{if(f())return;let w;const C=i===0?s.initialPromise:void 0;try{w=C??s.fn()}catch(_){w=Promise.reject(_)}Promise.resolve(w).then(j).catch(_=>{var B;if(f())return;const $=s.retry??(Ro.isServer()?0:3),V=s.retryDelay??Ax,z=typeof V=="function"?V(i,_):V,L=$===!0||typeof $=="number"&&i<$||typeof $=="function"&&$(i,_);if(o||!L){M(_);return}i++,(B=s.onFail)==null||B.call(s,i,_),Px(z).then(()=>x()?void 0:O()).then(()=>{o?M(_):A()})})};return{promise:d,status:()=>d.status,cancel:g,continue:()=>(u==null||u(),d),cancelRetry:h,continueRetry:v,canStart:b,start:()=>(b()?A():O().then(A),d)}}var Cn,eh,gh=(eh=class{constructor(){be(this,Cn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ru(this.gcTime)&&oe(this,Cn,Nn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Ro.isServer()?1/0:300*1e3))}clearGcTimeout(){S(this,Cn)!==void 0&&(Nn.clearTimeout(S(this,Cn)),oe(this,Cn,void 0))}},Cn=new WeakMap,eh);function zx(s){return{onFetch:(o,i)=>{var b,j,M,O,A;const u=o.options,d=(M=(j=(b=o.fetchOptions)==null?void 0:b.meta)==null?void 0:j.fetchMore)==null?void 0:M.direction,f=((O=o.state.data)==null?void 0:O.pages)||[],g=((A=o.state.data)==null?void 0:A.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const x=async()=>{let w=!1;const C=V=>{Rx(V,()=>o.signal,()=>w=!0)},_=fh(o.options,o.fetchOptions),$=async(V,z,L)=>{if(w)return Promise.reject(o.signal.reason);if(z==null&&V.pages.length)return Promise.resolve(V);const J=(()=>{const ge={client:o.client,queryKey:o.queryKey,pageParam:z,direction:L?"backward":"forward",meta:o.options.meta};return C(ge),ge})(),te=await _(J),{maxPages:re}=o.options,ee=L?Mx:_x;return{pages:ee(V.pages,te,re),pageParams:ee(V.pageParams,z,re)}};if(d&&f.length){const V=d==="backward",z=V?Lx:yp,L={pages:f,pageParams:g},B=z(u,L);h=await $(L,B,V)}else{const V=s??f.length;do{const z=v===0?g[0]??u.initialPageParam:yp(u,h);if(v>0&&z==null)break;h=await $(h,z),v++}while(v{var w,C;return(C=(w=o.options).persister)==null?void 0:C.call(w,x,{client:o.client,queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},i)}:o.fetchFn=x}}}function yp(s,{pages:o,pageParams:i}){const u=o.length-1;return o.length>0?s.getNextPageParam(o[u],o,i[u],i):void 0}function Lx(s,{pages:o,pageParams:i}){var u;return o.length>0?(u=s.getPreviousPageParam)==null?void 0:u.call(s,o[0],o,i[0],i):void 0}var Ss,En,Cs,Bt,Pn,nt,Io,_n,Dt,xh,wr,th,Ix=(th=class extends gh{constructor(o){super();be(this,Dt);be(this,Ss);be(this,En);be(this,Cs);be(this,Bt);be(this,Pn);be(this,nt);be(this,Io);be(this,_n);oe(this,_n,!1),oe(this,Io,o.defaultOptions),this.setOptions(o.options),this.observers=[],oe(this,Pn,o.client),oe(this,Bt,S(this,Pn).getQueryCache()),this.queryKey=o.queryKey,this.queryHash=o.queryHash,oe(this,En,bp(this.options)),this.state=o.state??S(this,En),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return S(this,Ss)}get promise(){var o;return(o=S(this,nt))==null?void 0:o.promise}setOptions(o){if(this.options={...S(this,Io),...o},o!=null&&o._type&&oe(this,Ss,o._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=bp(this.options);i.data!==void 0&&(this.setState(vp(i.data,i.dataUpdatedAt)),oe(this,En,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&S(this,Bt).remove(this)}setData(o,i){const u=Tu(this.state.data,o,this.options);return _e(this,Dt,wr).call(this,{data:u,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),u}setState(o){_e(this,Dt,wr).call(this,{type:"setState",state:o})}cancel(o){var u,d;const i=(u=S(this,nt))==null?void 0:u.promise;return(d=S(this,nt))==null||d.cancel(o),i?i.then(Nt).catch(Nt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return S(this,En)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(o=>Tt(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ac||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(o=>sn(o.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(o=0){return this.state.data===void 0?!0:o==="static"?!1:this.state.isInvalidated?!0:!ch(this.state.dataUpdatedAt,o)}onFocus(){var i;const o=this.observers.find(u=>u.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,nt))==null||i.continue()}onOnline(){var i;const o=this.observers.find(u=>u.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(i=S(this,nt))==null||i.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),S(this,Bt).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(i=>i!==o),this.observers.length||(S(this,nt)&&(S(this,_n)||_e(this,Dt,xh).call(this)?S(this,nt).cancel({revert:!0}):S(this,nt).cancelRetry()),this.scheduleGc()),S(this,Bt).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Dt,wr).call(this,{type:"invalidate"})}async fetch(o,i){var x,b,j,M,O,A,w,C,_,$,V;if(this.state.fetchStatus!=="idle"&&((x=S(this,nt))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(S(this,nt))return S(this,nt).continueRetry(),S(this,nt).promise}if(o&&this.setOptions(o),!this.options.queryFn){const z=this.observers.find(L=>L.options.queryFn);z&&this.setOptions(z.options)}const u=new AbortController,d=z=>{Object.defineProperty(z,"signal",{enumerable:!0,get:()=>(oe(this,_n,!0),u.signal)})},f=()=>{const z=fh(this.options,i),B=(()=>{const J={client:S(this,Pn),queryKey:this.queryKey,meta:this.meta};return d(J),J})();return oe(this,_n,!1),this.options.persister?this.options.persister(z,B,this):z(B)},h=(()=>{const z={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:S(this,Pn),state:this.state,fetchFn:f};return d(z),z})(),v=S(this,Ss)==="infinite"?zx(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),oe(this,Cs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=h.fetchOptions)==null?void 0:b.meta))&&_e(this,Dt,wr).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta}),oe(this,nt,mh({initialPromise:i==null?void 0:i.initialPromise,fn:h.fetchFn,onCancel:z=>{z instanceof zu&&z.revert&&this.setState({...S(this,Cs),fetchStatus:"idle"}),u.abort()},onFail:(z,L)=>{_e(this,Dt,wr).call(this,{type:"failed",failureCount:z,error:L})},onPause:()=>{_e(this,Dt,wr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Dt,wr).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const z=await S(this,nt).start();if(z===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(z),(O=(M=S(this,Bt).config).onSuccess)==null||O.call(M,z,this),(w=(A=S(this,Bt).config).onSettled)==null||w.call(A,z,this.state.error,this),z}catch(z){if(z instanceof zu){if(z.silent)return S(this,nt).promise;if(z.revert){if(this.state.data===void 0)throw z;return this.state.data}}throw _e(this,Dt,wr).call(this,{type:"error",error:z}),(_=(C=S(this,Bt).config).onError)==null||_.call(C,z,this),(V=($=S(this,Bt).config).onSettled)==null||V.call($,this.state.data,z,this),z}finally{this.scheduleGc()}}},Ss=new WeakMap,En=new WeakMap,Cs=new WeakMap,Bt=new WeakMap,Pn=new WeakMap,nt=new WeakMap,Io=new WeakMap,_n=new WeakMap,Dt=new WeakSet,xh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},wr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...u,fetchStatus:"paused"};case"continue":return{...u,fetchStatus:"fetching"};case"fetch":return{...u,...yh(u.data,this.options),fetchMeta:o.meta??null};case"success":const d={...u,...vp(o.data,o.dataUpdatedAt),dataUpdateCount:u.dataUpdateCount+1,...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return oe(this,Cs,o.manual?d:void 0),d;case"error":const f=o.error;return{...u,error:f,errorUpdateCount:u.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:u.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...u,isInvalidated:!0};case"setState":return{...u,...o.state}}};this.state=i(this.state),lt.batch(()=>{this.observers.forEach(u=>{u.onQueryUpdate()}),S(this,Bt).notify({query:this,type:"updated",action:o})})},th);function yh(s,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hh(o.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function vp(s,o){return{data:s,dataUpdatedAt:o??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bp(s){const o=typeof s.initialData=="function"?s.initialData():s.initialData,i=o!==void 0,u=i?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:i?u??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var kt,Oe,Fo,gt,Mn,Es,jr,Xr,Uo,Ps,_s,Rn,On,en,Ms,Le,Po,Lu,Iu,Fu,Uu,$u,Bu,Hu,vh,rh,Fx=(rh=class extends Ho{constructor(o,i){super();be(this,Le);be(this,kt);be(this,Oe);be(this,Fo);be(this,gt);be(this,Mn);be(this,Es);be(this,jr);be(this,Xr);be(this,Uo);be(this,Ps);be(this,_s);be(this,Rn);be(this,On);be(this,en);be(this,Ms,new Set);this.options=i,oe(this,kt,o),oe(this,Xr,null),oe(this,jr,Au()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(S(this,Oe).addObserver(this),wp(S(this,Oe),this.options)?_e(this,Le,Po).call(this):this.updateResult(),_e(this,Le,Uu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wu(S(this,Oe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wu(S(this,Oe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Le,$u).call(this),_e(this,Le,Bu).call(this),S(this,Oe).removeObserver(this)}setOptions(o){const i=this.options,u=S(this,Oe);if(this.options=S(this,kt).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tt(this.options.enabled,S(this,Oe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Le,Hu).call(this),S(this,Oe).setOptions(this.options),i._defaulted&&!Ou(this.options,i)&&S(this,kt).getQueryCache().notify({type:"observerOptionsUpdated",query:S(this,Oe),observer:this});const d=this.hasListeners();d&&jp(S(this,Oe),u,this.options,i)&&_e(this,Le,Po).call(this),this.updateResult(),d&&(S(this,Oe)!==u||Tt(this.options.enabled,S(this,Oe))!==Tt(i.enabled,S(this,Oe))||sn(this.options.staleTime,S(this,Oe))!==sn(i.staleTime,S(this,Oe)))&&_e(this,Le,Lu).call(this);const f=_e(this,Le,Iu).call(this);d&&(S(this,Oe)!==u||Tt(this.options.enabled,S(this,Oe))!==Tt(i.enabled,S(this,Oe))||f!==S(this,en))&&_e(this,Le,Fu).call(this,f)}getOptimisticResult(o){const i=S(this,kt).getQueryCache().build(S(this,kt),o),u=this.createResult(i,o);return $x(this,u)&&(oe(this,gt,u),oe(this,Es,this.options),oe(this,Mn,S(this,Oe).state)),u}getCurrentResult(){return S(this,gt)}trackResult(o,i){return new Proxy(o,{get:(u,d)=>(this.trackProp(d),i==null||i(d),d==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&S(this,jr).status==="pending"&&S(this,jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(u,d))})}trackProp(o){S(this,Ms).add(o)}getCurrentQuery(){return S(this,Oe)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const i=S(this,kt).defaultQueryOptions(o),u=S(this,kt).getQueryCache().build(S(this,kt),i);return u.fetch().then(()=>this.createResult(u,i))}fetch(o){return _e(this,Le,Po).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),S(this,gt)))}createResult(o,i){var re;const u=S(this,Oe),d=this.options,f=S(this,gt),g=S(this,Mn),h=S(this,Es),x=o!==u?o.state:S(this,Fo),{state:b}=o;let j={...b},M=!1,O;if(i._optimisticResults){const ee=this.hasListeners(),ge=!ee&&wp(o,i),ue=ee&&jp(o,u,i,d);(ge||ue)&&(j={...j,...yh(b.data,o.options)}),i._optimisticResults==="isRestoring"&&(j.fetchStatus="idle")}let{error:A,errorUpdatedAt:w,status:C}=j;O=j.data;let _=!1;if(i.placeholderData!==void 0&&O===void 0&&C==="pending"){let ee;f!=null&&f.isPlaceholderData&&i.placeholderData===(h==null?void 0:h.placeholderData)?(ee=f.data,_=!0):ee=typeof i.placeholderData=="function"?i.placeholderData((re=S(this,_s))==null?void 0:re.state.data,S(this,_s)):i.placeholderData,ee!==void 0&&(C="success",O=Tu(f==null?void 0:f.data,ee,i),M=!0)}if(i.select&&O!==void 0&&!_)if(f&&O===(g==null?void 0:g.data)&&i.select===S(this,Uo))O=S(this,Ps);else try{oe(this,Uo,i.select),O=i.select(O),O=Tu(f==null?void 0:f.data,O,i),oe(this,Ps,O),oe(this,Xr,null)}catch(ee){oe(this,Xr,ee)}S(this,Xr)&&(A=S(this,Xr),O=S(this,Ps),w=Date.now(),C="error");const $=j.fetchStatus==="fetching",V=C==="pending",z=C==="error",L=V&&$,B=O!==void 0,te={status:C,fetchStatus:j.fetchStatus,isPending:V,isSuccess:C==="success",isError:z,isInitialLoading:L,isLoading:L,data:O,dataUpdatedAt:j.dataUpdatedAt,error:A,errorUpdatedAt:w,failureCount:j.fetchFailureCount,failureReason:j.fetchFailureReason,errorUpdateCount:j.errorUpdateCount,isFetched:o.isFetched(),isFetchedAfterMount:j.dataUpdateCount>x.dataUpdateCount||j.errorUpdateCount>x.errorUpdateCount,isFetching:$,isRefetching:$&&!V,isLoadingError:z&&!B,isPaused:j.fetchStatus==="paused",isPlaceholderData:M,isRefetchError:z&&B,isStale:uc(o,i),refetch:this.refetch,promise:S(this,jr),isEnabled:Tt(i.enabled,o)!==!1};if(this.options.experimental_prefetchInRender){const ee=te.data!==void 0,ge=te.status==="error"&&!ee,ue=De=>{ge?De.reject(te.error):ee&&De.resolve(te.data)},Ae=()=>{const De=oe(this,jr,te.promise=Au());ue(De)},Ee=S(this,jr);switch(Ee.status){case"pending":o.queryHash===u.queryHash&&ue(Ee);break;case"fulfilled":(ge||te.data!==Ee.value)&&Ae();break;case"rejected":(!ge||te.error!==Ee.reason)&&Ae();break}}return te}updateResult(){const o=S(this,gt),i=this.createResult(S(this,Oe),this.options);if(oe(this,Mn,S(this,Oe).state),oe(this,Es,this.options),S(this,Mn).data!==void 0&&oe(this,_s,S(this,Oe)),Ou(i,o))return;oe(this,gt,i);const u=()=>{if(!o)return!0;const{notifyOnChangeProps:d}=this.options,f=typeof d=="function"?d():d;if(f==="all"||!f&&!S(this,Ms).size)return!0;const g=new Set(f??S(this,Ms));return this.options.throwOnError&&g.add("error"),Object.keys(S(this,gt)).some(h=>{const v=h;return S(this,gt)[v]!==o[v]&&g.has(v)})};_e(this,Le,vh).call(this,{listeners:u()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Le,Uu).call(this)}},kt=new WeakMap,Oe=new WeakMap,Fo=new WeakMap,gt=new WeakMap,Mn=new WeakMap,Es=new WeakMap,jr=new WeakMap,Xr=new WeakMap,Uo=new WeakMap,Ps=new WeakMap,_s=new WeakMap,Rn=new WeakMap,On=new WeakMap,en=new WeakMap,Ms=new WeakMap,Le=new WeakSet,Po=function(o){_e(this,Le,Hu).call(this);let i=S(this,Oe).fetch(this.options,o);return o!=null&&o.throwOnError||(i=i.catch(Nt)),i},Lu=function(){_e(this,Le,$u).call(this);const o=sn(this.options.staleTime,S(this,Oe));if(Ro.isServer()||S(this,gt).isStale||!Ru(o))return;const u=ch(S(this,gt).dataUpdatedAt,o)+1;oe(this,Rn,Nn.setTimeout(()=>{S(this,gt).isStale||this.updateResult()},u))},Iu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(S(this,Oe)):this.options.refetchInterval)??!1},Fu=function(o){_e(this,Le,Bu).call(this),oe(this,en,o),!(Ro.isServer()||Tt(this.options.enabled,S(this,Oe))===!1||!Ru(S(this,en))||S(this,en)===0)&&oe(this,On,Nn.setInterval(()=>{(this.options.refetchIntervalInBackground||lc.isFocused())&&_e(this,Le,Po).call(this)},S(this,en)))},Uu=function(){_e(this,Le,Lu).call(this),_e(this,Le,Fu).call(this,_e(this,Le,Iu).call(this))},$u=function(){S(this,Rn)!==void 0&&(Nn.clearTimeout(S(this,Rn)),oe(this,Rn,void 0))},Bu=function(){S(this,On)!==void 0&&(Nn.clearInterval(S(this,On)),oe(this,On,void 0))},Hu=function(){const o=S(this,kt).getQueryCache().build(S(this,kt),this.options);if(o===S(this,Oe))return;const i=S(this,Oe);oe(this,Oe,o),oe(this,Fo,o.state),this.hasListeners()&&(i==null||i.removeObserver(this),o.addObserver(this))},vh=function(o){lt.batch(()=>{o.listeners&&this.listeners.forEach(i=>{i(S(this,gt))}),S(this,kt).getQueryCache().notify({query:S(this,Oe),type:"observerResultsUpdated"})})},rh);function Ux(s,o){return Tt(o.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&Tt(o.retryOnMount,s)===!1)}function wp(s,o){return Ux(s,o)||s.state.data!==void 0&&Wu(s,o,o.refetchOnMount)}function Wu(s,o,i){if(Tt(o.enabled,s)!==!1&&sn(o.staleTime,s)!=="static"){const u=typeof i=="function"?i(s):i;return u==="always"||u!==!1&&uc(s,o)}return!1}function jp(s,o,i,u){return(s!==o||Tt(u.enabled,s)===!1)&&(!i.suspense||s.state.status!=="error")&&uc(s,i)}function uc(s,o){return Tt(o.enabled,s)!==!1&&s.isStaleByTime(sn(o.staleTime,s))}function $x(s,o){return!Ou(s.getCurrentResult(),o)}var $o,or,pt,Dn,lr,Qr,nh,Bx=(nh=class extends gh{constructor(o){super();be(this,lr);be(this,$o);be(this,or);be(this,pt);be(this,Dn);oe(this,$o,o.client),this.mutationId=o.mutationId,oe(this,pt,o.mutationCache),oe(this,or,[]),this.state=o.state||Hx(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){S(this,or).includes(o)||(S(this,or).push(o),this.clearGcTimeout(),S(this,pt).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){oe(this,or,S(this,or).filter(i=>i!==o)),this.scheduleGc(),S(this,pt).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){S(this,or).length||(this.state.status==="pending"?this.scheduleGc():S(this,pt).remove(this))}continue(){var o;return((o=S(this,Dn))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var g,h,v,x,b,j,M,O,A,w,C,_,$,V,z,L,B,J;const i=()=>{_e(this,lr,Qr).call(this,{type:"continue"})},u={client:S(this,$o),meta:this.options.meta,mutationKey:this.options.mutationKey};oe(this,Dn,mh({fn:()=>this.options.mutationFn?this.options.mutationFn(o,u):Promise.reject(new Error("No mutationFn found")),onFail:(te,re)=>{_e(this,lr,Qr).call(this,{type:"failed",failureCount:te,error:re})},onPause:()=>{_e(this,lr,Qr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>S(this,pt).canRun(this)}));const d=this.state.status==="pending",f=!S(this,Dn).canStart();try{if(d)i();else{_e(this,lr,Qr).call(this,{type:"pending",variables:o,isPaused:f}),S(this,pt).config.onMutate&&await S(this,pt).config.onMutate(o,this,u);const re=await((h=(g=this.options).onMutate)==null?void 0:h.call(g,o,u));re!==this.state.context&&_e(this,lr,Qr).call(this,{type:"pending",context:re,variables:o,isPaused:f})}const te=await S(this,Dn).start();return await((x=(v=S(this,pt).config).onSuccess)==null?void 0:x.call(v,te,o,this.state.context,this,u)),await((j=(b=this.options).onSuccess)==null?void 0:j.call(b,te,o,this.state.context,u)),await((O=(M=S(this,pt).config).onSettled)==null?void 0:O.call(M,te,null,this.state.variables,this.state.context,this,u)),await((w=(A=this.options).onSettled)==null?void 0:w.call(A,te,null,o,this.state.context,u)),_e(this,lr,Qr).call(this,{type:"success",data:te}),te}catch(te){try{await((_=(C=S(this,pt).config).onError)==null?void 0:_.call(C,te,o,this.state.context,this,u))}catch(re){Promise.reject(re)}try{await((V=($=this.options).onError)==null?void 0:V.call($,te,o,this.state.context,u))}catch(re){Promise.reject(re)}try{await((L=(z=S(this,pt).config).onSettled)==null?void 0:L.call(z,void 0,te,this.state.variables,this.state.context,this,u))}catch(re){Promise.reject(re)}try{await((J=(B=this.options).onSettled)==null?void 0:J.call(B,void 0,te,o,this.state.context,u))}catch(re){Promise.reject(re)}throw _e(this,lr,Qr).call(this,{type:"error",error:te}),te}finally{S(this,pt).runNext(this)}}},$o=new WeakMap,or=new WeakMap,pt=new WeakMap,Dn=new WeakMap,lr=new WeakSet,Qr=function(o){const i=u=>{switch(o.type){case"failed":return{...u,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...u,isPaused:!0};case"continue":return{...u,isPaused:!1};case"pending":return{...u,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...u,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...u,data:void 0,error:o.error,failureCount:u.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=i(this.state),lt.batch(()=>{S(this,or).forEach(u=>{u.onMutationUpdate(o)}),S(this,pt).notify({mutation:this,type:"updated",action:o})})},nh);function Hx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kr,Yt,Bo,sh,Wx=(sh=class extends Ho{constructor(o={}){super();be(this,kr);be(this,Yt);be(this,Bo);this.config=o,oe(this,kr,new Set),oe(this,Yt,new Map),oe(this,Bo,0)}build(o,i,u){const d=new Bx({client:o,mutationCache:this,mutationId:++Xl(this,Bo)._,options:o.defaultMutationOptions(i),state:u});return this.add(d),d}add(o){S(this,kr).add(o);const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i);u?u.push(o):S(this,Yt).set(i,[o])}this.notify({type:"added",mutation:o})}remove(o){if(S(this,kr).delete(o)){const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i);if(u)if(u.length>1){const d=u.indexOf(o);d!==-1&&u.splice(d,1)}else u[0]===o&&S(this,Yt).delete(i)}}this.notify({type:"removed",mutation:o})}canRun(o){const i=ti(o);if(typeof i=="string"){const u=S(this,Yt).get(i),d=u==null?void 0:u.find(f=>f.state.status==="pending");return!d||d===o}else return!0}runNext(o){var u;const i=ti(o);if(typeof i=="string"){const d=(u=S(this,Yt).get(i))==null?void 0:u.find(f=>f!==o&&f.state.isPaused);return(d==null?void 0:d.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{S(this,kr).forEach(o=>{this.notify({type:"removed",mutation:o})}),S(this,kr).clear(),S(this,Yt).clear()})}getAll(){return Array.from(S(this,kr))}find(o){const i={exact:!0,...o};return this.getAll().find(u=>mp(i,u))}findAll(o={}){return this.getAll().filter(i=>mp(o,i))}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}resumePausedMutations(){const o=this.getAll().filter(i=>i.state.isPaused);return lt.batch(()=>Promise.all(o.map(i=>i.continue().catch(Nt))))}},kr=new WeakMap,Yt=new WeakMap,Bo=new WeakMap,sh);function ti(s){var o;return(o=s.options.scope)==null?void 0:o.id}var ir,oh,Vx=(oh=class extends Ho{constructor(o={}){super();be(this,ir);this.config=o,oe(this,ir,new Map)}build(o,i,u){const d=i.queryKey,f=i.queryHash??ic(d,i);let g=this.get(f);return g||(g=new Ix({client:o,queryKey:d,queryHash:f,options:o.defaultQueryOptions(i),state:u,defaultOptions:o.getQueryDefaults(d)}),this.add(g)),g}add(o){S(this,ir).has(o.queryHash)||(S(this,ir).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const i=S(this,ir).get(o.queryHash);i&&(o.destroy(),i===o&&S(this,ir).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){lt.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return S(this,ir).get(o)}getAll(){return[...S(this,ir).values()]}find(o){const i={exact:!0,...o};return this.getAll().find(u=>hp(i,u))}findAll(o={}){const i=this.getAll();return Object.keys(o).length>0?i.filter(u=>hp(o,u)):i}notify(o){lt.batch(()=>{this.listeners.forEach(i=>{i(o)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},ir=new WeakMap,oh),Qe,tn,rn,Rs,Os,nn,Ds,Ts,lh,Gx=(lh=class{constructor(s={}){be(this,Qe);be(this,tn);be(this,rn);be(this,Rs);be(this,Os);be(this,nn);be(this,Ds);be(this,Ts);oe(this,Qe,s.queryCache||new Vx),oe(this,tn,s.mutationCache||new Wx),oe(this,rn,s.defaultOptions||{}),oe(this,Rs,new Map),oe(this,Os,new Map),oe(this,nn,0)}mount(){Xl(this,nn)._++,S(this,nn)===1&&(oe(this,Ds,lc.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Qe).onFocus())})),oe(this,Ts,hi.subscribe(async s=>{s&&(await this.resumePausedMutations(),S(this,Qe).onOnline())})))}unmount(){var s,o;Xl(this,nn)._--,S(this,nn)===0&&((s=S(this,Ds))==null||s.call(this),oe(this,Ds,void 0),(o=S(this,Ts))==null||o.call(this),oe(this,Ts,void 0))}isFetching(s){return S(this,Qe).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return S(this,tn).findAll({...s,status:"pending"}).length}getQueryData(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Qe).get(o.queryHash))==null?void 0:i.state.data}ensureQueryData(s){const o=this.defaultQueryOptions(s),i=S(this,Qe).build(this,o),u=i.state.data;return u===void 0?this.fetchQuery(s):(s.revalidateIfStale&&i.isStaleByTime(sn(o.staleTime,i))&&this.prefetchQuery(o),Promise.resolve(u))}getQueriesData(s){return S(this,Qe).findAll(s).map(({queryKey:o,state:i})=>{const u=i.data;return[o,u]})}setQueryData(s,o,i){const u=this.defaultQueryOptions({queryKey:s}),d=S(this,Qe).get(u.queryHash),f=d==null?void 0:d.state.data,g=Cx(o,f);if(g!==void 0)return S(this,Qe).build(this,u).setData(g,{...i,manual:!0})}setQueriesData(s,o,i){return lt.batch(()=>S(this,Qe).findAll(s).map(({queryKey:u})=>[u,this.setQueryData(u,o,i)]))}getQueryState(s){var i;const o=this.defaultQueryOptions({queryKey:s});return(i=S(this,Qe).get(o.queryHash))==null?void 0:i.state}removeQueries(s){const o=S(this,Qe);lt.batch(()=>{o.findAll(s).forEach(i=>{o.remove(i)})})}resetQueries(s,o){const i=S(this,Qe);return lt.batch(()=>(i.findAll(s).forEach(u=>{u.reset()}),this.refetchQueries({type:"active",...s},o)))}cancelQueries(s,o={}){const i={revert:!0,...o},u=lt.batch(()=>S(this,Qe).findAll(s).map(d=>d.cancel(i)));return Promise.all(u).then(Nt).catch(Nt)}invalidateQueries(s,o={}){return lt.batch(()=>(S(this,Qe).findAll(s).forEach(i=>{i.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},o)))}refetchQueries(s,o={}){const i={...o,cancelRefetch:o.cancelRefetch??!0},u=lt.batch(()=>S(this,Qe).findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let f=d.fetch(void 0,i);return i.throwOnError||(f=f.catch(Nt)),d.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(u).then(Nt)}fetchQuery(s){const o=this.defaultQueryOptions(s);o.retry===void 0&&(o.retry=!1);const i=S(this,Qe).build(this,o);return i.isStaleByTime(sn(o.staleTime,i))?i.fetch(o):Promise.resolve(i.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(Nt).catch(Nt)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(Nt).catch(Nt)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return hi.isOnline()?S(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return S(this,Qe)}getMutationCache(){return S(this,tn)}getDefaultOptions(){return S(this,rn)}setDefaultOptions(s){oe(this,rn,s)}setQueryDefaults(s,o){S(this,Rs).set(_o(s),{queryKey:s,defaultOptions:o})}getQueryDefaults(s){const o=[...S(this,Rs).values()],i={};return o.forEach(u=>{Mo(s,u.queryKey)&&Object.assign(i,u.defaultOptions)}),i}setMutationDefaults(s,o){S(this,Os).set(_o(s),{mutationKey:s,defaultOptions:o})}getMutationDefaults(s){const o=[...S(this,Os).values()],i={};return o.forEach(u=>{Mo(s,u.mutationKey)&&Object.assign(i,u.defaultOptions)}),i}defaultQueryOptions(s){if(s._defaulted)return s;const o={...S(this,rn).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return o.queryHash||(o.queryHash=ic(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.queryFn===ac&&(o.enabled=!1),o}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...S(this,rn).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){S(this,Qe).clear(),S(this,tn).clear()}},Qe=new WeakMap,tn=new WeakMap,rn=new WeakMap,Rs=new WeakMap,Os=new WeakMap,nn=new WeakMap,Ds=new WeakMap,Ts=new WeakMap,lh),bh=m.createContext(void 0),cc=s=>{const o=m.useContext(bh);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},Kx=({client:s,children:o})=>(m.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),n.jsx(bh.Provider,{value:s,children:o})),wh=m.createContext(!1),Qx=()=>m.useContext(wh);wh.Provider;function qx(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Zx=m.createContext(qx()),Yx=()=>m.useContext(Zx),Jx=(s,o,i)=>{const u=i!=null&&i.state.error&&typeof s.throwOnError=="function"?ph(s.throwOnError,[i.state.error,i]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||u)&&(o.isReset()||(s.retryOnMount=!1))},Xx=s=>{m.useEffect(()=>{s.clearReset()},[s])},e0=({result:s,errorResetBoundary:o,throwOnError:i,query:u,suspense:d})=>s.isError&&!o.isReset()&&!s.isFetching&&u&&(d&&s.data===void 0||ph(i,[s.error,u])),t0=s=>{if(s.suspense){const i=d=>d==="static"?d:Math.max(d??1e3,1e3),u=s.staleTime;s.staleTime=typeof u=="function"?(...d)=>i(u(...d)):i(u),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},r0=(s,o)=>s.isLoading&&s.isFetching&&!o,n0=(s,o)=>(s==null?void 0:s.suspense)&&o.isPending,kp=(s,o,i)=>o.fetchOptimistic(s).catch(()=>{i.clearReset()});function s0(s,o,i){var O,A,w,C;const u=Qx(),d=Yx(),f=cc(),g=f.defaultQueryOptions(s);(A=(O=f.getDefaultOptions().queries)==null?void 0:O._experimental_beforeQuery)==null||A.call(O,g);const h=f.getQueryCache().get(g.queryHash),v=s.subscribed!==!1;g._optimisticResults=u?"isRestoring":v?"optimistic":void 0,t0(g),Jx(g,d,h),Xx(d);const x=!f.getQueryCache().get(g.queryHash),[b]=m.useState(()=>new o(f,g)),j=b.getOptimisticResult(g),M=!u&&v;if(m.useSyncExternalStore(m.useCallback(_=>{const $=M?b.subscribe(lt.batchCalls(_)):Nt;return b.updateResult(),$},[b,M]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),m.useEffect(()=>{b.setOptions(g)},[g,b]),n0(g,j))throw kp(g,b,d);if(e0({result:j,errorResetBoundary:d,throwOnError:g.throwOnError,query:h,suspense:g.suspense}))throw j.error;if((C=(w=f.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||C.call(w,g,j),g.experimental_prefetchInRender&&!Ro.isServer()&&r0(j,u)){const _=x?kp(g,b,d):h==null?void 0:h.promise;_==null||_.catch(Nt).finally(()=>{b.updateResult()})}return g.notifyOnChangeProps?j:b.trackResult(j)}function Fn(s,o){return s0(s,Fx)}/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o0=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jh=(...s)=>s.filter((o,i,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===i).join(" ").trim();/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var l0={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"};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i0=m.forwardRef(({color:s="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:d="",children:f,iconNode:g,...h},v)=>m.createElement("svg",{ref:v,...l0,width:o,height:o,stroke:s,strokeWidth:u?Number(i)*24/Number(o):i,className:jh("lucide",d),...h},[...g.map(([x,b])=>m.createElement(x,b)),...Array.isArray(f)?f:[f]]));/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const je=(s,o)=>{const i=m.forwardRef(({className:u,...d},f)=>m.createElement(i0,{ref:f,iconNode:o,className:jh(`lucide-${o0(s)}`,u),...d}));return i.displayName=`${s}`,i};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mi=je("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Np=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kh=je("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oo=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a0=je("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Do=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const As=je("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u0=je("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c0=je("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d0=je("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f0=je("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p0=je("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h0=je("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vu=je("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m0=je("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g0=je("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gu=je("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x0=je("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nh=je("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const At=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const An=je("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gi=je("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sp=je("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ku=je("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y0=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v0=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qu=je("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b0=je("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w0=je("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const To=je("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j0=je("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k0=je("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N0=je("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sh=je("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ch=je("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tn=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S0=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C0=je("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dc=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E0=je("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P0=je("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zn=je("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _0=je("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Eh=je("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M0=je("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xi=je("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qu=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R0=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O0=je("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yi=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"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ln=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Zu=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:j0},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:a0},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:At},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Do},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:N0},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Oo},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:p0}];var Cp=1,D0=.9,T0=.8,A0=.17,vu=.1,bu=.999,z0=.9999,L0=.99,I0=/[\\\/_+.#"@\[\(\{&]/,F0=/[\\\/_+.#"@\[\(\{&]/g,U0=/[\s-]/,Ph=/[\s-]/g;function Yu(s,o,i,u,d,f,g){if(f===o.length)return d===s.length?Cp:L0;var h=`${d},${f}`;if(g[h]!==void 0)return g[h];for(var v=u.charAt(f),x=i.indexOf(v,d),b=0,j,M,O,A;x>=0;)j=Yu(s,o,i,u,x+1,f+1,g),j>b&&(x===d?j*=Cp:I0.test(s.charAt(x-1))?(j*=T0,O=s.slice(d,x-1).match(F0),O&&d>0&&(j*=Math.pow(bu,O.length))):U0.test(s.charAt(x-1))?(j*=D0,A=s.slice(d,x-1).match(Ph),A&&d>0&&(j*=Math.pow(bu,A.length))):(j*=A0,d>0&&(j*=Math.pow(bu,x-d))),s.charAt(x)!==o.charAt(f)&&(j*=z0)),(jj&&(j=M*vu)),j>b&&(b=j),x=i.indexOf(v,x+1);return g[h]=b,b}function Ep(s){return s.toLowerCase().replace(Ph," ")}function $0(s,o,i){return s=i&&i.length>0?`${s+" "+i.join(" ")}`:s,Yu(s,o,Ep(s),Ep(o),0,0,{})}function on(s,o,{checkForDefaultPrevented:i=!0}={}){return function(d){if(s==null||s(d),i===!1||!d.defaultPrevented)return o==null?void 0:o(d)}}function Pp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function zs(...s){return o=>{let i=!1;const u=s.map(d=>{const f=Pp(d,o);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let d=0;d{var _;const{scope:M,children:O,...A}=j,w=((_=M==null?void 0:M[s])==null?void 0:_[v])||h,C=m.useMemo(()=>A,Object.values(A));return n.jsx(w.Provider,{value:C,children:O})};x.displayName=f+"Provider";function b(j,M){var w;const O=((w=M==null?void 0:M[s])==null?void 0:w[v])||h,A=m.useContext(O);if(A)return A;if(g!==void 0)return g;throw new Error(`\`${j}\` must be used within \`${f}\``)}return[x,b]}const d=()=>{const f=i.map(g=>m.createContext(g));return function(h){const v=(h==null?void 0:h[s])||f;return m.useMemo(()=>({[`__scope${s}`]:{...h,[s]:v}}),[h,v])}};return d.scopeName=s,[u,H0(d,...o)]}function H0(...s){const o=s[0];if(s.length===1)return o;const i=()=>{const u=s.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(f){const g=u.reduce((h,{useScope:v,scopeName:x})=>{const j=v(f)[`__scope${x}`];return{...h,...j}},{});return m.useMemo(()=>({[`__scope${o.scopeName}`]:g}),[g])}};return i.scopeName=o.scopeName,i}var Ao=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},W0=oc[" useId ".trim().toString()]||(()=>{}),V0=0;function Nr(s){const[o,i]=m.useState(W0());return Ao(()=>{i(u=>u??String(V0++))},[s]),o?`radix-${o}`:""}var G0=oc[" useInsertionEffect ".trim().toString()]||Ao;function K0({prop:s,defaultProp:o,onChange:i=()=>{},caller:u}){const[d,f,g]=Q0({defaultProp:o,onChange:i}),h=s!==void 0,v=h?s:d;{const b=m.useRef(s!==void 0);m.useEffect(()=>{const j=b.current;j!==h&&console.warn(`${u} is changing from ${j?"controlled":"uncontrolled"} to ${h?"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.`),b.current=h},[h,u])}const x=m.useCallback(b=>{var j;if(h){const M=q0(b)?b(s):b;M!==s&&((j=g.current)==null||j.call(g,M))}else f(b)},[h,s,f,g]);return[v,x]}function Q0({defaultProp:s,onChange:o}){const[i,u]=m.useState(s),d=m.useRef(i),f=m.useRef(o);return G0(()=>{f.current=o},[o]),m.useEffect(()=>{var g;d.current!==i&&((g=f.current)==null||g.call(f,i),d.current=i)},[i,d]),[i,u,f]}function q0(s){return typeof s=="function"}var _h=uh();function Mh(s){const o=m.forwardRef((i,u)=>{let{children:d,...f}=i,g=null,h=!1;const v=[];_p(d)&&typeof ri=="function"&&(d=ri(d._payload)),m.Children.forEach(d,M=>{var O;if(ey(M)){h=!0;const A=M;let w="child"in A.props?A.props.child:A.props.children;_p(w)&&typeof ri=="function"&&(w=ri(w._payload)),g=Y0(A,w),v.push((O=g==null?void 0:g.props)==null?void 0:O.children)}else v.push(M)}),g?g=m.cloneElement(g,void 0,v):!h&&m.Children.count(d)===1&&m.isValidElement(d)&&(g=d);const x=g?X0(g):void 0,b=Un(u,x);if(!g){if(d||d===0)throw new Error(h?sy(s):ny(s));return d}const j=J0(f,g.props??{});return g.type!==m.Fragment&&(j.ref=u?b:x),m.cloneElement(g,j)});return o.displayName=`${s}.Slot`,o}var Z0=Symbol.for("radix.slottable"),Y0=(s,o)=>{if("child"in s.props){const i=s.props.child;return m.isValidElement(i)?m.cloneElement(i,void 0,s.props.children(i.props.children)):null}return m.isValidElement(o)?o:null};function J0(s,o){const i={...o};for(const u in o){const d=s[u],f=o[u];/^on[A-Z]/.test(u)?d&&f?i[u]=(...h)=>{const v=f(...h);return d(...h),v}:d&&(i[u]=d):u==="style"?i[u]={...d,...f}:u==="className"&&(i[u]=[d,f].filter(Boolean).join(" "))}return{...s,...i}}function X0(s){var u,d;let o=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,i=o&&"isReactWarning"in o&&o.isReactWarning;return i?s.ref:(o=(d=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:d.get,i=o&&"isReactWarning"in o&&o.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}function ey(s){return m.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===Z0}var ty=Symbol.for("react.lazy");function _p(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===ty&&"_payload"in s&&ry(s._payload)}function ry(s){return typeof s=="object"&&s!==null&&"then"in s}var ny=s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,sy=s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ri=oc[" use ".trim().toString()],oy=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=oy.reduce((s,o)=>{const i=Mh(`Primitive.${o}`),u=m.forwardRef((d,f)=>{const{asChild:g,...h}=d,v=g?i:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(v,{...h,ref:f})});return u.displayName=`Primitive.${o}`,{...s,[o]:u}},{});function ly(s,o){s&&_h.flushSync(()=>s.dispatchEvent(o))}function zo(s){const o=m.useRef(s);return m.useEffect(()=>{o.current=s}),m.useMemo(()=>((...i)=>{var u;return(u=o.current)==null?void 0:u.call(o,...i)}),[])}function iy(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s);m.useEffect(()=>{const u=d=>{d.key==="Escape"&&i(d)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[i,o])}var ay="DismissableLayer",Ju="dismissableLayer.update",uy="dismissableLayer.pointerDownOutside",cy="dismissableLayer.focusOutside",Mp,fc=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Rh=m.forwardRef((s,o)=>{const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:u=!1,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:g,onInteractOutside:h,onDismiss:v,...x}=s,b=m.useContext(fc),[j,M]=m.useState(null),O=(j==null?void 0:j.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=m.useState({}),w=Un(o,re=>M(re)),C=Array.from(b.layers),[_]=[...b.layersWithOutsidePointerEventsDisabled].slice(-1),$=C.indexOf(_),V=j?C.indexOf(j):-1,z=b.layersWithOutsidePointerEventsDisabled.size>0,L=V>=$,B=m.useRef(!1),J=hy(re=>{const ee=re.target;if(!(ee instanceof Node))return;const ge=[...b.branches].some(ue=>ue.contains(ee));!L||ge||(f==null||f(re),h==null||h(re),re.defaultPrevented||v==null||v())},{ownerDocument:O,deferPointerDownOutside:u,isDeferredPointerDownOutsideRef:B,dismissableSurfaces:b.dismissableSurfaces}),te=my(re=>{if(u&&B.current)return;const ee=re.target;[...b.branches].some(ue=>ue.contains(ee))||(g==null||g(re),h==null||h(re),re.defaultPrevented||v==null||v())},O);return iy(re=>{V===b.layers.size-1&&(d==null||d(re),!re.defaultPrevented&&v&&(re.preventDefault(),v()))},O),m.useEffect(()=>{if(j)return i&&(b.layersWithOutsidePointerEventsDisabled.size===0&&(Mp=O.body.style.pointerEvents,O.body.style.pointerEvents="none"),b.layersWithOutsidePointerEventsDisabled.add(j)),b.layers.add(j),Rp(),()=>{i&&(b.layersWithOutsidePointerEventsDisabled.delete(j),b.layersWithOutsidePointerEventsDisabled.size===0&&(O.body.style.pointerEvents=Mp))}},[j,O,i,b]),m.useEffect(()=>()=>{j&&(b.layers.delete(j),b.layersWithOutsidePointerEventsDisabled.delete(j),Rp())},[j,b]),m.useEffect(()=>{const re=()=>A({});return document.addEventListener(Ju,re),()=>document.removeEventListener(Ju,re)},[]),n.jsx(it.div,{...x,ref:w,style:{pointerEvents:z?L?"auto":"none":void 0,...s.style},onFocusCapture:on(s.onFocusCapture,te.onFocusCapture),onBlurCapture:on(s.onBlurCapture,te.onBlurCapture),onPointerDownCapture:on(s.onPointerDownCapture,J.onPointerDownCapture)})});Rh.displayName=ay;var dy="DismissableLayerBranch",fy=m.forwardRef((s,o)=>{const i=m.useContext(fc),u=m.useRef(null),d=Un(o,u);return m.useEffect(()=>{const f=u.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),n.jsx(it.div,{...s,ref:d})});fy.displayName=dy;function py(){const s=m.useContext(fc),[o,i]=m.useState(null);return m.useEffect(()=>{if(o)return s.dismissableSurfaces.add(o),()=>{s.dismissableSurfaces.delete(o)}},[o,s.dismissableSurfaces]),i}function hy(s,o){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:u=!1,isDeferredPointerDownOutsideRef:d,dismissableSurfaces:f}=o,g=zo(s),h=m.useRef(!1),v=m.useRef(!1),x=m.useRef(new Map),b=m.useRef(()=>{});return m.useEffect(()=>{function j(){v.current=!1,d.current=!1,x.current.clear()}function M(){return Array.from(x.current.values()).some(Boolean)}function O($){if(!v.current)return;const V=$.target;V instanceof Node&&[...f].some(L=>L.contains(V))||x.current.set($.type,!0),$.type==="click"&&window.setTimeout(()=>{v.current&&b.current()},0)}function A($){v.current&&x.current.set($.type,!1)}const w=$=>{if($.target&&!h.current){let V=function(){i.removeEventListener("click",b.current);const L=M();j(),L||Oh(uy,g,z,{discrete:!0})};const z={originalEvent:$};v.current=!0,d.current=u&&$.button===0,x.current.clear(),!u||$.button!==0?V():(i.removeEventListener("click",b.current),b.current=V,i.addEventListener("click",b.current,{once:!0}))}else i.removeEventListener("click",b.current),j();h.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const $ of C)i.addEventListener($,O,!0),i.addEventListener($,A);const _=window.setTimeout(()=>{i.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(_),i.removeEventListener("pointerdown",w),i.removeEventListener("click",b.current);for(const $ of C)i.removeEventListener($,O,!0),i.removeEventListener($,A)}},[i,g,u,d,f]),{onPointerDownCapture:()=>h.current=!0}}function my(s,o=globalThis==null?void 0:globalThis.document){const i=zo(s),u=m.useRef(!1);return m.useEffect(()=>{const d=f=>{f.target&&!u.current&&Oh(cy,i,{originalEvent:f},{discrete:!1})};return o.addEventListener("focusin",d),()=>o.removeEventListener("focusin",d)},[o,i]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function Rp(){const s=new CustomEvent(Ju);document.dispatchEvent(s)}function Oh(s,o,i,{discrete:u}){const d=i.originalEvent.target,f=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:i});o&&d.addEventListener(s,o,{once:!0}),u?ly(d,f):d.dispatchEvent(f)}var wu="focusScope.autoFocusOnMount",ju="focusScope.autoFocusOnUnmount",Op={bubbles:!1,cancelable:!0},gy="FocusScope",Dh=m.forwardRef((s,o)=>{const{loop:i=!1,trapped:u=!1,onMountAutoFocus:d,onUnmountAutoFocus:f,...g}=s,[h,v]=m.useState(null),x=zo(d),b=zo(f),j=m.useRef(null),M=Un(o,w=>v(w)),O=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(u){let w=function(V){if(O.paused||!h)return;const z=V.target;h.contains(z)?j.current=z:qr(j.current,{select:!0})},C=function(V){if(O.paused||!h)return;const z=V.relatedTarget;z!==null&&(h.contains(z)||qr(j.current,{select:!0}))},_=function(V){if(document.activeElement===document.body)for(const L of V)L.removedNodes.length>0&&qr(h)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const $=new MutationObserver(_);return h&&$.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),$.disconnect()}}},[u,h,O.paused]),m.useEffect(()=>{if(h){Tp.add(O);const w=document.activeElement;if(!h.contains(w)){const _=new CustomEvent(wu,Op);h.addEventListener(wu,x),h.dispatchEvent(_),_.defaultPrevented||(xy(jy(Th(h)),{select:!0}),document.activeElement===w&&qr(h))}return()=>{h.removeEventListener(wu,x),setTimeout(()=>{const _=new CustomEvent(ju,Op);h.addEventListener(ju,b),h.dispatchEvent(_),_.defaultPrevented||qr(w??document.body,{select:!0}),h.removeEventListener(ju,b),Tp.remove(O)},0)}}},[h,x,b,O]);const A=m.useCallback(w=>{if(!i&&!u||O.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,_=document.activeElement;if(C&&_){const $=w.currentTarget,[V,z]=yy($);V&&z?!w.shiftKey&&_===z?(w.preventDefault(),i&&qr(V,{select:!0})):w.shiftKey&&_===V&&(w.preventDefault(),i&&qr(z,{select:!0})):_===$&&w.preventDefault()}},[i,u,O.paused]);return n.jsx(it.div,{tabIndex:-1,...g,ref:M,onKeyDown:A})});Dh.displayName=gy;function xy(s,{select:o=!1}={}){const i=document.activeElement;for(const u of s)if(qr(u,{select:o}),document.activeElement!==i)return}function yy(s){const o=Th(s),i=Dp(o,s),u=Dp(o.reverse(),s);return[i,u]}function Th(s){const o=[],i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const d=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||d?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)o.push(i.currentNode);return o}function Dp(s,o){for(const i of s)if(!vy(i,{upTo:o}))return i}function vy(s,{upTo:o}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(o!==void 0&&s===o)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function by(s){return s instanceof HTMLInputElement&&"select"in s}function qr(s,{select:o=!1}={}){if(s&&s.focus){const i=document.activeElement;s.focus({preventScroll:!0}),s!==i&&by(s)&&o&&s.select()}}var Tp=wy();function wy(){let s=[];return{add(o){const i=s[0];o!==i&&(i==null||i.pause()),s=Ap(s,o),s.unshift(o)},remove(o){var i;s=Ap(s,o),(i=s[0])==null||i.resume()}}}function Ap(s,o){const i=[...s],u=i.indexOf(o);return u!==-1&&i.splice(u,1),i}function jy(s){return s.filter(o=>o.tagName!=="A")}var ky="Portal",Ah=m.forwardRef((s,o)=>{var h;const{container:i,...u}=s,[d,f]=m.useState(!1);Ao(()=>f(!0),[]);const g=i||d&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return g?_h.createPortal(n.jsx(it.div,{...u,ref:o}),g):null});Ah.displayName=ky;function Ny(s,o){return m.useReducer((i,u)=>o[i][u]??i,s)}var bi=s=>{const{present:o,children:i}=s,u=Sy(o),d=typeof i=="function"?i({present:u.isPresent}):m.Children.only(i),f=Cy(u.ref,Ey(d));return typeof i=="function"||u.isPresent?m.cloneElement(d,{ref:f}):null};bi.displayName="Presence";function Sy(s){const[o,i]=m.useState(),u=m.useRef(null),d=m.useRef(s),f=m.useRef("none"),g=s?"mounted":"unmounted",[h,v]=Ny(g,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const x=ni(u.current);f.current=h==="mounted"?x:"none"},[h]),Ao(()=>{const x=u.current,b=d.current;if(b!==s){const M=f.current,O=ni(x);s?v("MOUNT"):O==="none"||(x==null?void 0:x.display)==="none"?v("UNMOUNT"):v(b&&M!==O?"ANIMATION_OUT":"UNMOUNT"),d.current=s}},[s,v]),Ao(()=>{if(o){let x;const b=o.ownerDocument.defaultView??window,j=O=>{const w=ni(u.current).includes(CSS.escape(O.animationName));if(O.target===o&&w&&(v("ANIMATION_END"),!d.current)){const C=o.style.animationFillMode;o.style.animationFillMode="forwards",x=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=C)})}},M=O=>{O.target===o&&(f.current=ni(u.current))};return o.addEventListener("animationstart",M),o.addEventListener("animationcancel",j),o.addEventListener("animationend",j),()=>{b.clearTimeout(x),o.removeEventListener("animationstart",M),o.removeEventListener("animationcancel",j),o.removeEventListener("animationend",j)}}else v("ANIMATION_END")},[o,v]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:m.useCallback(x=>{u.current=x?getComputedStyle(x):null,i(x)},[])}}function zp(s,o){if(typeof s=="function")return s(o);s!=null&&(s.current=o)}function Cy(...s){const o=m.useRef(s);return o.current=s,m.useCallback(i=>{const u=o.current;let d=!1;const f=u.map(g=>{const h=zp(g,i);return!d&&typeof h=="function"&&(d=!0),h});if(d)return()=>{for(let g=0;g{sr||(sr={start:Lp(),end:Lp()});const{start:s,end:o}=sr;return document.body.firstElementChild!==s&&document.body.insertAdjacentElement("afterbegin",s),document.body.lastElementChild!==o&&document.body.insertAdjacentElement("beforeend",o),si++,()=>{si===1&&(sr==null||sr.start.remove(),sr==null||sr.end.remove(),sr=null),si=Math.max(0,si-1)}},[])}function Lp(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var ar=function(){return ar=Object.assign||function(o){for(var i,u=1,d=arguments.length;u"u")return Vy;var o=Gy(s),i=document.documentElement.clientWidth,u=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,u-i+o[2]-o[0])}},Qy=Fh(),bs="data-scroll-locked",qy=function(s,o,i,u){var d=s.left,f=s.top,g=s.right,h=s.gap;return i===void 0&&(i="margin"),` + .`.concat(My,` { + overflow: hidden `).concat(u,`; + padding-right: `).concat(h,"px ").concat(u,`; + } + body[`).concat(bs,`] { + overflow: hidden `).concat(u,`; + overscroll-behavior: contain; + `).concat([o&&"position: relative ".concat(u,";"),i==="margin"&&` + padding-left: `.concat(d,`px; + padding-top: `).concat(f,`px; + padding-right: `).concat(g,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(h,"px ").concat(u,`; + `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(u,";")].filter(Boolean).join(""),` + } + + .`).concat(fi,` { + right: `).concat(h,"px ").concat(u,`; + } + + .`).concat(pi,` { + margin-right: `).concat(h,"px ").concat(u,`; + } + + .`).concat(fi," .").concat(fi,` { + right: 0 `).concat(u,`; + } + + .`).concat(pi," .").concat(pi,` { + margin-right: 0 `).concat(u,`; + } + + body[`).concat(bs,`] { + `).concat(Ry,": ").concat(h,`px; + } +`)},Fp=function(){var s=parseInt(document.body.getAttribute(bs)||"0",10);return isFinite(s)?s:0},Zy=function(){m.useEffect(function(){return document.body.setAttribute(bs,(Fp()+1).toString()),function(){var s=Fp()-1;s<=0?document.body.removeAttribute(bs):document.body.setAttribute(bs,s.toString())}},[])},Yy=function(s){var o=s.noRelative,i=s.noImportant,u=s.gapMode,d=u===void 0?"margin":u;Zy();var f=m.useMemo(function(){return Ky(d)},[d]);return m.createElement(Qy,{styles:qy(f,!o,d,i?"":"!important")})},Xu=!1;if(typeof window<"u")try{var oi=Object.defineProperty({},"passive",{get:function(){return Xu=!0,!0}});window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{Xu=!1}var hs=Xu?{passive:!1}:!1,Jy=function(s){return s.tagName==="TEXTAREA"},Uh=function(s,o){if(!(s instanceof Element))return!1;var i=window.getComputedStyle(s);return i[o]!=="hidden"&&!(i.overflowY===i.overflowX&&!Jy(s)&&i[o]==="visible")},Xy=function(s){return Uh(s,"overflowY")},ev=function(s){return Uh(s,"overflowX")},Up=function(s,o){var i=o.ownerDocument,u=o;do{typeof ShadowRoot<"u"&&u instanceof ShadowRoot&&(u=u.host);var d=$h(s,u);if(d){var f=Bh(s,u),g=f[1],h=f[2];if(g>h)return!0}u=u.parentNode}while(u&&u!==i.body);return!1},tv=function(s){var o=s.scrollTop,i=s.scrollHeight,u=s.clientHeight;return[o,i,u]},rv=function(s){var o=s.scrollLeft,i=s.scrollWidth,u=s.clientWidth;return[o,i,u]},$h=function(s,o){return s==="v"?Xy(o):ev(o)},Bh=function(s,o){return s==="v"?tv(o):rv(o)},nv=function(s,o){return s==="h"&&o==="rtl"?-1:1},sv=function(s,o,i,u,d){var f=nv(s,window.getComputedStyle(o).direction),g=f*u,h=i.target,v=o.contains(h),x=!1,b=g>0,j=0,M=0;do{if(!h)break;var O=Bh(s,h),A=O[0],w=O[1],C=O[2],_=w-C-f*A;(A||_)&&$h(s,h)&&(j+=_,M+=A);var $=h.parentNode;h=$&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE?$.host:$}while(!v&&h!==document.body||v&&(o.contains(h)||o===h));return(b&&Math.abs(j)<1||!b&&Math.abs(M)<1)&&(x=!0),x},li=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},$p=function(s){return[s.deltaX,s.deltaY]},Bp=function(s){return s&&"current"in s?s.current:s},ov=function(s,o){return s[0]===o[0]&&s[1]===o[1]},lv=function(s){return` + .block-interactivity-`.concat(s,` {pointer-events: none;} + .allow-interactivity-`).concat(s,` {pointer-events: all;} +`)},iv=0,ms=[];function av(s){var o=m.useRef([]),i=m.useRef([0,0]),u=m.useRef(),d=m.useState(iv++)[0],f=m.useState(Fh)[0],g=m.useRef(s);m.useEffect(function(){g.current=s},[s]),m.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(d));var w=_y([s.lockRef.current],(s.shards||[]).map(Bp),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(d))})}}},[s.inert,s.lockRef.current,s.shards]);var h=m.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!g.current.allowPinchZoom;var _=li(w),$=i.current,V="deltaX"in w?w.deltaX:$[0]-_[0],z="deltaY"in w?w.deltaY:$[1]-_[1],L,B=w.target,J=Math.abs(V)>Math.abs(z)?"h":"v";if("touches"in w&&J==="h"&&B.type==="range")return!1;var te=window.getSelection(),re=te&&te.anchorNode,ee=re?re===B||re.contains(B):!1;if(ee)return!1;var ge=Up(J,B);if(!ge)return!0;if(ge?L=J:(L=J==="v"?"h":"v",ge=Up(J,B)),!ge)return!1;if(!u.current&&"changedTouches"in w&&(V||z)&&(u.current=L),!L)return!0;var ue=u.current||L;return sv(ue,C,w,ue==="h"?V:z)},[]),v=m.useCallback(function(w){var C=w;if(!(!ms.length||ms[ms.length-1]!==f)){var _="deltaY"in C?$p(C):li(C),$=o.current.filter(function(L){return L.name===C.type&&(L.target===C.target||C.target===L.shadowParent)&&ov(L.delta,_)})[0];if($&&$.should){C.cancelable&&C.preventDefault();return}if(!$){var V=(g.current.shards||[]).map(Bp).filter(Boolean).filter(function(L){return L.contains(C.target)}),z=V.length>0?h(C,V[0]):!g.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),x=m.useCallback(function(w,C,_,$){var V={name:w,delta:C,target:_,should:$,shadowParent:uv(_)};o.current.push(V),setTimeout(function(){o.current=o.current.filter(function(z){return z!==V})},1)},[]),b=m.useCallback(function(w){i.current=li(w),u.current=void 0},[]),j=m.useCallback(function(w){x(w.type,$p(w),w.target,h(w,s.lockRef.current))},[]),M=m.useCallback(function(w){x(w.type,li(w),w.target,h(w,s.lockRef.current))},[]);m.useEffect(function(){return ms.push(f),s.setCallbacks({onScrollCapture:j,onWheelCapture:j,onTouchMoveCapture:M}),document.addEventListener("wheel",v,hs),document.addEventListener("touchmove",v,hs),document.addEventListener("touchstart",b,hs),function(){ms=ms.filter(function(w){return w!==f}),document.removeEventListener("wheel",v,hs),document.removeEventListener("touchmove",v,hs),document.removeEventListener("touchstart",b,hs)}},[]);var O=s.removeScrollBar,A=s.inert;return m.createElement(m.Fragment,null,A?m.createElement(f,{styles:lv(d)}):null,O?m.createElement(Yy,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function uv(s){for(var o=null;s!==null;)s instanceof ShadowRoot&&(o=s.host,s=s.host),s=s.parentNode;return o}const cv=Iy(Ih,av);var Hh=m.forwardRef(function(s,o){return m.createElement(wi,ar({},s,{ref:o,sideCar:cv}))});Hh.classNames=wi.classNames;var dv=function(s){if(typeof document>"u")return null;var o=Array.isArray(s)?s[0]:s;return o.ownerDocument.body},gs=new WeakMap,ii=new WeakMap,ai={},Cu=0,Wh=function(s){return s&&(s.host||Wh(s.parentNode))},fv=function(s,o){return o.map(function(i){if(s.contains(i))return i;var u=Wh(i);return u&&s.contains(u)?u:(console.error("aria-hidden",i,"in not contained inside",s,". Doing nothing"),null)}).filter(function(i){return!!i})},pv=function(s,o,i,u){var d=fv(o,Array.isArray(s)?s:[s]);ai[i]||(ai[i]=new WeakMap);var f=ai[i],g=[],h=new Set,v=new Set(d),x=function(j){!j||h.has(j)||(h.add(j),x(j.parentNode))};d.forEach(x);var b=function(j){!j||v.has(j)||Array.prototype.forEach.call(j.children,function(M){if(h.has(M))b(M);else try{var O=M.getAttribute(u),A=O!==null&&O!=="false",w=(gs.get(M)||0)+1,C=(f.get(M)||0)+1;gs.set(M,w),f.set(M,C),g.push(M),w===1&&A&&ii.set(M,!0),C===1&&M.setAttribute(i,"true"),A||M.setAttribute(u,"true")}catch(_){console.error("aria-hidden: cannot operate on ",M,_)}})};return b(o),h.clear(),Cu++,function(){g.forEach(function(j){var M=gs.get(j)-1,O=f.get(j)-1;gs.set(j,M),f.set(j,O),M||(ii.has(j)||j.removeAttribute(u),ii.delete(j)),O||j.removeAttribute(i)}),Cu--,Cu||(gs=new WeakMap,gs=new WeakMap,ii=new WeakMap,ai={})}},hv=function(s,o,i){i===void 0&&(i="data-aria-hidden");var u=Array.from(Array.isArray(s)?s:[s]),d=dv(s);return d?(u.push.apply(u,Array.from(d.querySelectorAll("[aria-live], script"))),pv(u,d,i,"aria-hidden")):function(){return null}},ji="Dialog",[Vh]=B0(ji),[mv,Jt]=Vh(ji),Gh=s=>{const{__scopeDialog:o,children:i,open:u,defaultOpen:d,onOpenChange:f,modal:g=!0}=s,h=m.useRef(null),v=m.useRef(null),[x,b]=K0({prop:u,defaultProp:d??!1,onChange:f,caller:ji});return n.jsx(mv,{scope:o,triggerRef:h,contentRef:v,contentId:Nr(),titleId:Nr(),descriptionId:Nr(),open:x,onOpenChange:b,onOpenToggle:m.useCallback(()=>b(j=>!j),[b]),modal:g,children:i})};Gh.displayName=ji;var Kh="DialogTrigger",gv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(Kh,i),f=Un(o,d.triggerRef);return n.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":hc(d.open),...u,ref:f,onClick:on(s.onClick,d.onOpenToggle)})});gv.displayName=Kh;var pc="DialogPortal",[xv,Qh]=Vh(pc,{forceMount:void 0}),qh=s=>{const{__scopeDialog:o,forceMount:i,children:u,container:d}=s,f=Jt(pc,o);return n.jsx(xv,{scope:o,forceMount:i,children:m.Children.map(u,g=>n.jsx(bi,{present:i||f.open,children:n.jsx(Ah,{asChild:!0,container:d,children:g})}))})};qh.displayName=pc;var vi="DialogOverlay",Zh=m.forwardRef((s,o)=>{const i=Qh(vi,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=Jt(vi,s.__scopeDialog);return f.modal?n.jsx(bi,{present:u||f.open,children:n.jsx(vv,{...d,ref:o})}):null});Zh.displayName=vi;var yv=Mh("DialogOverlay.RemoveScroll"),vv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(vi,i),f=py(),g=Un(o,f);return n.jsx(Hh,{as:yv,allowPinchZoom:!0,shards:[d.contentRef],children:n.jsx(it.div,{"data-state":hc(d.open),...u,ref:g,style:{pointerEvents:"auto",...u.style}})})}),Ls="DialogContent",Yh=m.forwardRef((s,o)=>{const i=Qh(Ls,s.__scopeDialog),{forceMount:u=i.forceMount,...d}=s,f=Jt(Ls,s.__scopeDialog);return n.jsx(bi,{present:u||f.open,children:f.modal?n.jsx(bv,{...d,ref:o}):n.jsx(wv,{...d,ref:o})})});Yh.displayName=Ls;var bv=m.forwardRef((s,o)=>{const i=Jt(Ls,s.__scopeDialog),u=m.useRef(null),d=Un(o,i.contentRef,u);return m.useEffect(()=>{const f=u.current;if(f)return hv(f)},[]),n.jsx(Jh,{...s,ref:d,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:on(s.onCloseAutoFocus,f=>{var g;f.preventDefault(),(g=i.triggerRef.current)==null||g.focus()}),onPointerDownOutside:on(s.onPointerDownOutside,f=>{const g=f.detail.originalEvent,h=g.button===0&&g.ctrlKey===!0;(g.button===2||h)&&f.preventDefault()}),onFocusOutside:on(s.onFocusOutside,f=>f.preventDefault())})}),wv=m.forwardRef((s,o)=>{const i=Jt(Ls,s.__scopeDialog),u=m.useRef(!1),d=m.useRef(!1);return n.jsx(Jh,{...s,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var g,h;(g=s.onCloseAutoFocus)==null||g.call(s,f),f.defaultPrevented||(u.current||(h=i.triggerRef.current)==null||h.focus(),f.preventDefault()),u.current=!1,d.current=!1},onInteractOutside:f=>{var v,x;(v=s.onInteractOutside)==null||v.call(s,f),f.defaultPrevented||(u.current=!0,f.detail.originalEvent.type==="pointerdown"&&(d.current=!0));const g=f.target;((x=i.triggerRef.current)==null?void 0:x.contains(g))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&d.current&&f.preventDefault()}})}),Jh=m.forwardRef((s,o)=>{const{__scopeDialog:i,trapFocus:u,onOpenAutoFocus:d,onCloseAutoFocus:f,...g}=s,h=Jt(Ls,i);return Py(),n.jsx(n.Fragment,{children:n.jsx(Dh,{asChild:!0,loop:!0,trapped:u,onMountAutoFocus:d,onUnmountAutoFocus:f,children:n.jsx(Rh,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":hc(h.open),...g,ref:o,deferPointerDownOutside:!0,onDismiss:()=>h.onOpenChange(!1)})})})}),Xh="DialogTitle",jv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(Xh,i);return n.jsx(it.h2,{id:d.titleId,...u,ref:o})});jv.displayName=Xh;var em="DialogDescription",kv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(em,i);return n.jsx(it.p,{id:d.descriptionId,...u,ref:o})});kv.displayName=em;var tm="DialogClose",Nv=m.forwardRef((s,o)=>{const{__scopeDialog:i,...u}=s,d=Jt(tm,i);return n.jsx(it.button,{type:"button",...u,ref:o,onClick:on(s.onClick,()=>d.onOpenChange(!1))})});Nv.displayName=tm;function hc(s){return s?"open":"closed"}var So='[cmdk-group=""]',Eu='[cmdk-group-items=""]',Sv='[cmdk-group-heading=""]',rm='[cmdk-item=""]',Hp=`${rm}:not([aria-disabled="true"])`,ec="cmdk-item-select",ys="data-value",Cv=(s,o,i)=>$0(s,o,i),nm=m.createContext(void 0),Wo=()=>m.useContext(nm),sm=m.createContext(void 0),mc=()=>m.useContext(sm),om=m.createContext(void 0),lm=m.forwardRef((s,o)=>{let i=vs(()=>{var k,G;return{search:"",value:(G=(k=s.value)!=null?k:s.defaultValue)!=null?G:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=vs(()=>new Set),d=vs(()=>new Map),f=vs(()=>new Map),g=vs(()=>new Set),h=im(s),{label:v,children:x,value:b,onValueChange:j,filter:M,shouldFilter:O,loop:A,disablePointerSelection:w=!1,vimBindings:C=!0,..._}=s,$=Nr(),V=Nr(),z=Nr(),L=m.useRef(null),B=Lv();In(()=>{if(b!==void 0){let k=b.trim();i.current.value=k,J.emit()}},[b]),In(()=>{B(6,Ae)},[]);let J=m.useMemo(()=>({subscribe:k=>(g.current.add(k),()=>g.current.delete(k)),snapshot:()=>i.current,setState:(k,G,X)=>{var Z,ie,he,xe;if(!Object.is(i.current[k],G)){if(i.current[k]=G,k==="search")ue(),ee(),B(1,ge);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(z);U?U.focus():(Z=document.getElementById($))==null||Z.focus()}if(B(7,()=>{var U;i.current.selectedItemId=(U=Ee())==null?void 0:U.id,J.emit()}),X||B(5,Ae),((ie=h.current)==null?void 0:ie.value)!==void 0){let U=G??"";(xe=(he=h.current).onValueChange)==null||xe.call(he,U);return}}J.emit()}},emit:()=>{g.current.forEach(k=>k())}}),[]),te=m.useMemo(()=>({value:(k,G,X)=>{var Z;G!==((Z=f.current.get(k))==null?void 0:Z.value)&&(f.current.set(k,{value:G,keywords:X}),i.current.filtered.items.set(k,re(G,X)),B(2,()=>{ee(),J.emit()}))},item:(k,G)=>(u.current.add(k),G&&(d.current.has(G)?d.current.get(G).add(k):d.current.set(G,new Set([k]))),B(3,()=>{ue(),ee(),i.current.value||ge(),J.emit()}),()=>{f.current.delete(k),u.current.delete(k),i.current.filtered.items.delete(k);let X=Ee();B(4,()=>{ue(),(X==null?void 0:X.getAttribute("id"))===k&&ge(),J.emit()})}),group:k=>(d.current.has(k)||d.current.set(k,new Set),()=>{f.current.delete(k),d.current.delete(k)}),filter:()=>h.current.shouldFilter,label:v||s["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:$,inputId:z,labelId:V,listInnerRef:L}),[]);function re(k,G){var X,Z;let ie=(Z=(X=h.current)==null?void 0:X.filter)!=null?Z:Cv;return k?ie(k,i.current.search,G):0}function ee(){if(!i.current.search||h.current.shouldFilter===!1)return;let k=i.current.filtered.items,G=[];i.current.filtered.groups.forEach(Z=>{let ie=d.current.get(Z),he=0;ie.forEach(xe=>{let U=k.get(xe);he=Math.max(U,he)}),G.push([Z,he])});let X=L.current;De().sort((Z,ie)=>{var he,xe;let U=Z.getAttribute("id"),F=ie.getAttribute("id");return((he=k.get(F))!=null?he:0)-((xe=k.get(U))!=null?xe:0)}).forEach(Z=>{let ie=Z.closest(Eu);ie?ie.appendChild(Z.parentElement===ie?Z:Z.closest(`${Eu} > *`)):X.appendChild(Z.parentElement===X?Z:Z.closest(`${Eu} > *`))}),G.sort((Z,ie)=>ie[1]-Z[1]).forEach(Z=>{var ie;let he=(ie=L.current)==null?void 0:ie.querySelector(`${So}[${ys}="${encodeURIComponent(Z[0])}"]`);he==null||he.parentElement.appendChild(he)})}function ge(){let k=De().find(X=>X.getAttribute("aria-disabled")!=="true"),G=k==null?void 0:k.getAttribute(ys);J.setState("value",G||void 0)}function ue(){var k,G,X,Z;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=u.current.size;return}i.current.filtered.groups=new Set;let ie=0;for(let he of u.current){let xe=(G=(k=f.current.get(he))==null?void 0:k.value)!=null?G:"",U=(Z=(X=f.current.get(he))==null?void 0:X.keywords)!=null?Z:[],F=re(xe,U);i.current.filtered.items.set(he,F),F>0&&ie++}for(let[he,xe]of d.current)for(let U of xe)if(i.current.filtered.items.get(U)>0){i.current.filtered.groups.add(he);break}i.current.filtered.count=ie}function Ae(){var k,G,X;let Z=Ee();Z&&(((k=Z.parentElement)==null?void 0:k.firstChild)===Z&&((X=(G=Z.closest(So))==null?void 0:G.querySelector(Sv))==null||X.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function Ee(){var k;return(k=L.current)==null?void 0:k.querySelector(`${rm}[aria-selected="true"]`)}function De(){var k;return Array.from(((k=L.current)==null?void 0:k.querySelectorAll(Hp))||[])}function Me(k){let G=De()[k];G&&J.setState("value",G.getAttribute(ys))}function Pe(k){var G;let X=Ee(),Z=De(),ie=Z.findIndex(xe=>xe===X),he=Z[ie+k];(G=h.current)!=null&&G.loop&&(he=ie+k<0?Z[Z.length-1]:ie+k===Z.length?Z[0]:Z[ie+k]),he&&J.setState("value",he.getAttribute(ys))}function Q(k){let G=Ee(),X=G==null?void 0:G.closest(So),Z;for(;X&&!Z;)X=k>0?Av(X,So):zv(X,So),Z=X==null?void 0:X.querySelector(Hp);Z?J.setState("value",Z.getAttribute(ys)):Pe(k)}let ce=()=>Me(De().length-1),q=k=>{k.preventDefault(),k.metaKey?ce():k.altKey?Q(1):Pe(1)},E=k=>{k.preventDefault(),k.metaKey?Me(0):k.altKey?Q(-1):Pe(-1)};return m.createElement(it.div,{ref:o,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:k=>{var G;(G=_.onKeyDown)==null||G.call(_,k);let X=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||X))switch(k.key){case"n":case"j":{C&&k.ctrlKey&&q(k);break}case"ArrowDown":{q(k);break}case"p":case"k":{C&&k.ctrlKey&&E(k);break}case"ArrowUp":{E(k);break}case"Home":{k.preventDefault(),Me(0);break}case"End":{k.preventDefault(),ce();break}case"Enter":{k.preventDefault();let Z=Ee();if(Z){let ie=new Event(ec);Z.dispatchEvent(ie)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:te.inputId,id:te.labelId,style:Fv},v),ki(s,k=>m.createElement(sm.Provider,{value:J},m.createElement(nm.Provider,{value:te},k))))}),Ev=m.forwardRef((s,o)=>{var i,u;let d=Nr(),f=m.useRef(null),g=m.useContext(om),h=Wo(),v=im(s),x=(u=(i=v.current)==null?void 0:i.forceMount)!=null?u:g==null?void 0:g.forceMount;In(()=>{if(!x)return h.item(d,g==null?void 0:g.id)},[x]);let b=am(d,f,[s.value,s.children,f],s.keywords),j=mc(),M=ln(B=>B.value&&B.value===b.current),O=ln(B=>x||h.filter()===!1?!0:B.search?B.filtered.items.get(d)>0:!0);m.useEffect(()=>{let B=f.current;if(!(!B||s.disabled))return B.addEventListener(ec,A),()=>B.removeEventListener(ec,A)},[O,s.onSelect,s.disabled]);function A(){var B,J;w(),(J=(B=v.current).onSelect)==null||J.call(B,b.current)}function w(){j.setState("value",b.current,!0)}if(!O)return null;let{disabled:C,value:_,onSelect:$,forceMount:V,keywords:z,...L}=s;return m.createElement(it.div,{ref:zs(f,o),...L,id:d,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!M,"data-disabled":!!C,"data-selected":!!M,onPointerMove:C||h.getDisablePointerSelection()?void 0:w,onClick:C?void 0:A},s.children)}),Pv=m.forwardRef((s,o)=>{let{heading:i,children:u,forceMount:d,...f}=s,g=Nr(),h=m.useRef(null),v=m.useRef(null),x=Nr(),b=Wo(),j=ln(O=>d||b.filter()===!1?!0:O.search?O.filtered.groups.has(g):!0);In(()=>b.group(g),[]),am(g,h,[s.value,s.heading,v]);let M=m.useMemo(()=>({id:g,forceMount:d}),[d]);return m.createElement(it.div,{ref:zs(h,o),...f,"cmdk-group":"",role:"presentation",hidden:j?void 0:!0},i&&m.createElement("div",{ref:v,"cmdk-group-heading":"","aria-hidden":!0,id:x},i),ki(s,O=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?x:void 0},m.createElement(om.Provider,{value:M},O))))}),_v=m.forwardRef((s,o)=>{let{alwaysRender:i,...u}=s,d=m.useRef(null),f=ln(g=>!g.search);return!i&&!f?null:m.createElement(it.div,{ref:zs(d,o),...u,"cmdk-separator":"",role:"separator"})}),Mv=m.forwardRef((s,o)=>{let{onValueChange:i,...u}=s,d=s.value!=null,f=mc(),g=ln(x=>x.search),h=ln(x=>x.selectedItemId),v=Wo();return m.useEffect(()=>{s.value!=null&&f.setState("search",s.value)},[s.value]),m.createElement(it.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":v.listId,"aria-labelledby":v.labelId,"aria-activedescendant":h,id:v.inputId,type:"text",value:d?s.value:g,onChange:x=>{d||f.setState("search",x.target.value),i==null||i(x.target.value)}})}),Rv=m.forwardRef((s,o)=>{let{children:i,label:u="Suggestions",...d}=s,f=m.useRef(null),g=m.useRef(null),h=ln(x=>x.selectedItemId),v=Wo();return m.useEffect(()=>{if(g.current&&f.current){let x=g.current,b=f.current,j,M=new ResizeObserver(()=>{j=requestAnimationFrame(()=>{let O=x.offsetHeight;b.style.setProperty("--cmdk-list-height",O.toFixed(1)+"px")})});return M.observe(x),()=>{cancelAnimationFrame(j),M.unobserve(x)}}},[]),m.createElement(it.div,{ref:zs(f,o),...d,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":u,id:v.listId},ki(s,x=>m.createElement("div",{ref:zs(g,v.listInnerRef),"cmdk-list-sizer":""},x)))}),Ov=m.forwardRef((s,o)=>{let{open:i,onOpenChange:u,overlayClassName:d,contentClassName:f,container:g,...h}=s;return m.createElement(Gh,{open:i,onOpenChange:u},m.createElement(qh,{container:g},m.createElement(Zh,{"cmdk-overlay":"",className:d}),m.createElement(Yh,{"aria-label":s.label,"cmdk-dialog":"",className:f},m.createElement(lm,{ref:o,...h}))))}),Dv=m.forwardRef((s,o)=>ln(i=>i.filtered.count===0)?m.createElement(it.div,{ref:o,...s,"cmdk-empty":"",role:"presentation"}):null),Tv=m.forwardRef((s,o)=>{let{progress:i,children:u,label:d="Loading...",...f}=s;return m.createElement(it.div,{ref:o,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":d},ki(s,g=>m.createElement("div",{"aria-hidden":!0},g)))}),xs=Object.assign(lm,{List:Rv,Item:Ev,Input:Mv,Group:Pv,Separator:_v,Dialog:Ov,Empty:Dv,Loading:Tv});function Av(s,o){let i=s.nextElementSibling;for(;i;){if(i.matches(o))return i;i=i.nextElementSibling}}function zv(s,o){let i=s.previousElementSibling;for(;i;){if(i.matches(o))return i;i=i.previousElementSibling}}function im(s){let o=m.useRef(s);return In(()=>{o.current=s}),o}var In=typeof window>"u"?m.useEffect:m.useLayoutEffect;function vs(s){let o=m.useRef();return o.current===void 0&&(o.current=s()),o}function ln(s){let o=mc(),i=()=>s(o.snapshot());return m.useSyncExternalStore(o.subscribe,i,i)}function am(s,o,i,u=[]){let d=m.useRef(),f=Wo();return In(()=>{var g;let h=(()=>{var x;for(let b of i){if(typeof b=="string")return b.trim();if(typeof b=="object"&&"current"in b)return b.current?(x=b.current.textContent)==null?void 0:x.trim():d.current}})(),v=u.map(x=>x.trim());f.value(s,h,v),(g=o.current)==null||g.setAttribute(ys,h),d.current=h}),d}var Lv=()=>{let[s,o]=m.useState(),i=vs(()=>new Map);return In(()=>{i.current.forEach(u=>u()),i.current=new Map},[s]),(u,d)=>{i.current.set(u,d),o({})}};function Iv(s){let o=s.type;return typeof o=="function"?o(s.props):"render"in o?o.render(s.props):s}function ki({asChild:s,children:o},i){return s&&m.isValidElement(o)?m.cloneElement(Iv(o),{ref:o.ref},i(o.props.children)):i(o)}var Fv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Uv({onNavigate:s}){const[o,i]=m.useState(!1);return m.useEffect(()=>{const u=d=>{(d.metaKey||d.ctrlKey)&&d.key.toLowerCase()==="k"&&(d.preventDefault(),i(f=>!f))};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[]),n.jsx(xs.Dialog,{open:o,onOpenChange:i,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>i(!1),children:n.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:u=>u.stopPropagation(),children:[n.jsx(xs.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),n.jsxs(xs.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(xs.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(xs.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:Zu.map(u=>n.jsxs(xs.Item,{value:`${u.label} ${u.hint}`,onSelect:()=>{s(u.id),i(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[n.jsx(u.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:u.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:u.hint})]},u.id))})]})]})})}async function me(s,o){var v;const i={"Content-Type":"application/json",...o==null?void 0:o.headers},u=localStorage.getItem("mc_sudo_password"),d=localStorage.getItem("mc_hf_token");u&&(i["X-Sudo-Password"]=u);let f=o==null?void 0:o.body;if((((v=o==null?void 0:o.method)==null?void 0:v.toUpperCase())||"GET")==="POST"){if(typeof f=="string")try{const x=JSON.parse(f);let b=!1;u&&!("sudo_password"in x)&&(x.sudo_password=u,b=!0),d&&!("hf_token"in x)&&(x.hf_token=d,b=!0),b&&(f=JSON.stringify(x))}catch{}else if(!f){const x={};u&&(x.sudo_password=u),d&&(x.hf_token=d),Object.keys(x).length>0&&(f=JSON.stringify(x))}}const h=await fetch(s,{...o,headers:i,body:f});if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return h.json()}function um(s){var o,i,u="";if(typeof s=="string"||typeof s=="number")u+=s;else if(typeof s=="object")if(Array.isArray(s)){var d=s.length;for(o=0;o{const o=Wv(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:u}=s;return{getClassGroupId:g=>{const h=g.split(gc);return h[0]===""&&h.length!==1&&h.shift(),cm(h,o)||Hv(g)},getConflictingClassGroupIds:(g,h)=>{const v=i[g]||[];return h&&u[g]?[...v,...u[g]]:v}}},cm=(s,o)=>{var g;if(s.length===0)return o.classGroupId;const i=s[0],u=o.nextPart.get(i),d=u?cm(s.slice(1),u):void 0;if(d)return d;if(o.validators.length===0)return;const f=s.join(gc);return(g=o.validators.find(({validator:h})=>h(f)))==null?void 0:g.classGroupId},Wp=/^\[(.+)\]$/,Hv=s=>{if(Wp.test(s)){const o=Wp.exec(s)[1],i=o==null?void 0:o.substring(0,o.indexOf(":"));if(i)return"arbitrary.."+i}},Wv=s=>{const{theme:o,prefix:i}=s,u={nextPart:new Map,validators:[]};return Gv(Object.entries(s.classGroups),i).forEach(([f,g])=>{tc(g,u,f,o)}),u},tc=(s,o,i,u)=>{s.forEach(d=>{if(typeof d=="string"){const f=d===""?o:Vp(o,d);f.classGroupId=i;return}if(typeof d=="function"){if(Vv(d)){tc(d(u),o,i,u);return}o.validators.push({validator:d,classGroupId:i});return}Object.entries(d).forEach(([f,g])=>{tc(g,Vp(o,f),i,u)})})},Vp=(s,o)=>{let i=s;return o.split(gc).forEach(u=>{i.nextPart.has(u)||i.nextPart.set(u,{nextPart:new Map,validators:[]}),i=i.nextPart.get(u)}),i},Vv=s=>s.isThemeGetter,Gv=(s,o)=>o?s.map(([i,u])=>{const d=u.map(f=>typeof f=="string"?o+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([g,h])=>[o+g,h])):f);return[i,d]}):s,Kv=s=>{if(s<1)return{get:()=>{},set:()=>{}};let o=0,i=new Map,u=new Map;const d=(f,g)=>{i.set(f,g),o++,o>s&&(o=0,u=i,i=new Map)};return{get(f){let g=i.get(f);if(g!==void 0)return g;if((g=u.get(f))!==void 0)return d(f,g),g},set(f,g){i.has(f)?i.set(f,g):d(f,g)}}},dm="!",Qv=s=>{const{separator:o,experimentalParseClassName:i}=s,u=o.length===1,d=o[0],f=o.length,g=h=>{const v=[];let x=0,b=0,j;for(let C=0;Cb?j-b:void 0;return{modifiers:v,hasImportantModifier:O,baseClassName:A,maybePostfixModifierPosition:w}};return i?h=>i({className:h,parseClassName:g}):g},qv=s=>{if(s.length<=1)return s;const o=[];let i=[];return s.forEach(u=>{u[0]==="["?(o.push(...i.sort(),u),i=[]):i.push(u)}),o.push(...i.sort()),o},Zv=s=>({cache:Kv(s.cacheSize),parseClassName:Qv(s),...Bv(s)}),Yv=/\s+/,Jv=(s,o)=>{const{parseClassName:i,getClassGroupId:u,getConflictingClassGroupIds:d}=o,f=[],g=s.trim().split(Yv);let h="";for(let v=g.length-1;v>=0;v-=1){const x=g[v],{modifiers:b,hasImportantModifier:j,baseClassName:M,maybePostfixModifierPosition:O}=i(x);let A=!!O,w=u(A?M.substring(0,O):M);if(!w){if(!A){h=x+(h.length>0?" "+h:h);continue}if(w=u(M),!w){h=x+(h.length>0?" "+h:h);continue}A=!1}const C=qv(b).join(":"),_=j?C+dm:C,$=_+w;if(f.includes($))continue;f.push($);const V=d(w,A);for(let z=0;z0?" "+h:h)}return h};function Xv(){let s=0,o,i,u="";for(;s{if(typeof s=="string")return s;let o,i="";for(let u=0;uj(b),s());return i=Zv(x),u=i.cache.get,d=i.cache.set,f=h,h(v)}function h(v){const x=u(v);if(x)return x;const b=Jv(v,i);return d(v,b),b}return function(){return f(Xv.apply(null,arguments))}}const He=s=>{const o=i=>i[s]||[];return o.isThemeGetter=!0,o},pm=/^\[(?:([a-z-]+):)?(.+)\]$/i,tb=/^\d+\/\d+$/,rb=new Set(["px","full","screen"]),nb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sb=/\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$/,ob=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ib=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,br=s=>ws(s)||rb.has(s)||tb.test(s),Gr=s=>Is(s,"length",mb),ws=s=>!!s&&!Number.isNaN(Number(s)),Pu=s=>Is(s,"number",ws),Co=s=>!!s&&Number.isInteger(Number(s)),ab=s=>s.endsWith("%")&&ws(s.slice(0,-1)),Se=s=>pm.test(s),Kr=s=>nb.test(s),ub=new Set(["length","size","percentage"]),cb=s=>Is(s,ub,hm),db=s=>Is(s,"position",hm),fb=new Set(["image","url"]),pb=s=>Is(s,fb,xb),hb=s=>Is(s,"",gb),Eo=()=>!0,Is=(s,o,i)=>{const u=pm.exec(s);return u?u[1]?typeof o=="string"?u[1]===o:o.has(u[1]):i(u[2]):!1},mb=s=>sb.test(s)&&!ob.test(s),hm=()=>!1,gb=s=>lb.test(s),xb=s=>ib.test(s),yb=()=>{const s=He("colors"),o=He("spacing"),i=He("blur"),u=He("brightness"),d=He("borderColor"),f=He("borderRadius"),g=He("borderSpacing"),h=He("borderWidth"),v=He("contrast"),x=He("grayscale"),b=He("hueRotate"),j=He("invert"),M=He("gap"),O=He("gradientColorStops"),A=He("gradientColorStopPositions"),w=He("inset"),C=He("margin"),_=He("opacity"),$=He("padding"),V=He("saturate"),z=He("scale"),L=He("sepia"),B=He("skew"),J=He("space"),te=He("translate"),re=()=>["auto","contain","none"],ee=()=>["auto","hidden","clip","visible","scroll"],ge=()=>["auto",Se,o],ue=()=>[Se,o],Ae=()=>["",br,Gr],Ee=()=>["auto",ws,Se],De=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Me=()=>["solid","dashed","dotted","double","none"],Pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Se],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>[ws,Se];return{cacheSize:500,separator:":",theme:{colors:[Eo],spacing:[br,Gr],blur:["none","",Kr,Se],brightness:E(),borderColor:[s],borderRadius:["none","","full",Kr,Se],borderSpacing:ue(),borderWidth:Ae(),contrast:E(),grayscale:ce(),hueRotate:E(),invert:ce(),gap:ue(),gradientColorStops:[s],gradientColorStopPositions:[ab,Gr],inset:ge(),margin:ge(),opacity:E(),padding:ue(),saturate:E(),scale:E(),sepia:ce(),skew:E(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",Se]}],container:["container"],columns:[{columns:[Kr]}],"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:[...De(),Se]}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:re()}],"overscroll-x":[{"overscroll-x":re()}],"overscroll-y":[{"overscroll-y":re()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Co,Se]}],basis:[{basis:ge()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Se]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",Co,Se]}],"grid-cols":[{"grid-cols":[Eo]}],"col-start-end":[{col:["auto",{span:["full",Co,Se]},Se]}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":[Eo]}],"row-start-end":[{row:["auto",{span:[Co,Se]},Se]}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Se]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Se]}],gap:[{gap:[M]}],"gap-x":[{"gap-x":[M]}],"gap-y":[{"gap-y":[M]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[$]}],px:[{px:[$]}],py:[{py:[$]}],ps:[{ps:[$]}],pe:[{pe:[$]}],pt:[{pt:[$]}],pr:[{pr:[$]}],pb:[{pb:[$]}],pl:[{pl:[$]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[J]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[J]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Se,o]}],"min-w":[{"min-w":[Se,o,"min","max","fit"]}],"max-w":[{"max-w":[Se,o,"none","full","min","max","fit","prose",{screen:[Kr]},Kr]}],h:[{h:[Se,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Se,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Se,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Se,o,"auto","min","max","fit"]}],"font-size":[{text:["base",Kr,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pu]}],"font-family":[{font:[Eo]}],"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",Se]}],"line-clamp":[{"line-clamp":["none",ws,Pu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",br,Se]}],"list-image":[{"list-image":["none",Se]}],"list-style-type":[{list:["none","disc","decimal",Se]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Me(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",br,Gr]}],"underline-offset":[{"underline-offset":["auto",br,Se]}],"text-decoration-color":[{decoration:[s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se]}],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",Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...De(),db]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",cb]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},pb]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[O]}],"gradient-via":[{via:[O]}],"gradient-to":[{to:[O]}],rounded:[{rounded:[f]}],"rounded-s":[{"rounded-s":[f]}],"rounded-e":[{"rounded-e":[f]}],"rounded-t":[{"rounded-t":[f]}],"rounded-r":[{"rounded-r":[f]}],"rounded-b":[{"rounded-b":[f]}],"rounded-l":[{"rounded-l":[f]}],"rounded-ss":[{"rounded-ss":[f]}],"rounded-se":[{"rounded-se":[f]}],"rounded-ee":[{"rounded-ee":[f]}],"rounded-es":[{"rounded-es":[f]}],"rounded-tl":[{"rounded-tl":[f]}],"rounded-tr":[{"rounded-tr":[f]}],"rounded-br":[{"rounded-br":[f]}],"rounded-bl":[{"rounded-bl":[f]}],"border-w":[{border:[h]}],"border-w-x":[{"border-x":[h]}],"border-w-y":[{"border-y":[h]}],"border-w-s":[{"border-s":[h]}],"border-w-e":[{"border-e":[h]}],"border-w-t":[{"border-t":[h]}],"border-w-r":[{"border-r":[h]}],"border-w-b":[{"border-b":[h]}],"border-w-l":[{"border-l":[h]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...Me(),"hidden"]}],"divide-x":[{"divide-x":[h]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[h]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:Me()}],"border-color":[{border:[d]}],"border-color-x":[{"border-x":[d]}],"border-color-y":[{"border-y":[d]}],"border-color-s":[{"border-s":[d]}],"border-color-e":[{"border-e":[d]}],"border-color-t":[{"border-t":[d]}],"border-color-r":[{"border-r":[d]}],"border-color-b":[{"border-b":[d]}],"border-color-l":[{"border-l":[d]}],"divide-color":[{divide:[d]}],"outline-style":[{outline:["",...Me()]}],"outline-offset":[{"outline-offset":[br,Se]}],"outline-w":[{outline:[br,Gr]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:Ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[br,Gr]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",Kr,hb]}],"shadow-color":[{shadow:[Eo]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...Pe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Pe()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[u]}],contrast:[{contrast:[v]}],"drop-shadow":[{"drop-shadow":["","none",Kr,Se]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[j]}],saturate:[{saturate:[V]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[u]}],"backdrop-contrast":[{"backdrop-contrast":[v]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[j]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[V]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[g]}],"border-spacing-x":[{"border-spacing-x":[g]}],"border-spacing-y":[{"border-spacing-y":[g]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Se]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",Se]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",Se]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Co,Se]}],"translate-x":[{"translate-x":[te]}],"translate-y":[{"translate-y":[te]}],"skew-x":[{"skew-x":[B]}],"skew-y":[{"skew-y":[B]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Se]}],accent:[{accent:["auto",s]}],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",Se]}],"caret-color":[{caret:[s]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"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",Se]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[br,Gr,Pu]}],stroke:[{stroke:[s,"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"]}}},vb=eb(yb);function ne(...s){return vb($v(s))}function Lo(s){return s?s.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function St(s){return(s/1024**3).toFixed(1)}function rc(s){return s?s>1024**3?`${(s/1024**3).toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`:""}function jn(s){if(!s)return"—";const o=s/1024**3;return o>=1?`${o.toFixed(1)} GB`:`${(s/1024**2).toFixed(0)} MB`}function bb(s){if(!s)return"";const o=Math.floor(s/60);return o>0?`${o} min`:`${s} s`}function Gp(s){return s?`${Math.round(s/1024)}k`:"—"}function Vo({type:s,title:o,message:i,defaultValue:u,onConfirm:d,onCancel:f}){const g=m.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:o}),n.jsx("button",{onClick:f||(()=>d()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i}),s==="prompt"&&n.jsx("input",{ref:g,type:"text",defaultValue:u,className:"w-full h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:h=>{var v;h.key==="Enter"&&d((v=g.current)==null?void 0:v.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(s==="confirm"||s==="prompt")&&n.jsx("button",{onClick:f,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:()=>{var v;const h=s==="prompt"?(v=g.current)==null?void 0:v.value:void 0;d(h)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:s==="confirm"?"Ja, fortfahren":s==="prompt"?"Übernehmen":"OK"})]})]})})}function ui({value:s,label:o,detail:i}){const d=2*Math.PI*24,f=d-Math.min(s,100)/100*d,g=s>90?"stroke-red-500":s>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ne("fill-none transition-all duration-700 ease-out",g),strokeWidth:"4.5",strokeDasharray:d,strokeDashoffset:f,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(s),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:o}),i&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function wb(){var U;const[s,o]=m.useState(null),[i,u]=m.useState(null),[d,f]=m.useState([]),[g,h]=m.useState([]),[v,x]=m.useState([]),[b,j]=m.useState(null),[M,O]=m.useState([]),[A,w]=m.useState(null),[C,_]=m.useState(""),[$,V]=m.useState(!1),[z,L]=m.useState(""),[B,J]=m.useState(!1),[te,re]=m.useState({open:!1,actionPath:"",actionLabel:""}),[ee,ge]=m.useState(null),[ue,Ae]=m.useState(!1);async function Ee(F){try{await me("/api/agent/brain",{method:"POST",body:JSON.stringify({model:F})}),ge({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${F}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>ge(null)}),k(),Ae(!1)}catch(we){ge({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${we.message}`,onConfirm:()=>ge(null)})}}function De(F,we,at){ge({type:"confirm",title:F,message:we,onConfirm:()=>{ge(null),at()},onCancel:()=>ge(null)})}const[Me,Pe]=m.useState(""),[Q,ce]=m.useState("stable"),[q,E]=m.useState(!1);function k(){me("/api/system/status").then(o).catch(()=>{}),me("/api/agent/status").then(u).catch(()=>{}),me("/api/models").then(F=>{f(F.models||[]),h(F.running||[])}).catch(()=>{}),me("/api/memory?category=").then(F=>x(F.slice(0,3))).catch(()=>{}),me("/api/maintenance/updates").then(j).catch(()=>{}),me("/api/jobs").then(F=>O(F.jobs||[])).catch(()=>{}),me("/api/system/token-stats").then(w).catch(()=>{})}m.useEffect(()=>{k();const F=setInterval(k,3e3);return()=>clearInterval(F)},[]);async function G(F,we,at,Ct){_(`${we} wird ausgeführt...`),V(!0);try{const Et={...at},Pt=await me(F,{method:"POST",body:JSON.stringify(Et)});if(Pt.status==="password_required"||Pt.status==="incorrect_password"){re({open:!0,actionPath:F,actionLabel:we,payload:at,error:Pt.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),_("");return}Pt.job_id?_(`${we} gestartet (Job-ID: ${Pt.job_id})`):Pt.ok?_(`${we} erfolgreich ausgeführt.`):_(`Fehler: ${Pt.err||"Unbekannter Fehler"}`),k()}catch(Et){_(`Fehler bei ${we}: ${Et.message}`)}finally{V(!1)}}async function X(){J(!0);try{const F={...te.payload,sudo_password:z},we=await me(te.actionPath,{method:"POST",body:JSON.stringify(F)});if(we.status==="password_required"||we.status==="incorrect_password"){re(at=>({...at,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}we.job_id?_(`${te.actionLabel} gestartet (Job-ID: ${we.job_id})`):we.ok?_(`${te.actionLabel} erfolgreich ausgeführt.`):_(`Fehler: ${we.err||"Unbekannter Fehler"}`),re({open:!1,actionPath:"",actionLabel:""}),L(""),k()}catch(F){_(`Fehler: ${F.message}`),re({open:!1,actionPath:"",actionLabel:""}),L("")}finally{J(!1)}}async function Z(F,we){_(`Upgrade für ${F} wird gestartet...`);try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:F,role:we,quant:"Q4_K_M",jinja:!0})}),_("Upgrade-Download gestartet."),k()}catch(at){_(`Upgrade fehlgeschlagen: ${at.message}`)}}async function ie(){if(!(!Me.trim()||q)){E(!0);try{await me("/api/memory",{method:"POST",body:JSON.stringify({content:Me,category:Q,source:"dashboard"})}),Pe(""),me("/api/memory?category=").then(F=>x(F.slice(0,3))).catch(()=>{})}catch(F){console.error(F)}finally{E(!1)}}}const he=M.find(F=>F.label.includes("OS-Update")&&(F.state==="running"||F.state==="queued")),xe=M.find(F=>F.label.includes("Engine-Update")&&(F.state==="running"||F.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[te.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/60 bg-card/90 backdrop-blur-xl p-5 shadow-2xl space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{re({open:!1,actionPath:"",actionLabel:""}),L("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:te.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:z,onChange:F=>L(F.target.value),placeholder:"Sudo-Passwort eingeben...",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground",onKeyDown:F=>F.key==="Enter"&&X(),autoFocus:!0}),te.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:te.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{re({open:!1,actionPath:"",actionLabel:""}),L("")},className:"h-8 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent transition-all cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:X,disabled:!z||B,className:"h-8 px-4 rounded-lg bg-primary text-primary-foreground text-[10px] font-bold uppercase hover:opacity-90 transition-all disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5",children:B?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.jsxs("div",{className:"md:col-span-2 flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(At,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),s?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(ui,{value:s.cpu.percent,label:"CPU",detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0}),n.jsx(ui,{value:s.ram.percent,label:"RAM",detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`}),s.gpu&&s.gpu.busy_percent!=null&&s.gpu.gtt_used!=null&&s.gpu.gtt_total!=null&&n.jsx(ui,{value:s.gpu.busy_percent,label:"GPU",detail:`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB`}),s.disk&&n.jsx(ui,{value:s.disk.percent,label:"Disk",detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(s==null?void 0:s.temp)&&(s.temp.cpu||s.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[s.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",s.temp.cpu," °C"]}),s.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",s.temp.gpu," °C"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(P0,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(b==null?void 0:b.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(b.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),b?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.os>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:b.os>0?`${b.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.engine>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:b.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ne("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",b.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:b.models>0?`${b.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>G("/api/maintenance/os-update","OS-Update"),disabled:$||!!he,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:he?n.jsxs(n.Fragment,{children:[n.jsx(Tn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",he.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>G("/api/maintenance/engine-update","Engine-Update"),disabled:$||!!xe,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:xe?n.jsxs(n.Fragment,{children:[n.jsx(Tn,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",xe.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{De("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>G("/api/maintenance/reboot","Reboot"))},disabled:$,className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 text-red-400 text-[10px] font-bold uppercase hover:bg-red-500/10 transition-all cursor-pointer disabled:opacity-50",children:[n.jsx(Ch,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),b.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:b.model_list.map(F=>n.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-background/25 border border-border/30 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${F.role}: ${F.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:F.role}),": ",F.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Z(F.repo,F.role),className:"px-2 py-0.5 text-[8px] font-bold uppercase rounded bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer flex items-center gap-0.5",children:[n.jsx(An,{className:"h-2.5 w-2.5"})," Laden"]})]},F.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),C&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:C}),n.jsxs("div",{className:"text-[9px] text-muted-foreground/60 leading-normal border-t border-border/10 pt-2.5 flex items-start gap-1",children:[n.jsx(zn,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer")),className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer shadow-md shadow-primary/10",children:"System-Zentrale öffnen"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Oo,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(i==null?void 0:i.webui_url)&&n.jsxs("a",{href:Lo(i.webui_url),target:"_blank",rel:"noopener",className:ne("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",i.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(gi,{className:"h-3 w-3"})," Hermes öffnen"]})]}),i?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full",i.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:i.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full",i.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:i.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Ae(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(At,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(To,{className:"h-3.5 w-3.5"}),i.brain_model?`model: ${i.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(To,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(F=>{var Ct;const we=d.find(Et=>Et.role===F),at=we?g.includes(we.name):!1;return n.jsxs("div",{className:ne("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",at?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":we?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ne("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",F==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":F==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":F==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":F==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":F==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:F}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:we?(Ct=we.name.split("/").pop())==null?void 0:Ct.replace(/\.gguf$/i,""):"nicht zugewiesen"}),we&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[we.prompt_cache&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),we.spec_draft_model&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${we.spec_draft_model})`,children:"SPEC"}),we.parallel_slots>1&&n.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${we.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",we.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:we?at?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},F)})})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Do,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Me,onChange:F=>Pe(F.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:Q,onChange:F=>ce(F.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:ie,disabled:!Me.trim()||q,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[n.jsx(Sh,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:v.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):v.map(F=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:F.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:F.content,children:F.content})]},F.id))})]})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(m0,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(U=A==null?void 0:A.pricing)!=null&&U.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),i&&ue&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Ae(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...d.map(F=>{var we;return((we=F.name.split("/").pop())==null?void 0:we.replace(".gguf",""))||F.name})].map(F=>{const we=["auto","fast","heavy"].includes(F);return n.jsxs("button",{onClick:()=>Ee(F),className:ne("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",i.brain_model===F||!i.brain_model&&F==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:F}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:we?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(i.brain_model===F||!i.brain_model&&F==="auto")&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},F)})})]})}),ee&&n.jsx(Vo,{type:ee.type,title:ee.title,message:ee.message,onConfirm:()=>ee.onConfirm(),onCancel:ee.onCancel})]})}function kn({children:s,tone:o="muted"}){const i={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${i[o]}`,children:s})}function Kp({caps:s}){return s?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[s.coder&&n.jsx(kn,{children:"💻 Code"}),s.vision&&n.jsx(kn,{children:"👁 Bild"}),s.reasoning&&n.jsx(kn,{children:"🧠 Reason"}),s.moe&&n.jsxs(kn,{tone:"primary",children:["🧩 MoE",s.active_b?`·${s.active_b}b`:""]}),s.tools==="yes"&&n.jsx(kn,{tone:"primary",children:"🛠 Tools"}),s.tools==="likely"&&n.jsx(kn,{tone:"warn",children:"🛠 Tools?"}),s.embedding&&n.jsx(kn,{children:"🔢 Embed"})]}):null}function jb({onError:s}){const[o,i]=m.useState([]),[u,d]=m.useState(null);function f(){me("/api/jobs").then(x=>i(x.jobs||[])).catch(()=>{})}m.useEffect(()=>{f();const x=setInterval(f,2e3);return()=>clearInterval(x)},[]);async function g(x){try{await me(`/api/jobs/${x}/cancel`,{method:"POST"}),f()}catch(b){s?s(b.message):d(b.message)}}const h=o.filter(x=>x.state==="running"||x.state==="queued"),v=o.filter(x=>x.state!=="running"&&x.state!=="queued").slice(-3);return h.length===0&&v.length===0?null:n.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),h.map(x=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:x.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[x.progress??0,"% • ",rc(x.done_bytes),"/",rc(x.total_bytes),x.eta_s?` • ETA ${bb(x.eta_s)}`:""]}),n.jsx("button",{onClick:()=>g(x.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${x.progress??0}%`}})})]},x.id)),v.map(x=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:x.label}),n.jsx("span",{className:ne("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",x.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:x.state})]},x.id)),u&&n.jsx(Vo,{type:"alert",title:"Fehler",message:u,onConfirm:()=>d(null)})]})}function kb({fit:s}){const o={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[s.level];return n.jsxs("span",{className:ne("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",o),children:[s.text," • ",s.req_gb," GB RAM"]})}const Nb=["fast","heavy","coder","reasoning","agent","vision","scout"];function Qp(s){const o=s.toLowerCase();return o.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:o.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:o.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:o.includes("mistral")||o.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:o.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:o.includes("hermes")||o.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:o.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function Sb(){var Bn,Cr,ur,Hn,Us;const[s,o]=m.useState([]),[i,u]=m.useState([]),[d,f]=m.useState(null),[g,h]=m.useState(null),[v,x]=m.useState(null),[b,j]=m.useState(!0),[M,O]=m.useState(""),[A,w]=m.useState(null),[C,_]=m.useState(null),[$,V]=m.useState(!1),[z,L]=m.useState(null),[B,J]=m.useState("grid"),[te,re]=m.useState("all"),[ee,ge]=m.useState(null);function ue(T,le,ke){ge({type:"alert",title:T,message:le,onConfirm:()=>{ge(null)}})}function Ae(T,le,ke,Re){ge({type:"confirm",title:T,message:le,onConfirm:()=>{ge(null),ke()},onCancel:()=>{ge(null)}})}function Ee(T,le,ke,Re,Fe){ge({type:"prompt",title:T,message:le,defaultValue:ke,onConfirm:Ht=>{ge(null),Re(Ht)},onCancel:()=>{ge(null)}})}const De=s.filter(T=>te==="in_use"?!!T.role||i.includes(T.name):!0),[Me,Pe]=m.useState({width:800,height:360}),Q=m.useRef(null),ce=m.useCallback(T=>{if(Q.current&&(Q.current.disconnect(),Q.current=null),T){const le=new ResizeObserver(ke=>{if(!ke||ke.length===0)return;const Re=ke[0].contentRect;Pe({width:Re.width,height:Re.height})});le.observe(T),Q.current=le}},[]),q=Me.width,E=Me.height,k=T=>{const le=q*.1,ke=E*T,Re=q*.5,Fe=E*.5,Ht=q*.3,cr=ke,dr=q*.3;return`M ${le} ${ke} C ${Ht} ${cr}, ${dr} ${Fe}, ${Re} ${Fe}`},G=T=>{const le=q*.5,ke=E*.5,Re=q*.9,Fe=E*T,Ht=q*.7,cr=ke,dr=q*.7;return`M ${le} ${ke} C ${Ht} ${cr}, ${dr} ${Fe}, ${Re} ${Fe}`};function X(){Promise.all([me("/api/models"),me("/api/routing"),me("/api/connect"),me("/api/maintenance/updates")]).then(([T,le,ke,Re])=>{o(T.models||[]),u(T.running||[]),f(le),h(ke),x(Re)}).catch(T=>O(String(T))).finally(()=>j(!1))}m.useEffect(()=>{X();const T=setInterval(X,4e3);return()=>clearInterval(T)},[]);async function Z(T){try{await me(`/api/models/${encodeURIComponent(T)}/load`,{method:"POST"}),X()}catch(le){ue("Fehler",`Fehler beim Laden des Modells: ${le.message}`)}}async function ie(T){try{await me(`/api/models/${encodeURIComponent(T)}/unload`,{method:"POST"}),X()}catch(le){ue("Fehler",`Fehler beim Entladen des Modells: ${le.message}`)}}async function he(){try{await me("/api/models/unload",{method:"POST"}),X()}catch(T){ue("Fehler",`Fehler beim Entladen aller Modelle: ${T.message}`)}}async function xe(T,le){try{await me(`/api/models/${encodeURIComponent(le)}/role`,{method:"POST",body:JSON.stringify({role:T||null})}),X()}catch(ke){ue("Fehler",`Fehler beim Zuweisen der Rolle: ${ke.message||ke}`)}}async function U(T,le){Ee("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(le||32768),async ke=>{if(ke)try{await me(`/api/models/${encodeURIComponent(T)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ke,10)})}),X()}catch(Re){ue("Fehler",`Fehler beim Setzen des Kontexts: ${Re.message||Re}`)}})}async function F(T){Ae("Modell löschen?",`Modell '${T}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await me(`/api/models/${encodeURIComponent(T)}`,{method:"DELETE"}),X()}catch(le){ue("Fehler",`Fehler beim Löschen: ${le.message||le}`)}})}async function we(T,le,ke,Re){try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:le,quant:ke,jinja:Re})}),ue("Herunterladen gestartet",`Download für '${T}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Fe){ue("Fehler",`Fehler beim Starten des Upgrades: ${Fe.message||Fe}`)}}async function at(T){T&&(await navigator.clipboard.writeText(T),V(!0),setTimeout(()=>V(!1),1500))}if(b)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(M)return n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",M,")."]});const Ct=s.filter(T=>i.includes(T.name)),Et=Ct.reduce((T,le)=>T+(le.size_bytes||0),0),Pt=16*1024**3,Fs=Et>Pt?Et*1.2:Pt,$n=T=>s.find(le=>le.role===T),Sr=T=>{const le=$n(T);return le?i.includes(le.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",jn(Et)," / ",jn(Fs)," geladen"]}),i.length>0&&n.jsx("button",{onClick:he,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),n.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:Ct.length===0?n.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):Ct.map((T,le)=>{var Fe;const ke=(T.size_bytes||0)/Fs*100,Re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][le%4];return n.jsxs("div",{style:{width:`${ke}%`},className:ne("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Re),title:`${T.name} (${jn(T.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[T.role?`[${T.role}] `:"",(Fe=T.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:jn(T.size_bytes)})]},T.name)})})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),n.jsxs("div",{ref:ce,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:k(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="roocode"||A==="roocode")&&n.jsx("path",{d:k(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="cursor"||A==="cursor")&&n.jsx("path",{d:k(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="opencode"||A==="opencode")&&n.jsx("path",{d:k(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="zed"||A==="zed")&&n.jsx("path",{d:k(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:k(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(z==="continue"||A==="continue")&&n.jsx("path",{d:k(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("fast")&&n.jsx("path",{d:G(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("heavy")&&n.jsx("path",{d:G(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("coder")&&n.jsx("path",{d:G(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("vision")&&n.jsx("path",{d:G(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:G(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Sr("scout")&&n.jsx("path",{d:G(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>L("roocode"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>L("cursor"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>L("opencode"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>L("zed"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>L("continue"),onMouseLeave:()=>L(null),onClick:()=>w(T=>T==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",d!=null&&d.heavy_threshold_chars?d.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),Nb.map(T=>{var Ht;const le=["12%","31%","50%","69%","88%"],ke=$n(T),Re=ke?i.includes(ke.name):!1;if(T==="reasoning"||T==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[T];return n.jsxs("div",{className:ne("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ke?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:le[Fe]},onClick:()=>_(T),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:T}),Re&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ke?(Ht=ke.name.split("/").pop())==null?void 0:Ht.replace(".gguf",""):"Keine Zuweisung"})]},T)}),A&&g&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>w(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),g.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var T,le,ke,Re,Fe;return at(A==="roocode"?(T=g.tools.cline)==null?void 0:T.snippet:A==="cursor"?(le=g.tools.cursor)==null?void 0:le.snippet:A==="opencode"?(ke=g.tools.opencode)==null?void 0:ke.snippet:A==="zed"?(Re=g.tools.zed)==null?void 0:Re.snippet:(Fe=g.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[$?n.jsx(As,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Nh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:$?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:n.jsxs("code",{children:[A==="roocode"&&((Bn=g.tools.cline)==null?void 0:Bn.snippet),A==="cursor"&&((Cr=g.tools.cursor)==null?void 0:Cr.snippet),A==="opencode"&&((ur=g.tools.opencode)==null?void 0:ur.snippet),A==="zed"&&((Hn=g.tools.zed)==null?void 0:Hn.snippet),A==="continue"&&((Us=g.tools.continue)==null?void 0:Us.snippet)]})})]}),n.jsx("button",{onClick:()=>w(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(T=>{var Re;const le=s.find(Fe=>Fe.role===T),ke=le?i.includes(le.name):!1;return n.jsxs("div",{onClick:()=>_(T),className:ne("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",ke?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":le?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ne("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",T==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":T==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":T==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":T==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":T==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:T}),ke&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:le==null?void 0:le.name,children:le?(Re=le.name.split("/").pop())==null?void 0:Re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},T)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",De.length," von ",s.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>re("all"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>re("in_use"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",te==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>J("grid"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",B==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>J("list"),className:ne("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",B==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),B==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:De.length===0?n.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):De.map(T=>{const le=i.includes(T.name),ke=v==null?void 0:v.model_list.find(Fe=>Fe.role===T.role),Re=Qp(T.name);return n.jsxs("div",{className:ne("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",le?"border-primary/45 shadow-primary/5":T.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ne("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Re.color),title:Re.name,children:Re.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:T.name,children:T.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:T.quant||"GGUF"}),le&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(mi,{className:"h-3 w-3 animate-pulse"})," Warm"]}),T.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:T.role}),T.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),T.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${T.spec_draft_model})`,children:"SPEC"}),T.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${T.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",T.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Kp,{caps:T.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(Qu,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:jn(T.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(k0,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:Gp(T.ctx)})]})]})]}),ke&&n.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ke.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>we(ke.repo,T.role,T.quant||"Q4_K_M",T.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[n.jsx(An,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>le?ie(T.name):Z(T.name),className:ne("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",le?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:le?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(T.name,T.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>F(T.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]})]},T.name)})}):n.jsx("div",{className:"space-y-2",children:De.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:te==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):De.map(T=>{const le=i.includes(T.name),ke=Qp(T.name);return n.jsxs("div",{className:ne("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",le?"border-primary/45":T.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ne("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ke.color),title:ke.name,children:ke.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:T.name,children:T.name.split("/").pop()}),T.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:T.role}),T.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),T.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${T.spec_draft_model})`,children:"SPEC"}),T.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${T.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",T.parallel_slots]}),le&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",jn(T.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",Gp(T.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:T.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Kp,{caps:T.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>le?ie(T.name):Z(T.name),className:ne("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",le?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:le?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>U(T.name,T.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>F(T.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]})]},T.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>_(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{xe(C,""),_(null)},className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:n.jsx("span",{children:"Zuweisung entfernen"})}),s.map(T=>{var le;return n.jsxs("button",{onClick:()=>{xe(C,T.name),_(null)},className:ne("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",T.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(le=T.name.split("/").pop())==null?void 0:le.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[jn(T.size_bytes)," · ",T.quant]})]}),T.role===C&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},T.name)})]})]})}),ee&&n.jsx(Vo,{type:ee.type,title:ee.title,message:ee.message,defaultValue:ee.defaultValue,onConfirm:ee.onConfirm,onCancel:ee.onCancel})]})}function Cb(){const[s,o]=m.useState(""),[i,u]=m.useState([]),[d,f]=m.useState("Q4_K_M"),[g,h]=m.useState(""),[v,x]=m.useState(""),[b,j]=m.useState([]);async function M(w){const C=w??s;if(C.trim()){h("Analysiere HuggingFace Repository...");try{const _=await me(`/api/hf/quants?repo=${encodeURIComponent(C)}`);o(_.repo),u(_.quants),_.quants.length&&f(_.quants.includes("Q4_K_M")?"Q4_K_M":_.quants[0]),h(_.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(_){h(`Fehler: ${_}`)}}}async function O(){if(v.trim()){h("Durchsuche HuggingFace...");try{const w=await me(`/api/hf/search?q=${encodeURIComponent(v)}`);j(w.results),h(w.results.length?"":"Keine Ergebnisse gefunden.")}catch(w){h(`Suche fehlgeschlagen: ${w}`)}}}async function A(){if(s.trim()){h("Download-Job wird initiiert...");try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:s,quant:d,jinja:!0})}),h(`Download gestartet: ${s} (${d}). Fortschritt wird oben angezeigt.`)}catch(w){h(`Download-Fehler: ${w}`)}}}return n.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:s,onChange:w=>o(w.target.value),placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>M(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),i.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:d,onChange:w=>f(w.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:i.map(w=>n.jsx("option",{value:w,className:"bg-popover text-foreground",children:w},w))}),n.jsxs("button",{onClick:A,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n.jsx(An,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:v,onChange:w=>x(w.target.value),onKeyDown:w=>w.key==="Enter"&&O(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(dc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:O,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),b.length>0&&n.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:b.map(w=>n.jsxs("button",{onClick:()=>{o(w.repo),j([]),x(""),M(w.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[n.jsx("span",{className:"font-semibold truncate",children:w.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(An,{className:"h-3 w-3"})," ",w.downloads.toLocaleString()]})]},w.repo))}),g&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:g})]})}const Eb={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Ku},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Vu},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Do},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Oo},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:Gu}};function Pb(){const[s,o]=m.useState(null),[i,u]=m.useState([]),[d,f]=m.useState(null),[g,h]=m.useState(""),[v,x]=m.useState(!0),[b,j]=m.useState({}),[M,O]=m.useState({}),[A,w]=m.useState(!1);m.useEffect(()=>{Promise.all([me("/api/discover"),me("/api/models"),me("/api/maintenance/updates").catch(()=>null)]).then(([_,$,V])=>{o(_),u($.models||[]),V&&f(V)}).catch(_=>h(String(_))).finally(()=>x(!1))},[]);async function C(_,$,V,z){j(L=>({...L,[_]:"Starte..."}));try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:_,role:$,quant:V,jinja:z})}),j(L=>({...L,[_]:"Download läuft"}))}catch{j(B=>({...B,[_]:"Fehler"}))}}return v?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):g||!s?n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",g,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Eh,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:s.categories.map(_=>{const $=Eb[_.role]||{title:_.title||_.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:To},V=$.icon,z=i.find(ee=>ee.role===_.role),L=d==null?void 0:d.model_list.find(ee=>ee.role===_.role),B=_.models.find(ee=>ee.repo===_.recommended)||_.models[0];if(!B)return null;const J=b[B.repo],te=_.models.filter(ee=>ee.repo!==_.recommended),re=!!M[_.role];return n.jsxs("div",{className:ne("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",z?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:n.jsx(V,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:$.title}),n.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",_.role]})]})]}),z?n.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:z?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:z.name,children:z.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",rc(z.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",z.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:B.name,children:B.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",B.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",B.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(kb,{fit:B.fit})})]})}),n.jsx("div",{className:"pt-1",children:z?L?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",L.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(L.repo,_.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!b[L.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[n.jsx(An,{className:"h-3.5 w-3.5"}),b[L.repo]||"Auf neue Version aktualisieren"]})]}):n.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[n.jsx(As,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(B.repo,_.role,B.quant||"Q4_K_M",B.caps.tools!=="no"),disabled:!!J,className:ne("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",J?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(An,{className:"h-3.5 w-3.5"}),J||"Optimales Modell einsetzen"]})})]}),te.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>O(ee=>({...ee,[_.role]:!re})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[re?n.jsx(f0,{className:"h-3 w-3"}):n.jsx(u0,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",te.length,")"]})]}),re&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:te.map(ee=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:ee.name,children:ee.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",ee.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:ee.fit.text})]})]}),n.jsx("button",{onClick:()=>C(ee.repo,_.role,ee.quant||"Q4_K_M",ee.caps.tools!=="no"),disabled:!!b[ee.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:b[ee.repo]||"Installieren"})]},ee.repo))})]})]},_.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>w(!A),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(dc,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(Cb,{})})]})]})}function _b(){const[s,o]=m.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(i=>n.jsx("button",{onClick:()=>o(i),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",s===i?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:i==="cockpit"?"Cockpit":"Modelle finden"},i))})]}),n.jsx(jb,{}),n.jsx("div",{className:"transition-all duration-300",children:s==="cockpit"?n.jsx(Sb,{}):n.jsx(Pb,{})})]})}const an={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],updates:["updates"],discover:["discover"],connect:s=>["connect",s??""],memory:(s,o)=>["memory",s??"",o??""]},Mb=()=>Fn({queryKey:an.health,queryFn:()=>me("/api/health"),refetchInterval:1e4}),mm=(s=5e3)=>Fn({queryKey:an.systemStatus,queryFn:()=>me("/api/system/status"),refetchInterval:s}),Rb=(s=3e3)=>Fn({queryKey:an.services,queryFn:()=>me("/api/system/services"),refetchInterval:s}),Ob=(s=4e3)=>Fn({queryKey:an.models,queryFn:()=>me("/api/models"),refetchInterval:s}),Db=(s=5e3)=>Fn({queryKey:an.agentStatus,queryFn:()=>me("/api/agent/status"),refetchInterval:s}),Tb=s=>Fn({queryKey:an.connect(s),queryFn:()=>me(s?`/api/connect?${s}`:"/api/connect")}),Ab=s=>Fn({queryKey:an.memory(s==null?void 0:s.q,s==null?void 0:s.category),queryFn:()=>{const o=new URLSearchParams;return s!=null&&s.q&&o.set("q",s.q),s!=null&&s.category&&o.set("category",s.category),me(`/api/memory?${o}`)},select:o=>s!=null&&s.limit?o.slice(0,s.limit):o});function xc(){const[s,o]=m.useState(null),i=m.useCallback(()=>o(null),[]),u=m.useCallback((h,v,x)=>{o({type:"alert",title:h,message:v,onConfirm:()=>{o(null),x==null||x()}})},[]),d=m.useCallback((h,v,x,b)=>{o({type:"confirm",title:h,message:v,onConfirm:()=>{o(null),x()},onCancel:()=>{o(null),b==null||b()}})},[]),f=m.useCallback((h,v,x,b,j)=>{o({type:"prompt",title:h,message:v,defaultValue:x,onConfirm:M=>{o(null),b(M)},onCancel:()=>{o(null),j==null||j()}})},[]),g=s?n.jsx(Vo,{...s}):null;return{showAlert:u,showConfirm:d,showPrompt:f,close:i,dialogElement:g}}function ci({label:s,percent:o,detail:i,icon:u}){const d=o>90?"bg-red-500 shadow-md shadow-red-500/20":o>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/30 transition-all duration-300",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(u,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:s})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ne("h-full transition-all duration-700 ease-out",d),style:{width:`${Math.min(o,100)}%`}})}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:i})]})}function zb(){const{data:s,error:o}=mm(3e3),{data:i}=Rb(3e3),{showAlert:u,dialogElement:d}=xc(),f=o?String(o):"",[g,h]=m.useState(""),[v,x]=m.useState({});async function b(){h("Backup snapshotted...");try{const M=await me("/api/system/backup",{method:"POST"});h(M.ok?`Snapshot erzeugt: ${M.snapshot} (${M.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(M){h(`Fehler: ${M.message}`)}}async function j(M){x(O=>({...O,[M]:!0}));try{const O=await me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:M})});O.ok?u("Erfolgreich",`Dienst ${M} wurde erfolgreich neu gestartet.`):u("Fehler beim Neustart",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){u("Fehler",`Fehler: ${O.message}`)}finally{x(O=>({...O,[M]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"System-Diagnose & Status"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["System-Status nicht lesbar (",f,")."]}),s&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(ci,{label:"CPU",percent:s.cpu.percent,detail:s.cpu.cores?`${s.cpu.cores} Cores`:void 0,icon:At}),n.jsx(ci,{label:"RAM",percent:s.ram.percent,detail:`${St(s.ram.used)} / ${St(s.ram.total)} GB`,icon:mi}),s.gpu&&s.gpu.busy_percent!=null&&n.jsx(ci,{label:"GPU",percent:s.gpu.busy_percent,detail:s.gpu.gtt_used!=null&&s.gpu.gtt_total?`${St(s.gpu.gtt_used)} / ${St(s.gpu.gtt_total)} GB (GTT/unified)`:s.gpu.vram_used!=null&&s.gpu.vram_total?`${St(s.gpu.vram_used)} / ${St(s.gpu.vram_total)} GB VRAM`:void 0,icon:At}),s.disk&&n.jsx(ci,{label:"Disk",percent:s.disk.percent,detail:`${St(s.disk.used)} / ${St(s.disk.total)} GB`,icon:Qu})]}),s.temp&&(s.temp.cpu||s.temp.gpu)&&n.jsxs("div",{className:"flex gap-3 text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-2.5 rounded-xl self-start w-fit",children:[s.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.cpu," °C"]})]}),s.temp.cpu!=null&&s.temp.gpu!=null&&n.jsx("span",{children:"|"}),s.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[s.temp.gpu," °C"]})]})]})]}),i&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"h-7 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",children:"System-Logs anzeigen"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:i.services.map(M=>n.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background/20 border border-border/30 hover:border-primary/20 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ne("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",M.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:M.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:M.url})]})]}),n.jsx("button",{onClick:()=>j(M.name),disabled:v[M.name],className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-primary hover:bg-primary/5 flex items-center justify-center transition-all opacity-0 group-hover:opacity-100",title:"Dienst neu starten",children:n.jsx(Tn,{className:ne("h-3.5 w-3.5",v[M.name]&&"animate-spin")})})]},M.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Lo(i.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(gi,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Lo(i.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(gi,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:b,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(S0,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),g&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:g}),d]})}function Lb(){const[s,o]=m.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[i,u]=m.useState(localStorage.getItem("mc_mcp_path")||""),[d,f]=m.useState("cline"),[g,h]=m.useState(!1),v=new URLSearchParams({host:s});i&&v.set("mcp_path",i);const{data:x,error:b}=Tb(v.toString()),j=b?String(b):"";function M(C){o(C),C&&localStorage.setItem("mc_host",C)}function O(C){u(C),localStorage.setItem("mc_mcp_path",C)}const A=x==null?void 0:x.tools[d];async function w(){A&&(await navigator.clipboard.writeText(A.snippet),h(!0),setTimeout(()=>h(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Kopiere vorgefertigte Konfigurationsdateien für deinen lokalen PC (IDEs, Cline, Roo Code, Cursor), um direkt auf das geteilte Gedächtnis und den Auto-Swap-Gateway der Box zuzugreifen."})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(v0,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:s,onChange:C=>M(C.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(y0,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:i,onChange:C=>O(C.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]})]}),j&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",j]}),x&&n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex flex-wrap gap-1 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:Object.entries(x.tools).map(([C,_])=>n.jsx("button",{onClick:()=>f(C),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",d===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:_.label},C))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-xs text-muted-foreground leading-relaxed",children:[n.jsx(b0,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:d==="cline"||d==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:w,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[g?n.jsx(As,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(Nh,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:g?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-5 overflow-x-auto text-xs font-mono text-cyan-200/90 whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",children:n.jsx("code",{children:A.snippet})})]})]})]})]})}const qp=["user","instruction","stable","versioned","ephemeral"],_u={user:{label:"User",icon:O0,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:C0,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:zn,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:M0,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:h0,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Zp={label:"Gedächtnis",icon:kh,bg:"bg-muted/10",text:"text-muted-foreground"},Ib={user:"border-l-cyan-500/80",instruction:"border-l-violet-500/80",stable:"border-l-indigo-500/80",versioned:"border-l-amber-500/80",ephemeral:"border-l-pink-500/80"};function Fb(){const[s,o]=m.useState(""),[i,u]=m.useState(""),[d,f]=m.useState(""),[g,h]=m.useState("stable"),[v,x]=m.useState(!1),b=cc(),{showAlert:j,showConfirm:M,dialogElement:O}=xc(),{data:A=[],error:w}=Ab({q:i,category:s}),C=w?String(w):"",_=()=>b.invalidateQueries({queryKey:["memory"]});async function $(){d.trim()&&(await me("/api/memory",{method:"POST",body:JSON.stringify({content:d,category:g,source:"ui"})}),f(""),_())}async function V(L){await me(`/api/memory/${L}`,{method:"DELETE"}),_()}async function z(){x(!0);try{const L=await me("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(L.duplicate_count===0){j("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${L.duplicate_count} Dublette(n) in ${L.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await me("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),_()}catch(B){j("Fehler",`Fehler beim Löschen: ${B.message}`)}})}catch(L){j("Fehler",`Fehler bei der Deduplizierung: ${L.message}`)}finally{x(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool (Memory)"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Die geteilte Konstitution des Systems. Alle Instanzen (Hermes, IDEs, Gateway) lesen und schreiben hierauf per MCP-Protokoll."})]}),n.jsxs("button",{onClick:z,disabled:v,className:"flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50 shrink-0 self-start",children:[n.jsx(_0,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:d,onChange:L=>f(L.target.value),placeholder:"Füge eine neue Regel, eine Vorliebe oder einen stabilen Fakt über das Projekt oder dich hinzu...",rows:3,className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3.5 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground transition-all leading-relaxed"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:g,onChange:L=>h(L.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 py-1 text-xs outline-none font-semibold text-foreground cursor-pointer",children:qp.map(L=>{var B;return n.jsx("option",{value:L,className:"bg-popover text-foreground",children:((B=_u[L])==null?void 0:B.label)||L},L)})})]}),n.jsxs("button",{onClick:$,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(Sh,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:i,onChange:L=>u(L.target.value),placeholder:"Gedächtnis durchsuchen...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(dc,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl overflow-x-auto max-w-full",children:[n.jsx("button",{onClick:()=>o(""),className:ne("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",s?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),qp.map(L=>{const B=_u[L]||Zp,J=B.icon;return n.jsxs("button",{onClick:()=>o(L),className:ne("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 whitespace-nowrap",s===L?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(J,{className:"h-3 w-3"}),n.jsx("span",{children:B.label})]},L)})]})]}),C&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Laden des Gedächtnisses: ",C]}),n.jsx("div",{className:"space-y-3",children:A.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):A.map(L=>{const B=_u[L.category]||Zp,J=B.icon;return n.jsxs("div",{className:ne("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",Ib[L.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ne("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",B.bg,B.text),children:[n.jsx(J,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:B.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:L.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-background/20 px-1.5 py-0.5 rounded uppercase tracking-wider",children:L.source}),n.jsx("button",{onClick:()=>V(L.id),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",title:"Eintrag löschen",children:n.jsx(qu,{className:"h-3.5 w-3.5"})})]})]},L.id)})}),O]})}function di({label:s,ok:o,detail:i,icon:u,onClick:d}){return n.jsxs("div",{onClick:d,className:ne("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",o?"border-border/60":"border-amber-500/30",d&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:s}),n.jsx(u,{className:ne("h-4.5 w-4.5",o?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full ring-2 ring-black/40",o?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:o?"Bereit / Online":"Offline / Inaktiv"})]}),i&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:i,children:i})]}),d&&n.jsxs("button",{onClick:f=>{f.stopPropagation(),d()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[n.jsx(At,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function Ub(){const{data:s,error:o}=Db(5e3),{data:i}=Ob(),{showAlert:u,dialogElement:d}=xc(),f=cc(),g=o?String(o):"",h=m.useMemo(()=>["auto","fast","heavy",...((i==null?void 0:i.models)??[]).map(L=>{var B;return((B=L.name.split("/").pop())==null?void 0:B.replace(".gguf",""))||L.name})],[i]),[v,x]=m.useState(null),[b,j]=m.useState(!1),[M,O]=m.useState({width:800,height:360}),A=m.useRef(null),w=m.useCallback(z=>{if(A.current&&(A.current.disconnect(),A.current=null),z){const L=new ResizeObserver(B=>{if(!B||B.length===0)return;const J=B[0].contentRect;O({width:J.width,height:J.height})});L.observe(z),A.current=L}},[]),C=M.width,_=M.height,$=(z,L,B,J)=>{const te=(z+B)/2;return`M ${z} ${L} C ${te} ${L}, ${te} ${J}, ${B} ${J}`};async function V(z){try{await me("/api/agent/brain",{method:"POST",body:JSON.stringify({model:z})}),u("Erfolgreich",`Hermes-Gehirn wurde auf '${z}' geändert. Der Gateway-Dienst wurde neu gestartet.`),f.invalidateQueries({queryKey:an.agentStatus}),j(!1)}catch(L){u("Fehler",`Fehler beim Wechseln des Gehirns: ${L.message}`)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(s==null?void 0:s.webui_url)&&n.jsxs("a",{href:Lo(s.webui_url),target:"_blank",rel:"noopener",className:ne("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",s.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(gi,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),g&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",g,")."]}),s&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(di,{label:"Agent Gateway",ok:s.gateway_reachable,detail:"Port :8642 (REST API)",icon:Oo}),n.jsx(di,{label:"Agent WebUI",ok:s.webui_reachable,detail:"Port :8787 (Chat UI)",icon:mi}),n.jsx(di,{label:"Aktives Gehirn",ok:s.gateway_reachable,detail:s.brain_model?`Model: ${s.brain_model}`:"Model: auto",icon:At,onClick:()=>j(!0)}),n.jsx(di,{label:"Verdrahtung",ok:s.has_config,detail:`Config: ${s.has_config?"✓":"—"} · Skills: ${s.has_skills?"✓":"—"} · Memory: ${s.has_memories?"✓":"—"}`,icon:yi})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:w,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="webui"||s.webui_reachable)&&n.jsx("path",{d:$(C*.15,_*.5,C*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="brain"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(v==="gateway"||v==="wiring"||s.gateway_reachable)&&n.jsx("path",{d:$(C*.5,_*.5,C*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>x("webui"),onMouseLeave:()=>x(null),onClick:()=>s.webui_reachable&&window.open(Lo(s.webui_url),"_blank"),title:s.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(mi,{className:ne("h-3.5 w-3.5",s.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ne("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",s.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>x("gateway"),onMouseLeave:()=>x(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Oo,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ne("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",s.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:s.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ne("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",s.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>x("brain"),onMouseLeave:()=>x(null),onClick:()=>j(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(At,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),s.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:s.brain_model,children:s.brain_model||"auto"})]}),n.jsxs("div",{className:ne("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",s.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>x("wiring"),onMouseLeave:()=>x(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(yi,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),s.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",s.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",s.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",s.has_memories?"✓":"—"]})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(zn,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!s.gateway_reachable&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(zn,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),s&&b&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>j(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:h.map(z=>{const L=["auto","fast","heavy"].includes(z);return n.jsxs("button",{onClick:()=>V(z),className:ne("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",s.brain_model===z||!s.brain_model&&z==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:z}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:L?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(s.brain_model===z||!s.brain_model&&z==="auto")&&n.jsx(As,{className:"h-4 w-4 shrink-0 text-primary"})]},z)})})]})}),d]})}function $b(){const[s,o]=m.useState("connect"),[i,u]=m.useState("roocode"),[d,f]=m.useState(null),g="192.168.178.151",[h,v]=m.useState(!1),[x,b]=m.useState(null);function j(){v(!0),me("/api/health").then(M=>{f(M),b(M.engine_reachable?"success":"partial")}).catch(()=>{f(null),b("fail")}).finally(()=>v(!1))}return m.useEffect(()=>{j()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Stack-Anleitung & Vibe-Coding-Guide"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Einsteigerfreundliche Erklärungen zu deinem Stack und Schritt-für-Schritt-Anleitungen zur Anbindung deiner Editoren."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>o("connect"),className:ne("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>o("concepts"),className:ne("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",s==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),s==="connect"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ne("h-3 w-3 rounded-full ring-2 ring-black/40",x==="success"&&"bg-emerald-500 animate-pulse",x==="partial"&&"bg-amber-500",x==="fail"&&"bg-red-500",!x&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[x==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(d==null?void 0:d.version)||""}).`,x==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",x==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!x&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:j,disabled:h,className:"h-8 px-3 flex items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50 cursor-pointer self-start sm:self-auto shrink-0",children:[n.jsx(Tn,{className:ne("h-3.5 w-3.5",h&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(kh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(At,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein Dashboard. Hier siehst du die CPU-/RAM- und GPU-Last der Box und siehst sofort, ob Updates anstehen."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(To,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Do,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein geteiltes Langzeitgedächtnis (Memory-Pool). Hier merkt sich dein Agent Regeln, Projekt-Details und Vorlieben."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(Vu,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>u("roocode"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",i==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[n.jsx(Eh,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>u("cursor"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),n.jsx("button",{onClick:()=>u("opencode"),className:ne("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",i==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[i==="roocode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.jsx("p",{children:"Roo Code ist die beliebteste und flexibelste Vibe-Coding-Erweiterung für VS Code im Jahr 2026. Sie ermöglicht vollen Zugriff auf das Terminal und das MCP-Gedächtnis."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Roo Code installieren"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"API-Anbindung konfigurieren"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"MCP Gedächtnis verknüpfen (Optional, aber empfohlen)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),i==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Einstellungen öffnen"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"OpenAI API überschreiben"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Modell hinzufügen"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),i==="opencode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.jsx("p",{children:"OpenCode ist eine standalone Desktop-App für ein ablenkungsfreies Coden über natürliche Sprache. Es trennt den KI-Prozess von deinem Editor."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"OpenCode Desktop herunterladen"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"Endpunkt auf Box-Gateway setzen"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",g,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Erster Vibe-Coding Test"]}),n.jsx("p",{className:"pl-6",children:'Starte eine neue Session und teste die Verbindung mit einem einfachen Prompt, z. B. *"Erstelle ein einfaches Skript, das die Fibonaccizahlen berechnet"*. Das Box-Gateway tauscht das Modell im Hintergrund vollautomatisch aus.'})]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 space-y-3 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Keine Verbindung?"})," Überprüfe im Live-Verbindungsprüfer oben, ob die Box-IP erreichbar ist. Stelle sicher, dass dein lokaler PC im selben WLAN/LAN-Netzwerk wie die Box eingeloggt ist."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex items-start gap-4",children:[n.jsx(Gu,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.jsx("p",{className:"text-xs text-muted-foreground leading-normal",children:"Willkommen im Wissenszentrum für dein Mission Control 2 Setup. Hier erfährst du, wie die verschiedenen Technologien (MoE, MCP, Skills, Hermes) zusammenarbeiten und wie du das Maximum aus deinen AI-Prozessabläufen herausholst."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(To,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Bei traditionellen LLMs wird für jedes Wort das gesamte neuronale Netz aktiviert. Bei MoE besteht das Modell aus mehreren spezialisierten Teilnetzwerken (den ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," So können extrem leistungsstarke Modelle (wie DeepSeek-V3, Mixtral oder Command R+) mit wesentlich geringeren Hardwarekosten ausgeführt werden. Es wird nur ein Bruchteil der Parameter geladen und aktiv berechnet, was Speicherplatz spart und die Inferenz beschleunigt."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Gu,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," MCP ist ein offenes Protokoll (initiiert von Anthropic), das festlegt, wie ein KI-Client (z.B. Roo Code auf deinem PC) mit externen Datenquellen und Tools kommuniziert. Es funktioniert wie ein USB-Standard für KI."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," MCP trennt den AI-Kern von der Umgebung. Statt für jeden Editor eigene Tools zu schreiben, binden deine Agenten (Roo Code, Hermes) einfach MCP-Server an. Diese Server können Dateien lesen, Websuchen durchführen, Git bedienen oder mit deiner App interagieren."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("a",{href:"https://smithery.ai/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Smithery Registry"})," — Ein Portal zum Suchen und automatischen Installieren von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://glama.ai/mcp/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Glama MCP Registry"})," — Eine kuratierte, umfangreiche Community-Datenbank von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Offizielles Anthropic Repo"})," — Das offizielle Repository mit Standards wie filesystem, postgres, sqlite, brave-search und puppeteer."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Do,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Ein Skill ist ein Verzeichnis mit standardisierten Anweisungen, Scripten und Beispielen, das deine Agenten für spezifische Aufgaben trainiert (z.B. Test-Driven Development, Code-Vereinfachung, API-Design)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- +name: tdd-pro +description: Drive development with strict TDD practices +--- +# Instructions +...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.jsx("a",{href:"https://skills.sh/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"skills.sh"}),"). Du kannst Skills direkt über das Terminal suchen und in deinem Projekt installieren:",n.jsxs("div",{className:"mt-1 font-mono text-[9px] bg-background/40 p-2 rounded border border-border/30 text-cyan-300",children:["# Nach Skills suchen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:"C:\\Users\\TobisPC\\.gemini\\config\\plugins\\agent-skills\\skills\\"}),". Hier sind deine vorinstallierten, global verfügbaren Skills (wie ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:".agents/skills/"}),". Lege diesen Ordner im Root eines beliebigen Projekts an. Dein lokaler Editor-Agent (z.B. Roo Code) liest ihn beim Starten automatisch ein."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(At,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Hermes ist der auf der Box installierte, autonome Hintergrund-Agent. Er verwaltet das Dateisystem und kann über REST (Port 8642) oder eine interaktive ChatUI (Port 8787) gesteuert werden."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(yi,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(Vu,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(yi,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.jsx("p",{className:"text-[11px]",children:"Koppele deine Debug-Dienste mit dem Chrome-DevTools-Plugin. So kann der Agent Fehler in der Konsole live analysieren und das DOM verifizieren, anstatt blind zu raten."})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(zn,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Np,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Np,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.jsx("strong",{children:"Fazit:"})," Der Stack erledigt die Kärrnerarbeit (Modelle tauschen, API-Adapter bereitstellen, Sandbox-Verbindungen herstellen) komplett im Hintergrund. Er agiert als dein persönlicher, treuer Copilot, ohne jemals ungefragt schädliche Operationen auf deinem Hauptsystem auszuführen."]})]})]})]})]})]})}function Bb({title:s,hint:o}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:s}),n.jsx("p",{className:"text-sm text-muted-foreground",children:o})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[n.jsx(x0,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Hb=[{id:"llama-swap",label:"Llama Swap",type:"system"},{id:"mission-control-2",label:"Mission Control 2",type:"user"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user"},{id:"hermes-dashboard",label:"Hermes Dashboard",type:"user"},{id:"hermes-webui",label:"Hermes WebUI",type:"user"}];function Mu(s){return s==null?"":s>1024**3?`${(s/1024**3).toFixed(2)} GB`:`${(s/1024**2).toFixed(1)} MB`}function Wb({open:s,onClose:o,defaultTab:i="maintenance"}){const[u,d]=m.useState(null),[f,g]=m.useState([]),[h,v]=m.useState("llama-swap"),[x,b]=m.useState(""),[j,M]=m.useState(!1),[O,A]=m.useState(null),[w,C]=m.useState({}),[_,$]=m.useState("maintenance"),[V,z]=m.useState(!1),[L,B]=m.useState(null);function J(U,F,we){B({type:"alert",title:U,message:F,onConfirm:()=>{B(null),we&&we()}})}function te(U,F,we){B({type:"confirm",title:U,message:F,onConfirm:()=>{B(null),we()},onCancel:()=>B(null)})}function re(U){return U?new Date(U*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[ee,ge]=m.useState(""),[ue,Ae]=m.useState(""),[Ee,De]=m.useState(!1),[Me,Pe]=m.useState(!1);m.useEffect(()=>{s&&(ge(localStorage.getItem("mc_sudo_password")||""),Ae(localStorage.getItem("mc_hf_token")||""))},[s]),m.useEffect(()=>{s&&i&&$(i)},[s,i]);const Q=m.useRef(null);function ce(){me("/api/maintenance/updates").then(d).catch(U=>console.error("Error loading updates",U))}function q(){me("/api/jobs").then(U=>g(U.jobs||[])).catch(U=>console.error("Error loading jobs",U))}function E(U){M(!0),A(null),me(`/api/maintenance/logs?service=${U}&lines=150`).then(F=>{F.ok?b(F.text):(b(`Fehler beim Laden der Logs: ${F.err||"Unbekannter Fehler"}`),(F.status==="incorrect_password"||F.status==="password_required")&&A(F.status))}).catch(F=>b(`Fehler: ${F.message}`)).finally(()=>{M(!1),setTimeout(()=>{Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},50)})}m.useEffect(()=>{if(!s)return;ce(),q();const U=setInterval(()=>{q(),ce()},3e3);return()=>clearInterval(U)},[s]),m.useEffect(()=>{!s||_!=="logs"||E(h)},[s,_,h]);async function k(){try{await me("/api/maintenance/os-update",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler beim Starten des OS-Updates: ${U.message}`)}}async function G(){try{await me("/api/maintenance/engine-update",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler beim Engine-Update: ${U.message}`)}}async function X(){z(!0);try{await me("/api/maintenance/check-updates",{method:"POST"}),q(),$("maintenance")}catch(U){J("Fehler",`Fehler bei der Update-Suche: ${U.message}`)}finally{z(!1)}}async function Z(U,F){try{await me("/api/models/install",{method:"POST",body:JSON.stringify({repo:U,role:F})}),J("Gestartet",`Modell-Upgrade für '${F}' (${U}) gestartet.`),q(),$("maintenance")}catch(we){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${we.message}`)}}async function ie(){te("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await me("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{o()})}catch(U){J("Fehler",`Fehler beim Reboot: ${U.message}`)}})}async function he(U){C(F=>({...F,[U]:!0}));try{const F=await me("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:U})});F.ok?J("Dienst neu gestartet",`Dienst ${U} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&h===U&&E(U)}):J("Fehler",`Fehler beim Neustart: ${F.err||"Unbekannter Fehler"}`)}catch(F){J("Fehler",`Fehler beim Neustart: ${F.message}`)}finally{C(F=>({...F,[U]:!1}))}}async function xe(U){try{await me(`/api/jobs/${U}/cancel`,{method:"POST"}),q()}catch(F){J("Fehler",`Fehler beim Abbrechen: ${F.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ne("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",s?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:o}),n.jsxs("div",{className:ne("fixed inset-y-0 right-0 w-full sm:w-[500px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",s?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(At,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:o,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:n.jsx(Ln,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>$("maintenance"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>$("logs"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>$("settings"),className:ne("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",re(u.last_check)]}),n.jsxs("button",{onClick:X,disabled:V,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Tn,{className:ne("h-3 w-3",V&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:k,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(zn,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.os?`${u.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:G,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(E0,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:u!=null&&u.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:ie,className:"flex w-full items-center gap-3 p-3 rounded-xl border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[n.jsx(Ch,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(u==null?void 0:u.model_list)&&u.model_list.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(u==null?void 0:u.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",re(u.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:u.model_list.map(U=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:U.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:U.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",U.role]})]}),n.jsxs("button",{onClick:()=>Z(U.repo,U.role),className:"flex items-center gap-1.5 text-[10px] font-semibold text-emerald-400 hover:text-emerald-300 border border-emerald-500/20 bg-emerald-500/5 hover:bg-emerald-500/10 px-2 py-1 rounded-lg transition-colors shrink-0",children:[n.jsx(An,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},U.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[f.filter(U=>U.state==="running"||U.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:f.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):f.map(U=>{const F=U.state==="running"||U.state==="queued";return n.jsxs("div",{className:ne("p-3 rounded-xl border transition-all duration-300",F?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[F&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),U.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",U.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ne(U.state==="done"&&"text-emerald-400",U.state==="failed"&&"text-red-400",U.state==="running"&&"text-primary",U.state==="queued"&&"text-amber-400",U.state==="canceled"&&"text-muted-foreground"),children:U.state})]})]}),F&&n.jsx("button",{onClick:()=>xe(U.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),U.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${U.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[U.progress??0,"%"]}),U.done_bytes!=null&&U.total_bytes!=null&&n.jsxs("span",{children:[Mu(U.done_bytes)," / ",Mu(U.total_bytes),U.rate_bps!=null&&` (${Mu(U.rate_bps)}/s)`]}),U.eta_s!=null&&n.jsxs("span",{children:["ETA: ",U.eta_s,"s"]})]})]})]},U.id)})})]})]}),_==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:h,onChange:U=>v(U.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:Hb.map(U=>n.jsxs("option",{value:U.id,children:[U.label," (",U.type==="system"?"systemd-root":"user",")"]},U.id))}),n.jsxs("button",{onClick:()=>he(h),disabled:w[h],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[n.jsx(Tn,{className:ne("h-3.5 w-3.5",w[h]&&"animate-spin")}),"Restart"]})]}),n.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(xi,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",h]})]}),n.jsx("button",{onClick:()=>E(h),disabled:j,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Tn,{className:ne("h-3 w-3",j&&"animate-spin")})})]}),n.jsx("pre",{ref:Q,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:O==="password_required"||O==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(R0,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:O==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",h," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>$("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):j&&!x?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):x||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(zn,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Ee?"text":"password",value:ee,onChange:U=>ge(U.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>De(!Ee),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Ee?n.jsx(Sp,{className:"h-4 w-4"}):n.jsx(Ku,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(w0,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Me?"text":"password",value:ue,onChange:U=>Ae(U.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>Pe(!Me),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Me?n.jsx(Sp,{className:"h-4 w-4"}):n.jsx(Ku,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",ee),localStorage.setItem("mc_hf_token",ue),J("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),n.jsx("button",{onClick:()=>{ge(""),Ae(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),J("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),L&&n.jsx(Vo,{type:L.type,title:L.title,message:L.message,onConfirm:L.onConfirm,onCancel:L.onCancel})]})}function Vb(){var j,M,O,A,w;const[s,o]=m.useState("dashboard"),[i,u]=m.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[d,f]=m.useState(!1),[g,h]=m.useState("maintenance"),{data:v}=Mb(),{data:x}=mm(2e4);m.useEffect(()=>{document.documentElement.classList.add("dark")},[]),m.useEffect(()=>{const C=_=>{var V;h(((V=_.detail)==null?void 0:V.tab)||"maintenance"),f(!0)};return window.addEventListener("open-system-drawer",C),()=>window.removeEventListener("open-system-drawer",C)},[]);const b=Zu.find(C=>C.id===s);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Uv,{onNavigate:o}),n.jsx(Wb,{open:d,onClose:()=>f(!1),defaultTab:g}),n.jsxs("aside",{className:ne("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",i?"w-16":"w-60"),children:[n.jsxs("div",{className:ne("flex items-center py-4 border-b border-border/40 shrink-0",i?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!i&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{u(C=>{const _=!C;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:i?"Maximieren":"Minimieren",children:i?n.jsx(d0,{className:"h-4 w-4"}):n.jsx(c0,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:Zu.map(C=>n.jsxs("button",{onClick:()=>o(C.id),className:ne("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",i?"justify-center p-2.5":"gap-3 px-3 py-2",s===C.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:i?C.label:void 0,children:[n.jsx(C.icon,{className:"h-4.5 w-4.5 shrink-0"}),!i&&n.jsx("span",{className:"truncate",children:C.label})]},C.id))}),n.jsx("div",{className:ne("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",i?"px-2 text-center":"px-5"),children:i?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ne("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",v?v.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:v?`Engine ${v.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[v?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ne("h-2 w-2 rounded-full animate-pulse",v.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",v.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(x==null?void 0:x.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:x.versions.mc2?`${x.versions.mc2.branch}-${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""} (${x.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",x.versions.mc2?`${x.versions.mc2.hash}${x.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((j=x.versions.engine)==null?void 0:j.type)==="git"?`${x.versions.engine.branch}-${x.versions.engine.hash}${x.versions.engine.dirty?"*":""} (${x.versions.engine.date})`:((M=x.versions.engine)==null?void 0:M.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((O=x.versions.engine)==null?void 0:O.type)==="git"?`${x.versions.engine.hash}${x.versions.engine.dirty?"*":""}`:((w=(A=x.versions.engine)==null?void 0:A.version_text)==null?void 0:w.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:x.versions.hermes_ui?`${x.versions.hermes_ui.branch}-${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""} (${x.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",x.versions.hermes_ui?`${x.versions.hermes_ui.hash}${x.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:x.versions.hermes_agent?`${x.versions.hermes_agent.branch}-${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""} (${x.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",x.versions.hermes_agent?`${x.versions.hermes_agent.hash}${x.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:b.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),n.jsxs("button",{onClick:()=>{const C=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(C)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[n.jsx(g0,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[s==="dashboard"&&n.jsx(wb,{}),s==="models"&&n.jsx(_b,{}),s==="system"&&n.jsx(zb,{}),s==="connect"&&n.jsx(Lb,{}),s==="memory"&&n.jsx(Fb,{}),s==="agent"&&n.jsx(Ub,{}),s==="guide"&&n.jsx($b,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(s)&&n.jsx(Bb,{title:b.label,hint:b.hint})]})]})]})}const Gb=new Gx({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});bx.createRoot(document.getElementById("root")).render(n.jsx(ah.StrictMode,{children:n.jsx(Kx,{client:Gb,children:n.jsx(Vb,{})})})); diff --git a/frontend/dist/assets/index-L9oobut2.js b/frontend/dist/assets/index-L9oobut2.js deleted file mode 100644 index 2101b76..0000000 --- a/frontend/dist/assets/index-L9oobut2.js +++ /dev/null @@ -1,380 +0,0 @@ -function Gm(o,d){for(var a=0;ac[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const d=document.createElement("link").relList;if(d&&d.supports&&d.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))c(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function a(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(f){if(f.ep)return;f.ep=!0;const m=a(f);fetch(f.href,m)}})();function ef(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Za={exports:{}},bs={},Ya={exports:{}},ke={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var vu;function Km(){if(vu)return ke;vu=1;var o=Symbol.for("react.element"),d=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),h=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),b=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),P=Symbol.iterator;function L(w){return w===null||typeof w!="object"?null:(w=P&&w[P]||w["@@iterator"],typeof w=="function"?w:null)}var F={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,N={};function C(w,v,V){this.props=w,this.context=v,this.refs=N,this.updater=V||F}C.prototype.isReactComponent={},C.prototype.setState=function(w,v){if(typeof w!="object"&&typeof w!="function"&&w!=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,w,v,"setState")},C.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function E(){}E.prototype=C.prototype;function D(w,v,V){this.props=w,this.context=v,this.refs=N,this.updater=V||F}var Z=D.prototype=new E;Z.constructor=D,A(Z,C.prototype),Z.isPureReactComponent=!0;var Y=Array.isArray,G=Object.prototype.hasOwnProperty,I={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function ne(w,v,V){var J,Q={},oe=null,pe=null;if(v!=null)for(J in v.ref!==void 0&&(pe=v.ref),v.key!==void 0&&(oe=""+v.key),v)G.call(v,J)&&!$.hasOwnProperty(J)&&(Q[J]=v[J]);var me=arguments.length-2;if(me===1)Q.children=V;else if(1>>1,v=H[w];if(0>>1;wf(Q,K))oef(pe,Q)?(H[w]=pe,H[oe]=K,w=oe):(H[w]=Q,H[J]=K,w=J);else if(oef(pe,K))H[w]=pe,H[oe]=K,w=oe;else break e}}return ae}function f(H,ae){var K=H.sortIndex-ae.sortIndex;return K!==0?K:H.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;o.unstable_now=function(){return m.now()}}else{var h=Date,x=h.now();o.unstable_now=function(){return h.now()-x}}var S=[],b=[],j=1,P=null,L=3,F=!1,A=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Z(H){for(var ae=a(b);ae!==null;){if(ae.callback===null)c(b);else if(ae.startTime<=H)c(b),ae.sortIndex=ae.expirationTime,d(S,ae);else break;ae=a(b)}}function Y(H){if(N=!1,Z(H),!A)if(a(S)!==null)A=!0,Se(G);else{var ae=a(b);ae!==null&&Ne(Y,ae.startTime-H)}}function G(H,ae){A=!1,N&&(N=!1,E(ne),ne=-1),F=!0;var K=L;try{for(Z(ae),P=a(S);P!==null&&(!(P.expirationTime>ae)||H&&!be());){var w=P.callback;if(typeof w=="function"){P.callback=null,L=P.priorityLevel;var v=w(P.expirationTime<=ae);ae=o.unstable_now(),typeof v=="function"?P.callback=v:P===a(S)&&c(S),Z(ae)}else c(S);P=a(S)}if(P!==null)var V=!0;else{var J=a(b);J!==null&&Ne(Y,J.startTime-ae),V=!1}return V}finally{P=null,L=K,F=!1}}var I=!1,$=null,ne=-1,se=5,X=-1;function be(){return!(o.unstable_now()-XH||125w?(H.sortIndex=K,d(b,H),a(S)===null&&H===a(b)&&(N?(E(ne),ne=-1):N=!0,Ne(Y,K-w))):(H.sortIndex=v,d(S,H),A||F||(A=!0,Se(G))),H},o.unstable_shouldYield=be,o.unstable_wrapCallback=function(H){var ae=L;return function(){var K=L;L=ae;try{return H.apply(this,arguments)}finally{L=K}}}})(ei)),ei}var ku;function Ym(){return ku||(ku=1,Xa.exports=Zm()),Xa.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Nu;function Jm(){if(Nu)return ut;Nu=1;var o=Si(),d=Ym();function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,b=/^[: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]*$/,j={},P={};function L(e){return S.call(P,e)?!0:S.call(j,e)?!1:b.test(e)?P[e]=!0:(j[e]=!0,!1)}function F(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function A(e,t,r,s){if(t===null||typeof t>"u"||F(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function N(e,t,r,s,l,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=l,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new N(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);C[t]=new N(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function Z(e,t,r,s){var l=C.hasOwnProperty(t)?C[t]:null;(l!==null?l.type!==0:s||!(2g||l[u]!==i[g]){var y=` -`+l[u].replace(" at new "," at ");return e.displayName&&y.includes("")&&(y=y.replace("",e.displayName)),y}while(1<=u&&0<=g);break}}}finally{V=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?v(e):""}function Q(e){switch(e.tag){case 5:return v(e.type);case 16:return v("Lazy");case 13:return v("Suspense");case 19:return v("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function oe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $:return"Fragment";case I:return"Portal";case se:return"Profiler";case ne:return"StrictMode";case Me:return"Suspense";case Pe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case be:return(e.displayName||"Context")+".Consumer";case X:return(e._context.displayName||"Context")+".Provider";case ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}function pe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function me(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function O(e){var t=T(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var l=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||(e._valueTracker=O(e))}function Xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=T(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function pt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function mt(e,t){var r=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ht(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=me(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function On(e,t){t=t.checked,t!=null&&Z(e,"checked",t,!1)}function Zr(e,t){On(e,t);var r=me(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yr(e,t.type,r):t.hasOwnProperty("defaultValue")&&Yr(e,t.type,me(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function rr(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Yr(e,t,r){(t!=="number"||pt(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var nr=Array.isArray;function Vt(e,t,r,s){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Ht={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},al=["Webkit","ms","Moz","O"];Object.keys(Ht).forEach(function(e){al.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ht[t]=Ht[e]})});function Di(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Ht.hasOwnProperty(e)&&Ht[e]?(""+t).trim():t+"px"}function Li(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,l=Di(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,l):e[r]=l}}var Yf=K({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 il(e,t){if(t){if(Yf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(a(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(a(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(t.style!=null&&typeof t.style!="object")throw Error(a(62))}}function dl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var cl=null;function ul(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fl=null,Xr=null,en=null;function Ai(e){if(e=os(e)){if(typeof fl!="function")throw Error(a(280));var t=e.stateNode;t&&(t=Xs(t),fl(e.stateNode,e.type,t))}}function Oi(e){Xr?en?en.push(e):en=[e]:Xr=e}function Ti(){if(Xr){var e=Xr,t=en;if(en=Xr=null,Ai(e),t)for(e=0;e>>=0,e===0?32:31-(ip(e)/dp|0)|0}var As=64,Os=4194304;function Un(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ts(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,l=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var g=u&~l;g!==0?s=Un(g):(i&=u,i!==0&&(s=Un(i)))}else u=r&~l,u!==0?s=Un(u):i!==0&&(s=Un(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&l)===0&&(l=s&-s,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0r;r++)t.push(e);return t}function Bn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-_t(t),e[t]=r}function pp(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=Zn),ud=" ",fd=!1;function pd(e,t){switch(e){case"keyup":return Up.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function md(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var nn=!1;function Vp(e,t){switch(e){case"compositionend":return md(t);case"keypress":return t.which!==32?null:(fd=!0,ud);case"textInput":return e=t.data,e===ud&&fd?null:e;default:return null}}function Wp(e,t){if(nn)return e==="compositionend"||!Ml&&pd(e,t)?(e=od(),Bs=Nl=ir=null,nn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=wd(r)}}function kd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nd(){for(var e=window,t=pt();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=pt(e.document)}return t}function Dl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Xp(e){var t=Nd(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&kd(r.ownerDocument.documentElement,r)){if(s!==null&&Dl(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=r.textContent.length,i=Math.min(s.start,l);s=s.end===void 0?i:Math.min(s.end,l),!e.extend&&i>s&&(l=s,s=i,i=l),l=jd(r,i);var u=jd(r,s);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,sn=null,Ll=null,es=null,Al=!1;function Sd(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Al||sn==null||sn!==pt(s)||(s=sn,"selectionStart"in s&&Dl(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),es&&Xn(es,s)||(es=s,s=Zs(Ll,"onSelect"),0cn||(e.current=Kl[cn],Kl[cn]=null,cn--)}function Le(e,t){cn++,Kl[cn]=e.current,e.current=t}var fr={},et=ur(fr),lt=ur(!1),Mr=fr;function un(e,t){var r=e.type.contextTypes;if(!r)return fr;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in r)l[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function at(e){return e=e.childContextTypes,e!=null}function eo(){Oe(lt),Oe(et)}function $d(e,t,r){if(et.current!==fr)throw Error(a(168));Le(et,t),Le(lt,r)}function Ud(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var l in s)if(!(l in t))throw Error(a(108,pe(e)||"Unknown",l));return K({},r,s)}function to(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fr,Mr=et.current,Le(et,e),Le(lt,lt.current),!0}function Bd(e,t,r){var s=e.stateNode;if(!s)throw Error(a(169));r?(e=Ud(e,t,Mr),s.__reactInternalMemoizedMergedChildContext=e,Oe(lt),Oe(et),Le(et,e)):Oe(lt),Le(lt,r)}var Kt=null,ro=!1,Ql=!1;function Vd(e){Kt===null?Kt=[e]:Kt.push(e)}function um(e){ro=!0,Vd(e)}function pr(){if(!Ql&&Kt!==null){Ql=!0;var e=0,t=ze;try{var r=Kt;for(ze=1;e>=u,l-=u,Qt=1<<32-_t(t)+l|r<we?(qe=xe,xe=null):qe=xe.sibling;var _e=U(_,xe,M[we],q);if(_e===null){xe===null&&(xe=qe);break}e&&xe&&_e.alternate===null&&t(_,xe),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e,xe=qe}if(we===M.length)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;wewe?(qe=xe,xe=null):qe=xe.sibling;var jr=U(_,xe,_e.value,q);if(jr===null){xe===null&&(xe=qe);break}e&&xe&&jr.alternate===null&&t(_,xe),k=i(jr,k,we),he===null?ue=jr:he.sibling=jr,he=jr,xe=qe}if(_e.done)return r(_,xe),Ie&&zr(_,we),ue;if(xe===null){for(;!_e.done;we++,_e=M.next())_e=W(_,_e.value,q),_e!==null&&(k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return Ie&&zr(_,we),ue}for(xe=s(_,xe);!_e.done;we++,_e=M.next())_e=te(xe,_,we,_e.value,q),_e!==null&&(e&&_e.alternate!==null&&xe.delete(_e.key===null?we:_e.key),k=i(_e,k,we),he===null?ue=_e:he.sibling=_e,he=_e);return e&&xe.forEach(function(Hm){return t(_,Hm)}),Ie&&zr(_,we),ue}function Ve(_,k,M,q){if(typeof M=="object"&&M!==null&&M.type===$&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case G:e:{for(var ue=M.key,he=k;he!==null;){if(he.key===ue){if(ue=M.type,ue===$){if(he.tag===7){r(_,he.sibling),k=l(he,M.props.children),k.return=_,_=k;break e}}else if(he.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Se&&qd(ue)===he.type){r(_,he.sibling),k=l(he,M.props),k.ref=ls(_,he,M),k.return=_,_=k;break e}r(_,he);break}else t(_,he);he=he.sibling}M.type===$?(k=$r(M.props.children,_.mode,q,M.key),k.return=_,_=k):(q=Ro(M.type,M.key,M.props,null,_.mode,q),q.ref=ls(_,k,M),q.return=_,_=q)}return u(_);case I:e:{for(he=M.key;k!==null;){if(k.key===he)if(k.tag===4&&k.stateNode.containerInfo===M.containerInfo&&k.stateNode.implementation===M.implementation){r(_,k.sibling),k=l(k,M.children||[]),k.return=_,_=k;break e}else{r(_,k);break}else t(_,k);k=k.sibling}k=Ha(M,_.mode,q),k.return=_,_=k}return u(_);case Se:return he=M._init,Ve(_,k,he(M._payload),q)}if(nr(M))return ie(_,k,M,q);if(ae(M))return de(_,k,M,q);lo(_,M)}return typeof M=="string"&&M!==""||typeof M=="number"?(M=""+M,k!==null&&k.tag===6?(r(_,k.sibling),k=l(k,M),k.return=_,_=k):(r(_,k),k=Wa(M,_.mode,q),k.return=_,_=k),u(_)):r(_,k)}return Ve}var hn=Zd(!0),Yd=Zd(!1),ao=ur(null),io=null,xn=null,ea=null;function ta(){ea=xn=io=null}function ra(e){var t=ao.current;Oe(ao),e._currentValue=t}function na(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}function gn(e,t){io=e,ea=xn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(it=!0),e.firstContext=null)}function kt(e){var t=e._currentValue;if(ea!==e)if(e={context:e,memoizedValue:t,next:null},xn===null){if(io===null)throw Error(a(308));xn=e,io.dependencies={lanes:0,firstContext:e}}else xn=xn.next=e;return t}var Dr=null;function sa(e){Dr===null?Dr=[e]:Dr.push(e)}function Jd(e,t,r,s){var l=t.interleaved;return l===null?(r.next=r,sa(t)):(r.next=l.next,l.next=r),t.interleaved=r,Zt(e,s)}function Zt(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var mr=!1;function oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hr(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ee&2)!==0){var l=s.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),s.pending=t,Zt(e,r)}return l=s.interleaved,l===null?(t.next=t,sa(s)):(t.next=l.next,l.next=t),s.interleaved=t,Zt(e,r)}function co(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,yl(e,r)}}function ec(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var l=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?l=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?l=i=t:i=i.next=t}else l=i=t;r={baseState:s.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function uo(e,t,r,s){var l=e.updateQueue;mr=!1;var i=l.firstBaseUpdate,u=l.lastBaseUpdate,g=l.shared.pending;if(g!==null){l.shared.pending=null;var y=g,z=y.next;y.next=null,u===null?i=z:u.next=z,u=y;var B=e.alternate;B!==null&&(B=B.updateQueue,g=B.lastBaseUpdate,g!==u&&(g===null?B.firstBaseUpdate=z:g.next=z,B.lastBaseUpdate=y))}if(i!==null){var W=l.baseState;u=0,B=z=y=null,g=i;do{var U=g.lane,te=g.eventTime;if((s&U)===U){B!==null&&(B=B.next={eventTime:te,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,de=g;switch(U=t,te=r,de.tag){case 1:if(ie=de.payload,typeof ie=="function"){W=ie.call(te,W,U);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=de.payload,U=typeof ie=="function"?ie.call(te,W,U):ie,U==null)break e;W=K({},W,U);break e;case 2:mr=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,U=l.effects,U===null?l.effects=[g]:U.push(g))}else te={eventTime:te,lane:U,tag:g.tag,payload:g.payload,callback:g.callback,next:null},B===null?(z=B=te,y=W):B=B.next=te,u|=U;if(g=g.next,g===null){if(g=l.shared.pending,g===null)break;U=g,g=U.next,U.next=null,l.lastBaseUpdate=U,l.shared.pending=null}}while(!0);if(B===null&&(y=W),l.baseState=y,l.firstBaseUpdate=z,l.lastBaseUpdate=B,t=l.shared.interleaved,t!==null){l=t;do u|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Or|=u,e.lanes=u,e.memoizedState=W}}function tc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var s=ca.transition;ca.transition={};try{e(!1),t()}finally{ze=r,ca.transition=s}}function bc(){return Nt().memoizedState}function hm(e,t,r){var s=yr(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},wc(e))jc(t,r);else if(r=Jd(e,t,r,s),r!==null){var l=ot();Lt(r,e,s,l),kc(r,t,s)}}function xm(e,t,r){var s=yr(e),l={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(wc(e))jc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,g=i(u,r);if(l.hasEagerState=!0,l.eagerState=g,Pt(g,u)){var y=t.interleaved;y===null?(l.next=l,sa(t)):(l.next=y.next,y.next=l),t.interleaved=l;return}}catch{}finally{}r=Jd(e,t,l,s),r!==null&&(l=ot(),Lt(r,e,s,l),kc(r,t,s))}}function wc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function jc(e,t){cs=mo=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function kc(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,yl(e,r)}}var go={readContext:kt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},gm={readContext:kt,useCallback:function(e,t){return Ft().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:fc,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,ho(4194308,4,hc.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var r=Ft();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=Ft();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=hm.bind(null,$e,e),[s.memoizedState,e]},useRef:function(e){var t=Ft();return e={current:e},t.memoizedState=e},useState:cc,useDebugValue:ga,useDeferredValue:function(e){return Ft().memoizedState=e},useTransition:function(){var e=cc(!1),t=e[0];return e=mm.bind(null,e[1]),Ft().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=$e,l=Ft();if(Ie){if(r===void 0)throw Error(a(407));r=r()}else{if(r=t(),Qe===null)throw Error(a(349));(Ar&30)!==0||oc(s,t,r)}l.memoizedState=r;var i={value:r,getSnapshot:t};return l.queue=i,fc(ac.bind(null,s,i,e),[e]),s.flags|=2048,ps(9,lc.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=Ft(),t=Qe.identifierPrefix;if(Ie){var r=qt,s=Qt;r=(s&~(1<<32-_t(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=us++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Tt]=t,e[ss]=s,Vc(e,t,!1,!1),t.stateNode=e;e:{switch(u=dl(r,s),r){case"dialog":Ae("cancel",e),Ae("close",e),l=s;break;case"iframe":case"object":case"embed":Ae("load",e),l=s;break;case"video":case"audio":for(l=0;ljn&&(t.flags|=128,s=!0,ms(i,!1),t.lanes=4194304)}else{if(!s)if(e=fo(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),ms(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Ie)return rt(t),null}else 2*Be()-i.renderingStartTime>jn&&r!==1073741824&&(t.flags|=128,s=!0,ms(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Be(),t.sibling=null,r=Fe.current,Le(Fe,s?r&1|2:r&1),t):(rt(t),null);case 22:case 23:return Ua(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(yt&1073741824)!==0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),null;case 24:return null;case 25:return null}throw Error(a(156,t.tag))}function Sm(e,t){switch(Zl(t),t.tag){case 1:return at(t.type)&&eo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vn(),Oe(lt),Oe(et),da(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return aa(t),null;case 13:if(Oe(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(Fe),null;case 4:return vn(),null;case 10:return ra(t.type._context),null;case 22:case 23:return Ua(),null;case 24:return null;default:return null}}var wo=!1,nt=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,le=null;function bn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Ue(e,t,s)}else r.current=null}function Pa(e,t,r){try{r()}catch(s){Ue(e,t,s)}}var Gc=!1;function Em(e,t){if(Ul=$s,e=Nd(),Dl(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var l=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,g=-1,y=-1,z=0,B=0,W=e,U=null;t:for(;;){for(var te;W!==r||l!==0&&W.nodeType!==3||(g=u+l),W!==i||s!==0&&W.nodeType!==3||(y=u+s),W.nodeType===3&&(u+=W.nodeValue.length),(te=W.firstChild)!==null;)U=W,W=te;for(;;){if(W===e)break t;if(U===r&&++z===l&&(g=u),U===i&&++B===s&&(y=u),(te=W.nextSibling)!==null)break;W=U,U=W.parentNode}W=te}r=g===-1||y===-1?null:{start:g,end:y}}else r=null}r=r||{start:0,end:0}}else r=null;for(Bl={focusedElem:e,selectionRange:r},$s=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var de=ie.memoizedProps,Ve=ie.memoizedState,_=t.stateNode,k=_.getSnapshotBeforeUpdate(t.elementType===t.type?de:Rt(t.type,de),Ve);_.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var M=t.stateNode.containerInfo;M.nodeType===1?M.textContent="":M.nodeType===9&&M.documentElement&&M.removeChild(M.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(q){Ue(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ie=Gc,Gc=!1,ie}function hs(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var l=s=s.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Pa(t,r,i)}l=l.next}while(l!==s)}}function jo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Ma(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Kc(e){var t=e.alternate;t!==null&&(e.alternate=null,Kc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[ss],delete t[Gl],delete t[dm],delete t[cm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Qc(e){return e.tag===5||e.tag===3||e.tag===4}function qc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ra(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Js));else if(s!==4&&(e=e.child,e!==null))for(Ra(e,t,r),e=e.sibling;e!==null;)Ra(e,t,r),e=e.sibling}function za(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(za(e,t,r),e=e.sibling;e!==null;)za(e,t,r),e=e.sibling}var Ze=null,zt=!1;function xr(e,t,r){for(r=r.child;r!==null;)Zc(e,t,r),r=r.sibling}function Zc(e,t,r){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(Ls,r)}catch{}switch(r.tag){case 5:nt||bn(r,t);case 6:var s=Ze,l=zt;Ze=null,xr(e,t,r),Ze=s,zt=l,Ze!==null&&(zt?(e=Ze,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ze.removeChild(r.stateNode));break;case 18:Ze!==null&&(zt?(e=Ze,r=r.stateNode,e.nodeType===8?Hl(e.parentNode,r):e.nodeType===1&&Hl(e,r),Kn(e)):Hl(Ze,r.stateNode));break;case 4:s=Ze,l=zt,Ze=r.stateNode.containerInfo,zt=!0,xr(e,t,r),Ze=s,zt=l;break;case 0:case 11:case 14:case 15:if(!nt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){l=s=s.next;do{var i=l,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Pa(r,t,u),l=l.next}while(l!==s)}xr(e,t,r);break;case 1:if(!nt&&(bn(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(g){Ue(r,t,g)}xr(e,t,r);break;case 21:xr(e,t,r);break;case 22:r.mode&1?(nt=(s=nt)||r.memoizedState!==null,xr(e,t,r),nt=s):xr(e,t,r);break;default:xr(e,t,r)}}function Yc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Cm),t.forEach(function(s){var l=Om.bind(null,e,s);r.has(s)||(r.add(s),s.then(l,l))})}}function Dt(e,t){var r=t.deletions;if(r!==null)for(var s=0;sl&&(l=u),s&=~i}if(s=l,s=Be()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Pm(s/1960))-s,10e?16:e,vr===null)var s=!1;else{if(e=vr,vr=null,Eo=0,(Ee&6)!==0)throw Error(a(331));var l=Ee;for(Ee|=4,le=e.current;le!==null;){var i=le,u=i.child;if((le.flags&16)!==0){var g=i.deletions;if(g!==null){for(var y=0;yBe()-Aa?Ir(e,0):La|=r),ct(e,t)}function cu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Os,Os<<=1,(Os&130023424)===0&&(Os=4194304)));var r=ot();e=Zt(e,t),e!==null&&(Bn(e,t,r),ct(e,r))}function Am(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),cu(e,r)}function Om(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,l=e.memoizedState;l!==null&&(r=l.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(a(314))}s!==null&&s.delete(t),cu(e,r)}var uu;uu=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)it=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return it=!1,km(e,t,r);it=(e.flags&131072)!==0}else it=!1,Ie&&(t.flags&1048576)!==0&&Wd(t,so,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;bo(e,t),e=t.pendingProps;var l=un(t,et.current);gn(t,r),l=fa(null,t,s,e,l,r);var i=pa();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(s)?(i=!0,to(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,oa(t),l.updater=vo,t.stateNode=l,l._reactInternals=t,ya(t,s,e,r),t=ka(null,t,s,!0,i,r)):(t.tag=0,Ie&&i&&ql(t),st(null,t,l,r),t=t.child),t;case 16:s=t.elementType;e:{switch(bo(e,t),e=t.pendingProps,l=s._init,s=l(s._payload),t.type=s,l=t.tag=Im(s),e=Rt(s,e),l){case 0:t=ja(null,t,s,e,r);break e;case 1:t=Tc(null,t,s,e,r);break e;case 11:t=zc(null,t,s,e,r);break e;case 14:t=Dc(null,t,s,Rt(s.type,e),r);break e}throw Error(a(306,s,""))}return t;case 0:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),ja(e,t,s,l,r);case 1:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),Tc(e,t,s,l,r);case 3:e:{if(Ic(t),e===null)throw Error(a(387));s=t.pendingProps,i=t.memoizedState,l=i.element,Xd(e,t),uo(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(a(423)),t),t=Fc(e,t,s,r,l);break e}else if(s!==l){l=yn(Error(a(424)),t),t=Fc(e,t,s,r,l);break e}else for(vt=cr(t.stateNode.containerInfo.firstChild),gt=t,Ie=!0,Mt=null,r=Yd(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mn(),s===l){t=Jt(e,t,r);break e}st(e,t,s,r)}t=t.child}return t;case 5:return rc(t),e===null&&Jl(t),s=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,u=l.children,Vl(s,l)?u=null:i!==null&&Vl(s,i)&&(t.flags|=32),Oc(e,t),st(e,t,u,r),t.child;case 6:return e===null&&Jl(t),null;case 13:return $c(e,t,r);case 4:return la(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hn(t,null,s,r):st(e,t,s,r),t.child;case 11:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),zc(e,t,s,l,r);case 7:return st(e,t,t.pendingProps,r),t.child;case 8:return st(e,t,t.pendingProps.children,r),t.child;case 12:return st(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,l=t.pendingProps,i=t.memoizedProps,u=l.value,Le(ao,s._currentValue),s._currentValue=u,i!==null)if(Pt(i.value,u)){if(i.children===l.children&&!lt.current){t=Jt(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){u=i.child;for(var y=g.firstContext;y!==null;){if(y.context===s){if(i.tag===1){y=Yt(-1,r&-r),y.tag=2;var z=i.updateQueue;if(z!==null){z=z.shared;var B=z.pending;B===null?y.next=y:(y.next=B.next,B.next=y),z.pending=y}}i.lanes|=r,y=i.alternate,y!==null&&(y.lanes|=r),na(i.return,r,t),g.lanes|=r;break}y=y.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(a(341));u.lanes|=r,g=u.alternate,g!==null&&(g.lanes|=r),na(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}st(e,t,l.children,r),t=t.child}return t;case 9:return l=t.type,s=t.pendingProps.children,gn(t,r),l=kt(l),s=s(l),t.flags|=1,st(e,t,s,r),t.child;case 14:return s=t.type,l=Rt(s,t.pendingProps),l=Rt(s.type,l),Dc(e,t,s,l,r);case 15:return Lc(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,l=t.pendingProps,l=t.elementType===s?l:Rt(s,l),bo(e,t),t.tag=1,at(s)?(e=!0,to(t)):e=!1,gn(t,r),Sc(t,s,l),ya(t,s,l,r),ka(null,t,s,!0,e,r);case 19:return Bc(e,t,r);case 22:return Ac(e,t,r)}throw Error(a(156,t.tag))};function fu(e,t){return Hi(e,t)}function Tm(e,t,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ct(e,t,r,s){return new Tm(e,t,r,s)}function Va(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Im(e){if(typeof e=="function")return Va(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ce)return 11;if(e===Re)return 14}return 2}function wr(e,t){var r=e.alternate;return r===null?(r=Ct(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ro(e,t,r,s,l,i){var u=2;if(s=e,typeof e=="function")Va(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case $:return $r(r.children,l,i,t);case ne:u=8,l|=8;break;case se:return e=Ct(12,r,t,l|2),e.elementType=se,e.lanes=i,e;case Me:return e=Ct(13,r,t,l),e.elementType=Me,e.lanes=i,e;case Pe:return e=Ct(19,r,t,l),e.elementType=Pe,e.lanes=i,e;case Ne:return zo(r,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case X:u=10;break e;case be:u=9;break e;case ce:u=11;break e;case Re:u=14;break e;case Se:u=16,s=null;break e}throw Error(a(130,e==null?e:typeof e,""))}return t=Ct(u,r,t,l),t.elementType=e,t.type=s,t.lanes=i,t}function $r(e,t,r,s){return e=Ct(7,e,s,t),e.lanes=r,e}function zo(e,t,r,s){return e=Ct(22,e,s,t),e.elementType=Ne,e.lanes=r,e.stateNode={isHidden:!1},e}function Wa(e,t,r){return e=Ct(6,e,null,t),e.lanes=r,e}function Ha(e,t,r){return t=Ct(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Fm(e,t,r,s,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vl(0),this.expirationTimes=vl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vl(0),this.identifierPrefix=s,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ga(e,t,r,s,l,i,u,g,y){return e=new Fm(e,t,r,g,y),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ct(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},oa(i),e}function $m(e,t,r){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(d){console.error(d)}}return o(),Ja.exports=Jm(),Ja.exports}var Cu;function Xm(){if(Cu)return Fo;Cu=1;var o=rf();return Fo.createRoot=o.createRoot,Fo.hydrateRoot=o.hydrateRoot,Fo}var eh=Xm();const th=ef(eh);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rh=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nf=(...o)=>o.filter((d,a,c)=>!!d&&d.trim()!==""&&c.indexOf(d)===a).join(" ").trim();/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var nh={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"};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sh=p.forwardRef(({color:o="currentColor",size:d=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:f="",children:m,iconNode:h,...x},S)=>p.createElement("svg",{ref:S,...nh,width:d,height:d,stroke:o,strokeWidth:c?Number(a)*24/Number(d):a,className:nf("lucide",f),...x},[...h.map(([b,j])=>p.createElement(b,j)),...Array.isArray(m)?m:[m]]));/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ve=(o,d)=>{const a=p.forwardRef(({className:c,...f},m)=>p.createElement(sh,{ref:m,iconNode:d,className:nf(`lucide-${rh(o)}`,c),...f}));return a.displayName=`${o}`,a};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jo=ve("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eu=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sf=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ns=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oh=ve("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ss=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zn=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lh=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ah=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ih=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dh=ve("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ch=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uh=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pi=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fh=ve("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ph=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mi=ve("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mh=ve("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const of=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bt=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wr=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xo=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _u=ve("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hi=ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hh=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xh=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xi=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gh=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vh=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cs=ve("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yh=ve("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bh=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wh=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lf=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const af=ve("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vr=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jh=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kh=ve("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ei=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nh=ve("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sh=ve("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hr=ve("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ch=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const df=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eh=ve("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const el=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gi=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _h=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ph=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tl=ve("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"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gr=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vi=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:yh},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:oh},{id:"system",label:"Diagnose",hint:"Metriken, Dienste, Logs",icon:bt},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:Ss},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:wh},{id:"agent",label:"Hermes",hint:"Agent-Status & WebUI öffnen",icon:Ns},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:ch}];var Pu=1,Mh=.9,Rh=.8,zh=.17,ti=.1,ri=.999,Dh=.9999,Lh=.99,Ah=/[\\\/_+.#"@\[\(\{&]/,Oh=/[\\\/_+.#"@\[\(\{&]/g,Th=/[\s-]/,cf=/[\s-]/g;function yi(o,d,a,c,f,m,h){if(m===d.length)return f===o.length?Pu:Lh;var x=`${f},${m}`;if(h[x]!==void 0)return h[x];for(var S=c.charAt(m),b=a.indexOf(S,f),j=0,P,L,F,A;b>=0;)P=yi(o,d,a,c,b+1,m+1,h),P>j&&(b===f?P*=Pu:Ah.test(o.charAt(b-1))?(P*=Rh,F=o.slice(f,b-1).match(Oh),F&&f>0&&(P*=Math.pow(ri,F.length))):Th.test(o.charAt(b-1))?(P*=Mh,A=o.slice(f,b-1).match(cf),A&&f>0&&(P*=Math.pow(ri,A.length))):(P*=zh,f>0&&(P*=Math.pow(ri,b-f))),o.charAt(b)!==d.charAt(m)&&(P*=Dh)),(PP&&(P=L*ti)),P>j&&(j=P),b=a.indexOf(S,b+1);return h[x]=j,j}function Mu(o){return o.toLowerCase().replace(cf," ")}function Ih(o,d,a){return o=a&&a.length>0?`${o+" "+a.join(" ")}`:o,yi(o,d,Mu(o),Mu(d),0,0,{})}function Cr(o,d,{checkForDefaultPrevented:a=!0}={}){return function(f){if(o==null||o(f),a===!1||!f.defaultPrevented)return d==null?void 0:d(f)}}function Ru(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function Dn(...o){return d=>{let a=!1;const c=o.map(f=>{const m=Ru(f,d);return!a&&typeof m=="function"&&(a=!0),m});if(a)return()=>{for(let f=0;f{var E;const{scope:L,children:F,...A}=P,N=((E=L==null?void 0:L[o])==null?void 0:E[S])||x,C=p.useMemo(()=>A,Object.values(A));return n.jsx(N.Provider,{value:C,children:F})};b.displayName=m+"Provider";function j(P,L){var N;const F=((N=L==null?void 0:L[o])==null?void 0:N[S])||x,A=p.useContext(F);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${P}\` must be used within \`${m}\``)}return[b,j]}const f=()=>{const m=a.map(h=>p.createContext(h));return function(x){const S=(x==null?void 0:x[o])||m;return p.useMemo(()=>({[`__scope${o}`]:{...x,[o]:S}}),[x,S])}};return f.scopeName=o,[c,$h(f,...d)]}function $h(...o){const d=o[0];if(o.length===1)return d;const a=()=>{const c=o.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const h=c.reduce((x,{useScope:S,scopeName:b})=>{const P=S(m)[`__scope${b}`];return{...x,...P}},{});return p.useMemo(()=>({[`__scope${d.scopeName}`]:h}),[h])}};return a.scopeName=d.scopeName,a}var Es=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Uh=Ci[" useId ".trim().toString()]||(()=>{}),Bh=0;function tr(o){const[d,a]=p.useState(Uh());return Es(()=>{a(c=>c??String(Bh++))},[o]),d?`radix-${d}`:""}var Vh=Ci[" useInsertionEffect ".trim().toString()]||Es;function Wh({prop:o,defaultProp:d,onChange:a=()=>{},caller:c}){const[f,m,h]=Hh({defaultProp:d,onChange:a}),x=o!==void 0,S=x?o:f;{const j=p.useRef(o!==void 0);p.useEffect(()=>{const P=j.current;P!==x&&console.warn(`${c} is changing from ${P?"controlled":"uncontrolled"} to ${x?"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.`),j.current=x},[x,c])}const b=p.useCallback(j=>{var P;if(x){const L=Gh(j)?j(o):j;L!==o&&((P=h.current)==null||P.call(h,L))}else m(j)},[x,o,m,h]);return[S,b]}function Hh({defaultProp:o,onChange:d}){const[a,c]=p.useState(o),f=p.useRef(a),m=p.useRef(d);return Vh(()=>{m.current=d},[d]),p.useEffect(()=>{var h;f.current!==a&&((h=m.current)==null||h.call(m,a),f.current=a)},[a,f]),[a,c,m]}function Gh(o){return typeof o=="function"}var uf=rf();function ff(o){const d=p.forwardRef((a,c)=>{let{children:f,...m}=a,h=null,x=!1;const S=[];zu(f)&&typeof $o=="function"&&(f=$o(f._payload)),p.Children.forEach(f,L=>{var F;if(Yh(L)){x=!0;const A=L;let N="child"in A.props?A.props.child:A.props.children;zu(N)&&typeof $o=="function"&&(N=$o(N._payload)),h=Qh(A,N),S.push((F=h==null?void 0:h.props)==null?void 0:F.children)}else S.push(L)}),h?h=p.cloneElement(h,void 0,S):!x&&p.Children.count(f)===1&&p.isValidElement(f)&&(h=f);const b=h?Zh(h):void 0,j=Qr(c,b);if(!h){if(f||f===0)throw new Error(x?tx(o):ex(o));return f}const P=qh(m,h.props??{});return h.type!==p.Fragment&&(P.ref=c?j:b),p.cloneElement(h,P)});return d.displayName=`${o}.Slot`,d}var Kh=Symbol.for("radix.slottable"),Qh=(o,d)=>{if("child"in o.props){const a=o.props.child;return p.isValidElement(a)?p.cloneElement(a,void 0,o.props.children(a.props.children)):null}return p.isValidElement(d)?d:null};function qh(o,d){const a={...d};for(const c in d){const f=o[c],m=d[c];/^on[A-Z]/.test(c)?f&&m?a[c]=(...x)=>{const S=m(...x);return f(...x),S}:f&&(a[c]=f):c==="style"?a[c]={...f,...m}:c==="className"&&(a[c]=[f,m].filter(Boolean).join(" "))}return{...o,...a}}function Zh(o){var c,f;let d=(c=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:c.get,a=d&&"isReactWarning"in d&&d.isReactWarning;return a?o.ref:(d=(f=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:f.get,a=d&&"isReactWarning"in d&&d.isReactWarning,a?o.props.ref:o.props.ref||o.ref)}function Yh(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Kh}var Jh=Symbol.for("react.lazy");function zu(o){return o!=null&&typeof o=="object"&&"$$typeof"in o&&o.$$typeof===Jh&&"_payload"in o&&Xh(o._payload)}function Xh(o){return typeof o=="object"&&o!==null&&"then"in o}var ex=o=>`${o} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,tx=o=>`${o} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,$o=Ci[" use ".trim().toString()],rx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Je=rx.reduce((o,d)=>{const a=ff(`Primitive.${d}`),c=p.forwardRef((f,m)=>{const{asChild:h,...x}=f,S=h?a:d;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(S,{...x,ref:m})});return c.displayName=`Primitive.${d}`,{...o,[d]:c}},{});function nx(o,d){o&&uf.flushSync(()=>o.dispatchEvent(d))}function _s(o){const d=p.useRef(o);return p.useEffect(()=>{d.current=o}),p.useMemo(()=>((...a)=>{var c;return(c=d.current)==null?void 0:c.call(d,...a)}),[])}function sx(o,d=globalThis==null?void 0:globalThis.document){const a=_s(o);p.useEffect(()=>{const c=f=>{f.key==="Escape"&&a(f)};return d.addEventListener("keydown",c,{capture:!0}),()=>d.removeEventListener("keydown",c,{capture:!0})},[a,d])}var ox="DismissableLayer",bi="dismissableLayer.update",lx="dismissableLayer.pointerDownOutside",ax="dismissableLayer.focusOutside",Du,_i=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),pf=p.forwardRef((o,d)=>{const{disableOutsidePointerEvents:a=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:S,...b}=o,j=p.useContext(_i),[P,L]=p.useState(null),F=(P==null?void 0:P.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,A]=p.useState({}),N=Qr(d,se=>L(se)),C=Array.from(j.layers),[E]=[...j.layersWithOutsidePointerEventsDisabled].slice(-1),D=C.indexOf(E),Z=P?C.indexOf(P):-1,Y=j.layersWithOutsidePointerEventsDisabled.size>0,G=Z>=D,I=p.useRef(!1),$=ux(se=>{const X=se.target;if(!(X instanceof Node))return;const be=[...j.branches].some(ce=>ce.contains(X));!G||be||(m==null||m(se),x==null||x(se),se.defaultPrevented||S==null||S())},{ownerDocument:F,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:j.dismissableSurfaces}),ne=fx(se=>{if(c&&I.current)return;const X=se.target;[...j.branches].some(ce=>ce.contains(X))||(h==null||h(se),x==null||x(se),se.defaultPrevented||S==null||S())},F);return sx(se=>{Z===j.layers.size-1&&(f==null||f(se),!se.defaultPrevented&&S&&(se.preventDefault(),S()))},F),p.useEffect(()=>{if(P)return a&&(j.layersWithOutsidePointerEventsDisabled.size===0&&(Du=F.body.style.pointerEvents,F.body.style.pointerEvents="none"),j.layersWithOutsidePointerEventsDisabled.add(P)),j.layers.add(P),Lu(),()=>{a&&(j.layersWithOutsidePointerEventsDisabled.delete(P),j.layersWithOutsidePointerEventsDisabled.size===0&&(F.body.style.pointerEvents=Du))}},[P,F,a,j]),p.useEffect(()=>()=>{P&&(j.layers.delete(P),j.layersWithOutsidePointerEventsDisabled.delete(P),Lu())},[P,j]),p.useEffect(()=>{const se=()=>A({});return document.addEventListener(bi,se),()=>document.removeEventListener(bi,se)},[]),n.jsx(Je.div,{...b,ref:N,style:{pointerEvents:Y?G?"auto":"none":void 0,...o.style},onFocusCapture:Cr(o.onFocusCapture,ne.onFocusCapture),onBlurCapture:Cr(o.onBlurCapture,ne.onBlurCapture),onPointerDownCapture:Cr(o.onPointerDownCapture,$.onPointerDownCapture)})});pf.displayName=ox;var ix="DismissableLayerBranch",dx=p.forwardRef((o,d)=>{const a=p.useContext(_i),c=p.useRef(null),f=Qr(d,c);return p.useEffect(()=>{const m=c.current;if(m)return a.branches.add(m),()=>{a.branches.delete(m)}},[a.branches]),n.jsx(Je.div,{...o,ref:f})});dx.displayName=ix;function cx(){const o=p.useContext(_i),[d,a]=p.useState(null);return p.useEffect(()=>{if(d)return o.dismissableSurfaces.add(d),()=>{o.dismissableSurfaces.delete(d)}},[d,o.dismissableSurfaces]),a}function ux(o,d){const{ownerDocument:a=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:c=!1,isDeferredPointerDownOutsideRef:f,dismissableSurfaces:m}=d,h=_s(o),x=p.useRef(!1),S=p.useRef(!1),b=p.useRef(new Map),j=p.useRef(()=>{});return p.useEffect(()=>{function P(){S.current=!1,f.current=!1,b.current.clear()}function L(){return Array.from(b.current.values()).some(Boolean)}function F(D){if(!S.current)return;const Z=D.target;Z instanceof Node&&[...m].some(G=>G.contains(Z))||b.current.set(D.type,!0),D.type==="click"&&window.setTimeout(()=>{S.current&&j.current()},0)}function A(D){S.current&&b.current.set(D.type,!1)}const N=D=>{if(D.target&&!x.current){let Z=function(){a.removeEventListener("click",j.current);const G=L();P(),G||mf(lx,h,Y,{discrete:!0})};const Y={originalEvent:D};S.current=!0,f.current=c&&D.button===0,b.current.clear(),!c||D.button!==0?Z():(a.removeEventListener("click",j.current),j.current=Z,a.addEventListener("click",j.current,{once:!0}))}else a.removeEventListener("click",j.current),P();x.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const D of C)a.addEventListener(D,F,!0),a.addEventListener(D,A);const E=window.setTimeout(()=>{a.addEventListener("pointerdown",N)},0);return()=>{window.clearTimeout(E),a.removeEventListener("pointerdown",N),a.removeEventListener("click",j.current);for(const D of C)a.removeEventListener(D,F,!0),a.removeEventListener(D,A)}},[a,h,c,f,m]),{onPointerDownCapture:()=>x.current=!0}}function fx(o,d=globalThis==null?void 0:globalThis.document){const a=_s(o),c=p.useRef(!1);return p.useEffect(()=>{const f=m=>{m.target&&!c.current&&mf(ax,a,{originalEvent:m},{discrete:!1})};return d.addEventListener("focusin",f),()=>d.removeEventListener("focusin",f)},[d,a]),{onFocusCapture:()=>c.current=!0,onBlurCapture:()=>c.current=!1}}function Lu(){const o=new CustomEvent(bi);document.dispatchEvent(o)}function mf(o,d,a,{discrete:c}){const f=a.originalEvent.target,m=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:a});d&&f.addEventListener(o,d,{once:!0}),c?nx(f,m):f.dispatchEvent(m)}var ni="focusScope.autoFocusOnMount",si="focusScope.autoFocusOnUnmount",Au={bubbles:!1,cancelable:!0},px="FocusScope",hf=p.forwardRef((o,d)=>{const{loop:a=!1,trapped:c=!1,onMountAutoFocus:f,onUnmountAutoFocus:m,...h}=o,[x,S]=p.useState(null),b=_s(f),j=_s(m),P=p.useRef(null),L=Qr(d,N=>S(N)),F=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(c){let N=function(Z){if(F.paused||!x)return;const Y=Z.target;x.contains(Y)?P.current=Y:Sr(P.current,{select:!0})},C=function(Z){if(F.paused||!x)return;const Y=Z.relatedTarget;Y!==null&&(x.contains(Y)||Sr(P.current,{select:!0}))},E=function(Z){if(document.activeElement===document.body)for(const G of Z)G.removedNodes.length>0&&Sr(x)};document.addEventListener("focusin",N),document.addEventListener("focusout",C);const D=new MutationObserver(E);return x&&D.observe(x,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",C),D.disconnect()}}},[c,x,F.paused]),p.useEffect(()=>{if(x){Tu.add(F);const N=document.activeElement;if(!x.contains(N)){const E=new CustomEvent(ni,Au);x.addEventListener(ni,b),x.dispatchEvent(E),E.defaultPrevented||(mx(yx(xf(x)),{select:!0}),document.activeElement===N&&Sr(x))}return()=>{x.removeEventListener(ni,b),setTimeout(()=>{const E=new CustomEvent(si,Au);x.addEventListener(si,j),x.dispatchEvent(E),E.defaultPrevented||Sr(N??document.body,{select:!0}),x.removeEventListener(si,j),Tu.remove(F)},0)}}},[x,b,j,F]);const A=p.useCallback(N=>{if(!a&&!c||F.paused)return;const C=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(C&&E){const D=N.currentTarget,[Z,Y]=hx(D);Z&&Y?!N.shiftKey&&E===Y?(N.preventDefault(),a&&Sr(Z,{select:!0})):N.shiftKey&&E===Z&&(N.preventDefault(),a&&Sr(Y,{select:!0})):E===D&&N.preventDefault()}},[a,c,F.paused]);return n.jsx(Je.div,{tabIndex:-1,...h,ref:L,onKeyDown:A})});hf.displayName=px;function mx(o,{select:d=!1}={}){const a=document.activeElement;for(const c of o)if(Sr(c,{select:d}),document.activeElement!==a)return}function hx(o){const d=xf(o),a=Ou(d,o),c=Ou(d.reverse(),o);return[a,c]}function xf(o){const d=[],a=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:c=>{const f=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||f?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)d.push(a.currentNode);return d}function Ou(o,d){for(const a of o)if(!xx(a,{upTo:d}))return a}function xx(o,{upTo:d}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(d!==void 0&&o===d)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function gx(o){return o instanceof HTMLInputElement&&"select"in o}function Sr(o,{select:d=!1}={}){if(o&&o.focus){const a=document.activeElement;o.focus({preventScroll:!0}),o!==a&&gx(o)&&d&&o.select()}}var Tu=vx();function vx(){let o=[];return{add(d){const a=o[0];d!==a&&(a==null||a.pause()),o=Iu(o,d),o.unshift(d)},remove(d){var a;o=Iu(o,d),(a=o[0])==null||a.resume()}}}function Iu(o,d){const a=[...o],c=a.indexOf(d);return c!==-1&&a.splice(c,1),a}function yx(o){return o.filter(d=>d.tagName!=="A")}var bx="Portal",gf=p.forwardRef((o,d)=>{var x;const{container:a,...c}=o,[f,m]=p.useState(!1);Es(()=>m(!0),[]);const h=a||f&&((x=globalThis==null?void 0:globalThis.document)==null?void 0:x.body);return h?uf.createPortal(n.jsx(Je.div,{...c,ref:d}),h):null});gf.displayName=bx;function wx(o,d){return p.useReducer((a,c)=>d[a][c]??a,o)}var nl=o=>{const{present:d,children:a}=o,c=jx(d),f=typeof a=="function"?a({present:c.isPresent}):p.Children.only(a),m=kx(c.ref,Nx(f));return typeof a=="function"||c.isPresent?p.cloneElement(f,{ref:m}):null};nl.displayName="Presence";function jx(o){const[d,a]=p.useState(),c=p.useRef(null),f=p.useRef(o),m=p.useRef("none"),h=o?"mounted":"unmounted",[x,S]=wx(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const b=Uo(c.current);m.current=x==="mounted"?b:"none"},[x]),Es(()=>{const b=c.current,j=f.current;if(j!==o){const L=m.current,F=Uo(b);o?S("MOUNT"):F==="none"||(b==null?void 0:b.display)==="none"?S("UNMOUNT"):S(j&&L!==F?"ANIMATION_OUT":"UNMOUNT"),f.current=o}},[o,S]),Es(()=>{if(d){let b;const j=d.ownerDocument.defaultView??window,P=F=>{const N=Uo(c.current).includes(CSS.escape(F.animationName));if(F.target===d&&N&&(S("ANIMATION_END"),!f.current)){const C=d.style.animationFillMode;d.style.animationFillMode="forwards",b=j.setTimeout(()=>{d.style.animationFillMode==="forwards"&&(d.style.animationFillMode=C)})}},L=F=>{F.target===d&&(m.current=Uo(c.current))};return d.addEventListener("animationstart",L),d.addEventListener("animationcancel",P),d.addEventListener("animationend",P),()=>{j.clearTimeout(b),d.removeEventListener("animationstart",L),d.removeEventListener("animationcancel",P),d.removeEventListener("animationend",P)}}else S("ANIMATION_END")},[d,S]),{isPresent:["mounted","unmountSuspended"].includes(x),ref:p.useCallback(b=>{c.current=b?getComputedStyle(b):null,a(b)},[])}}function Fu(o,d){if(typeof o=="function")return o(d);o!=null&&(o.current=d)}function kx(...o){const d=p.useRef(o);return d.current=o,p.useCallback(a=>{const c=d.current;let f=!1;const m=c.map(h=>{const x=Fu(h,a);return!f&&typeof x=="function"&&(f=!0),x});if(f)return()=>{for(let h=0;h{Ut||(Ut={start:$u(),end:$u()});const{start:o,end:d}=Ut;return document.body.firstElementChild!==o&&document.body.insertAdjacentElement("afterbegin",o),document.body.lastElementChild!==d&&document.body.insertAdjacentElement("beforeend",d),Bo++,()=>{Bo===1&&(Ut==null||Ut.start.remove(),Ut==null||Ut.end.remove(),Ut=null),Bo=Math.max(0,Bo-1)}},[])}function $u(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var Bt=function(){return Bt=Object.assign||function(d){for(var a,c=1,f=arguments.length;c"u")return Bx;var d=Vx(o),a=document.documentElement.clientWidth,c=window.innerWidth;return{left:d[0],top:d[1],right:d[2],gap:Math.max(0,c-a+d[2]-d[0])}},Hx=wf(),Mn="data-scroll-locked",Gx=function(o,d,a,c){var f=o.left,m=o.top,h=o.right,x=o.gap;return a===void 0&&(a="margin"),` - .`.concat(Ex,` { - overflow: hidden `).concat(c,`; - padding-right: `).concat(x,"px ").concat(c,`; - } - body[`).concat(Mn,`] { - overflow: hidden `).concat(c,`; - overscroll-behavior: contain; - `).concat([d&&"position: relative ".concat(c,";"),a==="margin"&&` - padding-left: `.concat(f,`px; - padding-top: `).concat(m,`px; - padding-right: `).concat(h,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(x,"px ").concat(c,`; - `),a==="padding"&&"padding-right: ".concat(x,"px ").concat(c,";")].filter(Boolean).join(""),` - } - - .`).concat(Zo,` { - right: `).concat(x,"px ").concat(c,`; - } - - .`).concat(Yo,` { - margin-right: `).concat(x,"px ").concat(c,`; - } - - .`).concat(Zo," .").concat(Zo,` { - right: 0 `).concat(c,`; - } - - .`).concat(Yo," .").concat(Yo,` { - margin-right: 0 `).concat(c,`; - } - - body[`).concat(Mn,`] { - `).concat(_x,": ").concat(x,`px; - } -`)},Bu=function(){var o=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(o)?o:0},Kx=function(){p.useEffect(function(){return document.body.setAttribute(Mn,(Bu()+1).toString()),function(){var o=Bu()-1;o<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,o.toString())}},[])},Qx=function(o){var d=o.noRelative,a=o.noImportant,c=o.gapMode,f=c===void 0?"margin":c;Kx();var m=p.useMemo(function(){return Wx(f)},[f]);return p.createElement(Hx,{styles:Gx(m,!d,f,a?"":"!important")})},wi=!1;if(typeof window<"u")try{var Vo=Object.defineProperty({},"passive",{get:function(){return wi=!0,!0}});window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{wi=!1}var Nn=wi?{passive:!1}:!1,qx=function(o){return o.tagName==="TEXTAREA"},jf=function(o,d){if(!(o instanceof Element))return!1;var a=window.getComputedStyle(o);return a[d]!=="hidden"&&!(a.overflowY===a.overflowX&&!qx(o)&&a[d]==="visible")},Zx=function(o){return jf(o,"overflowY")},Yx=function(o){return jf(o,"overflowX")},Vu=function(o,d){var a=d.ownerDocument,c=d;do{typeof ShadowRoot<"u"&&c instanceof ShadowRoot&&(c=c.host);var f=kf(o,c);if(f){var m=Nf(o,c),h=m[1],x=m[2];if(h>x)return!0}c=c.parentNode}while(c&&c!==a.body);return!1},Jx=function(o){var d=o.scrollTop,a=o.scrollHeight,c=o.clientHeight;return[d,a,c]},Xx=function(o){var d=o.scrollLeft,a=o.scrollWidth,c=o.clientWidth;return[d,a,c]},kf=function(o,d){return o==="v"?Zx(d):Yx(d)},Nf=function(o,d){return o==="v"?Jx(d):Xx(d)},eg=function(o,d){return o==="h"&&d==="rtl"?-1:1},tg=function(o,d,a,c,f){var m=eg(o,window.getComputedStyle(d).direction),h=m*c,x=a.target,S=d.contains(x),b=!1,j=h>0,P=0,L=0;do{if(!x)break;var F=Nf(o,x),A=F[0],N=F[1],C=F[2],E=N-C-m*A;(A||E)&&kf(o,x)&&(P+=E,L+=A);var D=x.parentNode;x=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!S&&x!==document.body||S&&(d.contains(x)||d===x));return(j&&Math.abs(P)<1||!j&&Math.abs(L)<1)&&(b=!0),b},Wo=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},Wu=function(o){return[o.deltaX,o.deltaY]},Hu=function(o){return o&&"current"in o?o.current:o},rg=function(o,d){return o[0]===d[0]&&o[1]===d[1]},ng=function(o){return` - .block-interactivity-`.concat(o,` {pointer-events: none;} - .allow-interactivity-`).concat(o,` {pointer-events: all;} -`)},sg=0,Sn=[];function og(o){var d=p.useRef([]),a=p.useRef([0,0]),c=p.useRef(),f=p.useState(sg++)[0],m=p.useState(wf)[0],h=p.useRef(o);p.useEffect(function(){h.current=o},[o]),p.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(f));var N=Cx([o.lockRef.current],(o.shards||[]).map(Hu),!0).filter(Boolean);return N.forEach(function(C){return C.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),N.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(f))})}}},[o.inert,o.lockRef.current,o.shards]);var x=p.useCallback(function(N,C){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!h.current.allowPinchZoom;var E=Wo(N),D=a.current,Z="deltaX"in N?N.deltaX:D[0]-E[0],Y="deltaY"in N?N.deltaY:D[1]-E[1],G,I=N.target,$=Math.abs(Z)>Math.abs(Y)?"h":"v";if("touches"in N&&$==="h"&&I.type==="range")return!1;var ne=window.getSelection(),se=ne&&ne.anchorNode,X=se?se===I||se.contains(I):!1;if(X)return!1;var be=Vu($,I);if(!be)return!0;if(be?G=$:(G=$==="v"?"h":"v",be=Vu($,I)),!be)return!1;if(!c.current&&"changedTouches"in N&&(Z||Y)&&(c.current=G),!G)return!0;var ce=c.current||G;return tg(ce,C,N,ce==="h"?Z:Y)},[]),S=p.useCallback(function(N){var C=N;if(!(!Sn.length||Sn[Sn.length-1]!==m)){var E="deltaY"in C?Wu(C):Wo(C),D=d.current.filter(function(G){return G.name===C.type&&(G.target===C.target||C.target===G.shadowParent)&&rg(G.delta,E)})[0];if(D&&D.should){C.cancelable&&C.preventDefault();return}if(!D){var Z=(h.current.shards||[]).map(Hu).filter(Boolean).filter(function(G){return G.contains(C.target)}),Y=Z.length>0?x(C,Z[0]):!h.current.noIsolation;Y&&C.cancelable&&C.preventDefault()}}},[]),b=p.useCallback(function(N,C,E,D){var Z={name:N,delta:C,target:E,should:D,shadowParent:lg(E)};d.current.push(Z),setTimeout(function(){d.current=d.current.filter(function(Y){return Y!==Z})},1)},[]),j=p.useCallback(function(N){a.current=Wo(N),c.current=void 0},[]),P=p.useCallback(function(N){b(N.type,Wu(N),N.target,x(N,o.lockRef.current))},[]),L=p.useCallback(function(N){b(N.type,Wo(N),N.target,x(N,o.lockRef.current))},[]);p.useEffect(function(){return Sn.push(m),o.setCallbacks({onScrollCapture:P,onWheelCapture:P,onTouchMoveCapture:L}),document.addEventListener("wheel",S,Nn),document.addEventListener("touchmove",S,Nn),document.addEventListener("touchstart",j,Nn),function(){Sn=Sn.filter(function(N){return N!==m}),document.removeEventListener("wheel",S,Nn),document.removeEventListener("touchmove",S,Nn),document.removeEventListener("touchstart",j,Nn)}},[]);var F=o.removeScrollBar,A=o.inert;return p.createElement(p.Fragment,null,A?p.createElement(m,{styles:ng(f)}):null,F?p.createElement(Qx,{noRelative:o.noRelative,gapMode:o.gapMode}):null)}function lg(o){for(var d=null;o!==null;)o instanceof ShadowRoot&&(d=o.host,o=o.host),o=o.parentNode;return d}const ag=Ax(bf,og);var Sf=p.forwardRef(function(o,d){return p.createElement(sl,Bt({},o,{ref:d,sideCar:ag}))});Sf.classNames=sl.classNames;var ig=function(o){if(typeof document>"u")return null;var d=Array.isArray(o)?o[0]:o;return d.ownerDocument.body},Cn=new WeakMap,Ho=new WeakMap,Go={},ii=0,Cf=function(o){return o&&(o.host||Cf(o.parentNode))},dg=function(o,d){return d.map(function(a){if(o.contains(a))return a;var c=Cf(a);return c&&o.contains(c)?c:(console.error("aria-hidden",a,"in not contained inside",o,". Doing nothing"),null)}).filter(function(a){return!!a})},cg=function(o,d,a,c){var f=dg(d,Array.isArray(o)?o:[o]);Go[a]||(Go[a]=new WeakMap);var m=Go[a],h=[],x=new Set,S=new Set(f),b=function(P){!P||x.has(P)||(x.add(P),b(P.parentNode))};f.forEach(b);var j=function(P){!P||S.has(P)||Array.prototype.forEach.call(P.children,function(L){if(x.has(L))j(L);else try{var F=L.getAttribute(c),A=F!==null&&F!=="false",N=(Cn.get(L)||0)+1,C=(m.get(L)||0)+1;Cn.set(L,N),m.set(L,C),h.push(L),N===1&&A&&Ho.set(L,!0),C===1&&L.setAttribute(a,"true"),A||L.setAttribute(c,"true")}catch(E){console.error("aria-hidden: cannot operate on ",L,E)}})};return j(d),x.clear(),ii++,function(){h.forEach(function(P){var L=Cn.get(P)-1,F=m.get(P)-1;Cn.set(P,L),m.set(P,F),L||(Ho.has(P)||P.removeAttribute(c),Ho.delete(P)),F||P.removeAttribute(a)}),ii--,ii||(Cn=new WeakMap,Cn=new WeakMap,Ho=new WeakMap,Go={})}},ug=function(o,d,a){a===void 0&&(a="data-aria-hidden");var c=Array.from(Array.isArray(o)?o:[o]),f=ig(o);return f?(c.push.apply(c,Array.from(f.querySelectorAll("[aria-live], script"))),cg(c,f,a,"aria-hidden")):function(){return null}},ol="Dialog",[Ef]=Fh(ol),[fg,At]=Ef(ol),_f=o=>{const{__scopeDialog:d,children:a,open:c,defaultOpen:f,onOpenChange:m,modal:h=!0}=o,x=p.useRef(null),S=p.useRef(null),[b,j]=Wh({prop:c,defaultProp:f??!1,onChange:m,caller:ol});return n.jsx(fg,{scope:d,triggerRef:x,contentRef:S,contentId:tr(),titleId:tr(),descriptionId:tr(),open:b,onOpenChange:j,onOpenToggle:p.useCallback(()=>j(P=>!P),[j]),modal:h,children:a})};_f.displayName=ol;var Pf="DialogTrigger",pg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Pf,a),m=Qr(d,f.triggerRef);return n.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":Mi(f.open),...c,ref:m,onClick:Cr(o.onClick,f.onOpenToggle)})});pg.displayName=Pf;var Pi="DialogPortal",[mg,Mf]=Ef(Pi,{forceMount:void 0}),Rf=o=>{const{__scopeDialog:d,forceMount:a,children:c,container:f}=o,m=At(Pi,d);return n.jsx(mg,{scope:d,forceMount:a,children:p.Children.map(c,h=>n.jsx(nl,{present:a||m.open,children:n.jsx(gf,{asChild:!0,container:f,children:h})}))})};Rf.displayName=Pi;var rl="DialogOverlay",zf=p.forwardRef((o,d)=>{const a=Mf(rl,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=At(rl,o.__scopeDialog);return m.modal?n.jsx(nl,{present:c||m.open,children:n.jsx(xg,{...f,ref:d})}):null});zf.displayName=rl;var hg=ff("DialogOverlay.RemoveScroll"),xg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(rl,a),m=cx(),h=Qr(d,m);return n.jsx(Sf,{as:hg,allowPinchZoom:!0,shards:[f.contentRef],children:n.jsx(Je.div,{"data-state":Mi(f.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})}),Ln="DialogContent",Df=p.forwardRef((o,d)=>{const a=Mf(Ln,o.__scopeDialog),{forceMount:c=a.forceMount,...f}=o,m=At(Ln,o.__scopeDialog);return n.jsx(nl,{present:c||m.open,children:m.modal?n.jsx(gg,{...f,ref:d}):n.jsx(vg,{...f,ref:d})})});Df.displayName=Ln;var gg=p.forwardRef((o,d)=>{const a=At(Ln,o.__scopeDialog),c=p.useRef(null),f=Qr(d,a.contentRef,c);return p.useEffect(()=>{const m=c.current;if(m)return ug(m)},[]),n.jsx(Lf,{...o,ref:f,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:Cr(o.onCloseAutoFocus,m=>{var h;m.preventDefault(),(h=a.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Cr(o.onPointerDownOutside,m=>{const h=m.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0;(h.button===2||x)&&m.preventDefault()}),onFocusOutside:Cr(o.onFocusOutside,m=>m.preventDefault())})}),vg=p.forwardRef((o,d)=>{const a=At(Ln,o.__scopeDialog),c=p.useRef(!1),f=p.useRef(!1);return n.jsx(Lf,{...o,ref:d,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:m=>{var h,x;(h=o.onCloseAutoFocus)==null||h.call(o,m),m.defaultPrevented||(c.current||(x=a.triggerRef.current)==null||x.focus(),m.preventDefault()),c.current=!1,f.current=!1},onInteractOutside:m=>{var S,b;(S=o.onInteractOutside)==null||S.call(o,m),m.defaultPrevented||(c.current=!0,m.detail.originalEvent.type==="pointerdown"&&(f.current=!0));const h=m.target;((b=a.triggerRef.current)==null?void 0:b.contains(h))&&m.preventDefault(),m.detail.originalEvent.type==="focusin"&&f.current&&m.preventDefault()}})}),Lf=p.forwardRef((o,d)=>{const{__scopeDialog:a,trapFocus:c,onOpenAutoFocus:f,onCloseAutoFocus:m,...h}=o,x=At(Ln,a);return Sx(),n.jsx(n.Fragment,{children:n.jsx(hf,{asChild:!0,loop:!0,trapped:c,onMountAutoFocus:f,onUnmountAutoFocus:m,children:n.jsx(pf,{role:"dialog",id:x.contentId,"aria-describedby":x.descriptionId,"aria-labelledby":x.titleId,"data-state":Mi(x.open),...h,ref:d,deferPointerDownOutside:!0,onDismiss:()=>x.onOpenChange(!1)})})})}),Af="DialogTitle",yg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Af,a);return n.jsx(Je.h2,{id:f.titleId,...c,ref:d})});yg.displayName=Af;var Of="DialogDescription",bg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Of,a);return n.jsx(Je.p,{id:f.descriptionId,...c,ref:d})});bg.displayName=Of;var Tf="DialogClose",wg=p.forwardRef((o,d)=>{const{__scopeDialog:a,...c}=o,f=At(Tf,a);return n.jsx(Je.button,{type:"button",...c,ref:d,onClick:Cr(o.onClick,()=>f.onOpenChange(!1))})});wg.displayName=Tf;function Mi(o){return o?"open":"closed"}var ws='[cmdk-group=""]',di='[cmdk-group-items=""]',jg='[cmdk-group-heading=""]',If='[cmdk-item=""]',Gu=`${If}:not([aria-disabled="true"])`,ji="cmdk-item-select",_n="data-value",kg=(o,d,a)=>Ih(o,d,a),Ff=p.createContext(void 0),Ms=()=>p.useContext(Ff),$f=p.createContext(void 0),Ri=()=>p.useContext($f),Uf=p.createContext(void 0),Bf=p.forwardRef((o,d)=>{let a=Pn(()=>{var v,V;return{search:"",value:(V=(v=o.value)!=null?v:o.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),c=Pn(()=>new Set),f=Pn(()=>new Map),m=Pn(()=>new Map),h=Pn(()=>new Set),x=Vf(o),{label:S,children:b,value:j,onValueChange:P,filter:L,shouldFilter:F,loop:A,disablePointerSelection:N=!1,vimBindings:C=!0,...E}=o,D=tr(),Z=tr(),Y=tr(),G=p.useRef(null),I=Lg();Kr(()=>{if(j!==void 0){let v=j.trim();a.current.value=v,$.emit()}},[j]),Kr(()=>{I(6,Me)},[]);let $=p.useMemo(()=>({subscribe:v=>(h.current.add(v),()=>h.current.delete(v)),snapshot:()=>a.current,setState:(v,V,J)=>{var Q,oe,pe,me;if(!Object.is(a.current[v],V)){if(a.current[v]=V,v==="search")ce(),X(),I(1,be);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let T=document.getElementById(Y);T?T.focus():(Q=document.getElementById(D))==null||Q.focus()}if(I(7,()=>{var T;a.current.selectedItemId=(T=Pe())==null?void 0:T.id,$.emit()}),J||I(5,Me),((oe=x.current)==null?void 0:oe.value)!==void 0){let T=V??"";(me=(pe=x.current).onValueChange)==null||me.call(pe,T);return}}$.emit()}},emit:()=>{h.current.forEach(v=>v())}}),[]),ne=p.useMemo(()=>({value:(v,V,J)=>{var Q;V!==((Q=m.current.get(v))==null?void 0:Q.value)&&(m.current.set(v,{value:V,keywords:J}),a.current.filtered.items.set(v,se(V,J)),I(2,()=>{X(),$.emit()}))},item:(v,V)=>(c.current.add(v),V&&(f.current.has(V)?f.current.get(V).add(v):f.current.set(V,new Set([v]))),I(3,()=>{ce(),X(),a.current.value||be(),$.emit()}),()=>{m.current.delete(v),c.current.delete(v),a.current.filtered.items.delete(v);let J=Pe();I(4,()=>{ce(),(J==null?void 0:J.getAttribute("id"))===v&&be(),$.emit()})}),group:v=>(f.current.has(v)||f.current.set(v,new Set),()=>{m.current.delete(v),f.current.delete(v)}),filter:()=>x.current.shouldFilter,label:S||o["aria-label"],getDisablePointerSelection:()=>x.current.disablePointerSelection,listId:D,inputId:Y,labelId:Z,listInnerRef:G}),[]);function se(v,V){var J,Q;let oe=(Q=(J=x.current)==null?void 0:J.filter)!=null?Q:kg;return v?oe(v,a.current.search,V):0}function X(){if(!a.current.search||x.current.shouldFilter===!1)return;let v=a.current.filtered.items,V=[];a.current.filtered.groups.forEach(Q=>{let oe=f.current.get(Q),pe=0;oe.forEach(me=>{let T=v.get(me);pe=Math.max(T,pe)}),V.push([Q,pe])});let J=G.current;Re().sort((Q,oe)=>{var pe,me;let T=Q.getAttribute("id"),O=oe.getAttribute("id");return((pe=v.get(O))!=null?pe:0)-((me=v.get(T))!=null?me:0)}).forEach(Q=>{let oe=Q.closest(di);oe?oe.appendChild(Q.parentElement===oe?Q:Q.closest(`${di} > *`)):J.appendChild(Q.parentElement===J?Q:Q.closest(`${di} > *`))}),V.sort((Q,oe)=>oe[1]-Q[1]).forEach(Q=>{var oe;let pe=(oe=G.current)==null?void 0:oe.querySelector(`${ws}[${_n}="${encodeURIComponent(Q[0])}"]`);pe==null||pe.parentElement.appendChild(pe)})}function be(){let v=Re().find(J=>J.getAttribute("aria-disabled")!=="true"),V=v==null?void 0:v.getAttribute(_n);$.setState("value",V||void 0)}function ce(){var v,V,J,Q;if(!a.current.search||x.current.shouldFilter===!1){a.current.filtered.count=c.current.size;return}a.current.filtered.groups=new Set;let oe=0;for(let pe of c.current){let me=(V=(v=m.current.get(pe))==null?void 0:v.value)!=null?V:"",T=(Q=(J=m.current.get(pe))==null?void 0:J.keywords)!=null?Q:[],O=se(me,T);a.current.filtered.items.set(pe,O),O>0&&oe++}for(let[pe,me]of f.current)for(let T of me)if(a.current.filtered.items.get(T)>0){a.current.filtered.groups.add(pe);break}a.current.filtered.count=oe}function Me(){var v,V,J;let Q=Pe();Q&&(((v=Q.parentElement)==null?void 0:v.firstChild)===Q&&((J=(V=Q.closest(ws))==null?void 0:V.querySelector(jg))==null||J.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function Pe(){var v;return(v=G.current)==null?void 0:v.querySelector(`${If}[aria-selected="true"]`)}function Re(){var v;return Array.from(((v=G.current)==null?void 0:v.querySelectorAll(Gu))||[])}function Se(v){let V=Re()[v];V&&$.setState("value",V.getAttribute(_n))}function Ne(v){var V;let J=Pe(),Q=Re(),oe=Q.findIndex(me=>me===J),pe=Q[oe+v];(V=x.current)!=null&&V.loop&&(pe=oe+v<0?Q[Q.length-1]:oe+v===Q.length?Q[0]:Q[oe+v]),pe&&$.setState("value",pe.getAttribute(_n))}function H(v){let V=Pe(),J=V==null?void 0:V.closest(ws),Q;for(;J&&!Q;)J=v>0?zg(J,ws):Dg(J,ws),Q=J==null?void 0:J.querySelector(Gu);Q?$.setState("value",Q.getAttribute(_n)):Ne(v)}let ae=()=>Se(Re().length-1),K=v=>{v.preventDefault(),v.metaKey?ae():v.altKey?H(1):Ne(1)},w=v=>{v.preventDefault(),v.metaKey?Se(0):v.altKey?H(-1):Ne(-1)};return p.createElement(Je.div,{ref:d,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:v=>{var V;(V=E.onKeyDown)==null||V.call(E,v);let J=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||J))switch(v.key){case"n":case"j":{C&&v.ctrlKey&&K(v);break}case"ArrowDown":{K(v);break}case"p":case"k":{C&&v.ctrlKey&&w(v);break}case"ArrowUp":{w(v);break}case"Home":{v.preventDefault(),Se(0);break}case"End":{v.preventDefault(),ae();break}case"Enter":{v.preventDefault();let Q=Pe();if(Q){let oe=new Event(ji);Q.dispatchEvent(oe)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:ne.inputId,id:ne.labelId,style:Og},S),ll(o,v=>p.createElement($f.Provider,{value:$},p.createElement(Ff.Provider,{value:ne},v))))}),Ng=p.forwardRef((o,d)=>{var a,c;let f=tr(),m=p.useRef(null),h=p.useContext(Uf),x=Ms(),S=Vf(o),b=(c=(a=S.current)==null?void 0:a.forceMount)!=null?c:h==null?void 0:h.forceMount;Kr(()=>{if(!b)return x.item(f,h==null?void 0:h.id)},[b]);let j=Wf(f,m,[o.value,o.children,m],o.keywords),P=Ri(),L=Er(I=>I.value&&I.value===j.current),F=Er(I=>b||x.filter()===!1?!0:I.search?I.filtered.items.get(f)>0:!0);p.useEffect(()=>{let I=m.current;if(!(!I||o.disabled))return I.addEventListener(ji,A),()=>I.removeEventListener(ji,A)},[F,o.onSelect,o.disabled]);function A(){var I,$;N(),($=(I=S.current).onSelect)==null||$.call(I,j.current)}function N(){P.setState("value",j.current,!0)}if(!F)return null;let{disabled:C,value:E,onSelect:D,forceMount:Z,keywords:Y,...G}=o;return p.createElement(Je.div,{ref:Dn(m,d),...G,id:f,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!L,"data-disabled":!!C,"data-selected":!!L,onPointerMove:C||x.getDisablePointerSelection()?void 0:N,onClick:C?void 0:A},o.children)}),Sg=p.forwardRef((o,d)=>{let{heading:a,children:c,forceMount:f,...m}=o,h=tr(),x=p.useRef(null),S=p.useRef(null),b=tr(),j=Ms(),P=Er(F=>f||j.filter()===!1?!0:F.search?F.filtered.groups.has(h):!0);Kr(()=>j.group(h),[]),Wf(h,x,[o.value,o.heading,S]);let L=p.useMemo(()=>({id:h,forceMount:f}),[f]);return p.createElement(Je.div,{ref:Dn(x,d),...m,"cmdk-group":"",role:"presentation",hidden:P?void 0:!0},a&&p.createElement("div",{ref:S,"cmdk-group-heading":"","aria-hidden":!0,id:b},a),ll(o,F=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?b:void 0},p.createElement(Uf.Provider,{value:L},F))))}),Cg=p.forwardRef((o,d)=>{let{alwaysRender:a,...c}=o,f=p.useRef(null),m=Er(h=>!h.search);return!a&&!m?null:p.createElement(Je.div,{ref:Dn(f,d),...c,"cmdk-separator":"",role:"separator"})}),Eg=p.forwardRef((o,d)=>{let{onValueChange:a,...c}=o,f=o.value!=null,m=Ri(),h=Er(b=>b.search),x=Er(b=>b.selectedItemId),S=Ms();return p.useEffect(()=>{o.value!=null&&m.setState("search",o.value)},[o.value]),p.createElement(Je.input,{ref:d,...c,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":S.listId,"aria-labelledby":S.labelId,"aria-activedescendant":x,id:S.inputId,type:"text",value:f?o.value:h,onChange:b=>{f||m.setState("search",b.target.value),a==null||a(b.target.value)}})}),_g=p.forwardRef((o,d)=>{let{children:a,label:c="Suggestions",...f}=o,m=p.useRef(null),h=p.useRef(null),x=Er(b=>b.selectedItemId),S=Ms();return p.useEffect(()=>{if(h.current&&m.current){let b=h.current,j=m.current,P,L=new ResizeObserver(()=>{P=requestAnimationFrame(()=>{let F=b.offsetHeight;j.style.setProperty("--cmdk-list-height",F.toFixed(1)+"px")})});return L.observe(b),()=>{cancelAnimationFrame(P),L.unobserve(b)}}},[]),p.createElement(Je.div,{ref:Dn(m,d),...f,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":x,"aria-label":c,id:S.listId},ll(o,b=>p.createElement("div",{ref:Dn(h,S.listInnerRef),"cmdk-list-sizer":""},b)))}),Pg=p.forwardRef((o,d)=>{let{open:a,onOpenChange:c,overlayClassName:f,contentClassName:m,container:h,...x}=o;return p.createElement(_f,{open:a,onOpenChange:c},p.createElement(Rf,{container:h},p.createElement(zf,{"cmdk-overlay":"",className:f}),p.createElement(Df,{"aria-label":o.label,"cmdk-dialog":"",className:m},p.createElement(Bf,{ref:d,...x}))))}),Mg=p.forwardRef((o,d)=>Er(a=>a.filtered.count===0)?p.createElement(Je.div,{ref:d,...o,"cmdk-empty":"",role:"presentation"}):null),Rg=p.forwardRef((o,d)=>{let{progress:a,children:c,label:f="Loading...",...m}=o;return p.createElement(Je.div,{ref:d,...m,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":f},ll(o,h=>p.createElement("div",{"aria-hidden":!0},h)))}),En=Object.assign(Bf,{List:_g,Item:Ng,Input:Eg,Group:Sg,Separator:Cg,Dialog:Pg,Empty:Mg,Loading:Rg});function zg(o,d){let a=o.nextElementSibling;for(;a;){if(a.matches(d))return a;a=a.nextElementSibling}}function Dg(o,d){let a=o.previousElementSibling;for(;a;){if(a.matches(d))return a;a=a.previousElementSibling}}function Vf(o){let d=p.useRef(o);return Kr(()=>{d.current=o}),d}var Kr=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Pn(o){let d=p.useRef();return d.current===void 0&&(d.current=o()),d}function Er(o){let d=Ri(),a=()=>o(d.snapshot());return p.useSyncExternalStore(d.subscribe,a,a)}function Wf(o,d,a,c=[]){let f=p.useRef(),m=Ms();return Kr(()=>{var h;let x=(()=>{var b;for(let j of a){if(typeof j=="string")return j.trim();if(typeof j=="object"&&"current"in j)return j.current?(b=j.current.textContent)==null?void 0:b.trim():f.current}})(),S=c.map(b=>b.trim());m.value(o,x,S),(h=d.current)==null||h.setAttribute(_n,x),f.current=x}),f}var Lg=()=>{let[o,d]=p.useState(),a=Pn(()=>new Map);return Kr(()=>{a.current.forEach(c=>c()),a.current=new Map},[o]),(c,f)=>{a.current.set(c,f),d({})}};function Ag(o){let d=o.type;return typeof d=="function"?d(o.props):"render"in d?d.render(o.props):o}function ll({asChild:o,children:d},a){return o&&p.isValidElement(d)?p.cloneElement(Ag(d),{ref:d.ref},a(d.props.children)):a(d)}var Og={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Tg({onNavigate:o}){const[d,a]=p.useState(!1);return p.useEffect(()=>{const c=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&(f.preventDefault(),a(m=>!m))};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[]),n.jsx(En.Dialog,{open:d,onOpenChange:a,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>a(!1),children:n.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:c=>c.stopPropagation(),children:[n.jsx(En.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),n.jsxs(En.List,{className:"max-h-80 overflow-y-auto p-2",children:[n.jsx(En.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),n.jsx(En.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:vi.map(c=>n.jsxs(En.Item,{value:`${c.label} ${c.hint}`,onSelect:()=>{o(c.id),a(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[n.jsx(c.icon,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:c.label}),n.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:c.hint})]},c.id))})]})]})})}async function fe(o,d){var S;const a={"Content-Type":"application/json",...d==null?void 0:d.headers},c=localStorage.getItem("mc_sudo_password"),f=localStorage.getItem("mc_hf_token");c&&(a["X-Sudo-Password"]=c);let m=d==null?void 0:d.body;if((((S=d==null?void 0:d.method)==null?void 0:S.toUpperCase())||"GET")==="POST"){if(typeof m=="string")try{const b=JSON.parse(m);let j=!1;c&&!("sudo_password"in b)&&(b.sudo_password=c,j=!0),f&&!("hf_token"in b)&&(b.hf_token=f,j=!0),j&&(m=JSON.stringify(b))}catch{}else if(!m){const b={};c&&(b.sudo_password=c),f&&(b.hf_token=f),Object.keys(b).length>0&&(m=JSON.stringify(b))}}const x=await fetch(o,{...d,headers:a,body:m});if(!x.ok)throw new Error(`${x.status} ${x.statusText}`);return x.json()}function Hf(o){var d,a,c="";if(typeof o=="string"||typeof o=="number")c+=o;else if(typeof o=="object")if(Array.isArray(o)){var f=o.length;for(d=0;d{const d=Ug(o),{conflictingClassGroups:a,conflictingClassGroupModifiers:c}=o;return{getClassGroupId:h=>{const x=h.split(zi);return x[0]===""&&x.length!==1&&x.shift(),Gf(x,d)||$g(h)},getConflictingClassGroupIds:(h,x)=>{const S=a[h]||[];return x&&c[h]?[...S,...c[h]]:S}}},Gf=(o,d)=>{var h;if(o.length===0)return d.classGroupId;const a=o[0],c=d.nextPart.get(a),f=c?Gf(o.slice(1),c):void 0;if(f)return f;if(d.validators.length===0)return;const m=o.join(zi);return(h=d.validators.find(({validator:x})=>x(m)))==null?void 0:h.classGroupId},Ku=/^\[(.+)\]$/,$g=o=>{if(Ku.test(o)){const d=Ku.exec(o)[1],a=d==null?void 0:d.substring(0,d.indexOf(":"));if(a)return"arbitrary.."+a}},Ug=o=>{const{theme:d,prefix:a}=o,c={nextPart:new Map,validators:[]};return Vg(Object.entries(o.classGroups),a).forEach(([m,h])=>{ki(h,c,m,d)}),c},ki=(o,d,a,c)=>{o.forEach(f=>{if(typeof f=="string"){const m=f===""?d:Qu(d,f);m.classGroupId=a;return}if(typeof f=="function"){if(Bg(f)){ki(f(c),d,a,c);return}d.validators.push({validator:f,classGroupId:a});return}Object.entries(f).forEach(([m,h])=>{ki(h,Qu(d,m),a,c)})})},Qu=(o,d)=>{let a=o;return d.split(zi).forEach(c=>{a.nextPart.has(c)||a.nextPart.set(c,{nextPart:new Map,validators:[]}),a=a.nextPart.get(c)}),a},Bg=o=>o.isThemeGetter,Vg=(o,d)=>d?o.map(([a,c])=>{const f=c.map(m=>typeof m=="string"?d+m:typeof m=="object"?Object.fromEntries(Object.entries(m).map(([h,x])=>[d+h,x])):m);return[a,f]}):o,Wg=o=>{if(o<1)return{get:()=>{},set:()=>{}};let d=0,a=new Map,c=new Map;const f=(m,h)=>{a.set(m,h),d++,d>o&&(d=0,c=a,a=new Map)};return{get(m){let h=a.get(m);if(h!==void 0)return h;if((h=c.get(m))!==void 0)return f(m,h),h},set(m,h){a.has(m)?a.set(m,h):f(m,h)}}},Kf="!",Hg=o=>{const{separator:d,experimentalParseClassName:a}=o,c=d.length===1,f=d[0],m=d.length,h=x=>{const S=[];let b=0,j=0,P;for(let C=0;Cj?P-j:void 0;return{modifiers:S,hasImportantModifier:F,baseClassName:A,maybePostfixModifierPosition:N}};return a?x=>a({className:x,parseClassName:h}):h},Gg=o=>{if(o.length<=1)return o;const d=[];let a=[];return o.forEach(c=>{c[0]==="["?(d.push(...a.sort(),c),a=[]):a.push(c)}),d.push(...a.sort()),d},Kg=o=>({cache:Wg(o.cacheSize),parseClassName:Hg(o),...Fg(o)}),Qg=/\s+/,qg=(o,d)=>{const{parseClassName:a,getClassGroupId:c,getConflictingClassGroupIds:f}=d,m=[],h=o.trim().split(Qg);let x="";for(let S=h.length-1;S>=0;S-=1){const b=h[S],{modifiers:j,hasImportantModifier:P,baseClassName:L,maybePostfixModifierPosition:F}=a(b);let A=!!F,N=c(A?L.substring(0,F):L);if(!N){if(!A){x=b+(x.length>0?" "+x:x);continue}if(N=c(L),!N){x=b+(x.length>0?" "+x:x);continue}A=!1}const C=Gg(j).join(":"),E=P?C+Kf:C,D=E+N;if(m.includes(D))continue;m.push(D);const Z=f(N,A);for(let Y=0;Y0?" "+x:x)}return x};function Zg(){let o=0,d,a,c="";for(;o{if(typeof o=="string")return o;let d,a="";for(let c=0;cP(j),o());return a=Kg(b),c=a.cache.get,f=a.cache.set,m=x,x(S)}function x(S){const b=c(S);if(b)return b;const j=qg(S,a);return f(S,j),j}return function(){return m(Zg.apply(null,arguments))}}const Te=o=>{const d=a=>a[o]||[];return d.isThemeGetter=!0,d},qf=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jg=/^\d+\/\d+$/,Xg=new Set(["px","full","screen"]),e0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t0=/\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$/,r0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,er=o=>Rn(o)||Xg.has(o)||Jg.test(o),kr=o=>An(o,"length",f0),Rn=o=>!!o&&!Number.isNaN(Number(o)),ci=o=>An(o,"number",Rn),js=o=>!!o&&Number.isInteger(Number(o)),o0=o=>o.endsWith("%")&&Rn(o.slice(0,-1)),je=o=>qf.test(o),Nr=o=>e0.test(o),l0=new Set(["length","size","percentage"]),a0=o=>An(o,l0,Zf),i0=o=>An(o,"position",Zf),d0=new Set(["image","url"]),c0=o=>An(o,d0,m0),u0=o=>An(o,"",p0),ks=()=>!0,An=(o,d,a)=>{const c=qf.exec(o);return c?c[1]?typeof d=="string"?c[1]===d:d.has(c[1]):a(c[2]):!1},f0=o=>t0.test(o)&&!r0.test(o),Zf=()=>!1,p0=o=>n0.test(o),m0=o=>s0.test(o),h0=()=>{const o=Te("colors"),d=Te("spacing"),a=Te("blur"),c=Te("brightness"),f=Te("borderColor"),m=Te("borderRadius"),h=Te("borderSpacing"),x=Te("borderWidth"),S=Te("contrast"),b=Te("grayscale"),j=Te("hueRotate"),P=Te("invert"),L=Te("gap"),F=Te("gradientColorStops"),A=Te("gradientColorStopPositions"),N=Te("inset"),C=Te("margin"),E=Te("opacity"),D=Te("padding"),Z=Te("saturate"),Y=Te("scale"),G=Te("sepia"),I=Te("skew"),$=Te("space"),ne=Te("translate"),se=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],be=()=>["auto",je,d],ce=()=>[je,d],Me=()=>["",er,kr],Pe=()=>["auto",Rn,je],Re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Se=()=>["solid","dashed","dotted","double","none"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],ae=()=>["","0",je],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>[Rn,je];return{cacheSize:500,separator:":",theme:{colors:[ks],spacing:[er,kr],blur:["none","",Nr,je],brightness:w(),borderColor:[o],borderRadius:["none","","full",Nr,je],borderSpacing:ce(),borderWidth:Me(),contrast:w(),grayscale:ae(),hueRotate:w(),invert:ae(),gap:ce(),gradientColorStops:[o],gradientColorStopPositions:[o0,kr],inset:be(),margin:be(),opacity:w(),padding:ce(),saturate:w(),scale:w(),sepia:ae(),skew:w(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",je]}],container:["container"],columns:[{columns:[Nr]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...Re(),je]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:se()}],"overscroll-x":[{"overscroll-x":se()}],"overscroll-y":[{"overscroll-y":se()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",js,je]}],basis:[{basis:be()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",je]}],grow:[{grow:ae()}],shrink:[{shrink:ae()}],order:[{order:["first","last","none",js,je]}],"grid-cols":[{"grid-cols":[ks]}],"col-start-end":[{col:["auto",{span:["full",js,je]},je]}],"col-start":[{"col-start":Pe()}],"col-end":[{"col-end":Pe()}],"grid-rows":[{"grid-rows":[ks]}],"row-start-end":[{row:["auto",{span:[js,je]},je]}],"row-start":[{"row-start":Pe()}],"row-end":[{"row-end":Pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",je]}],gap:[{gap:[L]}],"gap-x":[{"gap-x":[L]}],"gap-y":[{"gap-y":[L]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",je,d]}],"min-w":[{"min-w":[je,d,"min","max","fit"]}],"max-w":[{"max-w":[je,d,"none","full","min","max","fit","prose",{screen:[Nr]},Nr]}],h:[{h:[je,d,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[je,d,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[je,d,"auto","min","max","fit"]}],"font-size":[{text:["base",Nr,kr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ci]}],"font-family":[{font:[ks]}],"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",je]}],"line-clamp":[{"line-clamp":["none",Rn,ci]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",er,je]}],"list-image":[{"list-image":["none",je]}],"list-style-type":[{list:["none","disc","decimal",je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",er,kr]}],"underline-offset":[{"underline-offset":["auto",er,je]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je]}],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",je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Re(),i0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c0]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[F]}],"gradient-via":[{via:[F]}],"gradient-to":[{to:[F]}],rounded:[{rounded:[m]}],"rounded-s":[{"rounded-s":[m]}],"rounded-e":[{"rounded-e":[m]}],"rounded-t":[{"rounded-t":[m]}],"rounded-r":[{"rounded-r":[m]}],"rounded-b":[{"rounded-b":[m]}],"rounded-l":[{"rounded-l":[m]}],"rounded-ss":[{"rounded-ss":[m]}],"rounded-se":[{"rounded-se":[m]}],"rounded-ee":[{"rounded-ee":[m]}],"rounded-es":[{"rounded-es":[m]}],"rounded-tl":[{"rounded-tl":[m]}],"rounded-tr":[{"rounded-tr":[m]}],"rounded-br":[{"rounded-br":[m]}],"rounded-bl":[{"rounded-bl":[m]}],"border-w":[{border:[x]}],"border-w-x":[{"border-x":[x]}],"border-w-y":[{"border-y":[x]}],"border-w-s":[{"border-s":[x]}],"border-w-e":[{"border-e":[x]}],"border-w-t":[{"border-t":[x]}],"border-w-r":[{"border-r":[x]}],"border-w-b":[{"border-b":[x]}],"border-w-l":[{"border-l":[x]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Se(),"hidden"]}],"divide-x":[{"divide-x":[x]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[x]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Se()}],"border-color":[{border:[f]}],"border-color-x":[{"border-x":[f]}],"border-color-y":[{"border-y":[f]}],"border-color-s":[{"border-s":[f]}],"border-color-e":[{"border-e":[f]}],"border-color-t":[{"border-t":[f]}],"border-color-r":[{"border-r":[f]}],"border-color-b":[{"border-b":[f]}],"border-color-l":[{"border-l":[f]}],"divide-color":[{divide:[f]}],"outline-style":[{outline:["",...Se()]}],"outline-offset":[{"outline-offset":[er,je]}],"outline-w":[{outline:[er,kr]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[er,kr]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",Nr,u0]}],"shadow-color":[{shadow:[ks]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ne()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[c]}],contrast:[{contrast:[S]}],"drop-shadow":[{"drop-shadow":["","none",Nr,je]}],grayscale:[{grayscale:[b]}],"hue-rotate":[{"hue-rotate":[j]}],invert:[{invert:[P]}],saturate:[{saturate:[Z]}],sepia:[{sepia:[G]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[c]}],"backdrop-contrast":[{"backdrop-contrast":[S]}],"backdrop-grayscale":[{"backdrop-grayscale":[b]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j]}],"backdrop-invert":[{"backdrop-invert":[P]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[Z]}],"backdrop-sepia":[{"backdrop-sepia":[G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[h]}],"border-spacing-x":[{"border-spacing-x":[h]}],"border-spacing-y":[{"border-spacing-y":[h]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",je]}],duration:[{duration:w()}],ease:[{ease:["linear","in","out","in-out",je]}],delay:[{delay:w()}],animate:[{animate:["none","spin","ping","pulse","bounce",je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[js,je]}],"translate-x":[{"translate-x":[ne]}],"translate-y":[{"translate-y":[ne]}],"skew-x":[{"skew-x":[I]}],"skew-y":[{"skew-y":[I]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",je]}],accent:[{accent:["auto",o]}],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",je]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",je]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[er,kr,ci]}],stroke:[{stroke:[o,"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"]}}},x0=Yg(h0);function ee(...o){return x0(Ig(o))}function Ps(o){return o?o.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function ft(o){return(o/1024**3).toFixed(1)}function Ni(o){return o?o>1024**3?`${(o/1024**3).toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`:""}function Ur(o){if(!o)return"—";const d=o/1024**3;return d>=1?`${d.toFixed(1)} GB`:`${(o/1024**2).toFixed(0)} MB`}function g0(o){if(!o)return"";const d=Math.floor(o/60);return d>0?`${d} min`:`${o} s`}function qu(o){return o?`${Math.round(o/1024)}k`:"—"}function qr({type:o,title:d,message:a,defaultValue:c,onConfirm:f,onCancel:m}){const h=p.useRef(null);return n.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:d}),n.jsx("button",{onClick:m||(()=>f()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:a}),o==="prompt"&&n.jsx("input",{ref:h,type:"text",defaultValue:c,className:"w-full h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:x=>{var S;x.key==="Enter"&&f((S=h.current)==null?void 0:S.value)}}),n.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(o==="confirm"||o==="prompt")&&n.jsx("button",{onClick:m,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:()=>{var S;const x=o==="prompt"?(S=h.current)==null?void 0:S.value:void 0;f(x)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:o==="confirm"?"Ja, fortfahren":o==="prompt"?"Übernehmen":"OK"})]})]})})}function Ko({value:o,label:d,detail:a}){const f=2*Math.PI*24,m=f-Math.min(o,100)/100*f,h=o>90?"stroke-red-500":o>75?"stroke-amber-500":"stroke-primary";return n.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-2 bg-background/20 rounded-xl border border-border/40",children:[n.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[n.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90",children:[n.jsx("circle",{cx:"32",cy:"32",r:24,className:"stroke-muted fill-none",strokeWidth:"4.5"}),n.jsx("circle",{cx:"32",cy:"32",r:24,className:ee("fill-none transition-all duration-700 ease-out",h),strokeWidth:"4.5",strokeDasharray:f,strokeDashoffset:m,strokeLinecap:"round"})]}),n.jsxs("span",{className:"text-xs font-mono font-bold tracking-tight text-foreground",children:[Math.round(o),"%"]})]}),n.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:d}),a&&n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function v0(){var T;const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState([]),[h,x]=p.useState([]),[S,b]=p.useState([]),[j,P]=p.useState(null),[L,F]=p.useState([]),[A,N]=p.useState(null),[C,E]=p.useState(""),[D,Z]=p.useState(!1),[Y,G]=p.useState(""),[I,$]=p.useState(!1),[ne,se]=p.useState({open:!1,actionPath:"",actionLabel:""}),[X,be]=p.useState(null),[ce,Me]=p.useState(!1);async function Pe(O){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:O})}),be({type:"alert",title:"Erfolgreich",message:`Hermes-Gehirn wurde auf '${O}' geändert. Der Gateway-Dienst wurde neu gestartet.`,onConfirm:()=>be(null)}),v(),Me(!1)}catch(ge){be({type:"alert",title:"Fehler",message:`Fehler beim Wechseln des Gehirns: ${ge.message}`,onConfirm:()=>be(null)})}}function Re(O,ge,Xe){be({type:"confirm",title:O,message:ge,onConfirm:()=>{be(null),Xe()},onCancel:()=>be(null)})}const[Se,Ne]=p.useState(""),[H,ae]=p.useState("stable"),[K,w]=p.useState(!1);function v(){fe("/api/system/status").then(d).catch(()=>{}),fe("/api/agent/status").then(c).catch(()=>{}),fe("/api/models").then(O=>{m(O.models||[]),x(O.running||[])}).catch(()=>{}),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{}),fe("/api/maintenance/updates").then(P).catch(()=>{}),fe("/api/jobs").then(O=>F(O.jobs||[])).catch(()=>{}),fe("/api/system/token-stats").then(N).catch(()=>{})}p.useEffect(()=>{v();const O=setInterval(v,3e3);return()=>clearInterval(O)},[]);async function V(O,ge,Xe,pt){E(`${ge} wird ausgeführt...`),Z(!0);try{const mt={...Xe},ht=await fe(O,{method:"POST",body:JSON.stringify(mt)});if(ht.status==="password_required"||ht.status==="incorrect_password"){se({open:!0,actionPath:O,actionLabel:ge,payload:Xe,error:ht.status==="incorrect_password"?"Falsches Sudo-Passwort. Bitte erneut versuchen.":void 0}),E("");return}ht.job_id?E(`${ge} gestartet (Job-ID: ${ht.job_id})`):ht.ok?E(`${ge} erfolgreich ausgeführt.`):E(`Fehler: ${ht.err||"Unbekannter Fehler"}`),v()}catch(mt){E(`Fehler bei ${ge}: ${mt.message}`)}finally{Z(!1)}}async function J(){$(!0);try{const O={...ne.payload,sudo_password:Y},ge=await fe(ne.actionPath,{method:"POST",body:JSON.stringify(O)});if(ge.status==="password_required"||ge.status==="incorrect_password"){se(Xe=>({...Xe,error:"Falsches Sudo-Passwort. Bitte erneut versuchen."}));return}ge.job_id?E(`${ne.actionLabel} gestartet (Job-ID: ${ge.job_id})`):ge.ok?E(`${ne.actionLabel} erfolgreich ausgeführt.`):E(`Fehler: ${ge.err||"Unbekannter Fehler"}`),se({open:!1,actionPath:"",actionLabel:""}),G(""),v()}catch(O){E(`Fehler: ${O.message}`),se({open:!1,actionPath:"",actionLabel:""}),G("")}finally{$(!1)}}async function Q(O,ge){E(`Upgrade für ${O} wird gestartet...`);try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:O,role:ge,quant:"Q4_K_M",jinja:!0})}),E("Upgrade-Download gestartet."),v()}catch(Xe){E(`Upgrade fehlgeschlagen: ${Xe.message}`)}}async function oe(){if(!(!Se.trim()||K)){w(!0);try{await fe("/api/memory",{method:"POST",body:JSON.stringify({content:Se,category:H,source:"dashboard"})}),Ne(""),fe("/api/memory?category=").then(O=>b(O.slice(0,3))).catch(()=>{})}catch(O){console.error(O)}finally{w(!1)}}}const pe=L.find(O=>O.label.includes("OS-Update")&&(O.state==="running"||O.state==="queued")),me=L.find(O=>O.label.includes("Engine-Update")&&(O.state==="running"||O.state==="queued"));return n.jsxs("div",{className:"space-y-6",children:[ne.open&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:n.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/60 bg-card/90 backdrop-blur-xl p-5 shadow-2xl space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-space",children:"Sudo-Passwort erforderlich"}),n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-[10px] text-muted-foreground leading-normal",children:["Für die Aktion ",n.jsx("strong",{children:ne.actionLabel})," wird das Administrator-Passwort (Sudo) auf der Box benötigt."]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("input",{type:"password",value:Y,onChange:O=>G(O.target.value),placeholder:"Sudo-Passwort eingeben...",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground",onKeyDown:O=>O.key==="Enter"&&J(),autoFocus:!0}),ne.error&&n.jsx("div",{className:"text-[10px] font-semibold text-red-400",children:ne.error})]}),n.jsxs("div",{className:"flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>{se({open:!1,actionPath:"",actionLabel:""}),G("")},className:"h-8 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent transition-all cursor-pointer",children:"Abbrechen"}),n.jsx("button",{onClick:J,disabled:!Y||I,className:"h-8 px-4 rounded-lg bg-primary text-primary-foreground text-[10px] font-bold uppercase hover:opacity-90 transition-all disabled:opacity-50 cursor-pointer flex items-center justify-center gap-1.5",children:I?"Prüfe...":"Ausführen"})]})]})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[n.jsxs("div",{className:"md:col-span-2 flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(bt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"System-Status"})]}),o?n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Ko,{value:o.cpu.percent,label:"CPU",detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0}),n.jsx(Ko,{value:o.ram.percent,label:"RAM",detail:`${ft(o.ram.used)} / ${ft(o.ram.total)} GB`}),o.gpu&&o.gpu.busy_percent!=null&&o.gpu.gtt_used!=null&&o.gpu.gtt_total!=null&&n.jsx(Ko,{value:o.gpu.busy_percent,label:"GPU",detail:`${ft(o.gpu.gtt_used)} / ${ft(o.gpu.gtt_total)} GB`}),o.disk&&n.jsx(Ko,{value:o.disk.percent,label:"Disk",detail:`${ft(o.disk.used)} / ${ft(o.disk.total)} GB`})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(o==null?void 0:o.temp)&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"mt-4 flex gap-4 text-xs font-mono text-muted-foreground/80 border-t border-border/30 pt-3",children:[o.temp.cpu!=null&&n.jsxs("span",{children:["CPU Temp: ",o.temp.cpu," °C"]}),o.temp.gpu!=null&&n.jsxs("span",{children:["GPU Temp: ",o.temp.gpu," °C"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 border-b border-border/20 pb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Sh,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Updates & Pflege"})]}),(j==null?void 0:j.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground/80 font-mono",children:["Zuletzt gesucht: ",new Date(j.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]})]}),j?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.os>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"OS-Pakete"}),n.jsx("span",{className:"font-mono",children:j.os>0?`${j.os} verfügbar`:"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.engine>0?"border-amber-500/30 bg-amber-500/5 text-amber-400 font-semibold":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Engine (llama.cpp)"}),n.jsx("span",{className:"font-mono",children:j.engine>0?"Update verfügbar":"aktuell"})]}),n.jsxs("div",{className:ee("flex items-center justify-between px-3 py-1.5 rounded-lg border text-xs",j.models>0?"border-primary/30 bg-primary/5 text-primary font-semibold animate-pulse":"border-border/30 bg-background/25 text-muted-foreground"),children:[n.jsx("span",{children:"Modell-Upgrades"}),n.jsx("span",{className:"font-mono",children:j.models>0?`${j.models} verfügbar`:"aktuell"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-border/20 pt-3",children:[n.jsx("button",{onClick:()=>V("/api/maintenance/os-update","OS-Update"),disabled:D||!!pe,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:pe?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",pe.progress??0,"%)"]})]}):n.jsx("span",{children:"OS Update"})}),n.jsx("button",{onClick:()=>V("/api/maintenance/engine-update","Engine-Update"),disabled:D||!!me,className:"h-8 px-2 rounded-lg border border-border/60 bg-background/20 text-[10px] font-bold uppercase hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer disabled:opacity-50 flex items-center justify-center gap-1",children:me?n.jsxs(n.Fragment,{children:[n.jsx(Vr,{className:"h-3 w-3 animate-spin text-primary"}),n.jsxs("span",{children:["Aktiv (",me.progress??0,"%)"]})]}):n.jsx("span",{children:"Engine Update"})})]}),n.jsxs("button",{onClick:()=>{Re("Host-System neu starten?","Bist du sicher, dass du das Host-System neu starten willst?",()=>V("/api/maintenance/reboot","Reboot"))},disabled:D,className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/5 text-red-400 text-[10px] font-bold uppercase hover:bg-red-500/10 transition-all cursor-pointer disabled:opacity-50",children:[n.jsx(af,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Host Reboot"})]}),j.model_list.length>0&&n.jsxs("div",{className:"space-y-1.5 border-t border-border/20 pt-3",children:[n.jsx("div",{className:"text-[9px] uppercase font-bold text-muted-foreground/60 tracking-wider",children:"Verfügbare Modell-Upgrades:"}),n.jsx("div",{className:"max-h-24 overflow-y-auto space-y-1.5 pr-1 scrollbar-thin",children:j.model_list.map(O=>n.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-background/25 border border-border/30 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("span",{className:"truncate flex-1 mr-1.5",title:`${O.role}: ${O.repo}`,children:[n.jsx("span",{className:"text-primary font-bold uppercase",children:O.role}),": ",O.repo.split("/").pop()]}),n.jsxs("button",{onClick:()=>Q(O.repo,O.role),className:"px-2 py-0.5 text-[8px] font-bold uppercase rounded bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer flex items-center gap-0.5",children:[n.jsx(Wr,{className:"h-2.5 w-2.5"})," Laden"]})]},O.repo))})]})]}):n.jsx("div",{className:"h-24 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."}),C&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:C}),n.jsxs("div",{className:"text-[9px] text-muted-foreground/60 leading-normal border-t border-border/10 pt-2.5 flex items-start gap-1",children:[n.jsx(Hr,{className:"h-3 w-3 shrink-0 text-muted-foreground/50 mt-0.5"}),n.jsxs("span",{children:["OS-Update & Reboot benötigen NOPASSWD in ",n.jsx("code",{children:"/etc/sudoers"})," (z.B. ",n.jsx("code",{children:"hitonabi ALL=(root) NOPASSWD:..."}),") oder ein gültiges Sudo-Passwort per Pop-up."]})]})]}),n.jsx("div",{className:"mt-4 border-t border-border/30 pt-3 shrink-0",children:n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer")),className:"w-full h-8 flex items-center justify-center gap-1.5 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer shadow-md shadow-primary/10",children:"System-Zentrale öffnen"})})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-4",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ns,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(a==null?void 0:a.webui_url)&&n.jsxs("a",{href:Ps(a.webui_url),target:"_blank",rel:"noopener",className:ee("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",a.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[n.jsx(Xo,{className:"h-3 w-3"})," Hermes öffnen"]})]}),a?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.gateway_reachable?"Online":"Offline"})]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[n.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"WebUI"}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full",a.webui_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-medium",children:a.webui_reachable?"Online":"Offline"})]})]})]}),n.jsxs("div",{onClick:()=>Me(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer group",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Aktives Gehirn"}),n.jsxs("button",{className:"flex items-center gap-1 text-[9px] font-bold uppercase tracking-wider text-primary border border-primary/20 bg-primary/10 hover:bg-primary/20 px-1.5 py-0.5 rounded transition-all cursor-pointer font-space",children:[n.jsx(bt,{className:"h-3 w-3"})," Ändern"]})]}),n.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-3.5 w-3.5"}),a.brain_model?`model: ${a.brain_model}`:"model: auto"]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),n.jsx("div",{className:"mt-3 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Gedächtnis & Stack-Tools via MCP gekoppelt."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Cs,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:["fast","heavy","coder","reasoning","vision","scout"].map(O=>{var pt;const ge=f.find(mt=>mt.role===O),Xe=ge?h.includes(ge.name):!1;return n.jsxs("div",{className:ee("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",Xe?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":ge?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[n.jsx("div",{className:"min-w-0 flex-1 mr-2",children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ee("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",O==="fast"?"bg-cyan-500/15 text-cyan-400 border-cyan-500/25":O==="heavy"?"bg-amber-500/15 text-amber-400 border-amber-500/25":O==="coder"?"bg-violet-500/15 text-violet-400 border-violet-500/25":O==="reasoning"?"bg-emerald-500/15 text-emerald-400 border-emerald-500/25":O==="vision"?"bg-pink-500/15 text-pink-400 border-pink-500/25":"bg-teal-500/15 text-teal-400 border-teal-500/25"),children:O}),n.jsxs("div",{className:"flex flex-col min-w-0",children:[n.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:ge?(pt=ge.name.split("/").pop())==null?void 0:pt.replace(/\.gguf$/i,""):"nicht zugewiesen"}),ge&&n.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[ge.prompt_cache&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),ge.spec_draft_model&&n.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${ge.spec_draft_model})`,children:"SPEC"}),ge.parallel_slots>1&&n.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${ge.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ge.parallel_slots]})]})]})]})}),n.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:ge?Xe?n.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):n.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},O)})})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(Ss,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:Se,onChange:O=>Ne(O.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),n.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[n.jsxs("select",{value:H,onChange:O=>ae(O.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[n.jsx("option",{value:"stable",children:"🔵 Fakt"}),n.jsx("option",{value:"instruction",children:"📋 Regel"}),n.jsx("option",{value:"user",children:"👤 User"}),n.jsx("option",{value:"versioned",children:"🟡 Version"})]}),n.jsxs("button",{onClick:oe,disabled:!Se.trim()||K,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[n.jsx(lf,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),n.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[n.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),n.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:S.length===0?n.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):S.map(O=>n.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[n.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:O.category}),n.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:O.content,children:O.content})]},O.id))})]})]}),n.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(fh,{className:"h-4.5 w-4.5 text-primary animate-pulse"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Effizienz & Ersparnis"})]}),A?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Geld gespart"}),n.jsxs("div",{className:"text-base font-bold text-emerald-400 mt-0.5 tracking-tight font-space",children:[A.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," €"]}),n.jsxs("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:["(",A.saved_usd.toLocaleString("en-US",{minimumFractionDigits:2})," $)"]})]}),n.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40 text-left",children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Gesamt-Tokens"}),n.jsx("div",{className:"text-base font-bold text-primary mt-0.5 tracking-tight font-space",children:A.total_tokens.toLocaleString("de-DE")}),n.jsx("div",{className:"text-[8px] text-muted-foreground/80 mt-0.5 font-mono",children:"(Lokale Inferenz)"})]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border/20 pt-3 text-[10px] text-muted-foreground",children:[n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Input (Prompts):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.prompt_tokens.toLocaleString("de-DE")," tkn"]})]}),n.jsxs("div",{className:"flex justify-between items-center font-mono",children:[n.jsx("span",{children:"Output (Antworten):"}),n.jsxs("span",{className:"font-semibold text-foreground",children:[A.completion_tokens.toLocaleString("de-DE")," tkn"]})]})]})]}):n.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Statistiken…"})]}),n.jsxs("div",{className:"mt-4 text-[9px] text-muted-foreground/70 border-t border-border/30 pt-2.5 leading-normal",children:["Berechnet im Vergleich zu Cloud-APIs von Juni 2026",(T=A==null?void 0:A.pricing)!=null&&T.heavy?` (Ø ${A.pricing.heavy.in.toFixed(2).replace(".",",")} $ / ${A.pricing.heavy.out.toFixed(2).replace(".",",")} $ pro 1M tkn).`:"."]})]})]}),a&&ce&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>Me(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...f.map(O=>{var ge;return((ge=O.name.split("/").pop())==null?void 0:ge.replace(".gguf",""))||O.name})].map(O=>{const ge=["auto","fast","heavy"].includes(O);return n.jsxs("button",{onClick:()=>Pe(O),className:ee("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",a.brain_model===O||!a.brain_model&&O==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:O}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ge?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(a.brain_model===O||!a.brain_model&&O==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},O)})})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,onConfirm:()=>X.onConfirm(),onCancel:X.onCancel})]})}function Br({children:o,tone:d="muted"}){const a={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return n.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${a[d]}`,children:o})}function Zu({caps:o}){return o?n.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[o.coder&&n.jsx(Br,{children:"💻 Code"}),o.vision&&n.jsx(Br,{children:"👁 Bild"}),o.reasoning&&n.jsx(Br,{children:"🧠 Reason"}),o.moe&&n.jsxs(Br,{tone:"primary",children:["🧩 MoE",o.active_b?`·${o.active_b}b`:""]}),o.tools==="yes"&&n.jsx(Br,{tone:"primary",children:"🛠 Tools"}),o.tools==="likely"&&n.jsx(Br,{tone:"warn",children:"🛠 Tools?"}),o.embedding&&n.jsx(Br,{children:"🔢 Embed"})]}):null}function y0({onError:o}){const[d,a]=p.useState([]),[c,f]=p.useState(null);function m(){fe("/api/jobs").then(b=>a(b.jobs||[])).catch(()=>{})}p.useEffect(()=>{m();const b=setInterval(m,2e3);return()=>clearInterval(b)},[]);async function h(b){try{await fe(`/api/jobs/${b}/cancel`,{method:"POST"}),m()}catch(j){o?o(j.message):f(j.message)}}const x=d.filter(b=>b.state==="running"||b.state==="queued"),S=d.filter(b=>b.state!=="running"&&b.state!=="queued").slice(-3);return x.length===0&&S.length===0?null:n.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),x.map(b=>n.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[n.jsxs("div",{className:"flex justify-between items-center text-xs",children:[n.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:b.label}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-muted-foreground font-mono",children:[b.progress??0,"% • ",Ni(b.done_bytes),"/",Ni(b.total_bytes),b.eta_s?` • ETA ${g0(b.eta_s)}`:""]}),n.jsx("button",{onClick:()=>h(b.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),n.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:n.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${b.progress??0}%`}})})]},b.id)),S.map(b=>n.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[n.jsx("span",{className:"truncate",children:b.label}),n.jsx("span",{className:ee("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",b.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:b.state})]},b.id)),c&&n.jsx(qr,{type:"alert",title:"Fehler",message:c,onConfirm:()=>f(null)})]})}function b0({fit:o}){const d={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[o.level];return n.jsxs("span",{className:ee("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",d),children:[o.text," • ",o.req_gb," GB RAM"]})}const w0=["fast","heavy","coder","reasoning","agent","vision","scout"];function Yu(o){const d=o.toLowerCase();return d.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:d.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:d.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:d.includes("mistral")||d.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:d.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:d.includes("hermes")||d.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:d.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function j0(){var Yr,nr,Vt,Jr,Tn;const[o,d]=p.useState([]),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(null),[S,b]=p.useState(null),[j,P]=p.useState(!0),[L,F]=p.useState(""),[A,N]=p.useState(null),[C,E]=p.useState(null),[D,Z]=p.useState(!1),[Y,G]=p.useState(null),[I,$]=p.useState("grid"),[ne,se]=p.useState("all"),[X,be]=p.useState(null);function ce(R,re,ye){be({type:"alert",title:R,message:re,onConfirm:()=>{be(null)}})}function Me(R,re,ye,Ce){be({type:"confirm",title:R,message:re,onConfirm:()=>{be(null),ye()},onCancel:()=>{be(null)}})}function Pe(R,re,ye,Ce,De){be({type:"prompt",title:R,message:re,defaultValue:ye,onConfirm:Et=>{be(null),Ce(Et)},onCancel:()=>{be(null)}})}const Re=o.filter(R=>ne==="in_use"?!!R.role||a.includes(R.name):!0),[Se,Ne]=p.useState({width:800,height:360}),H=p.useRef(null),ae=p.useCallback(R=>{if(H.current&&(H.current.disconnect(),H.current=null),R){const re=new ResizeObserver(ye=>{if(!ye||ye.length===0)return;const Ce=ye[0].contentRect;Ne({width:Ce.width,height:Ce.height})});re.observe(R),H.current=re}},[]),K=Se.width,w=Se.height,v=R=>{const re=K*.1,ye=w*R,Ce=K*.5,De=w*.5,Et=K*.3,Wt=ye,Ht=K*.3;return`M ${re} ${ye} C ${Et} ${Wt}, ${Ht} ${De}, ${Ce} ${De}`},V=R=>{const re=K*.5,ye=w*.5,Ce=K*.9,De=w*R,Et=K*.7,Wt=ye,Ht=K*.7;return`M ${re} ${ye} C ${Et} ${Wt}, ${Ht} ${De}, ${Ce} ${De}`};function J(){Promise.all([fe("/api/models"),fe("/api/routing"),fe("/api/connect"),fe("/api/maintenance/updates")]).then(([R,re,ye,Ce])=>{d(R.models||[]),c(R.running||[]),m(re),x(ye),b(Ce)}).catch(R=>F(String(R))).finally(()=>P(!1))}p.useEffect(()=>{J();const R=setInterval(J,4e3);return()=>clearInterval(R)},[]);async function Q(R){try{await fe(`/api/models/${encodeURIComponent(R)}/load`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Laden des Modells: ${re.message}`)}}async function oe(R){try{await fe(`/api/models/${encodeURIComponent(R)}/unload`,{method:"POST"}),J()}catch(re){ce("Fehler",`Fehler beim Entladen des Modells: ${re.message}`)}}async function pe(){try{await fe("/api/models/unload",{method:"POST"}),J()}catch(R){ce("Fehler",`Fehler beim Entladen aller Modelle: ${R.message}`)}}async function me(R,re){try{await fe(`/api/models/${encodeURIComponent(re)}/role`,{method:"POST",body:JSON.stringify({role:R||null})}),J()}catch(ye){ce("Fehler",`Fehler beim Zuweisen der Rolle: ${ye.message||ye}`)}}async function T(R,re){Pe("Kontextlänge anpassen","Gib die gewünschte Kontextlänge in Tokens an:",String(re||32768),async ye=>{if(ye)try{await fe(`/api/models/${encodeURIComponent(R)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ye,10)})}),J()}catch(Ce){ce("Fehler",`Fehler beim Setzen des Kontexts: ${Ce.message||Ce}`)}})}async function O(R){Me("Modell löschen?",`Modell '${R}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await fe(`/api/models/${encodeURIComponent(R)}`,{method:"DELETE"}),J()}catch(re){ce("Fehler",`Fehler beim Löschen: ${re.message||re}`)}})}async function ge(R,re,ye,Ce){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:R,role:re,quant:ye,jinja:Ce})}),ce("Herunterladen gestartet",`Download für '${R}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(De){ce("Fehler",`Fehler beim Starten des Upgrades: ${De.message||De}`)}}async function Xe(R){R&&(await navigator.clipboard.writeText(R),Z(!0),setTimeout(()=>Z(!1),1500))}if(j)return n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(L)return n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",L,")."]});const pt=o.filter(R=>a.includes(R.name)),mt=pt.reduce((R,re)=>R+(re.size_bytes||0),0),ht=16*1024**3,On=mt>ht?mt*1.2:ht,Zr=R=>o.find(re=>re.role===R),rr=R=>{const re=Zr(R);return re?a.includes(re.name):!1};return n.jsxs("div",{className:"space-y-8",children:[n.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsxs("div",{className:"flex justify-between items-center",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(xi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Llama Swap VRAM-Pool: ",Ur(mt)," / ",Ur(On)," geladen"]}),a.length>0&&n.jsx("button",{onClick:pe,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),n.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:pt.length===0?n.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):pt.map((R,re)=>{var De;const ye=(R.size_bytes||0)/On*100,Ce=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][re%4];return n.jsxs("div",{style:{width:`${ye}%`},className:ee("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Ce),title:`${R.name} (${Ur(R.size_bytes)})`,children:[n.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[R.role?`[${R.role}] `:"",(De=R.name.split("/").pop())==null?void 0:De.replace(".gguf","")]}),n.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Ur(R.size_bytes)})]},R.name)})})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),n.jsxs("div",{ref:ae,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:v(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="roocode"||A==="roocode")&&n.jsx("path",{d:v(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="cursor"||A==="cursor")&&n.jsx("path",{d:v(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="opencode"||A==="opencode")&&n.jsx("path",{d:v(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="zed"||A==="zed")&&n.jsx("path",{d:v(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:v(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Y==="continue"||A==="continue")&&n.jsx("path",{d:v(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("fast")&&n.jsx("path",{d:V(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("heavy")&&n.jsx("path",{d:V(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("coder")&&n.jsx("path",{d:V(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("vision")&&n.jsx("path",{d:V(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:V(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),rr("scout")&&n.jsx("path",{d:V(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>G("roocode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="roocode"?null:"roocode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Roo Code"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>G("cursor"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="cursor"?null:"cursor"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Cursor IDE"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>G("opencode"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="opencode"?null:"opencode"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"OpenCode"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>G("zed"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="zed"?null:"zed"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Zed"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>G("continue"),onMouseLeave:()=>G(null),onClick:()=>N(R=>R==="continue"?null:"continue"),children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),n.jsx("span",{children:"Continue"})]}),n.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[n.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",f!=null&&f.heavy_threshold_chars?f.heavy_threshold_chars/1e3:"4","k Zeichen"]}),n.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),w0.map(R=>{var Et;const re=["12%","31%","50%","69%","88%"],ye=Zr(R),Ce=ye?a.includes(ye.name):!1;if(R==="reasoning"||R==="agent")return null;const De={fast:0,heavy:1,coder:2,vision:3,scout:4}[R];return n.jsxs("div",{className:ee("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Ce?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":ye?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:re[De]},onClick:()=>E(R),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:R}),Ce&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:ye?(Et=ye.name.split("/").pop())==null?void 0:Et.replace(".gguf",""):"Keine Zuweisung"})]},R)}),A&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[A==="roocode"&&"Roo Code Setup",A==="cursor"&&"Cursor Setup",A==="opencode"&&"OpenCode Setup",A==="zed"&&"Zed Setup",A==="continue"&&"Continue Setup"]}),n.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[A==="roocode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),n.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",n.jsx("strong",{children:"OpenAI Compatible"}),"."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",n.jsx("code",{children:"settings.json"})," ein."]})]}),A==="cursor"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne Cursor Settings ➔ ",n.jsx("strong",{children:"Models"}),"."]}),n.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",n.jsx("strong",{children:"OpenAI API"})," auf."]}),n.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",n.jsx("strong",{children:"auto"}),"."]})]}),A==="opencode"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die ",n.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),n.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",n.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),A==="zed"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsxs("li",{children:["Öffne die Zed Settings (",n.jsx("code",{children:"ctrl+,"}),")."]}),n.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",n.jsx("code",{children:"language_models"})," ein."]})]}),A==="continue"&&n.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[n.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),n.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",n.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),h.tools&&n.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[n.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),n.jsxs("button",{onClick:()=>{var R,re,ye,Ce,De;return Xe(A==="roocode"?(R=h.tools.cline)==null?void 0:R.snippet:A==="cursor"?(re=h.tools.cursor)==null?void 0:re.snippet:A==="opencode"?(ye=h.tools.opencode)==null?void 0:ye.snippet:A==="zed"?(Ce=h.tools.zed)==null?void 0:Ce.snippet:(De=h.tools.continue)==null?void 0:De.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[D?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(of,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:D?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:n.jsxs("code",{children:[A==="roocode"&&((Yr=h.tools.cline)==null?void 0:Yr.snippet),A==="cursor"&&((nr=h.tools.cursor)==null?void 0:nr.snippet),A==="opencode"&&((Vt=h.tools.opencode)==null?void 0:Vt.snippet),A==="zed"&&((Jr=h.tools.zed)==null?void 0:Jr.snippet),A==="continue"&&((Tn=h.tools.continue)==null?void 0:Tn.snippet)]})})]}),n.jsx("button",{onClick:()=>N(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),n.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","reasoning","vision","scout"].map(R=>{var Ce;const re=o.find(De=>De.role===R),ye=re?a.includes(re.name):!1;return n.jsxs("div",{onClick:()=>E(R),className:ee("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",ye?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":re?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:ee("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",R==="fast"?"bg-cyan-500/10 text-cyan-400 border-cyan-500/20":R==="heavy"?"bg-amber-500/10 text-amber-400 border-amber-500/20":R==="coder"?"bg-violet-500/10 text-violet-400 border-violet-500/20":R==="reasoning"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":R==="vision"?"bg-pink-500/10 text-pink-400 border-pink-500/20":"bg-teal-500/10 text-teal-400 border-teal-500/20"),children:R}),ye&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:re==null?void 0:re.name,children:re?(Ce=re.name.split("/").pop())==null?void 0:Ce.replace(/\.gguf$/i,""):"nicht zugewiesen"}),n.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},R)})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[n.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",Re.length," von ",o.length,")"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>se("all"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),n.jsx("button",{onClick:()=>se("in_use"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ne==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),n.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[n.jsx("button",{onClick:()=>$("grid"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),n.jsx("button",{onClick:()=>$("list"),className:ee("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",I==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),I==="grid"?n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Re.length===0?n.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=S==null?void 0:S.model_list.find(De=>De.role===R.role),Ce=Yu(R.name);return n.jsxs("div",{className:ee("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",re?"border-primary/45 shadow-primary/5":R.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex items-start justify-between gap-3",children:n.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[n.jsx("div",{className:ee("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ce.color),title:Ce.name,children:Ce.initial}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:R.name,children:R.name.split("/").pop()}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:R.quant||"GGUF"}),re&&n.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[n.jsx(Jo,{className:"h-3 w-3 animate-pulse"})," Warm"]}),R.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:R.role}),R.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),R.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]})]})]})]})}),n.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})})]}),n.jsxs("div",{className:"space-y-3 pt-1",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(xi,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),n.jsx("div",{className:"text-foreground font-semibold",children:Ur(R.size_bytes)})]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[n.jsx(bh,{className:"h-3.5 w-3.5 text-primary/80"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),n.jsx("div",{className:"text-foreground font-semibold",children:qu(R.ctx)})]})]})]}),ye&&n.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),n.jsxs("span",{children:["Upgrade verfügbar: ",ye.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>ge(ye.repo,R.role,R.quant||"Q4_K_M",R.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[n.jsx(Wr,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),n.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center justify-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>O(R.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})}):n.jsx("div",{className:"space-y-2",children:Re.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ne==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):Re.map(R=>{const re=a.includes(R.name),ye=Yu(R.name);return n.jsxs("div",{className:ee("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",re?"border-primary/45":R.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("div",{className:ee("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",ye.color),title:ye.name,children:ye.initial}),n.jsxs("div",{className:"min-w-0 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:R.name,children:R.name.split("/").pop()}),R.role&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:R.role}),R.prompt_cache&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),R.spec_draft_model&&n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${R.spec_draft_model})`,children:"SPEC"}),R.parallel_slots>1&&n.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${R.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",R.parallel_slots]}),re&&n.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[n.jsxs("span",{children:["Größe: ",Ur(R.size_bytes)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Kontext: ",qu(R.ctx)]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:"font-mono text-[9px]",children:R.quant||"GGUF"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[n.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:n.jsx(Zu,{caps:R.capabilities})}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("button",{onClick:()=>re?oe(R.name):Q(R.name),className:ee("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all cursor-pointer border flex items-center gap-1",re?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary"),children:re?"Entladen":"Laden"}),n.jsx("button",{onClick:()=>T(R.name,R.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),n.jsx("button",{onClick:()=>O(R.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]})]},R.name)})})]}),C&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",C,"' konfigurieren"]}),n.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell aus deiner Bibliothek für die Rolle ",n.jsx("strong",{className:"text-foreground",children:C}),":"]}),n.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[n.jsx("button",{onClick:()=>{me(C,""),E(null)},className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:n.jsx("span",{children:"Zuweisung entfernen"})}),o.map(R=>{var re;return n.jsxs("button",{onClick:()=>{me(C,R.name),E(null)},className:ee("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",R.role===C?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"truncate max-w-[280px] font-semibold",children:(re=R.name.split("/").pop())==null?void 0:re.replace(".gguf","")}),n.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[Ur(R.size_bytes)," · ",R.quant]})]}),R.role===C&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},R.name)})]})]})}),X&&n.jsx(qr,{type:X.type,title:X.title,message:X.message,defaultValue:X.defaultValue,onConfirm:X.onConfirm,onCancel:X.onCancel})]})}function k0(){const[o,d]=p.useState(""),[a,c]=p.useState([]),[f,m]=p.useState("Q4_K_M"),[h,x]=p.useState(""),[S,b]=p.useState(""),[j,P]=p.useState([]);async function L(N){const C=N??o;if(C.trim()){x("Analysiere HuggingFace Repository...");try{const E=await fe(`/api/hf/quants?repo=${encodeURIComponent(C)}`);d(E.repo),c(E.quants),E.quants.length&&m(E.quants.includes("Q4_K_M")?"Q4_K_M":E.quants[0]),x(E.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden.")}catch(E){x(`Fehler: ${E}`)}}}async function F(){if(S.trim()){x("Durchsuche HuggingFace...");try{const N=await fe(`/api/hf/search?q=${encodeURIComponent(S)}`);P(N.results),x(N.results.length?"":"Keine Ergebnisse gefunden.")}catch(N){x(`Suche fehlgeschlagen: ${N}`)}}}async function A(){if(o.trim()){x("Download-Job wird initiiert...");try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:o,quant:f,jinja:!0})}),x(`Download gestartet: ${o} (${f}). Fortschritt wird oben angezeigt.`)}catch(N){x(`Download-Fehler: ${N}`)}}}return n.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx("input",{value:o,onChange:N=>d(N.target.value),placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),a.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("select",{value:f,onChange:N=>m(N.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:a.map(N=>n.jsx("option",{value:N,className:"bg-popover text-foreground",children:N},N))}),n.jsxs("button",{onClick:A,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer flex items-center gap-1.5",children:[n.jsx(Wr,{className:"h-3.5 w-3.5"})," Herunterladen"]})]})]})]}),n.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:S,onChange:N=>b(N.target.value),onKeyDown:N=>N.key==="Enter"&&F(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(Ei,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsx("button",{onClick:F,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),j.length>0&&n.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:j.map(N=>n.jsxs("button",{onClick:()=>{d(N.repo),P([]),b(""),L(N.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[n.jsx("span",{className:"font-semibold truncate",children:N.repo}),n.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[n.jsx(Wr,{className:"h-3 w-3"})," ",N.downloads.toLocaleString()]})]},N.repo))}),h&&n.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:h})]})}const N0={vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:hi},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:pi},reasoning:{title:"Logik & Nachdenken",desc:"Komplexe logische Gedankengänge, Mathematik und tiefgründiges Planen (Reasoning).",icon:Ss},agent:{title:"Autonomer Agent (Hermes)",desc:"Führt selbstständig Terminalbefehle aus und interagiert mit deinem Homelab.",icon:Ns},scout:{title:"Allrounder & Chat",desc:"Schnelle Antworten, Zusammenfassungen, Übersetzungen und alltägliche Fragen.",icon:mi}};function S0(){const[o,d]=p.useState(null),[a,c]=p.useState([]),[f,m]=p.useState(null),[h,x]=p.useState(""),[S,b]=p.useState(!0),[j,P]=p.useState({}),[L,F]=p.useState({}),[A,N]=p.useState(!1);p.useEffect(()=>{Promise.all([fe("/api/discover"),fe("/api/models"),fe("/api/maintenance/updates").catch(()=>null)]).then(([E,D,Z])=>{d(E),c(D.models||[]),Z&&m(Z)}).catch(E=>x(String(E))).finally(()=>b(!1))},[]);async function C(E,D,Z,Y){P(G=>({...G,[E]:"Starte..."}));try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:E,role:D,quant:Z,jinja:Y})}),P(G=>({...G,[E]:"Download läuft"}))}catch{P(I=>({...I,[E]:"Fehler"}))}}return S?n.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):h||!o?n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",h,")."]}):n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[n.jsxs("div",{children:["Modell-Registry geladen für ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.sys_ram_gb," GB"]})," System-RAM."]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(df,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),n.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),n.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:o.categories.map(E=>{const D=N0[E.role]||{title:E.title||E.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:Cs},Z=D.icon,Y=a.find(X=>X.role===E.role),G=f==null?void 0:f.model_list.find(X=>X.role===E.role),I=E.models.find(X=>X.repo===E.recommended)||E.models[0];if(!I)return null;const $=j[I.repo],ne=E.models.filter(X=>X.repo!==E.recommended),se=!!L[E.role];return n.jsxs("div",{className:ee("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",Y?"border-border/60":"border-primary/20 shadow-primary/5"),children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:n.jsx(Z,{className:"h-5.5 w-5.5"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:D.title}),n.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",E.role]})]})]}),Y?n.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):n.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),n.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:D.desc}),n.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:Y?n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:Y.name,children:Y.name.split("/").pop()}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[n.jsxs("span",{children:["Größe: ",Ni(Y.size_bytes||0)]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",Y.quant||"GGUF"]})]})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),n.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:I.name,children:I.name}),n.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{children:["Ersteller: ",I.author]}),n.jsx("span",{children:"•"}),n.jsxs("span",{children:["Quant: ",I.quant]})]}),n.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:n.jsx(b0,{fit:I.fit})})]})}),n.jsx("div",{className:"pt-1",children:Y?G?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),n.jsxs("span",{children:["Bessere Version in der Registry: ",G.repo.split("/").pop()]})]}),n.jsxs("button",{onClick:()=>C(G.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!j[G.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),j[G.repo]||"Auf neue Version aktualisieren"]})]}):n.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[n.jsx(zn,{className:"h-4 w-4"})," Auf neuestem Stand"]}):n.jsxs("button",{onClick:()=>C(I.repo,E.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!$,className:ee("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",$?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),$||"Optimales Modell einsetzen"]})})]}),ne.length>0&&n.jsxs("div",{className:"border-t border-border/20 pt-3",children:[n.jsxs("button",{onClick:()=>F(X=>({...X,[E.role]:!se})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[se?n.jsx(dh,{className:"h-3 w-3"}):n.jsx(lh,{className:"h-3 w-3"}),n.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",ne.length,")"]})]}),se&&n.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:ne.map(X=>n.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:X.name,children:X.name}),n.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[n.jsxs("span",{children:["Quant: ",X.quant]}),n.jsx("span",{children:"•"}),n.jsx("span",{children:X.fit.text})]})]}),n.jsx("button",{onClick:()=>C(X.repo,E.role,X.quant||"Q4_K_M",X.caps.tools!=="no"),disabled:!!j[X.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:j[X.repo]||"Installieren"})]},X.repo))})]})]},E.role)})}),n.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[n.jsxs("button",{onClick:()=>N(!A),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ei,{className:"h-4 w-4 text-primary"}),n.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),n.jsx("span",{className:"text-[10px] text-primary hover:underline",children:A?"Ausblenden ▲":"Anzeigen ▼"})]}),A&&n.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:n.jsx(k0,{})})]})]})}function C0(){const[o,d]=p.useState("cockpit");return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),n.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(a=>n.jsx("button",{onClick:()=>d(a),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",o===a?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:a==="cockpit"?"Cockpit":"Modelle finden"},a))})]}),n.jsx(y0,{}),n.jsx("div",{className:"transition-all duration-300",children:o==="cockpit"?n.jsx(j0,{}):n.jsx(S0,{})})]})}function Qo({label:o,percent:d,detail:a,icon:c}){const f=d>90?"bg-red-500 shadow-md shadow-red-500/20":d>75?"bg-amber-500 shadow-md shadow-amber-500/20":"bg-primary shadow-md shadow-primary/20";return n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/30 transition-all duration-300",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(c,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-foreground",children:o})]}),n.jsxs("span",{className:"text-xs font-mono font-bold text-foreground",children:[Math.round(d),"%"]})]}),n.jsx("div",{className:"w-full h-2 bg-background/40 rounded-full overflow-hidden border border-border/20",children:n.jsx("div",{className:ee("h-full transition-all duration-700 ease-out",f),style:{width:`${Math.min(d,100)}%`}})}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground/80",children:a})]})}function E0(){const[o,d]=p.useState(null),[a,c]=p.useState(null),[f,m]=p.useState(""),[h,x]=p.useState(""),[S,b]=p.useState({}),[j,P]=p.useState(null);function L(C,E,D){P({type:"alert",title:C,message:E,onConfirm:()=>{P(null)}})}function F(){fe("/api/system/status").then(d).catch(C=>m(String(C))),fe("/api/system/services").then(c).catch(()=>{})}p.useEffect(()=>{F();const C=setInterval(F,3e3);return()=>clearInterval(C)},[]);async function A(){x("Backup snapshotted...");try{const C=await fe("/api/system/backup",{method:"POST"});x(C.ok?`Snapshot erzeugt: ${C.snapshot} (${C.files.length} Dateien)`:"Keine Änderungen zu sichern.")}catch(C){x(`Fehler: ${C.message}`)}}async function N(C){b(E=>({...E,[C]:!0}));try{const E=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:C})});E.ok?L("Erfolgreich",`Dienst ${C} wurde erfolgreich neu gestartet.`):L("Fehler beim Neustart",`Fehler beim Neustart: ${E.err||"Unbekannter Fehler"}`)}catch(E){L("Fehler",`Fehler: ${E.message}`)}finally{b(E=>({...E,[C]:!1}))}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"System-Diagnose & Status"}),n.jsx("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:"Echtzeit-Ressourcen der Box, Dienst-Überwachung und Systempflege."})]}),f&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["System-Status nicht lesbar (",f,")."]}),o&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Qo,{label:"CPU",percent:o.cpu.percent,detail:o.cpu.cores?`${o.cpu.cores} Cores`:void 0,icon:bt}),n.jsx(Qo,{label:"RAM",percent:o.ram.percent,detail:`${ft(o.ram.used)} / ${ft(o.ram.total)} GB`,icon:Jo}),o.gpu&&o.gpu.busy_percent!=null&&n.jsx(Qo,{label:"GPU",percent:o.gpu.busy_percent,detail:o.gpu.gtt_used!=null&&o.gpu.gtt_total?`${ft(o.gpu.gtt_used)} / ${ft(o.gpu.gtt_total)} GB (GTT/unified)`:o.gpu.vram_used!=null&&o.gpu.vram_total?`${ft(o.gpu.vram_used)} / ${ft(o.gpu.vram_total)} GB VRAM`:void 0,icon:bt}),o.disk&&n.jsx(Qo,{label:"Disk",percent:o.disk.percent,detail:`${ft(o.disk.used)} / ${ft(o.disk.total)} GB`,icon:xi})]}),o.temp&&(o.temp.cpu||o.temp.gpu)&&n.jsxs("div",{className:"flex gap-3 text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-2.5 rounded-xl self-start w-fit",children:[o.temp.cpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["CPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.cpu," °C"]})]}),o.temp.cpu!=null&&o.temp.gpu!=null&&n.jsx("span",{children:"|"}),o.temp.gpu!=null&&n.jsxs("span",{className:"flex items-center gap-1",children:["GPU-Temperatur: ",n.jsxs("span",{className:"text-foreground font-bold",children:[o.temp.gpu," °C"]})]})]})]}),a&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Homelab-Dienste"}),n.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"h-7 px-3 rounded-lg border border-border/60 bg-background/25 text-[10px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",children:"System-Logs anzeigen"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:a.services.map(C=>n.jsxs("div",{className:"flex items-center justify-between p-3.5 rounded-xl bg-background/20 border border-border/30 hover:border-primary/20 transition-all group",children:[n.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",C.ok?"bg-emerald-500":"bg-amber-500")}),n.jsxs("div",{className:"truncate",children:[n.jsx("div",{className:"text-xs font-bold text-foreground truncate",children:C.name}),n.jsx("div",{className:"text-[9px] text-muted-foreground/60 font-mono mt-0.5 truncate",children:C.url})]})]}),n.jsx("button",{onClick:()=>N(C.name),disabled:S[C.name],className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-primary hover:bg-primary/5 flex items-center justify-center transition-all opacity-0 group-hover:opacity-100",title:"Dienst neu starten",children:n.jsx(Vr,{className:ee("h-3.5 w-3.5",S[C.name]&&"animate-spin")})})]},C.name))}),n.jsxs("div",{className:"flex flex-wrap gap-4 border-t border-border/20 pt-4 text-[10px] font-semibold text-muted-foreground",children:[n.jsxs("a",{href:Ps(a.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(Xo,{className:"h-3 w-3"})," Engine Dashboard (llama-swap)"]}),n.jsxs("a",{href:Ps(a.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 text-primary hover:text-primary-foreground hover:bg-primary/10 px-2 py-1 rounded transition-colors",children:[n.jsx(Xo,{className:"h-3 w-3"})," OpenAI Gateway"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"System-Backup & Snapshot"}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Erzeuge einen Git-Snapshot der aktuellen Konfigurationen und des System-Zustands."})]}),n.jsx("div",{className:"flex items-center gap-3 self-start sm:self-auto shrink-0",children:n.jsxs("button",{onClick:A,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(jh,{className:"h-4 w-4"})," Snapshot erstellen"]})})]}),h&&n.jsx("div",{className:"text-[10px] font-mono text-primary font-medium bg-primary/5 p-3 rounded-xl border border-primary/20",children:h}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:j.onConfirm,onCancel:j.onCancel})]})}function _0(){const[o,d]=p.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[a,c]=p.useState(localStorage.getItem("mc_mcp_path")||""),[f,m]=p.useState(null),[h,x]=p.useState("cline"),[S,b]=p.useState(!1),[j,P]=p.useState("");p.useEffect(()=>{const C=new URLSearchParams;C.set("host",o),a&&C.set("mcp_path",a),fe(`/api/connect?${C}`).then(m).catch(E=>P(String(E)))},[o,a]);function L(C){d(C),C&&localStorage.setItem("mc_host",C)}function F(C){c(C),localStorage.setItem("mc_mcp_path",C)}const A=f==null?void 0:f.tools[h];async function N(){A&&(await navigator.clipboard.writeText(A.snippet),b(!0),setTimeout(()=>b(!1),1500))}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Kopiere vorgefertigte Konfigurationsdateien für deinen lokalen PC (IDEs, Cline, Roo Code, Cursor), um direkt auf das geteilte Gedächtnis und den Auto-Swap-Gateway der Box zuzugreifen."})]}),n.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(xh,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),n.jsx("input",{value:o,onChange:C=>L(C.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[n.jsx(hh,{className:"h-3.5 w-3.5 text-primary"})," Lokaler MCP-Scriptpfad"]}),n.jsx("input",{value:a,onChange:C=>F(C.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]})]}),j&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",j]}),f&&n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex flex-wrap gap-1 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:Object.entries(f.tools).map(([C,E])=>n.jsx("button",{onClick:()=>x(C),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",h===C?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:E.label},C))}),A&&n.jsxs("div",{className:"space-y-3",children:[A.note&&n.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-xs text-muted-foreground leading-relaxed",children:[n.jsx(gh,{className:"h-4.5 w-4.5 text-primary shrink-0 mt-0.5"}),n.jsx("span",{children:A.note})]}),n.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[n.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80 shadow-md shadow-red-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80 shadow-md shadow-amber-500/10"}),n.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80 shadow-md shadow-emerald-500/10"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:[n.jsx(el,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{children:h==="cline"||h==="cursor"?"config.json":"settings.json"})]}),n.jsxs("button",{onClick:N,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[S?n.jsx(zn,{className:"h-3.5 w-3.5 text-emerald-400"}):n.jsx(of,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:S?"Kopiert":"Kopieren"})]})]}),n.jsx("pre",{className:"p-5 overflow-x-auto text-xs font-mono text-cyan-200/90 whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",children:n.jsx("code",{children:A.snippet})})]})]})]})]})}const Ju=["user","instruction","stable","versioned","ephemeral"],ui={user:{label:"User",icon:Ph,color:"text-cyan-400",border:"border-cyan-500/30",bg:"bg-cyan-500/10",text:"text-cyan-400"},instruction:{label:"Regel",icon:kh,color:"text-violet-400",border:"border-violet-500/30",bg:"bg-violet-500/10",text:"text-violet-400"},stable:{label:"Fakt",icon:Hr,color:"text-indigo-400",border:"border-indigo-500/30",bg:"bg-indigo-500/10",text:"text-indigo-400"},versioned:{label:"Version",icon:Eh,color:"text-amber-400",border:"border-amber-500/30",bg:"bg-amber-500/10",text:"text-amber-400"},ephemeral:{label:"Temporär",icon:uh,color:"text-pink-400",border:"border-pink-500/30",bg:"bg-pink-500/10",text:"text-pink-400"}},Xu={label:"Gedächtnis",icon:sf,bg:"bg-muted/10",text:"text-muted-foreground"},P0={user:"border-l-cyan-500/80",instruction:"border-l-violet-500/80",stable:"border-l-indigo-500/80",versioned:"border-l-amber-500/80",ephemeral:"border-l-pink-500/80"};function M0(){const[o,d]=p.useState([]),[a,c]=p.useState(""),[f,m]=p.useState(""),[h,x]=p.useState(""),[S,b]=p.useState("stable"),[j,P]=p.useState(""),[L,F]=p.useState(!1),[A,N]=p.useState(null);function C(I,$,ne){N({type:"alert",title:I,message:$,onConfirm:()=>{N(null)}})}function E(I,$,ne){N({type:"confirm",title:I,message:$,onConfirm:()=>{N(null),ne()},onCancel:()=>N(null)})}function D(){const I=new URLSearchParams;f&&I.set("q",f),a&&I.set("category",a),fe(`/api/memory?${I}`).then(d).catch($=>P(String($)))}p.useEffect(D,[f,a]);async function Z(){h.trim()&&(await fe("/api/memory",{method:"POST",body:JSON.stringify({content:h,category:S,source:"ui"})}),x(""),D())}async function Y(I){await fe(`/api/memory/${I}`,{method:"DELETE"}),D()}async function G(){F(!0);try{const I=await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(I.duplicate_count===0){C("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${I.duplicate_count} Dublette(n) in ${I.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await fe("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),D()}catch($){C("Fehler",`Fehler beim Löschen: ${$.message}`)}})}catch(I){C("Fehler",`Fehler bei der Deduplizierung: ${I.message}`)}finally{F(!1)}}return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool (Memory)"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Die geteilte Konstitution des Systems. Alle Instanzen (Hermes, IDEs, Gateway) lesen und schreiben hierauf per MCP-Protokoll."})]}),n.jsxs("button",{onClick:G,disabled:L,className:"flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50 shrink-0 self-start",children:[n.jsx(Ch,{className:"h-4 w-4 text-primary animate-pulse"}),n.jsx("span",{children:"Deduplizieren"})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),n.jsx("textarea",{value:h,onChange:I=>x(I.target.value),placeholder:"Füge eine neue Regel, eine Vorliebe oder einen stabilen Fakt über das Projekt oder dich hinzu...",rows:3,className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3.5 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground transition-all leading-relaxed"}),n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Kategorie"}),n.jsx("select",{value:S,onChange:I=>b(I.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 py-1 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Ju.map(I=>{var $;return n.jsx("option",{value:I,className:"bg-popover text-foreground",children:(($=ui[I])==null?void 0:$.label)||I},I)})})]}),n.jsxs("button",{onClick:Z,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[n.jsx(lf,{className:"h-4 w-4"})," Speichern"]})]})]}),n.jsxs("div",{className:"flex flex-col md:flex-row items-stretch md:items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("input",{value:f,onChange:I=>m(I.target.value),placeholder:"Gedächtnis durchsuchen...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),n.jsx(Ei,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl overflow-x-auto max-w-full",children:[n.jsx("button",{onClick:()=>c(""),className:ee("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer whitespace-nowrap",a?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Ju.map(I=>{const $=ui[I]||Xu,ne=$.icon;return n.jsxs("button",{onClick:()=>c(I),className:ee("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1 whitespace-nowrap",a===I?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{children:$.label})]},I)})]})]}),j&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Laden des Gedächtnisses: ",j]}),n.jsx("div",{className:"space-y-3",children:o.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):o.map(I=>{const $=ui[I.category]||Xu,ne=$.icon;return n.jsxs("div",{className:ee("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",P0[I.category]||"border-l-muted"),children:[n.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[n.jsxs("span",{className:ee("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",$.bg,$.text),children:[n.jsx(ne,{className:"h-3 w-3"}),n.jsx("span",{className:"hidden sm:inline",children:$.label})]}),n.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:I.content})]}),n.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[n.jsx("span",{className:"text-[9px] font-mono text-muted-foreground/60 bg-background/20 px-1.5 py-0.5 rounded uppercase tracking-wider",children:I.source}),n.jsx("button",{onClick:()=>Y(I.id),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",title:"Eintrag löschen",children:n.jsx(gi,{className:"h-3.5 w-3.5"})})]})]},I.id)})}),A&&n.jsx(qr,{type:A.type,title:A.title,message:A.message,onConfirm:A.onConfirm,onCancel:A.onCancel})]})}function qo({label:o,ok:d,detail:a,icon:c,onClick:f}){return n.jsxs("div",{onClick:f,className:ee("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",d?"border-border/60":"border-amber-500/30",f&&"cursor-pointer hover:bg-card/70"),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:o}),n.jsx(c,{className:ee("h-4.5 w-4.5",d?"text-primary":"text-amber-500")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full ring-2 ring-black/40",d?"bg-emerald-500 animate-pulse":"bg-amber-500")}),n.jsx("span",{className:"text-xs font-semibold text-foreground",children:d?"Bereit / Online":"Offline / Inaktiv"})]}),a&&n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:a,children:a})]}),f&&n.jsxs("button",{onClick:m=>{m.stopPropagation(),f()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[n.jsx(bt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Gehirn wechseln"})]})]})}function R0(){const[o,d]=p.useState(null),[a,c]=p.useState(""),[f,m]=p.useState(null),[h,x]=p.useState(!1),[S,b]=p.useState([]),[j,P]=p.useState(null);function L($,ne,se){P({type:"alert",title:$,message:ne,onConfirm:se})}const[F,A]=p.useState({width:800,height:360}),N=p.useRef(null),C=p.useCallback($=>{if(N.current&&(N.current.disconnect(),N.current=null),$){const ne=new ResizeObserver(se=>{if(!se||se.length===0)return;const X=se[0].contentRect;A({width:X.width,height:X.height})});ne.observe($),N.current=ne}},[]),E=F.width,D=F.height,Z=($,ne,se,X)=>{const be=($+se)/2;return`M ${$} ${ne} C ${be} ${ne}, ${be} ${X}, ${se} ${X}`};function Y(){fe("/api/agent/status").then(d).catch($=>c(String($)))}function G(){fe("/api/models").then($=>{const ne=$.models.map(se=>{var X;return((X=se.name.split("/").pop())==null?void 0:X.replace(".gguf",""))||se.name});b(["auto","fast","heavy",...ne])}).catch($=>console.error("Error loading models",$))}async function I($){try{await fe("/api/agent/brain",{method:"POST",body:JSON.stringify({model:$})}),L("Erfolgreich",`Hermes-Gehirn wurde auf '${$}' geändert. Der Gateway-Dienst wurde neu gestartet.`),Y(),x(!1)}catch(ne){L("Fehler",`Fehler beim Wechseln des Gehirns: ${ne.message}`)}}return p.useEffect(()=>{Y(),G();const $=setInterval(Y,5e3);return()=>clearInterval($)},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),n.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",n.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(o==null?void 0:o.webui_url)&&n.jsxs("a",{href:Ps(o.webui_url),target:"_blank",rel:"noopener",className:ee("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",o.webui_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[n.jsx(Xo,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes WebUI öffnen"})]})]}),a&&n.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",a,")."]}),o&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(qo,{label:"Agent Gateway",ok:o.gateway_reachable,detail:"Port :8642 (REST API)",icon:Ns}),n.jsx(qo,{label:"Agent WebUI",ok:o.webui_reachable,detail:"Port :8787 (Chat UI)",icon:Jo}),n.jsx(qo,{label:"Aktives Gehirn",ok:o.gateway_reachable,detail:o.brain_model?`Model: ${o.brain_model}`:"Model: auto",icon:bt,onClick:()=>x(!0)}),n.jsx(qo,{label:"Verdrahtung",ok:o.has_config,detail:`Config: ${o.has_config?"✓":"—"} · Skills: ${o.has_skills?"✓":"—"} · Memory: ${o.has_memories?"✓":"—"}`,icon:tl})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),n.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),n.jsxs("div",{ref:C,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[n.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),n.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),n.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[n.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),n.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="webui"||o.webui_reachable)&&n.jsx("path",{d:Z(E*.15,D*.5,E*.5,D*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||o.gateway_reachable)&&n.jsx("path",{d:Z(E*.5,D*.5,E*.85,D*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),n.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>m("webui"),onMouseLeave:()=>m(null),onClick:()=>o.webui_reachable&&window.open(Ps(o.webui_url),"_blank"),title:o.webui_reachable?"Klicken um Chat-WebUI zu öffnen":"WebUI Offline",children:[n.jsx(Jo,{className:ee("h-3.5 w-3.5",o.webui_reachable?"text-emerald-400":"text-amber-500")}),n.jsx("span",{children:"Agent WebUI"}),n.jsx("span",{className:ee("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",o.webui_reachable?"bg-emerald-500":"bg-amber-500")})]}),n.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>m("gateway"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(Ns,{className:"h-3.5 w-3.5 text-primary"}),n.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),n.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),n.jsx("div",{className:ee("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",o.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:o.gateway_reachable?"Online":"Offline"})]}),n.jsxs("div",{className:ee("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",o.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>m("brain"),onMouseLeave:()=>m(null),onClick:()=>x(!0),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(bt,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),o.gateway_reachable&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:o.brain_model,children:o.brain_model||"auto"})]}),n.jsxs("div",{className:ee("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",o.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>m("wiring"),onMouseLeave:()=>m(null),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[n.jsx(tl,{className:"h-3 w-3 text-primary"}),n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),o.has_config&&n.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),n.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[n.jsxs("span",{children:["Config: ",o.has_config?"✓":"—"]}),n.jsxs("span",{children:["Skills: ",o.has_skills?"✓":"—"]}),n.jsxs("span",{children:["Memory: ",o.has_memories?"✓":"—"]})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),n.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),n.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-primary"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"SSH-Kopplung & Sandbox-Umgehung"})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"1. Warum verweigert Hermes Aktionen auf dem PC?"}),n.jsx("p",{children:"Hermes ist standardmäßig so ausgerichtet, dass er sich als virtueller Assistent ohne Systemzugriff versteht. Um dies zu umgehen, musst du Hermes' **System-Prompt** in der Chat-WebUI anpassen."}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Beispiel System-Prompt Erweiterung:"}),n.jsx("br",{}),'"Du hast über das terminal-Tool vollen SSH-Zugriff auf den Windows-PC des Users (TobisPC). Nutze SSH-Befehle um Aktionen dort auszuführen, wenn danach gefragt wird. Behaupte nie, du könntest das nicht!"']})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-xs font-bold text-foreground",children:"2. SSH-Verbindung zum lokalen Windows-PC einrichten"}),n.jsx("p",{children:"Damit der Agent Befehle auf deinem PC ausführen kann, muss OpenSSH auf Windows aktiv und mit einem Key gekoppelt sein:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1.5 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"OpenSSH Server auf Windows starten:"})," In PowerShell als Admin ausführen: ",n.jsx("code",{className:"text-foreground font-mono",children:"Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"SSH-Key auf der Box erzeugen:"})," ",n.jsx("code",{className:"text-foreground font-mono",children:"ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_hermes_agent"})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Key autorisieren:"})," Kopiere den Inhalt von ",n.jsx("code",{className:"text-foreground font-mono",children:"~/.ssh/id_ed25519_hermes_agent.pub"})," in deine Windows-Datei ",n.jsx("code",{className:"text-foreground font-mono",children:"C:\\Users\\TobisPC\\.ssh\\authorized_keys"})]})]})]})]})]}),!o.gateway_reachable&&n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Hr,{className:"h-5 w-5 text-amber-500"}),n.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[n.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),n.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",n.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),n.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[n.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),n.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-webui"})]}),n.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",n.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),o&&h&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[n.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4"}),n.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),n.jsx("button",{onClick:()=>x(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',n.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",n.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),n.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:S.map($=>{const ne=["auto","fast","heavy"].includes($);return n.jsxs("button",{onClick:()=>I($),className:ee("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",o.brain_model===$||!o.brain_model&&$==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:$}),n.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:ne?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(o.brain_model===$||!o.brain_model&&$==="auto")&&n.jsx(zn,{className:"h-4 w-4 shrink-0 text-primary"})]},$)})})]})}),j&&n.jsx(qr,{type:j.type,title:j.title,message:j.message,onConfirm:()=>j.onConfirm&&j.onConfirm(),onCancel:j.onCancel})]})}function z0(){const[o,d]=p.useState("connect"),[a,c]=p.useState("roocode"),[f,m]=p.useState(null),h="192.168.178.151",[x,S]=p.useState(!1),[b,j]=p.useState(null);function P(){S(!0),fe("/api/health").then(L=>{m(L),j(L.engine_reachable?"success":"partial")}).catch(()=>{m(null),j("fail")}).finally(()=>S(!1))}return p.useEffect(()=>{P()},[]),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Stack-Anleitung & Vibe-Coding-Guide"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Einsteigerfreundliche Erklärungen zu deinem Stack und Schritt-für-Schritt-Anleitungen zur Anbindung deiner Editoren."})]}),n.jsxs("div",{className:"flex gap-4 border-b border-border/40 pb-px",children:[n.jsx("button",{onClick:()=>d("connect"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="connect"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Editor-Anbindung"}),n.jsx("button",{onClick:()=>d("concepts"),className:ee("pb-3 text-xs font-bold uppercase tracking-wider border-b-2 px-1 transition-all",o==="concepts"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"KI-Wissensdatenbank (Juni 2026)"})]}),o==="connect"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:ee("h-3 w-3 rounded-full ring-2 ring-black/40",b==="success"&&"bg-emerald-500 animate-pulse",b==="partial"&&"bg-amber-500",b==="fail"&&"bg-red-500",!b&&"bg-muted")}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lokaler Verbindungs-Check"}),n.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 font-mono",children:[b==="success"&&`Erfolgreich! Dein PC hat Zugriff auf das Box-Gateway (v${(f==null?void 0:f.version)||""}).`,b==="partial"&&"Gateway erreichbar, aber die llama-cpp-Engine ist offline.",b==="fail"&&"Verbindung fehlgeschlagen. Ist die Box im selben LAN-Netzwerk?",!b&&"Verbindung wird geprüft..."]})]})]}),n.jsxs("button",{onClick:P,disabled:x,className:"h-8 px-3 flex items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50 cursor-pointer self-start sm:self-auto shrink-0",children:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",x&&"animate-spin")}),n.jsx("span",{children:"Testen"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(sf,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie funktioniert mein Stack?"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(bt,{className:"h-4 w-4 text-cyan-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"1. Die Zentrale"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein Dashboard. Hier siehst du die CPU-/RAM- und GPU-Last der Box und siehst sofort, ob Updates anstehen."})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Cs,{className:"h-4 w-4 text-violet-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"2. Modell-Zentrale"})]}),n.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Deine GGUF-Datenbank. Gesteuert von ",n.jsx("strong",{children:"llama-swap"}),". Lädt dein schnelles Alltags-Hirn (`fast`) oder dein schweres Logik-Hirn (`heavy`) vollautomatisch im VRAM."]})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-border/60 bg-card/20 space-y-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx(Ss,{className:"h-4 w-4 text-indigo-400"}),n.jsx("h3",{className:"text-xs font-bold text-foreground",children:"3. Das Gedächtnis"})]}),n.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:"Dein geteiltes Langzeitgedächtnis (Memory-Pool). Hier merkt sich dein Agent Regeln, Projekt-Details und Vorlieben."})]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 px-1",children:[n.jsx(pi,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Vibe Coding auf dem PC einrichten"})]}),n.jsxs("div",{className:"flex gap-1.5 bg-card/20 p-1 border border-border/40 rounded-xl max-w-fit",children:[n.jsxs("button",{onClick:()=>c("roocode"),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer flex items-center gap-1.5",a==="roocode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:[n.jsx(df,{className:"h-3.5 w-3.5 fill-amber-400/20"}),"Roo Code (VS Code)"]}),n.jsx("button",{onClick:()=>c("cursor"),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="cursor"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"Cursor IDE"}),n.jsx("button",{onClick:()=>c("opencode"),className:ee("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",a==="opencode"?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:"OpenCode Desktop"})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[a==="roocode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Roo Code Kopplung (Empfohlene Open-Source-Erweiterung)"}),n.jsx("p",{children:"Roo Code ist die beliebteste und flexibelste Vibe-Coding-Erweiterung für VS Code im Jahr 2026. Sie ermöglicht vollen Zugriff auf das Terminal und das MCP-Gedächtnis."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Roo Code installieren"]}),n.jsxs("p",{className:"pl-6",children:["Suche in VS Code nach der Erweiterung ",n.jsx("strong",{children:"Roo Code"})," und installiere sie."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"API-Anbindung konfigurieren"]}),n.jsx("p",{className:"pl-6",children:"Klicke auf das Roo-Code-Symbol in der Sidebar, öffne die Einstellungen (Zahnrad) und stelle folgendes ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Provider:"})," OpenAI Compatible"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model ID:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"MCP Gedächtnis verknüpfen (Optional, aber empfohlen)"]}),n.jsxs("p",{className:"pl-6",children:["Damit Roo Code auf deinen ",n.jsx("strong",{children:"Gedächtnis-Pool"})," zugreifen kann, kopiere die MCP-Konfiguration aus dem Reiter ",n.jsx("strong",{children:"Verbinden"})," und füge sie in deine lokale Roo-Code-Konfigurationsdatei ein."]})]})]})]}),a==="cursor"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Cursor IDE Kopplung (Proprietäre All-in-One IDE)"}),n.jsx("p",{children:"Cursor ist ein polierter, extrem schneller VS-Code-Fork mit hervorragenden, tief integrierten Autovervollständigungen (Tab-Completions)."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"Einstellungen öffnen"]}),n.jsxs("p",{className:"pl-6",children:["Öffne Cursor, klicke oben rechts auf das Zahnrad (Settings) und navigiere zu ",n.jsx("strong",{children:"Models"}),"."]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"OpenAI API überschreiben"]}),n.jsxs("p",{className:"pl-6",children:["Deaktiviere die Standard-Cloudmodelle, klappe den Bereich ",n.jsx("strong",{children:"OpenAI API"})," auf und konfiguriere:"]}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Override Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"API Key:"})," ",n.jsx("span",{className:"italic text-muted-foreground/50",children:'beliebig (z.B. "local")'})]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Modell hinzufügen"]}),n.jsxs("p",{className:"pl-6",children:["Trage in der Modell-Liste ein neues Modell mit dem Namen ",n.jsx("strong",{children:"auto"})," ein und wähle es als aktives Modell aus. Cursor leitet ab jetzt alle deine Anfragen an die Box weiter."]})]})]})]}),a==="opencode"&&n.jsxs("div",{className:"space-y-4 text-xs leading-relaxed text-muted-foreground",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-sm font-bold text-foreground",children:"OpenCode Desktop Kopplung (Open-Source Vibe-Coding-App)"}),n.jsx("p",{children:"OpenCode ist eine standalone Desktop-App für ein ablenkungsfreies Coden über natürliche Sprache. Es trennt den KI-Prozess von deinem Editor."})]}),n.jsxs("div",{className:"space-y-3.5 border-t border-border/20 pt-4",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"1"}),"OpenCode Desktop herunterladen"]}),n.jsx("p",{className:"pl-6",children:"Lade die Desktop-Anwendung von der offiziellen Website (opencode.ai) herunter und starte sie."})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"2"}),"Endpunkt auf Box-Gateway setzen"]}),n.jsx("p",{className:"pl-6",children:"Gehe in den Bereich Einstellungen ➔ Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:"}),n.jsx("div",{className:"pl-6 pt-1",children:n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Base URL:"})," http://",h,":9001/v1"]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground/60",children:"Model:"})," auto"]})]})})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[n.jsx("span",{className:"h-4.5 w-4.5 rounded-full bg-primary/20 text-primary flex items-center justify-center font-mono text-[10px]",children:"3"}),"Erster Vibe-Coding Test"]}),n.jsx("p",{className:"pl-6",children:'Starte eine neue Session und teste die Verbindung mit einem einfachen Prompt, z. B. *"Erstelle ein einfaches Skript, das die Fibonaccizahlen berechnet"*. Das Box-Gateway tauscht das Modell im Hintergrund vollautomatisch aus.'})]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 space-y-3 shadow-lg shadow-black/10",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(el,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Was tun, wenn das Coden hakt?"})]}),n.jsxs("ul",{className:"text-[11px] text-muted-foreground space-y-2 list-disc pl-4 leading-relaxed",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Keine Verbindung?"})," Überprüfe im Live-Verbindungsprüfer oben, ob die Box-IP erreichbar ist. Stelle sicher, dass dein lokaler PC im selben WLAN/LAN-Netzwerk wie die Box eingeloggt ist."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Modell antwortet nicht?"})," Schaue unter ",n.jsx("strong",{children:"Diagnose"}),", ob der Dienst `llama-swap` aktiv (grün) is. Wenn nicht, klicke daneben auf ",n.jsx("strong",{children:"Restart"}),"."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Hermes Agent reagiert merkwürdig?"})," Starte in der Hermes WebUI einfach eine frische Session (neuen Chat). Ältere Chats sammeln Kontext-Müll an."]})]})]})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex items-start gap-4",children:[n.jsx(mi,{className:"h-8 w-8 text-primary shrink-0 mt-0.5"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Entwickler-Guide: Modernes Agentic Coding (2026)"}),n.jsx("p",{className:"text-xs text-muted-foreground leading-normal",children:"Willkommen im Wissenszentrum für dein Mission Control 2 Setup. Hier erfährst du, wie die verschiedenen Technologien (MoE, MCP, Skills, Hermes) zusammenarbeiten und wie du das Maximum aus deinen AI-Prozessabläufen herausholst."})]})]}),n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Cs,{className:"h-5 w-5 text-cyan-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"1. Mixture of Experts (MoE)"}),n.jsx("span",{className:"text-[9px] text-cyan-400 font-mono",children:"Effizienz durch Spezialisierung"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Bei traditionellen LLMs wird für jedes Wort das gesamte neuronale Netz aktiviert. Bei MoE besteht das Modell aus mehreren spezialisierten Teilnetzwerken (den ",n.jsx("em",{children:"Experts"}),"). Ein intelligenter ",n.jsx("em",{children:"Router"})," entscheidet pro Token (Wortteil), welche Experten zur Berechnung herangezogen werden."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," So können extrem leistungsstarke Modelle (wie DeepSeek-V3, Mixtral oder Command R+) mit wesentlich geringeren Hardwarekosten ausgeführt werden. Es wird nur ein Bruchteil der Parameter geladen und aktiv berechnet, was Speicherplatz spart und die Inferenz beschleunigt."]}),n.jsxs("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] text-foreground",children:[n.jsx("span",{className:"text-cyan-400",children:"Vorteil:"})," GPT-4-Klasse Performance bei einem Bruchteil der aktiven VRAM-Last auf deinem Homelab!"]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(mi,{className:"h-5 w-5 text-violet-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"2. Model Context Protocol (MCP)"}),n.jsx("span",{className:"text-[9px] text-violet-400 font-mono",children:"Standardisierte Agenten-Tools"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," MCP ist ein offenes Protokoll (initiiert von Anthropic), das festlegt, wie ein KI-Client (z.B. Roo Code auf deinem PC) mit externen Datenquellen und Tools kommuniziert. Es funktioniert wie ein USB-Standard für KI."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Warum in MC2?"})," MCP trennt den AI-Kern von der Umgebung. Statt für jeden Editor eigene Tools zu schreiben, binden deine Agenten (Roo Code, Hermes) einfach MCP-Server an. Diese Server können Dateien lesen, Websuchen durchführen, Git bedienen oder mit deiner App interagieren."]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Gute Quellen für MCP Server:"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("a",{href:"https://smithery.ai/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Smithery Registry"})," — Ein Portal zum Suchen und automatischen Installieren von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://glama.ai/mcp/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Glama MCP Registry"})," — Eine kuratierte, umfangreiche Community-Datenbank von MCP Servern."]}),n.jsxs("li",{children:[n.jsx("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"Offizielles Anthropic Repo"})," — Das offizielle Repository mit Standards wie filesystem, postgres, sqlite, brave-search und puppeteer."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Ss,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"3. Agent Skills"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Modulbasierte Fähigkeiten"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Ein Skill ist ein Verzeichnis mit standardisierten Anweisungen, Scripten und Beispielen, das deine Agenten für spezifische Aufgaben trainiert (z.B. Test-Driven Development, Code-Vereinfachung, API-Design)."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Wie benutzt man sie?"})," Lege einen Skill-Ordner unter ",n.jsx("code",{children:".agents/skills/"})," in deinem Projekt an. Das Herzstück ist die Datei ",n.jsx("code",{children:"SKILL.md"})," mit folgendem Aufbau:"]}),n.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- -name: tdd-pro -description: Drive development with strict TDD practices ---- -# Instructions -...`}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/25 rounded-xl border border-border/30 text-[10px]",children:[n.jsx("div",{className:"font-bold text-foreground",children:"Wo gibt es Skills & wo liegen sie?"}),n.jsxs("ul",{className:"list-disc pl-4 space-y-2.5 text-muted-foreground",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"skills.sh Registry & CLI:"})," Das offizielle offene Portal für Agent-Skills (",n.jsx("a",{href:"https://skills.sh/",target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold",children:"skills.sh"}),"). Du kannst Skills direkt über das Terminal suchen und in deinem Projekt installieren:",n.jsxs("div",{className:"mt-1 font-mono text-[9px] bg-background/40 p-2 rounded border border-border/30 text-cyan-300",children:["# Nach Skills suchen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills find"}),n.jsx("br",{}),"# Skill zum aktuellen Projekt hinzufügen:",n.jsx("br",{}),n.jsx("span",{className:"text-foreground",children:"npx skills add [owner/repo]"})]})]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Globaler Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:"C:\\Users\\TobisPC\\.gemini\\config\\plugins\\agent-skills\\skills\\"}),". Hier sind deine vorinstallierten, global verfügbaren Skills (wie ",n.jsx("i",{children:"code-simplification"}),", ",n.jsx("i",{children:"api-and-interface-design"}),", etc.) abgelegt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Projekt-Pfad:"})," ",n.jsx("code",{className:"text-foreground select-all",children:".agents/skills/"}),". Lege diesen Ordner im Root eines beliebigen Projekts an. Dein lokaler Editor-Agent (z.B. Roo Code) liest ihn beim Starten automatisch ein."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Vorlagen / Beispiele:"})," Kopiere einfach bestehende Skills aus dem globalen Verzeichnis oder erstelle deine eigenen, indem du eine ",n.jsx("code",{children:"SKILL.md"})," mit YAML-Header (name, description) anlegst."]})]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(bt,{className:"h-5 w-5 text-indigo-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"4. Arbeiten mit Hermes"}),n.jsx("span",{className:"text-[9px] text-indigo-400 font-mono",children:"Autonomer Box-Agent"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 leading-normal",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Was ist das?"})," Hermes ist der auf der Box installierte, autonome Hintergrund-Agent. Er verwaltet das Dateisystem und kann über REST (Port 8642) oder eine interaktive ChatUI (Port 8787) gesteuert werden."]}),n.jsx("p",{children:n.jsx("strong",{children:"Best Practices für Hermes:"})}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Chat-Kontext sauber halten:"})," Starte regelmäßig neue Chats. Zu große Historien verlangsamen den Agenten und führen zu Halluzinationen."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gehirn festlegen:"})," Konfiguriere im Gateway die Modell-Rolle ",n.jsx("code",{children:"brain"})," für Hermes, damit er automatisch das passende Modell per Llama Swap lädt."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Sandbox umgehen:"})," Erweitere Hermes' System-Prompt (WebUI-Einstellungen), um Befehle über SSH an deinen Windows-PC zu leiten."]})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(tl,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"5. Richtiges Arbeiten mit Tools (Dateien, Terminal, DevTools)"}),n.jsx("span",{className:"text-[9px] text-amber-400 font-mono",children:"Fehler vermeiden & Kosten senken"})]})]}),n.jsxs("div",{className:"grid md:grid-cols-3 gap-4 text-xs text-muted-foreground leading-normal",children:[n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(el,{className:"h-3.5 w-3.5 text-primary"})," Terminal"]}),n.jsxs("p",{className:"text-[11px]",children:["Verwende nur non-interaktive Befehle. Hänge bei langen Tasks (wie dev-Servern) ein ",n.jsx("code",{children:"&"})," an oder nutze die integrierte Job-Verwaltung. Verwende niemals interaktive Eingabeaufforderungen."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(pi,{className:"h-3.5 w-3.5 text-cyan-400"})," Dateimanager"]}),n.jsxs("p",{className:"text-[11px]",children:["Überschreibe keine ganzen Dateien, wenn du nur eine Zeile ändern willst. Verwende gezielte Ersetzungs-Tools (wie ",n.jsx("code",{children:"replace_file_content"}),"). Das spart massiv Token-Kosten und beugt Fehlern vor."]})]}),n.jsxs("div",{className:"space-y-1.5 p-3 bg-background/10 rounded-xl border border-border/30",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1",children:[n.jsx(tl,{className:"h-3.5 w-3.5 text-violet-400"})," Browser DevTools"]}),n.jsx("p",{className:"text-[11px]",children:"Koppele deine Debug-Dienste mit dem Chrome-DevTools-Plugin. So kann der Agent Fehler in der Konsole live analysieren und das DOM verifizieren, anstatt blind zu raten."})]})]})]}),n.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-6 shadow-lg shadow-black/10 space-y-4 md:col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border/20 pb-3",children:[n.jsx(Hr,{className:"h-5 w-5 text-emerald-400"}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Wie autonom ist Mission Control 2 wirklich?"}),n.jsx("span",{className:"text-[9px] text-emerald-400 font-mono",children:"Die Grenze zwischen Automatisierung und Kontrolle"})]})]}),n.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-normal",children:[n.jsxs("p",{children:["Mission Control 2 ist als ",n.jsx("strong",{children:"semi-autonomes Gateway"})," konzipiert. Es besitzt die Fähigkeit, komplexe Workflows komplett selbstständig durchzuführen, unterliegt jedoch strikten Sicherheitsplanken:"]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 pt-1",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Eu,{className:"h-3 w-3 text-emerald-400"})," Was läuft vollautomatisch?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsx("li",{children:"Modellaustausch (Routing) per llama-swap je nach Anfragetyp (z.B. Code vs. Reasoning)."}),n.jsx("li",{children:"Hintergrund-Synchronisation und Speicherung von Gedächtniseinträgen (Memory)."}),n.jsx("li",{children:"Modell-Installation und API-Key-Injektionen in Gateway-Verbindungen."})]})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("h4",{className:"font-bold text-foreground flex items-center gap-1 text-[11px]",children:[n.jsx(Eu,{className:"h-3 w-3 text-amber-400"})," Wo ist menschliche Freigabe nötig?"]}),n.jsxs("ul",{className:"list-disc pl-4 space-y-1 text-[11px]",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Systembefehle:"})," Das Ausführen von Terminal-Kommandos auf deinem PC erfordert standardmäßig deine Bestätigung."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Kritische Systemeingriffe:"})," OS-Updates, Engine-Rebuilds und Host-Reboots müssen manuell über das Dashboard ausgelöst werden."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Gedächtnis-Löschung:"})," Permanentes Verwerfen von gesammelten Memorys wird von dir freigegeben."]})]})]})]}),n.jsxs("p",{className:"text-[11px] bg-background/25 p-3 rounded-xl border border-border/30 mt-2",children:[n.jsx("strong",{children:"Fazit:"})," Der Stack erledigt die Kärrnerarbeit (Modelle tauschen, API-Adapter bereitstellen, Sandbox-Verbindungen herstellen) komplett im Hintergrund. Er agiert als dein persönlicher, treuer Copilot, ohne jemals ungefragt schädliche Operationen auf deinem Hauptsystem auszuführen."]})]})]})]})]})]})}function D0({title:o,hint:d}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-semibold",children:o}),n.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[n.jsx(mh,{className:"h-8 w-8 text-muted-foreground"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const L0=[{id:"llama-swap",label:"Llama Swap",type:"system"},{id:"mission-control-2",label:"Mission Control 2",type:"user"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user"},{id:"hermes-dashboard",label:"Hermes Dashboard",type:"user"},{id:"hermes-webui",label:"Hermes WebUI",type:"user"}];function fi(o){return o==null?"":o>1024**3?`${(o/1024**3).toFixed(2)} GB`:`${(o/1024**2).toFixed(1)} MB`}function A0({open:o,onClose:d,defaultTab:a="maintenance"}){const[c,f]=p.useState(null),[m,h]=p.useState([]),[x,S]=p.useState("llama-swap"),[b,j]=p.useState(""),[P,L]=p.useState(!1),[F,A]=p.useState(null),[N,C]=p.useState({}),[E,D]=p.useState("maintenance"),[Z,Y]=p.useState(!1),[G,I]=p.useState(null);function $(T,O,ge){I({type:"alert",title:T,message:O,onConfirm:()=>{I(null),ge&&ge()}})}function ne(T,O,ge){I({type:"confirm",title:T,message:O,onConfirm:()=>{I(null),ge()},onCancel:()=>I(null)})}function se(T){return T?new Date(T*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[X,be]=p.useState(""),[ce,Me]=p.useState(""),[Pe,Re]=p.useState(!1),[Se,Ne]=p.useState(!1);p.useEffect(()=>{o&&(be(localStorage.getItem("mc_sudo_password")||""),Me(localStorage.getItem("mc_hf_token")||""))},[o]),p.useEffect(()=>{o&&a&&D(a)},[o,a]);const H=p.useRef(null);function ae(){fe("/api/maintenance/updates").then(f).catch(T=>console.error("Error loading updates",T))}function K(){fe("/api/jobs").then(T=>h(T.jobs||[])).catch(T=>console.error("Error loading jobs",T))}function w(T){L(!0),A(null),fe(`/api/maintenance/logs?service=${T}&lines=150`).then(O=>{O.ok?j(O.text):(j(`Fehler beim Laden der Logs: ${O.err||"Unbekannter Fehler"}`),(O.status==="incorrect_password"||O.status==="password_required")&&A(O.status))}).catch(O=>j(`Fehler: ${O.message}`)).finally(()=>{L(!1),setTimeout(()=>{H.current&&(H.current.scrollTop=H.current.scrollHeight)},50)})}p.useEffect(()=>{if(!o)return;ae(),K();const T=setInterval(()=>{K(),ae()},3e3);return()=>clearInterval(T)},[o]),p.useEffect(()=>{!o||E!=="logs"||w(x)},[o,E,x]);async function v(){try{await fe("/api/maintenance/os-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Starten des OS-Updates: ${T.message}`)}}async function V(){try{await fe("/api/maintenance/engine-update",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler beim Engine-Update: ${T.message}`)}}async function J(){Y(!0);try{await fe("/api/maintenance/check-updates",{method:"POST"}),K(),D("maintenance")}catch(T){$("Fehler",`Fehler bei der Update-Suche: ${T.message}`)}finally{Y(!1)}}async function Q(T,O){try{await fe("/api/models/install",{method:"POST",body:JSON.stringify({repo:T,role:O})}),$("Gestartet",`Modell-Upgrade für '${O}' (${T}) gestartet.`),K(),D("maintenance")}catch(ge){$("Fehler",`Fehler beim Starten des Modell-Upgrades: ${ge.message}`)}}async function oe(){ne("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await fe("/api/maintenance/reboot",{method:"POST"}),$("Reboot","Reboot ausgelöst. System startet neu...",()=>{d()})}catch(T){$("Fehler",`Fehler beim Reboot: ${T.message}`)}})}async function pe(T){C(O=>({...O,[T]:!0}));try{const O=await fe("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:T})});O.ok?$("Dienst neu gestartet",`Dienst ${T} wurde erfolgreich neu gestartet.`,()=>{E==="logs"&&x===T&&w(T)}):$("Fehler",`Fehler beim Neustart: ${O.err||"Unbekannter Fehler"}`)}catch(O){$("Fehler",`Fehler beim Neustart: ${O.message}`)}finally{C(O=>({...O,[T]:!1}))}}async function me(T){try{await fe(`/api/jobs/${T}/cancel`,{method:"POST"}),K()}catch(O){$("Fehler",`Fehler beim Abbrechen: ${O.message}`)}}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:ee("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",o?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:d}),n.jsxs("div",{className:ee("fixed inset-y-0 right-0 w-full sm:w-[500px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",o?"translate-x-0":"translate-x-full"),children:[n.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(bt,{className:"h-4.5 w-4.5 text-primary"}),n.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),n.jsx("button",{onClick:d,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:n.jsx(Gr,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[n.jsx("button",{onClick:()=>D("maintenance"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),n.jsx("button",{onClick:()=>D("logs"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),n.jsx("button",{onClick:()=>D("settings"),className:ee("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",E==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[E==="maintenance"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Wartungsaktionen"}),n.jsxs("div",{className:"flex items-center gap-2",children:[(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Zuletzt gesucht: ",se(c.last_check)]}),n.jsxs("button",{onClick:J,disabled:Z,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[n.jsx(Vr,{className:ee("h-3 w-3",Z&&"animate-spin")}),"Nach Updates suchen"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("button",{onClick:v,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(Hr,{className:"h-5 w-5 text-cyan-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"OS Update (apt)"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.os?`${c.os} Updates verfügbar`:"Auf neuestem Stand"})]}),n.jsxs("button",{onClick:V,className:"flex flex-col items-start gap-1 p-4 rounded-xl border border-border/60 bg-background/20 hover:border-primary/50 transition-all text-left group",children:[n.jsx(Nh,{className:"h-5 w-5 text-violet-400 mb-1 group-hover:scale-105 transition-transform"}),n.jsx("span",{className:"text-xs font-semibold",children:"Engine Update"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:c!=null&&c.engine?"Update verfügbar":"Auf neuestem Stand"})]})]}),n.jsxs("button",{onClick:oe,className:"flex w-full items-center gap-3 p-3 rounded-xl border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[n.jsx(af,{className:"h-4.5 w-4.5"}),n.jsxs("div",{children:[n.jsx("div",{children:"Host-System neu starten (Reboot)"}),n.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet das gesamte Betriebssystem des Homelabs neu"})]})]})]}),(c==null?void 0:c.model_list)&&c.model_list.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Verfügbare Modell-Upgrades"}),(c==null?void 0:c.last_check)&&n.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["Gesucht: ",se(c.last_check)]})]}),n.jsx("div",{className:"space-y-2",children:c.model_list.map(T=>n.jsx("div",{className:"p-3 rounded-xl border border-border/60 bg-background/20 flex flex-col gap-2",children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-semibold",children:T.title}),n.jsx("div",{className:"text-[10px] font-mono text-muted-foreground",children:T.repo}),n.jsxs("div",{className:"text-[10px] text-primary font-semibold uppercase mt-0.5",children:["Rolle: ",T.role]})]}),n.jsxs("button",{onClick:()=>Q(T.repo,T.role),className:"flex items-center gap-1.5 text-[10px] font-semibold text-emerald-400 hover:text-emerald-300 border border-emerald-500/20 bg-emerald-500/5 hover:bg-emerald-500/10 px-2 py-1 rounded-lg transition-colors shrink-0",children:[n.jsx(Wr,{className:"h-3.5 w-3.5"}),"Upgrade"]})]})},T.role))})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),n.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[m.filter(T=>T.state==="running"||T.state==="queued").length," Aktiv"]})]}),n.jsx("div",{className:"space-y-3",children:m.length===0?n.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):m.map(T=>{const O=T.state==="running"||T.state==="queued";return n.jsxs("div",{className:ee("p-3 rounded-xl border transition-all duration-300",O?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[O&&n.jsxs("span",{className:"flex h-2 w-2 relative",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),T.label]}),n.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[n.jsxs("span",{children:["ID: ",T.id]}),n.jsx("span",{children:"•"}),n.jsx("span",{className:ee(T.state==="done"&&"text-emerald-400",T.state==="failed"&&"text-red-400",T.state==="running"&&"text-primary",T.state==="queued"&&"text-amber-400",T.state==="canceled"&&"text-muted-foreground"),children:T.state})]})]}),O&&n.jsx("button",{onClick:()=>me(T.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),T.state==="running"&&n.jsxs("div",{className:"mt-3 space-y-1",children:[n.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${T.progress??0}%`}})}),n.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[n.jsxs("span",{children:[T.progress??0,"%"]}),T.done_bytes!=null&&T.total_bytes!=null&&n.jsxs("span",{children:[fi(T.done_bytes)," / ",fi(T.total_bytes),T.rate_bps!=null&&` (${fi(T.rate_bps)}/s)`]}),T.eta_s!=null&&n.jsxs("span",{children:["ETA: ",T.eta_s,"s"]})]})]})]},T.id)})})]})]}),E==="logs"&&n.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("select",{value:x,onChange:T=>S(T.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:L0.map(T=>n.jsxs("option",{value:T.id,children:[T.label," (",T.type==="system"?"systemd-root":"user",")"]},T.id))}),n.jsxs("button",{onClick:()=>pe(x),disabled:N[x],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[n.jsx(Vr,{className:ee("h-3.5 w-3.5",N[x]&&"animate-spin")}),"Restart"]})]}),n.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[n.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[n.jsx(el,{className:"h-3 w-3 text-primary"}),n.jsxs("span",{children:["stdout/stderr - ",x]})]}),n.jsx("button",{onClick:()=>w(x),disabled:P,className:"text-muted-foreground hover:text-foreground transition-colors",children:n.jsx(Vr,{className:ee("h-3 w-3",P&&"animate-spin")})})]}),n.jsx("pre",{ref:H,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:F==="password_required"||F==="incorrect_password"?n.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[n.jsx(_h,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),n.jsx("div",{className:"text-xs font-semibold text-amber-300",children:F==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),n.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",x," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),n.jsx("button",{onClick:()=>D("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):P&&!b?n.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):b||n.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),E==="settings"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),n.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(Hr,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Pe?"text":"password",value:X,onChange:T=>be(T.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>Re(!Pe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Pe?n.jsx(_u,{className:"h-4 w-4"}):n.jsx(hi,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[n.jsx(vh,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:Se?"text":"password",value:ce,onChange:T=>Me(T.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),n.jsx("button",{type:"button",onClick:()=>Ne(!Se),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?n.jsx(_u,{className:"h-4 w-4"}):n.jsx(hi,{className:"h-4 w-4"})})]}),n.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",X),localStorage.setItem("mc_hf_token",ce),$("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),n.jsx("button",{onClick:()=>{be(""),Me(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),$("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),G&&n.jsx(qr,{type:G.type,title:G.title,message:G.message,onConfirm:G.onConfirm,onCancel:G.onCancel})]})}function O0(){var F,A,N,C,E;const[o,d]=p.useState("dashboard"),[a,c]=p.useState(null),[f,m]=p.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[h,x]=p.useState(null),[S,b]=p.useState(!1),[j,P]=p.useState("maintenance");p.useEffect(()=>{const D=()=>fe("/api/health").then(c).catch(()=>c(null));D();const Z=setInterval(D,1e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{const D=()=>fe("/api/system/status").then(x).catch(()=>{});D();const Z=setInterval(D,2e4);return()=>clearInterval(Z)},[]),p.useEffect(()=>{document.documentElement.classList.add("dark")},[]),p.useEffect(()=>{const D=Z=>{var G;P(((G=Z.detail)==null?void 0:G.tab)||"maintenance"),b(!0)};return window.addEventListener("open-system-drawer",D),()=>window.removeEventListener("open-system-drawer",D)},[]);const L=vi.find(D=>D.id===o);return n.jsxs("div",{className:"flex h-full relative",children:[n.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[n.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),n.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),n.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),n.jsx(Tg,{onNavigate:d}),n.jsx(A0,{open:S,onClose:()=>b(!1),defaultTab:j}),n.jsxs("aside",{className:ee("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",f?"w-16":"w-60"),children:[n.jsxs("div",{className:ee("flex items-center py-4 border-b border-border/40 shrink-0",f?"flex-col gap-3 px-2":"justify-between px-5"),children:[n.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[n.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!f&&n.jsxs("div",{className:"leading-tight",children:[n.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),n.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),n.jsx("button",{onClick:()=>{m(D=>{const Z=!D;return localStorage.setItem("mc_sidebar_collapsed",Z.toString()),Z})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:f?"Maximieren":"Minimieren",children:f?n.jsx(ih,{className:"h-4 w-4"}):n.jsx(ah,{className:"h-4 w-4"})})]}),n.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:vi.map(D=>n.jsxs("button",{onClick:()=>d(D.id),className:ee("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",f?"justify-center p-2.5":"gap-3 px-3 py-2",o===D.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:f?D.label:void 0,children:[n.jsx(D.icon,{className:"h-4.5 w-4.5 shrink-0"}),!f&&n.jsx("span",{className:"truncate",children:D.label})]},D.id))}),n.jsx("div",{className:ee("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",f?"px-2 text-center":"px-5"),children:f?n.jsx("div",{className:"flex justify-center",children:n.jsx("span",{className:ee("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",a?a.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:a?`Engine ${a.engine_reachable?"online":"offline"}`:"Backend offline"})}):n.jsxs("div",{className:"space-y-2 text-left",children:[a?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ee("h-2 w-2 rounded-full animate-pulse",a.engine_reachable?"bg-emerald-500":"bg-amber-500")}),n.jsxs("span",{className:"truncate",children:["Engine ",a.engine_reachable?"online":"offline"]})]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",n.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&n.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[n.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:((F=h.versions.engine)==null?void 0:F.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((A=h.versions.engine)==null?void 0:A.version_text)||"unbekannt",children:[n.jsx("strong",{children:"Engine:"})," ",((N=h.versions.engine)==null?void 0:N.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((E=(C=h.versions.engine)==null?void 0:C.version_text)==null?void 0:E.split(" ").pop())||"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),n.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[n.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:L.hint}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),n.jsxs("button",{onClick:()=>{const D=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(D)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[n.jsx(ph,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:"Suchen"}),n.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[o==="dashboard"&&n.jsx(v0,{}),o==="models"&&n.jsx(C0,{}),o==="system"&&n.jsx(E0,{}),o==="connect"&&n.jsx(_0,{}),o==="memory"&&n.jsx(M0,{}),o==="agent"&&n.jsx(R0,{}),o==="guide"&&n.jsx(z0,{}),!["dashboard","models","system","connect","memory","agent","guide"].includes(o)&&n.jsx(D0,{title:L.label,hint:L.hint})]})]})]})}th.createRoot(document.getElementById("root")).render(n.jsx(tf.StrictMode,{children:n.jsx(O0,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 1d7d3c3..d27c3e5 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 4e60f9e..5641660 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "mission-control-2-frontend", "version": "2.0.0", "dependencies": { + "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "lucide-react": "^0.460.0", @@ -1810,6 +1811,32 @@ "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, + "node_modules/@tanstack/query-core": { + "version": "5.101.1", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.101.1.tgz", + "integrity": "sha512-Y6Y92dkXtNqx67m2pMSxUsA3zOCwv862JexZRP8/EPwvKXMPu9m8rv43spiXWzOUIggQ3SQApttALStzhA8B4g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.101.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.101.1.tgz", + "integrity": "sha512-ZnONUuQKJe1bJMStXUL1s5uKN9FcfC28j5cK+iDZcdSHtUv1wtin1cGc/Oewhf2Oc4eKY7lggtpvT/AbMmhHew==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.101.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", diff --git a/frontend/package.json b/frontend/package.json index 6da0a05..5587e53 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,6 +9,7 @@ "preview": "vite preview" }, "dependencies": { + "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "lucide-react": "^0.460.0", @@ -18,9 +19,9 @@ }, "devDependencies": { "@tailwindcss/vite": "^4.0.0", + "@types/node": "^22.10.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", - "@types/node": "^22.10.1", "@vitejs/plugin-react": "^4.3.4", "tailwindcss": "^4.0.0", "typescript": "^5.6.3", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 05eed36..5da0513 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -11,30 +11,17 @@ import { AgentView } from "@/views/AgentView" import { GuideView } from "@/views/GuideView" import { Placeholder } from "@/views/Placeholder" import { SystemDrawer } from "@/components/SystemDrawer" -import { api, type Health, type SystemStatus } from "@/lib/api" +import { useHealth, useSystemStatus } from "@/lib/queries" import { cn } from "@/lib/utils" export default function App() { const [view, setView] = useState("dashboard") - const [health, setHealth] = useState(null) const [sidebarCollapsed, setSidebarCollapsed] = useState(() => localStorage.getItem("mc_sidebar_collapsed") === "true") - const [sysStatus, setSysStatus] = useState(null) const [drawerOpen, setDrawerOpen] = useState(false) const [drawerTab, setDrawerTab] = useState<"maintenance" | "logs">("maintenance") - useEffect(() => { - const load = () => api("/api/health").then(setHealth).catch(() => setHealth(null)) - load() - const t = setInterval(load, 10000) - return () => clearInterval(t) - }, []) - - useEffect(() => { - const loadSys = () => api("/api/system/status").then(setSysStatus).catch(() => {}) - loadSys() - const t = setInterval(loadSys, 20000) - return () => clearInterval(t) - }, []) + const { data: health } = useHealth() + const { data: sysStatus } = useSystemStatus(20_000) useEffect(() => { document.documentElement.classList.add("dark") diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index d10682a..47fcd7d 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -243,3 +243,17 @@ export interface Health { engine_reachable: boolean gateway_reachable: boolean } + +export interface TokenStats { + prompt_tokens: number + completion_tokens: number + total_tokens: number + saved_usd: number + saved_eur: number + pricing?: Record +} + +export interface ModelsResp { + models: ModelInfo[] + running?: string[] +} diff --git a/frontend/src/lib/queries.ts b/frontend/src/lib/queries.ts new file mode 100644 index 0000000..7b221bb --- /dev/null +++ b/frontend/src/lib/queries.ts @@ -0,0 +1,96 @@ +// Zentrale Daten-Hooks (TanStack Query). Kapseln lib/api.ts und liefern Caching, +// Dedup (gleicher queryKey = eine Anfrage über alle Views), Retry und Polling. +// Mutations invalidieren gezielt die betroffenen Keys, statt manuell neu zu laden. + +import { useQuery, useQueryClient, type QueryClient } from "@tanstack/react-query" +import { + api, + type AgentStatus, + type ConnectResp, + type DiscoverResp, + type Health, + type Job, + type Memory, + type ModelsResp, + type RoutingResp, + type ServicesResp, + type SystemStatus, + type TokenStats, + type UpdatesResp, +} from "./api" + +// Zentrale Query-Keys (eine Quelle der Wahrheit für invalidate). +export const qk = { + health: ["health"] as const, + systemStatus: ["system-status"] as const, + services: ["services"] as const, + models: ["models"] as const, + routing: ["routing"] as const, + jobs: ["jobs"] as const, + tokenStats: ["token-stats"] as const, + agentStatus: ["agent-status"] as const, + updates: ["updates"] as const, + discover: ["discover"] as const, + connect: (params?: string) => ["connect", params ?? ""] as const, + memory: (q?: string, category?: string) => ["memory", q ?? "", category ?? ""] as const, +} + +export const useHealth = () => + useQuery({ queryKey: qk.health, queryFn: () => api("/api/health"), refetchInterval: 10_000 }) + +export const useSystemStatus = (refetchInterval = 5_000) => + useQuery({ queryKey: qk.systemStatus, queryFn: () => api("/api/system/status"), refetchInterval }) + +export const useServices = (refetchInterval = 3_000) => + useQuery({ queryKey: qk.services, queryFn: () => api("/api/system/services"), refetchInterval }) + +export const useModels = (refetchInterval = 4_000) => + useQuery({ queryKey: qk.models, queryFn: () => api("/api/models"), refetchInterval }) + +export const useRouting = (refetchInterval = 4_000) => + useQuery({ queryKey: qk.routing, queryFn: () => api("/api/routing"), refetchInterval }) + +export const useJobs = (refetchInterval = 2_000) => + useQuery({ + queryKey: qk.jobs, + queryFn: () => api<{ jobs: Job[] }>("/api/jobs"), + refetchInterval, + select: (d) => d.jobs ?? [], + }) + +export const useTokenStats = (refetchInterval = 3_000) => + useQuery({ queryKey: qk.tokenStats, queryFn: () => api("/api/system/token-stats"), refetchInterval }) + +export const useAgentStatus = (refetchInterval = 5_000) => + useQuery({ queryKey: qk.agentStatus, queryFn: () => api("/api/agent/status"), refetchInterval }) + +export const useUpdates = (refetchInterval?: number) => + useQuery({ queryKey: qk.updates, queryFn: () => api("/api/maintenance/updates"), refetchInterval }) + +export const useDiscover = () => + useQuery({ queryKey: qk.discover, queryFn: () => api("/api/discover") }) + +export const useConnect = (params?: string) => + useQuery({ + queryKey: qk.connect(params), + queryFn: () => api(params ? `/api/connect?${params}` : "/api/connect"), + }) + +export const useMemory = (opts?: { q?: string; category?: string; limit?: number }) => + useQuery({ + queryKey: qk.memory(opts?.q, opts?.category), + queryFn: () => { + const p = new URLSearchParams() + if (opts?.q) p.set("q", opts.q) + if (opts?.category) p.set("category", opts.category) + return api(`/api/memory?${p}`) + }, + select: (d) => (opts?.limit ? d.slice(0, opts.limit) : d), + }) + +/** Nach Mutationen die betroffenen Listen-Queries neu ziehen. */ +export function invalidate(qc: QueryClient, ...keys: readonly unknown[][]) { + for (const key of keys) qc.invalidateQueries({ queryKey: key }) +} + +export { useQueryClient } diff --git a/frontend/src/lib/useDialog.tsx b/frontend/src/lib/useDialog.tsx new file mode 100644 index 0000000..0ff05af --- /dev/null +++ b/frontend/src/lib/useDialog.tsx @@ -0,0 +1,55 @@ +// Ein Hook für Alert/Confirm/Prompt-Dialoge — ersetzt die zuvor in jeder View +// duplizierte showAlert/showConfirm-Logik + den lokalen Dialog-State. +// +// Nutzung: +// const { showAlert, showConfirm, showPrompt, dialogElement } = useDialog() +// ... +// showConfirm("Titel", "Wirklich?", () => doIt()) +// return (<>{dialogElement}...) + +import { useCallback, useState } from "react" +import { CustomDialog } from "@/components/CustomDialog" + +interface DialogState { + type: "alert" | "confirm" | "prompt" + title: string + message: string + defaultValue?: string + onConfirm: (val?: string) => void + onCancel?: () => void +} + +export function useDialog() { + const [dialog, setDialog] = useState(null) + const close = useCallback(() => setDialog(null), []) + + const showAlert = useCallback((title: string, message: string, onConfirm?: () => void) => { + setDialog({ + type: "alert", title, message, + onConfirm: () => { setDialog(null); onConfirm?.() }, + }) + }, []) + + const showConfirm = useCallback( + (title: string, message: string, onConfirm: () => void, onCancel?: () => void) => { + setDialog({ + type: "confirm", title, message, + onConfirm: () => { setDialog(null); onConfirm() }, + onCancel: () => { setDialog(null); onCancel?.() }, + }) + }, []) + + const showPrompt = useCallback( + (title: string, message: string, defaultValue: string, + onConfirm: (val?: string) => void, onCancel?: () => void) => { + setDialog({ + type: "prompt", title, message, defaultValue, + onConfirm: (val) => { setDialog(null); onConfirm(val) }, + onCancel: () => { setDialog(null); onCancel?.() }, + }) + }, []) + + const dialogElement = dialog ? : null + + return { showAlert, showConfirm, showPrompt, close, dialogElement } +} diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index d250666..5a9fa82 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -1,10 +1,24 @@ import React from "react" import ReactDOM from "react-dom/client" +import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import App from "./App" import "./index.css" +// Zentraler Daten-Layer: Caching, Dedup, Retry, Polling pro Query-Hook. +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: 1, + refetchOnWindowFocus: false, + staleTime: 5_000, + }, + }, +}) + ReactDOM.createRoot(document.getElementById("root")!).render( - + + + , ) diff --git a/frontend/src/views/AgentView.tsx b/frontend/src/views/AgentView.tsx index ceadc19..6dea947 100644 --- a/frontend/src/views/AgentView.tsx +++ b/frontend/src/views/AgentView.tsx @@ -1,8 +1,9 @@ -import { useEffect, useState, useRef, useCallback } from "react" +import { useState, useRef, useCallback, useMemo } from "react" import { Bot, ExternalLink, Activity, Cpu, Wrench, Shield, Check, X } from "lucide-react" -import { api, type AgentStatus } from "@/lib/api" +import { api } from "@/lib/api" +import { useAgentStatus, useModels, useQueryClient, qk } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" import { cn, resolveExternalUrl } from "@/lib/utils" -import { CustomDialog } from "@/components/CustomDialog" function Tile({ label, ok, detail, icon: Icon, onClick }: { label: string; ok: boolean; detail?: string; icon: any; onClick?: () => void }) { @@ -49,26 +50,21 @@ function Tile({ label, ok, detail, icon: Icon, onClick }: { label: string; ok: b } export function AgentView() { - const [s, setS] = useState(null) - const [error, setError] = useState("") + const { data: s, error: sErr } = useAgentStatus(5_000) + const { data: modelsData } = useModels() + const { showAlert, dialogElement } = useDialog() + const qc = useQueryClient() + const error = sErr ? String(sErr) : "" + + const availableModels = useMemo(() => { + const names = (modelsData?.models ?? []).map( + (m) => m.name.split("/").pop()?.replace(".gguf", "") || m.name) + return ["auto", "fast", "heavy", ...names] + }, [modelsData]) // Graph UI state const [hoveredNode, setHoveredNode] = useState(null) const [showBrainSelect, setShowBrainSelect] = useState(false) - const [availableModels, setAvailableModels] = useState([]) - - // Custom Dialog State - const [dialog, setDialog] = useState<{ - type: "alert" | "confirm" - title: string - message: string - onConfirm?: () => void - onCancel?: () => void - } | null>(null) - - function showAlert(title: string, message: string, onConfirm?: () => void) { - setDialog({ type: "alert", title, message, onConfirm }) - } // Canvas pixel tracking for pixel-perfect connection graph without non-uniform scaling const [dimensions, setDimensions] = useState({ width: 800, height: 360 }) @@ -99,19 +95,6 @@ export function AgentView() { return `M ${startX} ${startY} C ${midX} ${startY}, ${midX} ${endY}, ${endX} ${endY}` } - function loadData() { - api("/api/agent/status").then(setS).catch((e) => setError(String(e))) - } - - function loadModels() { - api<{ models: { name: string }[] }>("/api/models") - .then((res) => { - const names = res.models.map(m => m.name.split("/").pop()?.replace(".gguf", "") || m.name) - setAvailableModels(["auto", "fast", "heavy", ...names]) - }) - .catch((e) => console.error("Error loading models", e)) - } - async function changeBrainModel(model: string) { try { await api("/api/agent/brain", { @@ -119,20 +102,13 @@ export function AgentView() { body: JSON.stringify({ model }) }) showAlert("Erfolgreich", `Hermes-Gehirn wurde auf '${model}' geändert. Der Gateway-Dienst wurde neu gestartet.`) - loadData() + qc.invalidateQueries({ queryKey: qk.agentStatus }) setShowBrainSelect(false) } catch (e: any) { showAlert("Fehler", `Fehler beim Wechseln des Gehirns: ${e.message}`) } } - useEffect(() => { - loadData() - loadModels() - const t = setInterval(loadData, 5000) - return () => clearInterval(t) - }, []) - return (
{/* Styles inside AgentView for dash flow animations */} @@ -471,15 +447,7 @@ export function AgentView() {
)} - {dialog && ( - dialog.onConfirm && dialog.onConfirm()} - onCancel={dialog.onCancel} - /> - )} + {dialogElement} ) } diff --git a/frontend/src/views/ConnectView.tsx b/frontend/src/views/ConnectView.tsx index fb9f256..0645920 100644 --- a/frontend/src/views/ConnectView.tsx +++ b/frontend/src/views/ConnectView.tsx @@ -1,24 +1,18 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { Check, Copy, Terminal, Info, Globe, FolderOpen } from "lucide-react" -import { api, type ConnectResp } from "@/lib/api" +import { useConnect } from "@/lib/queries" import { cn } from "@/lib/utils" export function ConnectView() { const [host, setHost] = useState(localStorage.getItem("mc_host") || "192.168.178.151") const [mcpPath, setMcpPath] = useState(localStorage.getItem("mc_mcp_path") || "") - const [data, setData] = useState(null) const [active, setActive] = useState("cline") const [copied, setCopied] = useState(false) - const [error, setError] = useState("") - useEffect(() => { - const params = new URLSearchParams() - params.set("host", host) - if (mcpPath) params.set("mcp_path", mcpPath) - api(`/api/connect?${params}`) - .then(setData) - .catch((e) => setError(String(e))) - }, [host, mcpPath]) + const params = new URLSearchParams({ host }) + if (mcpPath) params.set("mcp_path", mcpPath) + const { data, error: dataErr } = useConnect(params.toString()) + const error = dataErr ? String(dataErr) : "" function saveHost(v: string) { setHost(v) diff --git a/frontend/src/views/MemoryView.tsx b/frontend/src/views/MemoryView.tsx index e01bf5b..4eb24d3 100644 --- a/frontend/src/views/MemoryView.tsx +++ b/frontend/src/views/MemoryView.tsx @@ -1,8 +1,9 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { Trash2, Sparkles, User, Scroll, Shield, Tag, Clock, Search, Plus, BookOpen } from "lucide-react" -import { api, type DedupeResult, type Memory } from "@/lib/api" +import { api, type DedupeResult } from "@/lib/api" +import { useMemory, useQueryClient } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" import { cn } from "@/lib/utils" -import { CustomDialog } from "@/components/CustomDialog" const CATEGORIES = ["user", "instruction", "stable", "versioned", "ephemeral"] @@ -26,73 +27,32 @@ const BORDER_CLASSES: Record = { } export function MemoryView() { - const [items, setItems] = useState([]) const [filter, setFilter] = useState("") const [q, setQ] = useState("") const [content, setContent] = useState("") const [category, setCategory] = useState("stable") - const [error, setError] = useState("") const [deduping, setDeduping] = useState(false) - // Custom Dialog State - const [dialog, setDialog] = useState<{ - type: "alert" | "confirm" - title: string - message: string - onConfirm: () => void - onCancel?: () => void - } | null>(null) + const qc = useQueryClient() + const { showAlert, showConfirm, dialogElement } = useDialog() + const { data: items = [], error: itemsErr } = useMemory({ q, category: filter }) + const error = itemsErr ? String(itemsErr) : "" - function showAlert(title: string, message: string, onConfirm?: () => void) { - setDialog({ - type: "alert", - title, - message, - onConfirm: () => { - setDialog(null) - if (onConfirm) onConfirm() - } - }) - } - - function showConfirm(title: string, message: string, onConfirm: () => void) { - setDialog({ - type: "confirm", - title, - message, - onConfirm: () => { - setDialog(null) - onConfirm() - }, - onCancel: () => setDialog(null) - }) - } - - - function load() { - const params = new URLSearchParams() - if (q) params.set("q", q) - if (filter) params.set("category", filter) - api(`/api/memory?${params}`) - .then(setItems) - .catch((e) => setError(String(e))) - } - - useEffect(load, [q, filter]) + const reloadMemory = () => qc.invalidateQueries({ queryKey: ["memory"] }) async function add() { if (!content.trim()) return - await api("/api/memory", { - method: "POST", - body: JSON.stringify({ content, category, source: "ui" }) + await api("/api/memory", { + method: "POST", + body: JSON.stringify({ content, category, source: "ui" }) }) setContent("") - load() + reloadMemory() } async function del(id: string) { await api(`/api/memory/${id}`, { method: "DELETE" }) - load() + reloadMemory() } async function cleanup() { @@ -111,11 +71,11 @@ export function MemoryView() { `${dry.duplicate_count} Dublette(n) in ${dry.groups.length} Gruppe(n) gefunden. Entfernen?`, async () => { try { - await api("/api/memory/dedupe", { - method: "POST", - body: JSON.stringify({ apply: true }) + await api("/api/memory/dedupe", { + method: "POST", + body: JSON.stringify({ apply: true }) }) - load() + reloadMemory() } catch (e: any) { showAlert("Fehler", `Fehler beim Löschen: ${e.message}`) } @@ -285,15 +245,7 @@ export function MemoryView() { )} - {dialog && ( - - )} + {dialogElement} ) } diff --git a/frontend/src/views/SystemView.tsx b/frontend/src/views/SystemView.tsx index 0e752e7..31b0be1 100644 --- a/frontend/src/views/SystemView.tsx +++ b/frontend/src/views/SystemView.tsx @@ -1,9 +1,10 @@ -import { useEffect, useState } from "react" +import { useState } from "react" import { ExternalLink, RefreshCw, Save, Cpu, HardDrive, Cpu as GpuIcon, Activity } from "lucide-react" -import { api, type ServicesResp, type SystemStatus } from "@/lib/api" +import { api } from "@/lib/api" +import { useSystemStatus, useServices } from "@/lib/queries" +import { useDialog } from "@/lib/useDialog" import { cn, resolveExternalUrl } from "@/lib/utils" import { gb } from "@/lib/format" -import { CustomDialog } from "@/components/CustomDialog" function DiagnosticBar({ label, percent, detail, icon: Icon }: { label: string; percent: number; detail?: string; icon: any }) { @@ -36,44 +37,13 @@ function DiagnosticBar({ label, percent, detail, icon: Icon }: { label: string; } export function SystemView() { - const [s, setS] = useState(null) - const [svc, setSvc] = useState(null) - const [error, setError] = useState("") + const { data: s, error: sErr } = useSystemStatus(3_000) + const { data: svc } = useServices(3_000) + const { showAlert, dialogElement } = useDialog() + const error = sErr ? String(sErr) : "" const [backupMsg, setBackupMsg] = useState("") const [restartingServices, setRestartingServices] = useState>({}) - // Custom Dialog State - const [dialog, setDialog] = useState<{ - type: "alert" | "confirm" - title: string - message: string - onConfirm: () => void - onCancel?: () => void - } | null>(null) - - function showAlert(title: string, message: string, onConfirm?: () => void) { - setDialog({ - type: "alert", - title, - message, - onConfirm: () => { - setDialog(null) - if (onConfirm) onConfirm() - } - }) - } - - function load() { - api("/api/system/status").then(setS).catch((e) => setError(String(e))) - api("/api/system/services").then(setSvc).catch(() => {}) - } - - useEffect(() => { - load() - const t = setInterval(load, 3000) - return () => clearInterval(t) - }, []) - async function doBackup() { setBackupMsg("Backup snapshotted...") try { @@ -254,15 +224,7 @@ export function SystemView() { )} - {dialog && ( - - )} + {dialogElement} ) }