From c452b873b7805ce4e51da7cb5322bc863e905373 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Thu, 9 Jul 2026 12:48:15 +0200 Subject: [PATCH] Politur: Proportionale Hit-Erkennungszone (size + 5) in nodePointerAreaPaint fuer exaktes Hovern bei skalierten Knotengroessen --- .../assets/{GraphView-CpsmWoAD.js => GraphView-CU6ClVtS.js} | 4 ++-- .../dist/assets/{index-C1WKhrF6.js => index-CqKqlxwP.js} | 2 +- frontend/dist/index.html | 2 +- frontend/src/views/GraphView.tsx | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) rename frontend/dist/assets/{GraphView-CpsmWoAD.js => GraphView-CU6ClVtS.js} (98%) rename frontend/dist/assets/{index-C1WKhrF6.js => index-CqKqlxwP.js} (99%) diff --git a/frontend/dist/assets/GraphView-CpsmWoAD.js b/frontend/dist/assets/GraphView-CU6ClVtS.js similarity index 98% rename from frontend/dist/assets/GraphView-CpsmWoAD.js rename to frontend/dist/assets/GraphView-CU6ClVtS.js index 5ab4f63..64000f3 100644 --- a/frontend/dist/assets/GraphView-CpsmWoAD.js +++ b/frontend/dist/assets/GraphView-CU6ClVtS.js @@ -1,4 +1,4 @@ -import{i as Nt,r as Y,R as Ui,c as jn,a as $n,b as Li,o as qi,m as Fn,d as Un,g as Hi,j as Rt,e as Gi}from"./index-C1WKhrF6.js";function Wi(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var Ln=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Dr(e,n,r,i,o,a){var s,u,f;return(s=Math.sqrt(e*e+n*n))&&(e/=s,n/=s),(f=e*r+n*i)&&(r-=e*f,i-=n*f),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,f/=u),e*i180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Nt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Nt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,g,_){if(l!==h||c!==d){var b=g.push(o(g)+"scale(",null,",",null,")");_.push({i:b-4,x:Nt(l,h)},{i:b-2,x:Nt(c,d)})}else(h!==1||d!==1)&&g.push(o(g)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(g){for(var _=-1,b=d.length,y;++_e.length)&&(n=e.length);for(var r=0,i=new Array(n);r180?c+=360:c-l>180&&(l+=360),d.push({i:h.push(o(h)+"rotate(",null,i)-2,x:Nt(l,c)})):c&&h.push(o(h)+"rotate("+c+i)}function u(l,c,h,d){l!==c?d.push({i:h.push(o(h)+"skewX(",null,i)-2,x:Nt(l,c)}):c&&h.push(o(h)+"skewX("+c+i)}function f(l,c,h,d,g,_){if(l!==h||c!==d){var b=g.push(o(g)+"scale(",null,",",null,")");_.push({i:b-4,x:Nt(l,h)},{i:b-2,x:Nt(c,d)})}else(h!==1||d!==1)&&g.push(o(g)+"scale("+h+","+d+")")}return function(l,c){var h=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,h,d),s(l.rotate,c.rotate,h,d),u(l.skewX,c.skewX,h,d),f(l.scaleX,l.scaleY,c.scaleX,c.scaleY,h,d),l=c=null,function(g){for(var _=-1,b=d.length,y;++_e.length)&&(n=e.length);for(var r=0,i=new Array(n);ra,methodNames:i=[],initPropNames:o=[]}={}){return Y.forwardRef((a,s)=>{const u=Y.useRef(),f=Y.useMemo(()=>{const h=Object.fromEntries(o.filter(d=>a.hasOwnProperty(d)).map(d=>[d,a[d]]));return e(h)},[]);Gn(()=>{f(r(u.current))},Y.useLayoutEffect),Gn(()=>f._destructor instanceof Function?f._destructor:void 0);const l=Y.useCallback((h,...d)=>f[h]instanceof Function?f[h](...d):void 0,[f]),c=Y.useRef({});return Object.keys(fo(a,[...i,...o])).filter(h=>c.current[h]!==a[h]).forEach(h=>l(h,a[h])),c.current=a,Y.useImperativeHandle(s,()=>Object.fromEntries(i.map(h=>[h,(...d)=>l(h,...d)])),[l]),Ui.createElement(n,{ref:u})})}function Gn(e,n=Y.useEffect){const r=Y.useRef(),i=Y.useRef(!1),o=Y.useRef(!1),[a,s]=Y.useState(0);i.current&&(o.current=!0),n(()=>(i.current||(r.current=e(),i.current=!0),s(u=>u+1),()=>{o.current&&(r.current&&r.current(),r.current=void 0,i.current=!1,o.current=!1)}),[])}var rn="http://www.w3.org/1999/xhtml";const Wn={svg:"http://www.w3.org/2000/svg",xhtml:rn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ne(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Wn.hasOwnProperty(n)?{space:Wn[n],local:e}:e}function ho(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===rn&&n.documentElement.namespaceURI===rn?n.createElement(e):n.createElementNS(r,e)}}function po(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fr(e){var n=Ne(e);return(n.local?po:ho)(n)}function go(){}function mn(e){return e==null?go:function(){return this.querySelector(e)}}function yo(e){typeof e!="function"&&(e=mn(e));for(var n=this._groups,r=n.length,i=new Array(r),o=0;o=k&&(k=v+1);!(m=y[k])&&++k<_;);x._next=m||null}}return s=new rt(s,i),s._enter=u,s._exit=f,s}function Do(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jo(){return new rt(this._exit||this._groups.map(Hr),this._parents)}function $o(e,n,r){var i=this.enter(),o=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(o=n(o),o&&(o=o.selection())),r==null?a.remove():r(a),i&&o?i.merge(o).order():o}function Fo(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,o=r.length,a=i.length,s=Math.min(o,a),u=new Array(o),f=0;f=0;)(s=i[o])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function Lo(e){e||(e=qo);function n(h,d){return h&&d?e(h.__data__,d.__data__):!h-!d}for(var r=this._groups,i=r.length,o=new Array(i),a=0;an?1:e>=n?0:NaN}function Ho(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Go(){return Array.from(this)}function Wo(){for(var e=this._groups,n=0,r=e.length;n1?this.each((n==null?na:typeof n=="function"?ia:ra)(e,n,r??"")):Lt(this.node(),e)}function Lt(e,n){return e.style.getPropertyValue(n)||Gr(e).getComputedStyle(e,null).getPropertyValue(n)}function aa(e){return function(){delete this[e]}}function sa(e,n){return function(){this[e]=n}}function ua(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function la(e,n){return arguments.length>1?this.each((n==null?aa:typeof n=="function"?ua:sa)(e,n)):this.node()[e]}function Wr(e){return e.trim().split(/^|\s+/)}function bn(e){return e.classList||new Vr(e)}function Vr(e){this._node=e,this._names=Wr(e.getAttribute("class")||"")}Vr.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Br(e,n){for(var r=bn(e),i=-1,o=n.length;++i=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function ja(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,o=n.length,a;r{}};function fe(){for(var e=0,n=arguments.length,r={},i;e=0&&(i=r.slice(o+1),r=r.slice(0,o)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}_e.prototype=fe.prototype={constructor:_e,on:function(e,n){var r=this._,i=Ba(e+"",r),o,a=-1,s=i.length;if(arguments.length<2){for(;++a0)for(var r=new Array(o),i=0,o,a;i()=>e;function on(e,{sourceEvent:n,subject:r,target:i,identifier:o,active:a,x:s,y:u,dx:f,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}on.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Za(e){return!e.ctrlKey&&!e.button}function Ka(){return this.parentNode}function Qa(e,n){return n??{x:e.x,y:e.y}}function Ja(){return navigator.maxTouchPoints||"ontouchstart"in this}function ts(){var e=Za,n=Ka,r=Qa,i=Ja,o={},a=fe("start","drag","end"),s=0,u,f,l,c,h=0;function d(x){x.on("mousedown.drag",g).filter(i).on("touchstart.drag",y).on("touchmove.drag",p,Ya).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(x,m){if(!(c||!e.call(this,x,m))){var C=k(this,n.call(this,x,m),x,m,"mouse");C&&(at(x.view).on("mousemove.drag",_,ae).on("mouseup.drag",b,ae),Kr(x.view),He(x),l=!1,u=x.clientX,f=x.clientY,C("start",x))}}function _(x){if(Ut(x),!l){var m=x.clientX-u,C=x.clientY-f;l=m*m+C*C>h}o.mouse("drag",x)}function b(x){at(x.view).on("mousemove.drag mouseup.drag",null),Qr(x.view,l),Ut(x),o.mouse("end",x)}function y(x,m){if(e.call(this,x,m)){var C=x.changedTouches,S=n.call(this,x,m),T=C.length,E,M;for(E=0;E=0&&e._call.call(void 0,n),e=e._next;--qt}function Bn(){jt=(Ce=se.now())+De,qt=Qt=0;try{ns()}finally{qt=0,is(),jt=0}}function rs(){var e=se.now(),n=e-Ce;n>Jr&&(De-=n,Ce=e)}function is(){for(var e,n=Ae,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:Ae=r);Jt=e,an(i)}function an(e){if(!qt){Qt&&(Qt=clearTimeout(Qt));var n=e-jt;n>24?(e<1/0&&(Qt=setTimeout(Bn,e-se.now()-De)),Gt&&(Gt=clearInterval(Gt))):(Gt||(Ce=se.now(),Gt=setInterval(rs,Jr)),qt=1,ti(Bn))}}function Xn(e,n,r){var i=new Se;return n=n==null?0:+n,i.restart(o=>{i.stop(),e(o+n)},n,r),i}var os=fe("start","end","cancel","interrupt"),as=[],ei=0,Yn=1,sn=2,ve=3,Zn=4,un=5,me=6;function je(e,n,r,i,o,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;ss(e,r,{name:n,index:i,group:o,on:os,tween:as,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ei})}function kn(e,n){var r=ht(e,n);if(r.state>ei)throw new Error("too late; already scheduled");return r}function vt(e,n){var r=ht(e,n);if(r.state>ve)throw new Error("too late; already running");return r}function ht(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function ss(e,n,r){var i=e.__transition,o;i[n]=r,r.timer=wn(a,0,r.time);function a(l){r.state=Yn,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var c,h,d,g;if(r.state!==Yn)return f();for(c in i)if(g=i[c],g.name===r.name){if(g.state===ve)return Xn(s);g.state===Zn?(g.state=me,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete i[c]):+csn&&i.state=0&&(n=n.slice(0,r)),!n||n==="start"})}function js(e,n,r){var i,o,a=Ds(n)?kn:vt;return function(){var s=a(this,e),u=s.on;u!==i&&(o=(i=u).copy()).on(n,r),s.on=o}}function $s(e,n){var r=this._id;return arguments.length<2?ht(this.node(),r).on.on(e):this.each(js(r,e,n))}function Fs(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function Us(){return this.on("end.remove",Fs(this._id))}function Ls(e){var n=this._name,r=this._id;typeof e!="function"&&(e=mn(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s()=>e;function hu(e,{sourceEvent:n,target:r,transform:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function St(e,n,r){this.k=e,this.x=n,this.y=r}St.prototype={constructor:St,scale:function(e){return e===1?this:new St(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new St(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Cn=new St(1,0,0);dt.prototype=St.prototype;function dt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Cn;return e.__zoom}function Ge(e){e.stopImmediatePropagation()}function Wt(e){e.preventDefault(),e.stopImmediatePropagation()}function du(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Kn(){return this.__zoom||Cn}function gu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yu(){return navigator.maxTouchPoints||"ontouchstart"in this}function _u(e,n,r){var i=e.invertX(n[0][0])-r[0][0],o=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],s=e.invertY(n[1][1])-r[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}function vu(){var e=du,n=pu,r=_u,i=gu,o=yu,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],u=250,f=Ji,l=fe("start","zoom","end"),c,h,d,g=500,_=150,b=0,y=10;function p(A){A.property("__zoom",Kn).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",M).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(A,R,P,I){var D=A.selection?A.selection():A;D.property("__zoom",Kn),A!==D?m(A,R,P,I):D.interrupt().each(function(){C(this,arguments).event(I).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},p.scaleBy=function(A,R,P,I){p.scaleTo(A,function(){var D=this.__zoom.k,F=typeof R=="function"?R.apply(this,arguments):R;return D*F},P,I)},p.scaleTo=function(A,R,P,I){p.transform(A,function(){var D=n.apply(this,arguments),F=this.__zoom,U=P==null?x(D):typeof P=="function"?P.apply(this,arguments):P,L=F.invert(U),q=typeof R=="function"?R.apply(this,arguments):R;return r(k(v(F,q),U,L),D,s)},P,I)},p.translateBy=function(A,R,P,I){p.transform(A,function(){return r(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof P=="function"?P.apply(this,arguments):P),n.apply(this,arguments),s)},null,I)},p.translateTo=function(A,R,P,I,D){p.transform(A,function(){var F=n.apply(this,arguments),U=this.__zoom,L=I==null?x(F):typeof I=="function"?I.apply(this,arguments):I;return r(Cn.translate(L[0],L[1]).scale(U.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof P=="function"?-P.apply(this,arguments):-P),F,s)},I,D)};function v(A,R){return R=Math.max(a[0],Math.min(a[1],R)),R===A.k?A:new St(R,A.x,A.y)}function k(A,R,P){var I=R[0]-P[0]*A.k,D=R[1]-P[1]*A.k;return I===A.x&&D===A.y?A:new St(A.k,I,D)}function x(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function m(A,R,P,I){A.on("start.zoom",function(){C(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(I).end()}).tween("zoom",function(){var D=this,F=arguments,U=C(D,F).event(I),L=n.apply(D,F),q=P==null?x(L):typeof P=="function"?P.apply(D,F):P,Z=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),X=D.__zoom,ut=typeof R=="function"?R.apply(D,F):R,mt=f(X.invert(q).concat(Z/X.k),ut.invert(q).concat(Z/ut.k));return function(lt){if(lt===1)lt=ut;else{var bt=mt(lt),qe=Z/bt[2];lt=new St(qe,q[0]-bt[0]*qe,q[1]-bt[1]*qe)}U.zoom(null,lt)}})}function C(A,R,P){return!P&&A.__zooming||new S(A,R)}function S(A,R){this.that=A,this.args=R,this.active=0,this.sourceEvent=null,this.extent=n.apply(A,R),this.taps=0}S.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,R){return this.mouse&&A!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var R=at(this.that).datum();l.call(A,this.that,new hu(A,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),R)}};function T(A,...R){if(!e.apply(this,arguments))return;var P=C(this,R).event(A),I=this.__zoom,D=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,i.apply(this,arguments)))),F=pt(A);if(P.wheel)(P.mouse[0][0]!==F[0]||P.mouse[0][1]!==F[1])&&(P.mouse[1]=I.invert(P.mouse[0]=F)),clearTimeout(P.wheel);else{if(I.k===D)return;P.mouse=[F,I.invert(F)],be(this),P.start()}Wt(A),P.wheel=setTimeout(U,_),P.zoom("mouse",r(k(v(I,D),P.mouse[0],P.mouse[1]),P.extent,s));function U(){P.wheel=null,P.end()}}function E(A,...R){if(d||!e.apply(this,arguments))return;var P=A.currentTarget,I=C(this,R,!0).event(A),D=at(A.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",Z,!0),F=pt(A,P),U=A.clientX,L=A.clientY;Kr(A.view),Ge(A),I.mouse=[F,this.__zoom.invert(F)],be(this),I.start();function q(X){if(Wt(X),!I.moved){var ut=X.clientX-U,mt=X.clientY-L;I.moved=ut*ut+mt*mt>b}I.event(X).zoom("mouse",r(k(I.that.__zoom,I.mouse[0]=pt(X,P),I.mouse[1]),I.extent,s))}function Z(X){D.on("mousemove.zoom mouseup.zoom",null),Qr(X.view,I.moved),Wt(X),I.event(X).end()}}function M(A,...R){if(e.apply(this,arguments)){var P=this.__zoom,I=pt(A.changedTouches?A.changedTouches[0]:A,this),D=P.invert(I),F=P.k*(A.shiftKey?.5:2),U=r(k(v(P,F),I,D),n.apply(this,R),s);Wt(A),u>0?at(this).transition().duration(u).call(m,U,I,A):at(this).call(p.transform,U,I,A)}}function z(A,...R){if(e.apply(this,arguments)){var P=A.touches,I=P.length,D=C(this,R,A.changedTouches.length===I).event(A),F,U,L,q;for(Ge(A),U=0;U=n||S<0||h&&T>=a}function p(){var C=We();if(y(C))return v(C);u=setTimeout(p,b(C))}function v(C){return u=void 0,d&&i?g(C):(i=o=void 0,s)}function k(){u!==void 0&&clearTimeout(u),l=0,i=f=o=u=void 0}function x(){return u===void 0?s:v(We())}function m(){var C=We(),S=y(C);if(i=arguments,o=this,f=C,S){if(u===void 0)return _(f);if(h)return clearTimeout(u),u=setTimeout(p,n),g(f)}return u===void 0&&(u=setTimeout(p,n)),s}return m.cancel=k,m.flush=x,m}var Gu="Expected a function";function Wu(e,n,r){var i=!0,o=!0;if(typeof e!="function")throw new TypeError(Gu);return Me(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),si(e,n,{leading:i,maxWait:n,trailing:o})}var Dt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Dt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Dt.Bounce.In(e*2)*.5:Dt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),te=function(){return performance.now()},ui=(function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,r){n===void 0&&(n=te()),r===void 0&&(r=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o1?a(e[r],e[r-1],r-i):a(e[o],e[o+1>r?r:o+1],i-o)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},li=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),fn=new ui,er=(function(){function e(n,r){r===void 0&&(r=fn),this._object=n,this._group=r,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Dt.Linear.None,this._interpolationFunction=ln.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=li.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=te()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var a in this._valuesEnd)o[a]=this._valuesEnd[a];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,o,a){for(var s in i){var u=n[s],f=Array.isArray(u),l=f?"array":typeof u,c=!f&&Array.isArray(i[s]);if(!(l==="undefined"||l==="function")){if(c){var h=i[s];if(h.length===0)continue;for(var d=[u],g=0,_=h.length;g<_;g+=1){var b=this._handleRelativeValue(u,h[g]);if(isNaN(b)){c=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(b)}c&&(i[s]=d)}if((l==="object"||f)&&u&&!c){r[s]=f?[]:{};var y=u;for(var p in y)r[s][p]=y[p];o[s]=f?[]:{};var h=i[s];if(!this._isDynamic){var v={};for(var p in h)v[p]=h[p];i[s]=h=v}this._setupProperties(y,r[s],h,o[s],a)}else(typeof r[s]>"u"||a)&&(r[s]=u),f||(r[s]*=1),c?o[s]=i[s].slice().reverse():o[s]=r[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(n){return n===void 0&&(n=te()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=te()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;ns)return!1;r&&this.start(n,!0)}if(this._goToEnd=!1,nl)return 1;var y=Math.trunc(u/f),p=u-y*f,v=Math.min(p/i._duration,1);return v===0&&u===i._duration?1:v},h=c(),d=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||u>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((u-this._duration)/f)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=f*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var _=0,b=this._chainedTweens.length;_e.length)&&(n=e.length);for(var r=0,i=Array(n);r=0,a=!r&&o&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return $(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(fl,arguments)},brighten:function(){return this._applyModification(cl,arguments)},darken:function(){return this._applyModification(hl,arguments)},desaturate:function(){return this._applyModification(sl,arguments)},saturate:function(){return this._applyModification(ul,arguments)},greyscale:function(){return this._applyModification(ll,arguments)},spin:function(){return this._applyModification(dl,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(yl,arguments)},complement:function(){return this._applyCombination(pl,arguments)},monochromatic:function(){return this._applyCombination(_l,arguments)},splitcomplement:function(){return this._applyCombination(gl,arguments)},triad:function(){return this._applyCombination(sr,[3])},tetrad:function(){return this._applyCombination(sr,[4])}};$.fromRatio=function(e,n){if(Pe(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=ee(e[i]));e=r}return $(e,n)};function nl(e){var n={r:0,g:0,b:0},r=1,i=null,o=null,a=null,s=!1,u=!1;return typeof e=="string"&&(e=wl(e)),Pe(e)=="object"&&(wt(e.r)&&wt(e.g)&&wt(e.b)?(n=rl(e.r,e.g,e.b),s=!0,u=String(e.r).substr(-1)==="%"?"prgb":"rgb"):wt(e.h)&&wt(e.s)&&wt(e.v)?(i=ee(e.s),o=ee(e.v),n=ol(e.h,i,o),s=!0,u="hsv"):wt(e.h)&&wt(e.s)&&wt(e.l)&&(i=ee(e.s),a=ee(e.l),n=il(e.h,i,a),s=!0,u="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=fi(r),{ok:s,format:e.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function rl(e,n,r){return{r:V(e,255)*255,g:V(n,255)*255,b:V(r,255)*255}}function rr(e,n,r){e=V(e,255),n=V(n,255),r=V(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=(i+o)/2;if(i==o)a=s=0;else{var f=i-o;switch(s=u>.5?f/(2-i-o):f/(i+o),i){case e:a=(n-r)/f+(n1&&(h-=1),h<1/6?l+(c-l)*6*h:h<1/2?c:h<2/3?l+(c-l)*(2/3-h)*6:l}if(n===0)i=o=a=r;else{var u=r<.5?r*(1+n):r+n-r*n,f=2*r-u;i=s(f,u,e+1/3),o=s(f,u,e),a=s(f,u,e-1/3)}return{r:i*255,g:o*255,b:a*255}}function ir(e,n,r){e=V(e,255),n=V(n,255),r=V(r,255);var i=Math.max(e,n,r),o=Math.min(e,n,r),a,s,u=i,f=i-o;if(s=i===0?0:f/i,i==o)a=0;else{switch(i){case e:a=(n-r)/f+(n>1)+720)%360;--n;)i.h=(i.h+o)%360,a.push($(i));return a}function _l(e,n){n=n||6;for(var r=$(e).toHsv(),i=r.h,o=r.s,a=r.v,s=[],u=1/n;n--;)s.push($({h:i,s:o,v:a})),a=(a+u)%1;return s}$.mix=function(e,n,r){r=r===0?0:r||50;var i=$(e).toRgb(),o=$(n).toRgb(),a=r/100,s={r:(o.r-i.r)*a+i.r,g:(o.g-i.g)*a+i.g,b:(o.b-i.b)*a+i.b,a:(o.a-i.a)*a+i.a};return $(s)};$.readability=function(e,n){var r=$(e),i=$(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};$.isReadable=function(e,n,r){var i=$.readability(e,n),o,a;switch(a=!1,o=kl(r),o.level+o.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};$.mostReadable=function(e,n,r){var i=null,o=0,a,s,u,f;r=r||{},s=r.includeFallbackColors,u=r.level,f=r.size;for(var l=0;lo&&(o=a,i=$(n[l]));return $.isReadable(e,i,{level:u,size:f})||!s?i:(r.includeFallbackColors=!1,$.mostReadable(e,["#fff","#000"],r))};var cn=$.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},vl=$.hexNames=ml(cn);function ml(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function fi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function V(e,n){bl(e)&&(e="100%");var r=xl(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function $e(e){return Math.min(1,Math.max(0,e))}function nt(e){return parseInt(e,16)}function bl(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function xl(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ct(e){return e.length==1?"0"+e:""+e}function ee(e){return e<=1&&(e=e*100+"%"),e}function ci(e){return Math.round(parseFloat(e)*255).toString(16)}function ur(e){return nt(e)/255}var ft=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function wt(e){return!!ft.CSS_UNIT.exec(e)}function wl(e){e=e.replace(tl,"").replace(el,"").toLowerCase();var n=!1;if(cn[e])e=cn[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=ft.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=ft.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ft.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=ft.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ft.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=ft.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ft.hex8.exec(e))?{r:nt(r[1]),g:nt(r[2]),b:nt(r[3]),a:ur(r[4]),format:n?"name":"hex8"}:(r=ft.hex6.exec(e))?{r:nt(r[1]),g:nt(r[2]),b:nt(r[3]),format:n?"name":"hex"}:(r=ft.hex4.exec(e))?{r:nt(r[1]+""+r[1]),g:nt(r[2]+""+r[2]),b:nt(r[3]+""+r[3]),a:ur(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=ft.hex3.exec(e))?{r:nt(r[1]+""+r[1]),g:nt(r[2]+""+r[2]),b:nt(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function kl(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function hn(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);re.length)&&(n=e.length);for(var r=0,i=Array(n);r2&&arguments[2]!==void 0?arguments[2]:{},a=o.nodeFilter,s=a===void 0?function(){return!0}:a,u=o.onLoopError,f=u===void 0?function(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:u,l={};r.forEach(function(g){return l[n(g)]={data:g,out:[],depth:-1,skip:!s(g)}}),i.forEach(function(g){var _=g.source,b=g.target,y=x(_),p=x(b);if(!l.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!l.hasOwnProperty(p))throw"Missing target node with id: ".concat(p);var v=l[y],k=l[p];v.out.push(k);function x(m){return vn(m)==="object"?n(m):m}});var c=[];d(Object.values(l));var h=Object.assign.apply(Object,[{}].concat(st(Object.entries(l).filter(function(g){var _=oe(g,2),b=_[1];return!b.skip}).map(function(g){var _=oe(g,2),b=_[0],y=_[1];return ue({},b,y.depth)}))));return h;function d(g){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=g[p];if(_.indexOf(x)!==-1){var m=[].concat(st(_.slice(_.indexOf(x))),[x]).map(function(C){return n(C.data)});return c.some(function(C){return C.length===m.length&&C.every(function(S,T){return S===m[T]})})||(c.push(m),f(m)),1}b>x.depth&&(x.depth=b,d(x.out,[].concat(st(_),[x]),b+(x.skip?0:1)))},p=0,v=g.length;pn.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()0){var N=Math.atan2(M.y-E.y,M.x-E.x),j=z*T,A={x:(E.x+M.x)/2+j*Math.cos(N-Math.PI/2),y:(E.y+M.y)/2+j*Math.sin(N-Math.PI/2)};S.__controlPoints=[A.x,A.y]}else{var R=T*70;S.__controlPoints=[M.x,M.y-R,M.x+R,M.y]}}}}function a(){var u=1.6,f=.2,l=H(n.linkDirectionalArrowLength),c=H(n.linkDirectionalArrowRelPos),h=H(n.linkVisibility),d=H(n.linkDirectionalArrowColor||n.linkColor),g=H(n.nodeVal),_=n.ctx;_.save(),n.graphData.links.filter(h).forEach(function(b){var y=l(b);if(!(!y||y<0)){var p=b.source,v=b.target;if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var k=Math.sqrt(Math.max(0,g(p)||1))*n.nodeRelSize,x=Math.sqrt(Math.max(0,g(v)||1))*n.nodeRelSize,m=Math.min(1,Math.max(0,c(b))),C=d(b)||"rgba(0,0,0,0.28)",S=y/u/2,T=b.__controlPoints&&Tr(W,[p.x,p.y].concat(st(b.__controlPoints),[v.x,v.y])),E=T?function(P){return T.get(P)}:function(P){return{x:p.x+(v.x-p.x)*P||0,y:p.y+(v.y-p.y)*P||0}},M=T?T.length():Math.sqrt(Math.pow(v.x-p.x,2)+Math.pow(v.y-p.y,2)),z=k+y+(M-k-x-y)*m,N=E(z/M),j=E((z-y)/M),A=E((z-y*(1-f))/M),R=Math.atan2(N.y-j.y,N.x-j.x)-Math.PI/2;_.beginPath(),_.moveTo(N.x,N.y),_.lineTo(j.x+S*Math.cos(R),j.y+S*Math.sin(R)),_.lineTo(A.x,A.y),_.lineTo(j.x-S*Math.cos(R),j.y-S*Math.sin(R)),_.fillStyle=C,_.fill()}}}),_.restore()}function s(){var u=H(n.linkDirectionalParticles),f=H(n.linkDirectionalParticleSpeed),l=H(n.linkDirectionalParticleOffset),c=H(n.linkDirectionalParticleWidth),h=H(n.linkVisibility),d=H(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(h).forEach(function(_){var b=u(_);if(!(!_.hasOwnProperty("__photons")||!_.__photons.length)){var y=_.source,p=_.target;if(!(!y||!p||!y.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var v=f(_),k=Math.abs(l(_)),x=_.__photons||[],m=Math.max(0,c(_)/2)/Math.sqrt(n.globalScale),C=d(_)||"rgba(0,0,0,0.28)";g.fillStyle=C;var S=_.__controlPoints?Tr(W,[y.x,y.y].concat(st(_.__controlPoints),[p.x,p.y])):null,T=0,E=!1;x.forEach(function(M){var z=!!M.__singleHop;if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=z?v<0?1:0:(T+k)/b),!z&&T++,M.__progressRatio+=v,M.__progressRatio>=1||M.__progressRatio<0)if(!z)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{E=!0;return}var N=M.__progressRatio,j=S?S.get(N):{x:y.x+(p.x-y.x)*N||0,y:y.y+(p.y-y.y)*N||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(j.x,j.y,_,g,n.globalScale):(g.beginPath(),g.arc(j.x,j.y,m,0,2*Math.PI,!1),g.fill())}),E&&(_.__photons=_.__photons.filter(function(M){return!M.__singleHop||M.__progressRatio<=1&&M.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:pc().force("link",ac()).force("charge",gc()).force("center",uf()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Pr(n.graphData.nodes,H(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Pr(n.graphData.links,H(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&Zc(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,st(Object.values(o||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Kc*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var f=["rl","bu"].includes(n.dagMode),l=function(g){return(o[g[n.nodeId]]-a/2)*s*(f?-1:1)},c=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[c]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?yc(function(d){var g=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-g:g)*s}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var h=0;h0&&n.forceLayout.alpha()1?u-1:0),l=1;l1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,a=new Array(o>3?o-3:0),s=3;s1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=H(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(s){return{x:s.x,y:s.y,r:o(s)}});return a.length?{x:[Fn(a,function(s){return s.x-s.r}),Un(a,function(s){return s.x+s.r})],y:[Fn(a,function(s){return s.y-s.r}),Un(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},rh),stateInit:function(){return{lastSetZoom:1,zoom:vu(),forceGraph:new Ie,shadowGraph:new Ie().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new $l,tweenGroup:new ui}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),s=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},f=function(){var h=null,d=window.devicePixelRatio,g=u.x>0&&u.y>0?s.getImageData(u.x*d,u.y*d,1,1):null;return g&&(h=r.colorTracker.lookup(g.data)),h};at(r.canvas).call(ts().subject(function(){if(!r.enableNodeDrag)return null;var c=f();return c&&c.type==="Node"?c.d:null}).on("start",function(c){var h=c.subject;h.__initialDragPos={x:h.x,y:h.y,fx:h.fx,fy:h.fy},c.active||(h.fx=h.x,h.fy=h.y),r.canvas.classList.add("grabbable")}).on("drag",function(c){var h=c.subject,d=h.__initialDragPos,g=c,_=dt(r.canvas).k,b={x:d.x+(g.x-d.x)/_-h.x,y:d.y+(g.y-d.y)/_-h.y};["x","y"].forEach(function(y){return h["f".concat(y)]=h[y]=d[y]+(g[y]-d[y])/_}),!(!h.__dragged&&th>=Math.sqrt(Wi(["x","y"].map(function(y){return Math.pow(c[y]-d[y],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,h.__dragged=!0,r.onNodeDrag(h,b))}).on("end",function(c){var h=c.subject,d=h.__initialDragPos,g={x:h.x-d.x,y:h.y-d.y};d.fx===void 0&&(h.fx=void 0),d.fy===void 0&&(h.fy=void 0),delete h.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,h.__dragged&&(delete h.__dragged,r.onNodeDragEnd(h,g))})),r.zoom(r.zoom.__baseElem=at(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(c){return!c.button&&r.enableZoomPanInteraction&&(c.type!=="wheel"||H(r.enableZoomInteraction)(c))&&(c.type==="wheel"||H(r.enablePanInteraction)(c))}).on("zoom",function(c){var h=c.transform;[a,s].forEach(function(d){$i(d),d.translate(h.x,h.y),d.scale(h.k,h.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Ft(Ft({},h),i.centerAt())),r.needsRedraw=!0}).on("end",function(c){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Ft(Ft({},c.transform),i.centerAt()))}),Ze(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){dt(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=Jc/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new sf(o),["pointermove","pointerdown"].forEach(function(c){return o.addEventListener(c,function(h){c==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=h),!r.isPointerDragging&&h.type==="pointermove"&&r.onBackgroundClick&&(h.pressure>0||r.isPointerPressed)&&(h.pointerType==="mouse"||h.movementX===void 0||[h.movementX,h.movementY].some(function(_){return Math.abs(_)>1}))&&(r.isPointerDragging=!0);var d=g(o);u.x=h.pageX-d.left,u.y=h.pageY-d.top;function g(_){var b=_.getBoundingClientRect(),y=window.pageXOffset||document.documentElement.scrollLeft,p=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+p,left:b.left+y}}},{passive:!0})}),o.addEventListener("pointerup",function(c){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var h=[c,r.pointerDownEvent];requestAnimationFrame(function(){if(c.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,h);if(c.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,h)})}},{passive:!0}),o.addEventListener("contextmenu",function(c){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(c.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var l=Wu(function(){Er(s,r.width,r.height),r.shadowGraph.linkWidth(function(h){return H(r.linkWidth)(h)+r.linkHoverPrecision});var c=dt(r.canvas);r.shadowGraph.globalScale(c.k).tickFrame()},Qc);r.flushShadowCanvas=l.flush,(this._animationCycle=function c(){var h=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(k){return k.__photons&&k.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:f();if(d!==r.hoverObj){var g=r.hoverObj,_=g?g.type:null,b=d?d.type:null;if(_&&_!==b){var y=r["on".concat(_,"Hover")];y&&y(null,g.d)}if(b){var p=r["on".concat(b,"Hover")];p&&p(d.d,_===b?g.d:null)}r.tooltip.content(d&&H(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(b,"Click")]||!d&&r.onBackgroundClick)&&H(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}h&&l()}if(h){Er(a,r.width,r.height);var v=dt(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,v),r.forceGraph.globalScale(v).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,v)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(c)})()},update:function(n){}}),Ke={exports:{}},Qe,zr;function oh(){if(zr)return Qe;zr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Qe=e,Qe}var Je,Rr;function ah(){if(Rr)return Je;Rr=1;var e=oh();function n(){}function r(){}return r.resetWarningCache=n,Je=function(){function i(s,u,f,l,c,h){if(h!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}i.isRequired=i;function o(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},Je}var Ir;function sh(){return Ir||(Ir=1,Ke.exports=ah()()),Ke.exports}var uh=sh();const w=Hi(uh),Le={width:w.number,height:w.number,graphData:w.shape({nodes:w.arrayOf(w.object).isRequired,links:w.arrayOf(w.object).isRequired}),backgroundColor:w.string,nodeRelSize:w.number,nodeId:w.string,nodeLabel:w.oneOfType([w.string,w.func]),nodeVal:w.oneOfType([w.number,w.string,w.func]),nodeVisibility:w.oneOfType([w.bool,w.string,w.func]),nodeColor:w.oneOfType([w.string,w.func]),nodeAutoColorBy:w.oneOfType([w.string,w.func]),onNodeHover:w.func,onNodeClick:w.func,linkSource:w.string,linkTarget:w.string,linkLabel:w.oneOfType([w.string,w.func]),linkVisibility:w.oneOfType([w.bool,w.string,w.func]),linkColor:w.oneOfType([w.string,w.func]),linkAutoColorBy:w.oneOfType([w.string,w.func]),linkWidth:w.oneOfType([w.number,w.string,w.func]),linkCurvature:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowLength:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowColor:w.oneOfType([w.string,w.func]),linkDirectionalArrowRelPos:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticles:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleSpeed:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleOffset:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleWidth:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleColor:w.oneOfType([w.string,w.func]),onLinkHover:w.func,onLinkClick:w.func,dagMode:w.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:w.number,dagNodeFilter:w.func,onDagError:w.func,d3AlphaMin:w.number,d3AlphaDecay:w.number,d3VelocityDecay:w.number,warmupTicks:w.number,cooldownTicks:w.number,cooldownTime:w.number,onEngineTick:w.func,onEngineStop:w.func,getGraphBbox:w.func},Fi={zoomToFit:w.func,onNodeRightClick:w.func,onNodeDrag:w.func,onNodeDragEnd:w.func,onLinkRightClick:w.func,linkHoverPrecision:w.number,onBackgroundClick:w.func,onBackgroundRightClick:w.func,showPointerCursor:w.oneOfType([w.bool,w.func]),enablePointerInteraction:w.bool,enableNodeDrag:w.bool},Nn={showNavInfo:w.bool,nodeOpacity:w.number,nodeResolution:w.number,nodeThreeObject:w.oneOfType([w.object,w.string,w.func]),nodeThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),nodePositionUpdate:w.func,linkOpacity:w.number,linkResolution:w.number,linkCurveRotation:w.oneOfType([w.number,w.string,w.func]),linkMaterial:w.oneOfType([w.object,w.string,w.func]),linkThreeObject:w.oneOfType([w.object,w.string,w.func]),linkThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),linkPositionUpdate:w.func,linkDirectionalArrowResolution:w.number,linkDirectionalParticleResolution:w.number,linkDirectionalParticleThreeObject:w.oneOfType([w.object,w.string,w.func]),forceEngine:w.oneOf(["d3","ngraph"]),ngraphPhysics:w.object,numDimensions:w.oneOf([1,2,3])},lh=Object.assign({},Le,Fi,{linkLineDash:w.oneOfType([w.arrayOf(w.number),w.string,w.func]),nodeCanvasObjectMode:w.oneOfType([w.string,w.func]),nodeCanvasObject:w.func,nodePointerAreaPaint:w.func,linkCanvasObjectMode:w.oneOfType([w.string,w.func]),linkCanvasObject:w.func,linkPointerAreaPaint:w.func,linkDirectionalParticleCanvasObject:w.func,autoPauseRedraw:w.bool,minZoom:w.number,maxZoom:w.number,enableZoomInteraction:w.oneOfType([w.bool,w.func]),enablePanInteraction:w.oneOfType([w.bool,w.func]),onZoom:w.func,onZoomEnd:w.func,onRenderFramePre:w.func,onRenderFramePost:w.func});Object.assign({},Le,Fi,Nn,{enableNavigationControls:w.bool,controlType:w.oneOf(["trackball","orbit","fly"]),rendererConfig:w.object,extraRenderers:w.arrayOf(w.shape({render:w.func.isRequired}))});Object.assign({},Le,Nn,{nodeDesc:w.oneOfType([w.string,w.func]),linkDesc:w.oneOfType([w.string,w.func])});Object.assign({},Le,Nn,{markerAttrs:w.object,yOffset:w.number,glScale:w.number});const Dn=co(ih,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Dn.displayName="ForceGraph2D";Dn.propTypes=lh;function yt(e){return function(){return e}}function Nr(e){return(e()-.5)*1e-6}function fh(e){return e.x+e.vx}function ch(e){return e.y+e.vy}function hh(e){var n,r,i,o=1,a=1;typeof e!="function"&&(e=yt(e==null?1:+e));function s(){for(var l,c=n.length,h,d,g,_,b,y,p=0;pd.index){var z=g-T.x-T.vx,N=_-T.y-T.vy,j=z*z+N*N;jg+M||C_+M||S<_-M}}function u(l){if(l.data)return l.r=r[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function f(){if(n){var l,c=n.length,h;for(r=new Array(c),l=0;l{if(!a.current)return;const y=new ResizeObserver(p=>{for(let v of p)v.contentRect.width>0&&v.contentRect.height>0&&f({width:Math.floor(v.contentRect.width),height:Math.floor(v.contentRect.height)})});return y.observe(a.current),()=>y.disconnect()},[]);const l=Y.useMemo(()=>({nodes:e.nodes.map(y=>({...y})),links:e.edges.map(y=>({source:y.source,target:y.target,weight:y.weight||0}))}),[e]),c=Y.useMemo(()=>{const y={};return e.edges.forEach(p=>{const v=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;v&&k&&(y[v]=(y[v]||0)+1,y[k]=(y[k]||0)+1)}),y},[e]),h=y=>({identity:-240,knowledge:240,rules:-240,events:240})[y]||0,d=y=>({identity:-240,knowledge:-240,rules:240,events:240})[y]||0;Y.useEffect(()=>{const y=s.current;if(!y)return;y.d3Force("center",null),y.d3Force("x",dh().x(k=>h(k.category)).strength(.07)),y.d3Force("y",ph().y(k=>d(k.category)).strength(.07));const p=y.d3Force("charge");p&&p.strength(-380),y.d3Force("collide",hh().radius(28).iterations(2));const v=y.d3Force("link");v&&v.distance(85),y.d3ReheatSimulation()},[l]);const g=i||n,_=()=>{s.current&&s.current.zoomToFit(400,40)},b=Y.useMemo(()=>{if(!g)return new Set;const y=new Set;return e.edges.forEach(p=>{const v=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;v===g&&y.add(k),k===g&&y.add(v)}),y},[g,e]);return Rt.jsxs("div",{className:"absolute inset-0",ref:a,style:{background:"radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, #030712 100%)"},children:[Rt.jsx(Dn,{ref:s,width:u.width,height:u.height,graphData:l,backgroundColor:"rgba(0,0,0,0)",cooldownTicks:120,nodePointerAreaPaint:(y,p,v)=>{v.fillStyle=p,v.beginPath(),v.arc(y.x??0,y.y??0,16,0,2*Math.PI,!1),v.fill()},onNodeClick:y=>r(y.id),onBackgroundClick:()=>r(null),onNodeHover:y=>{o(y?y.id:null),a.current&&(a.current.style.cursor=y?"pointer":"default")},linkColor:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;if(g===p||g===v)return yh;if(g)return _h;const k=l.nodes.find(m=>m.id===p),x=k?tn[k.category]:"#64748b";return vh(x,.25)},linkWidth:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;return g===p||g===v?2.5:1.4},linkDirectionalParticles:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;return g===p||g===v?4:0},linkDirectionalParticleWidth:2.2,linkDirectionalParticleSpeed:.006,nodeCanvasObject:(y,p,v)=>{const k=y.x??0,x=y.y??0,m=6+Math.min(c[y.id]||0,15)*.8,C=tn[y.category]||"#64748b",S=y.id===i,T=y.id===n,E=g&&y.id!==g&&!b.has(y.id),M=E?"#1e293b":C;if(E||(p.shadowColor=C,p.shadowBlur=S||T?15:6),p.beginPath(),p.arc(k,x,m,0,2*Math.PI,!1),p.fillStyle=M,p.fill(),p.shadowBlur=0,(S||T)&&(p.beginPath(),p.arc(k,x,m+2.5,0,2*Math.PI,!1),p.strokeStyle=T?"#ffffff":"rgba(255, 255, 255, 0.7)",p.lineWidth=1.5,p.stroke()),S||T||v>=1.25||g&&b.has(y.id)){const N=y.content.length>35?y.content.slice(0,34)+"…":y.content;if(y.__baseTextWidth===void 0){const q=p.font;p.font='500 10px "Space Grotesk", sans-serif',y.__baseTextWidth=p.measureText(N).width,p.font=q}const A=(S||T?10.5:9.5)/Math.max(.5,v);p.font=`${S||T?"bold":"500"} ${A}px "Space Grotesk", sans-serif`;const R=y.__baseTextWidth*(A/10),P=4.5/Math.max(.5,v);p.fillStyle=E?"rgba(10, 15, 25, 0.45)":"rgba(8, 12, 20, 0.88)",p.beginPath();const I=k-R/2-P,D=x+m+6/Math.max(.5,v),F=R+P*2,U=A+P*1.6,L=4/Math.max(.5,v);p.beginPath(),p.moveTo(I+L,D),p.lineTo(I+F-L,D),p.quadraticCurveTo(I+F,D,I+F,D+L),p.lineTo(I+F,D+U-L),p.quadraticCurveTo(I+F,D+U,I+F-L,D+U),p.lineTo(I+L,D+U),p.quadraticCurveTo(I,D+U,I,D+U-L),p.lineTo(I,D+L),p.quadraticCurveTo(I,D,I+L,D),p.closePath(),p.fill(),p.strokeStyle=S||T?"rgba(255, 255, 255, 0.2)":"rgba(255, 255, 255, 0.08)",p.lineWidth=.6/Math.max(.5,v),p.stroke(),p.textAlign="center",p.textBaseline="top",p.fillStyle=E?"#475569":S||T?"#ffffff":"#cbd5e1",p.fillText(N,k,x+m+7/Math.max(.5,v))}}}),Rt.jsxs("button",{onClick:_,title:"Zentrieren",className:"absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded-lg border border-border/60 bg-background/50 px-2.5 py-1.5 text-[11px] text-muted-foreground hover:text-foreground backdrop-blur-sm transition-colors cursor-pointer",children:[Rt.jsx(Gi,{className:"h-3.5 w-3.5"})," Zentrieren"]}),Rt.jsx("div",{className:"absolute left-3 bottom-3 flex flex-wrap gap-2 rounded-lg bg-background/40 px-2.5 py-1.5 backdrop-blur-sm",children:Object.entries(gh).map(([y,p])=>Rt.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[Rt.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:tn[y]}}),p]},y))})]})}export{bh as GraphView}; +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mr(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function Ft(e){for(var n=1;n2&&arguments[2]!==void 0?arguments[2]:{},a=o.nodeFilter,s=a===void 0?function(){return!0}:a,u=o.onLoopError,f=u===void 0?function(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:u,l={};r.forEach(function(g){return l[n(g)]={data:g,out:[],depth:-1,skip:!s(g)}}),i.forEach(function(g){var _=g.source,b=g.target,y=x(_),p=x(b);if(!l.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!l.hasOwnProperty(p))throw"Missing target node with id: ".concat(p);var v=l[y],k=l[p];v.out.push(k);function x(m){return vn(m)==="object"?n(m):m}});var c=[];d(Object.values(l));var h=Object.assign.apply(Object,[{}].concat(st(Object.entries(l).filter(function(g){var _=oe(g,2),b=_[1];return!b.skip}).map(function(g){var _=oe(g,2),b=_[0],y=_[1];return ue({},b,y.depth)}))));return h;function d(g){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=g[p];if(_.indexOf(x)!==-1){var m=[].concat(st(_.slice(_.indexOf(x))),[x]).map(function(C){return n(C.data)});return c.some(function(C){return C.length===m.length&&C.every(function(S,T){return S===m[T]})})||(c.push(m),f(m)),1}b>x.depth&&(x.depth=b,d(x.out,[].concat(st(_),[x]),b+(x.skip?0:1)))},p=0,v=g.length;pn.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()0){var N=Math.atan2(M.y-E.y,M.x-E.x),j=z*T,A={x:(E.x+M.x)/2+j*Math.cos(N-Math.PI/2),y:(E.y+M.y)/2+j*Math.sin(N-Math.PI/2)};S.__controlPoints=[A.x,A.y]}else{var R=T*70;S.__controlPoints=[M.x,M.y-R,M.x+R,M.y]}}}}function a(){var u=1.6,f=.2,l=H(n.linkDirectionalArrowLength),c=H(n.linkDirectionalArrowRelPos),h=H(n.linkVisibility),d=H(n.linkDirectionalArrowColor||n.linkColor),g=H(n.nodeVal),_=n.ctx;_.save(),n.graphData.links.filter(h).forEach(function(b){var y=l(b);if(!(!y||y<0)){var p=b.source,v=b.target;if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var k=Math.sqrt(Math.max(0,g(p)||1))*n.nodeRelSize,x=Math.sqrt(Math.max(0,g(v)||1))*n.nodeRelSize,m=Math.min(1,Math.max(0,c(b))),C=d(b)||"rgba(0,0,0,0.28)",S=y/u/2,T=b.__controlPoints&&Tr(W,[p.x,p.y].concat(st(b.__controlPoints),[v.x,v.y])),E=T?function(P){return T.get(P)}:function(P){return{x:p.x+(v.x-p.x)*P||0,y:p.y+(v.y-p.y)*P||0}},M=T?T.length():Math.sqrt(Math.pow(v.x-p.x,2)+Math.pow(v.y-p.y,2)),z=k+y+(M-k-x-y)*m,N=E(z/M),j=E((z-y)/M),A=E((z-y*(1-f))/M),R=Math.atan2(N.y-j.y,N.x-j.x)-Math.PI/2;_.beginPath(),_.moveTo(N.x,N.y),_.lineTo(j.x+S*Math.cos(R),j.y+S*Math.sin(R)),_.lineTo(A.x,A.y),_.lineTo(j.x-S*Math.cos(R),j.y-S*Math.sin(R)),_.fillStyle=C,_.fill()}}}),_.restore()}function s(){var u=H(n.linkDirectionalParticles),f=H(n.linkDirectionalParticleSpeed),l=H(n.linkDirectionalParticleOffset),c=H(n.linkDirectionalParticleWidth),h=H(n.linkVisibility),d=H(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(h).forEach(function(_){var b=u(_);if(!(!_.hasOwnProperty("__photons")||!_.__photons.length)){var y=_.source,p=_.target;if(!(!y||!p||!y.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var v=f(_),k=Math.abs(l(_)),x=_.__photons||[],m=Math.max(0,c(_)/2)/Math.sqrt(n.globalScale),C=d(_)||"rgba(0,0,0,0.28)";g.fillStyle=C;var S=_.__controlPoints?Tr(W,[y.x,y.y].concat(st(_.__controlPoints),[p.x,p.y])):null,T=0,E=!1;x.forEach(function(M){var z=!!M.__singleHop;if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=z?v<0?1:0:(T+k)/b),!z&&T++,M.__progressRatio+=v,M.__progressRatio>=1||M.__progressRatio<0)if(!z)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{E=!0;return}var N=M.__progressRatio,j=S?S.get(N):{x:y.x+(p.x-y.x)*N||0,y:y.y+(p.y-y.y)*N||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(j.x,j.y,_,g,n.globalScale):(g.beginPath(),g.arc(j.x,j.y,m,0,2*Math.PI,!1),g.fill())}),E&&(_.__photons=_.__photons.filter(function(M){return!M.__singleHop||M.__progressRatio<=1&&M.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:pc().force("link",ac()).force("charge",gc()).force("center",uf()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Pr(n.graphData.nodes,H(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Pr(n.graphData.links,H(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(d){d.source=d[n.linkSource],d.target=d[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(d){return d[n.nodeId]}).links(n.graphData.links);var o=n.dagMode&&Zc(n.graphData,function(d){return d[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,st(Object.values(o||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Kc*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var u=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return delete d[u]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var f=["rl","bu"].includes(n.dagMode),l=function(g){return(o[g[n.nodeId]]-a/2)*s*(f?-1:1)},c=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(d){return d[c]=l(d)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?yc(function(d){var g=o[d[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-g:g)*s}).strength(function(d){return n.dagNodeFilter(d)?1:0}):null);for(var h=0;h0&&n.forceLayout.alpha()1?u-1:0),l=1;l1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,a=new Array(o>3?o-3:0),s=3;s1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=H(n.nodeVal),o=function(u){return Math.sqrt(Math.max(0,i(u)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(s){return{x:s.x,y:s.y,r:o(s)}});return a.length?{x:[Fn(a,function(s){return s.x-s.r}),Un(a,function(s){return s.x+s.r})],y:[Fn(a,function(s){return s.y-s.r}),Un(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},rh),stateInit:function(){return{lastSetZoom:1,zoom:vu(),forceGraph:new Ie,shadowGraph:new Ie().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new $l,tweenGroup:new ui}},init:function(n,r){var i=this;n.innerHTML="";var o=document.createElement("div");o.classList.add("force-graph-container"),o.style.position="relative",n.appendChild(o),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),o.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),s=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),u={x:-1e12,y:-1e12},f=function(){var h=null,d=window.devicePixelRatio,g=u.x>0&&u.y>0?s.getImageData(u.x*d,u.y*d,1,1):null;return g&&(h=r.colorTracker.lookup(g.data)),h};at(r.canvas).call(ts().subject(function(){if(!r.enableNodeDrag)return null;var c=f();return c&&c.type==="Node"?c.d:null}).on("start",function(c){var h=c.subject;h.__initialDragPos={x:h.x,y:h.y,fx:h.fx,fy:h.fy},c.active||(h.fx=h.x,h.fy=h.y),r.canvas.classList.add("grabbable")}).on("drag",function(c){var h=c.subject,d=h.__initialDragPos,g=c,_=dt(r.canvas).k,b={x:d.x+(g.x-d.x)/_-h.x,y:d.y+(g.y-d.y)/_-h.y};["x","y"].forEach(function(y){return h["f".concat(y)]=h[y]=d[y]+(g[y]-d[y])/_}),!(!h.__dragged&&th>=Math.sqrt(Wi(["x","y"].map(function(y){return Math.pow(c[y]-d[y],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,h.__dragged=!0,r.onNodeDrag(h,b))}).on("end",function(c){var h=c.subject,d=h.__initialDragPos,g={x:h.x-d.x,y:h.y-d.y};d.fx===void 0&&(h.fx=void 0),d.fy===void 0&&(h.fy=void 0),delete h.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,h.__dragged&&(delete h.__dragged,r.onNodeDragEnd(h,g))})),r.zoom(r.zoom.__baseElem=at(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(c){return!c.button&&r.enableZoomPanInteraction&&(c.type!=="wheel"||H(r.enableZoomInteraction)(c))&&(c.type==="wheel"||H(r.enablePanInteraction)(c))}).on("zoom",function(c){var h=c.transform;[a,s].forEach(function(d){$i(d),d.translate(h.x,h.y),d.scale(h.k,h.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Ft(Ft({},h),i.centerAt())),r.needsRedraw=!0}).on("end",function(c){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Ft(Ft({},c.transform),i.centerAt()))}),Ze(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){dt(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=Jc/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new sf(o),["pointermove","pointerdown"].forEach(function(c){return o.addEventListener(c,function(h){c==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=h),!r.isPointerDragging&&h.type==="pointermove"&&r.onBackgroundClick&&(h.pressure>0||r.isPointerPressed)&&(h.pointerType==="mouse"||h.movementX===void 0||[h.movementX,h.movementY].some(function(_){return Math.abs(_)>1}))&&(r.isPointerDragging=!0);var d=g(o);u.x=h.pageX-d.left,u.y=h.pageY-d.top;function g(_){var b=_.getBoundingClientRect(),y=window.pageXOffset||document.documentElement.scrollLeft,p=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+p,left:b.left+y}}},{passive:!0})}),o.addEventListener("pointerup",function(c){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var h=[c,r.pointerDownEvent];requestAnimationFrame(function(){if(c.button===0)if(r.hoverObj){var d=r["on".concat(r.hoverObj.type,"Click")];d&&d.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,h);if(c.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(h))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,h)})}},{passive:!0}),o.addEventListener("contextmenu",function(c){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(c.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var l=Wu(function(){Er(s,r.width,r.height),r.shadowGraph.linkWidth(function(h){return H(r.linkWidth)(h)+r.linkHoverPrecision});var c=dt(r.canvas);r.shadowGraph.globalScale(c.k).tickFrame()},Qc);r.flushShadowCanvas=l.flush,(this._animationCycle=function c(){var h=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(k){return k.__photons&&k.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var d=r.isPointerDragging?null:f();if(d!==r.hoverObj){var g=r.hoverObj,_=g?g.type:null,b=d?d.type:null;if(_&&_!==b){var y=r["on".concat(_,"Hover")];y&&y(null,g.d)}if(b){var p=r["on".concat(b,"Hover")];p&&p(d.d,_===b?g.d:null)}r.tooltip.content(d&&H(r["".concat(d.type.toLowerCase(),"Label")])(d.d)||null),r.canvas.classList[(d&&r["on".concat(b,"Click")]||!d&&r.onBackgroundClick)&&H(r.showPointerCursor)(d==null?void 0:d.d)?"add":"remove"]("clickable"),r.hoverObj=d}h&&l()}if(h){Er(a,r.width,r.height);var v=dt(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,v),r.forceGraph.globalScale(v).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,v)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(c)})()},update:function(n){}}),Ke={exports:{}},Qe,zr;function oh(){if(zr)return Qe;zr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Qe=e,Qe}var Je,Rr;function ah(){if(Rr)return Je;Rr=1;var e=oh();function n(){}function r(){}return r.resetWarningCache=n,Je=function(){function i(s,u,f,l,c,h){if(h!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}i.isRequired=i;function o(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},Je}var Ir;function sh(){return Ir||(Ir=1,Ke.exports=ah()()),Ke.exports}var uh=sh();const w=Hi(uh),Le={width:w.number,height:w.number,graphData:w.shape({nodes:w.arrayOf(w.object).isRequired,links:w.arrayOf(w.object).isRequired}),backgroundColor:w.string,nodeRelSize:w.number,nodeId:w.string,nodeLabel:w.oneOfType([w.string,w.func]),nodeVal:w.oneOfType([w.number,w.string,w.func]),nodeVisibility:w.oneOfType([w.bool,w.string,w.func]),nodeColor:w.oneOfType([w.string,w.func]),nodeAutoColorBy:w.oneOfType([w.string,w.func]),onNodeHover:w.func,onNodeClick:w.func,linkSource:w.string,linkTarget:w.string,linkLabel:w.oneOfType([w.string,w.func]),linkVisibility:w.oneOfType([w.bool,w.string,w.func]),linkColor:w.oneOfType([w.string,w.func]),linkAutoColorBy:w.oneOfType([w.string,w.func]),linkWidth:w.oneOfType([w.number,w.string,w.func]),linkCurvature:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowLength:w.oneOfType([w.number,w.string,w.func]),linkDirectionalArrowColor:w.oneOfType([w.string,w.func]),linkDirectionalArrowRelPos:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticles:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleSpeed:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleOffset:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleWidth:w.oneOfType([w.number,w.string,w.func]),linkDirectionalParticleColor:w.oneOfType([w.string,w.func]),onLinkHover:w.func,onLinkClick:w.func,dagMode:w.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:w.number,dagNodeFilter:w.func,onDagError:w.func,d3AlphaMin:w.number,d3AlphaDecay:w.number,d3VelocityDecay:w.number,warmupTicks:w.number,cooldownTicks:w.number,cooldownTime:w.number,onEngineTick:w.func,onEngineStop:w.func,getGraphBbox:w.func},Fi={zoomToFit:w.func,onNodeRightClick:w.func,onNodeDrag:w.func,onNodeDragEnd:w.func,onLinkRightClick:w.func,linkHoverPrecision:w.number,onBackgroundClick:w.func,onBackgroundRightClick:w.func,showPointerCursor:w.oneOfType([w.bool,w.func]),enablePointerInteraction:w.bool,enableNodeDrag:w.bool},Nn={showNavInfo:w.bool,nodeOpacity:w.number,nodeResolution:w.number,nodeThreeObject:w.oneOfType([w.object,w.string,w.func]),nodeThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),nodePositionUpdate:w.func,linkOpacity:w.number,linkResolution:w.number,linkCurveRotation:w.oneOfType([w.number,w.string,w.func]),linkMaterial:w.oneOfType([w.object,w.string,w.func]),linkThreeObject:w.oneOfType([w.object,w.string,w.func]),linkThreeObjectExtend:w.oneOfType([w.bool,w.string,w.func]),linkPositionUpdate:w.func,linkDirectionalArrowResolution:w.number,linkDirectionalParticleResolution:w.number,linkDirectionalParticleThreeObject:w.oneOfType([w.object,w.string,w.func]),forceEngine:w.oneOf(["d3","ngraph"]),ngraphPhysics:w.object,numDimensions:w.oneOf([1,2,3])},lh=Object.assign({},Le,Fi,{linkLineDash:w.oneOfType([w.arrayOf(w.number),w.string,w.func]),nodeCanvasObjectMode:w.oneOfType([w.string,w.func]),nodeCanvasObject:w.func,nodePointerAreaPaint:w.func,linkCanvasObjectMode:w.oneOfType([w.string,w.func]),linkCanvasObject:w.func,linkPointerAreaPaint:w.func,linkDirectionalParticleCanvasObject:w.func,autoPauseRedraw:w.bool,minZoom:w.number,maxZoom:w.number,enableZoomInteraction:w.oneOfType([w.bool,w.func]),enablePanInteraction:w.oneOfType([w.bool,w.func]),onZoom:w.func,onZoomEnd:w.func,onRenderFramePre:w.func,onRenderFramePost:w.func});Object.assign({},Le,Fi,Nn,{enableNavigationControls:w.bool,controlType:w.oneOf(["trackball","orbit","fly"]),rendererConfig:w.object,extraRenderers:w.arrayOf(w.shape({render:w.func.isRequired}))});Object.assign({},Le,Nn,{nodeDesc:w.oneOfType([w.string,w.func]),linkDesc:w.oneOfType([w.string,w.func])});Object.assign({},Le,Nn,{markerAttrs:w.object,yOffset:w.number,glScale:w.number});const Dn=co(ih,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Dn.displayName="ForceGraph2D";Dn.propTypes=lh;function yt(e){return function(){return e}}function Nr(e){return(e()-.5)*1e-6}function fh(e){return e.x+e.vx}function ch(e){return e.y+e.vy}function hh(e){var n,r,i,o=1,a=1;typeof e!="function"&&(e=yt(e==null?1:+e));function s(){for(var l,c=n.length,h,d,g,_,b,y,p=0;pd.index){var z=g-T.x-T.vx,N=_-T.y-T.vy,j=z*z+N*N;jg+M||C_+M||S<_-M}}function u(l){if(l.data)return l.r=r[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function f(){if(n){var l,c=n.length,h;for(r=new Array(c),l=0;l{if(!a.current)return;const y=new ResizeObserver(p=>{for(let v of p)v.contentRect.width>0&&v.contentRect.height>0&&f({width:Math.floor(v.contentRect.width),height:Math.floor(v.contentRect.height)})});return y.observe(a.current),()=>y.disconnect()},[]);const l=Y.useMemo(()=>({nodes:e.nodes.map(y=>({...y})),links:e.edges.map(y=>({source:y.source,target:y.target,weight:y.weight||0}))}),[e]),c=Y.useMemo(()=>{const y={};return e.edges.forEach(p=>{const v=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;v&&k&&(y[v]=(y[v]||0)+1,y[k]=(y[k]||0)+1)}),y},[e]),h=y=>({identity:-240,knowledge:240,rules:-240,events:240})[y]||0,d=y=>({identity:-240,knowledge:-240,rules:240,events:240})[y]||0;Y.useEffect(()=>{const y=s.current;if(!y)return;y.d3Force("center",null),y.d3Force("x",dh().x(k=>h(k.category)).strength(.07)),y.d3Force("y",ph().y(k=>d(k.category)).strength(.07));const p=y.d3Force("charge");p&&p.strength(-380),y.d3Force("collide",hh().radius(28).iterations(2));const v=y.d3Force("link");v&&v.distance(85),y.d3ReheatSimulation()},[l]);const g=i||n,_=()=>{s.current&&s.current.zoomToFit(400,40)},b=Y.useMemo(()=>{if(!g)return new Set;const y=new Set;return e.edges.forEach(p=>{const v=typeof p.source=="object"?p.source.id:p.source,k=typeof p.target=="object"?p.target.id:p.target;v===g&&y.add(k),k===g&&y.add(v)}),y},[g,e]);return Rt.jsxs("div",{className:"absolute inset-0",ref:a,style:{background:"radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, #030712 100%)"},children:[Rt.jsx(Dn,{ref:s,width:u.width,height:u.height,graphData:l,backgroundColor:"rgba(0,0,0,0)",cooldownTicks:120,nodePointerAreaPaint:(y,p,v)=>{v.fillStyle=p,v.beginPath();const k=typeof y=="object"?y.id:y,x=6+Math.min(c[k]||0,15)*.8;v.arc(y.x??0,y.y??0,x+5,0,2*Math.PI,!1),v.fill()},onNodeClick:y=>r(y.id),onBackgroundClick:()=>r(null),onNodeHover:y=>{o(y?y.id:null),a.current&&(a.current.style.cursor=y?"pointer":"default")},linkColor:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;if(g===p||g===v)return yh;if(g)return _h;const k=l.nodes.find(m=>m.id===p),x=k?tn[k.category]:"#64748b";return vh(x,.25)},linkWidth:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;return g===p||g===v?2.5:1.4},linkDirectionalParticles:y=>{const p=typeof y.source=="object"?y.source.id:y.source,v=typeof y.target=="object"?y.target.id:y.target;return g===p||g===v?4:0},linkDirectionalParticleWidth:2.2,linkDirectionalParticleSpeed:.006,nodeCanvasObject:(y,p,v)=>{const k=y.x??0,x=y.y??0,m=6+Math.min(c[y.id]||0,15)*.8,C=tn[y.category]||"#64748b",S=y.id===i,T=y.id===n,E=g&&y.id!==g&&!b.has(y.id),M=E?"#1e293b":C;if(E||(p.shadowColor=C,p.shadowBlur=S||T?15:6),p.beginPath(),p.arc(k,x,m,0,2*Math.PI,!1),p.fillStyle=M,p.fill(),p.shadowBlur=0,(S||T)&&(p.beginPath(),p.arc(k,x,m+2.5,0,2*Math.PI,!1),p.strokeStyle=T?"#ffffff":"rgba(255, 255, 255, 0.7)",p.lineWidth=1.5,p.stroke()),S||T||v>=1.25||g&&b.has(y.id)){const N=y.content.length>35?y.content.slice(0,34)+"…":y.content;if(y.__baseTextWidth===void 0){const q=p.font;p.font='500 10px "Space Grotesk", sans-serif',y.__baseTextWidth=p.measureText(N).width,p.font=q}const A=(S||T?10.5:9.5)/Math.max(.5,v);p.font=`${S||T?"bold":"500"} ${A}px "Space Grotesk", sans-serif`;const R=y.__baseTextWidth*(A/10),P=4.5/Math.max(.5,v);p.fillStyle=E?"rgba(10, 15, 25, 0.45)":"rgba(8, 12, 20, 0.88)",p.beginPath();const I=k-R/2-P,D=x+m+6/Math.max(.5,v),F=R+P*2,U=A+P*1.6,L=4/Math.max(.5,v);p.beginPath(),p.moveTo(I+L,D),p.lineTo(I+F-L,D),p.quadraticCurveTo(I+F,D,I+F,D+L),p.lineTo(I+F,D+U-L),p.quadraticCurveTo(I+F,D+U,I+F-L,D+U),p.lineTo(I+L,D+U),p.quadraticCurveTo(I,D+U,I,D+U-L),p.lineTo(I,D+L),p.quadraticCurveTo(I,D,I+L,D),p.closePath(),p.fill(),p.strokeStyle=S||T?"rgba(255, 255, 255, 0.2)":"rgba(255, 255, 255, 0.08)",p.lineWidth=.6/Math.max(.5,v),p.stroke(),p.textAlign="center",p.textBaseline="top",p.fillStyle=E?"#475569":S||T?"#ffffff":"#cbd5e1",p.fillText(N,k,x+m+7/Math.max(.5,v))}}}),Rt.jsxs("button",{onClick:_,title:"Zentrieren",className:"absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded-lg border border-border/60 bg-background/50 px-2.5 py-1.5 text-[11px] text-muted-foreground hover:text-foreground backdrop-blur-sm transition-colors cursor-pointer",children:[Rt.jsx(Gi,{className:"h-3.5 w-3.5"})," Zentrieren"]}),Rt.jsx("div",{className:"absolute left-3 bottom-3 flex flex-wrap gap-2 rounded-lg bg-background/40 px-2.5 py-1.5 backdrop-blur-sm",children:Object.entries(gh).map(([y,p])=>Rt.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[Rt.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:tn[y]}}),p]},y))})]})}export{bh as GraphView}; diff --git a/frontend/dist/assets/index-C1WKhrF6.js b/frontend/dist/assets/index-CqKqlxwP.js similarity index 99% rename from frontend/dist/assets/index-C1WKhrF6.js rename to frontend/dist/assets/index-CqKqlxwP.js index 3f27427..c152dcb 100644 --- a/frontend/dist/assets/index-C1WKhrF6.js +++ b/frontend/dist/assets/index-CqKqlxwP.js @@ -649,7 +649,7 @@ Error generating stack: `+j.message+` .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},eD=0,as=[];function tD(e){var t=x.useRef([]),r=x.useRef([0,0]),n=x.useRef(),i=x.useState(eD++)[0],o=x.useState(P5)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=kT([e.lockRef.current],(e.shards||[]).map(tk),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!c.current.allowPinchZoom;var N=Id(w),E=r.current,C="deltaX"in w?w.deltaX:E[0]-N[0],A="deltaY"in w?w.deltaY:E[1]-N[1],_,O=w.target,T=Math.abs(C)>Math.abs(A)?"h":"v";if("touches"in w&&T==="h"&&O.type==="range")return!1;var F=window.getSelection(),B=F&&F.anchorNode,$=B?B===O||B.contains(O):!1;if($)return!1;var q=Jw(T,O);if(!q)return!0;if(q?_=T:(_=T==="v"?"h":"v",q=Jw(T,O)),!q)return!1;if(!n.current&&"changedTouches"in w&&(C||A)&&(n.current=_),!_)return!0;var W=n.current||_;return ZT(W,k,w,W==="h"?C:A)},[]),f=x.useCallback(function(w){var k=w;if(!(!as.length||as[as.length-1]!==o)){var N="deltaY"in k?ek(k):Id(k),E=t.current.filter(function(_){return _.name===k.type&&(_.target===k.target||k.target===_.shadowParent)&&XT(_.delta,N)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var C=(c.current.shards||[]).map(tk).filter(Boolean).filter(function(_){return _.contains(k.target)}),A=C.length>0?u(k,C[0]):!c.current.noIsolation;A&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,N,E){var C={name:w,delta:k,target:N,should:E,shadowParent:rD(N)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(A){return A!==C})},1)},[]),m=x.useCallback(function(w){r.current=Id(w),n.current=void 0},[]),p=x.useCallback(function(w){h(w.type,ek(w),w.target,u(w,e.lockRef.current))},[]),v=x.useCallback(function(w){h(w.type,Id(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return as.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",f,is),document.addEventListener("touchmove",f,is),document.addEventListener("touchstart",m,is),function(){as=as.filter(function(w){return w!==o}),document.removeEventListener("wheel",f,is),document.removeEventListener("touchmove",f,is),document.removeEventListener("touchstart",m,is)}},[]);var b=e.removeScrollBar,S=e.inert;return x.createElement(x.Fragment,null,S?x.createElement(o,{styles:JT(i)}):null,b?x.createElement(HT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nD=_T(C5,tD);var I5=x.forwardRef(function(e,t){return x.createElement(xh,zn({},e,{ref:t,sideCar:nD}))});I5.classNames=xh.classNames;var iD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},os=new WeakMap,Td=new WeakMap,Dd={},mg=0,T5=function(e){return e&&(e.host||T5(e.parentNode))},aD=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=T5(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},oD=function(e,t,r,n){var i=aD(t,Array.isArray(e)?e:[e]);Dd[r]||(Dd[r]=new WeakMap);var o=Dd[r],c=[],u=new Set,f=new Set(i),h=function(p){!p||u.has(p)||(u.add(p),h(p.parentNode))};i.forEach(h);var m=function(p){!p||f.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))m(v);else try{var b=v.getAttribute(n),S=b!==null&&b!=="false",w=(os.get(v)||0)+1,k=(o.get(v)||0)+1;os.set(v,w),o.set(v,k),c.push(v),w===1&&S&&Td.set(v,!0),k===1&&v.setAttribute(r,"true"),S||v.setAttribute(n,"true")}catch(N){console.error("aria-hidden: cannot operate on ",v,N)}})};return m(t),u.clear(),mg++,function(){c.forEach(function(p){var v=os.get(p)-1,b=o.get(p)-1;os.set(p,v),o.set(p,b),v||(Td.has(p)||p.removeAttribute(n),Td.delete(p)),b||p.removeAttribute(r)}),mg--,mg||(os=new WeakMap,os=new WeakMap,Td=new WeakMap,Dd={})}},sD=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=iD(e);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),oD(n,i,r,"aria-hidden")):function(){return null}},yh="Dialog",[D5]=DI(yh),[lD,Sn]=D5(yh),L5=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:c=!0}=e,u=x.useRef(null),f=x.useRef(null),[h,m]=FI({prop:n,defaultProp:i??!1,onChange:o,caller:yh});return s.jsx(lD,{scope:t,triggerRef:u,contentRef:f,contentId:gi(),titleId:gi(),descriptionId:gi(),open:h,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(p=>!p),[m]),modal:c,children:r})};L5.displayName=yh;var R5="DialogTrigger",cD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(R5,r),o=Ao(t,i.triggerRef);return s.jsx(Jt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Bx(i.open),...n,ref:o,onClick:xa(e.onClick,i.onOpenToggle)})});cD.displayName=R5;var Fx="DialogPortal",[uD,$5]=D5(Fx,{forceMount:void 0}),z5=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=Sn(Fx,t);return s.jsx(uD,{scope:t,forceMount:r,children:x.Children.map(n,c=>s.jsx(vh,{present:r||o.open,children:s.jsx(N5,{asChild:!0,container:i,children:c})}))})};z5.displayName=Fx;var mf="DialogOverlay",F5=x.forwardRef((e,t)=>{const r=$5(mf,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Sn(mf,e.__scopeDialog);return o.modal?s.jsx(vh,{present:n||o.open,children:s.jsx(fD,{...i,ref:t})}):null});F5.displayName=mf;var dD=b5("DialogOverlay.RemoveScroll"),fD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(mf,r),o=oT(),c=Ao(t,o);return s.jsx(I5,{as:dD,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(Jt.div,{"data-state":Bx(i.open),...n,ref:c,style:{pointerEvents:"auto",...n.style}})})}),Hs="DialogContent",B5=x.forwardRef((e,t)=>{const r=$5(Hs,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Sn(Hs,e.__scopeDialog);return s.jsx(vh,{present:n||o.open,children:o.modal?s.jsx(hD,{...i,ref:t}):s.jsx(mD,{...i,ref:t})})});B5.displayName=Hs;var hD=x.forwardRef((e,t)=>{const r=Sn(Hs,e.__scopeDialog),n=x.useRef(null),i=Ao(t,r.contentRef,n);return x.useEffect(()=>{const o=n.current;if(o)return sD(o)},[]),s.jsx(U5,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:xa(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:xa(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&o.preventDefault()}),onFocusOutside:xa(e.onFocusOutside,o=>o.preventDefault())})}),mD=x.forwardRef((e,t)=>{const r=Sn(Hs,e.__scopeDialog),n=x.useRef(!1),i=x.useRef(!1);return s.jsx(U5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(n.current||(u=r.triggerRef.current)==null||u.focus(),o.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:o=>{var f,h;(f=e.onInteractOutside)==null||f.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=o.target;((h=r.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),U5=x.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...c}=e,u=Sn(Hs,r);return wT(),s.jsx(s.Fragment,{children:s.jsx(j5,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o,children:s.jsx(w5,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Bx(u.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})}),W5="DialogTitle",pD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(W5,r);return s.jsx(Jt.h2,{id:i.titleId,...n,ref:t})});pD.displayName=W5;var H5="DialogDescription",gD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(H5,r);return s.jsx(Jt.p,{id:i.descriptionId,...n,ref:t})});gD.displayName=H5;var K5="DialogClose",vD=x.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Sn(K5,r);return s.jsx(Jt.button,{type:"button",...n,ref:t,onClick:xa(e.onClick,()=>i.onOpenChange(!1))})});vD.displayName=K5;function Bx(e){return e?"open":"closed"}var nc='[cmdk-group=""]',pg='[cmdk-group-items=""]',xD='[cmdk-group-heading=""]',G5='[cmdk-item=""]',rk=`${G5}:not([aria-disabled="true"])`,kv="cmdk-item-select",vs="data-value",yD=(e,t,r)=>TI(e,t,r),V5=x.createContext(void 0),ru=()=>x.useContext(V5),q5=x.createContext(void 0),Ux=()=>x.useContext(q5),Q5=x.createContext(void 0),Y5=x.forwardRef((e,t)=>{let r=xs(()=>{var M,Q;return{search:"",value:(Q=(M=e.value)!=null?M:e.defaultValue)!=null?Q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=xs(()=>new Set),i=xs(()=>new Map),o=xs(()=>new Map),c=xs(()=>new Set),u=Z5(e),{label:f,children:h,value:m,onValueChange:p,filter:v,shouldFilter:b,loop:S,disablePointerSelection:w=!1,vimBindings:k=!0,...N}=e,E=gi(),C=gi(),A=gi(),_=x.useRef(null),O=OD();xo(()=>{if(m!==void 0){let M=m.trim();r.current.value=M,T.emit()}},[m]),xo(()=>{O(6,ve)},[]);let T=x.useMemo(()=>({subscribe:M=>(c.current.add(M),()=>c.current.delete(M)),snapshot:()=>r.current,setState:(M,Q,ne)=>{var ae,ee,se,me;if(!Object.is(r.current[M],Q)){if(r.current[M]=Q,M==="search")W(),$(),O(1,q);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let U=document.getElementById(A);U?U.focus():(ae=document.getElementById(E))==null||ae.focus()}if(O(7,()=>{var U;r.current.selectedItemId=(U=de())==null?void 0:U.id,T.emit()}),ne||O(5,ve),((ee=u.current)==null?void 0:ee.value)!==void 0){let U=Q??"";(me=(se=u.current).onValueChange)==null||me.call(se,U);return}}T.emit()}},emit:()=>{c.current.forEach(M=>M())}}),[]),F=x.useMemo(()=>({value:(M,Q,ne)=>{var ae;Q!==((ae=o.current.get(M))==null?void 0:ae.value)&&(o.current.set(M,{value:Q,keywords:ne}),r.current.filtered.items.set(M,B(Q,ne)),O(2,()=>{$(),T.emit()}))},item:(M,Q)=>(n.current.add(M),Q&&(i.current.has(Q)?i.current.get(Q).add(M):i.current.set(Q,new Set([M]))),O(3,()=>{W(),$(),r.current.value||q(),T.emit()}),()=>{o.current.delete(M),n.current.delete(M),r.current.filtered.items.delete(M);let ne=de();O(4,()=>{W(),(ne==null?void 0:ne.getAttribute("id"))===M&&q(),T.emit()})}),group:M=>(i.current.has(M)||i.current.set(M,new Set),()=>{o.current.delete(M),i.current.delete(M)}),filter:()=>u.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:E,inputId:A,labelId:C,listInnerRef:_}),[]);function B(M,Q){var ne,ae;let ee=(ae=(ne=u.current)==null?void 0:ne.filter)!=null?ae:yD;return M?ee(M,r.current.search,Q):0}function $(){if(!r.current.search||u.current.shouldFilter===!1)return;let M=r.current.filtered.items,Q=[];r.current.filtered.groups.forEach(ae=>{let ee=i.current.get(ae),se=0;ee.forEach(me=>{let U=M.get(me);se=Math.max(U,se)}),Q.push([ae,se])});let ne=_.current;ge().sort((ae,ee)=>{var se,me;let U=ae.getAttribute("id"),ue=ee.getAttribute("id");return((se=M.get(ue))!=null?se:0)-((me=M.get(U))!=null?me:0)}).forEach(ae=>{let ee=ae.closest(pg);ee?ee.appendChild(ae.parentElement===ee?ae:ae.closest(`${pg} > *`)):ne.appendChild(ae.parentElement===ne?ae:ae.closest(`${pg} > *`))}),Q.sort((ae,ee)=>ee[1]-ae[1]).forEach(ae=>{var ee;let se=(ee=_.current)==null?void 0:ee.querySelector(`${nc}[${vs}="${encodeURIComponent(ae[0])}"]`);se==null||se.parentElement.appendChild(se)})}function q(){let M=ge().find(ne=>ne.getAttribute("aria-disabled")!=="true"),Q=M==null?void 0:M.getAttribute(vs);T.setState("value",Q||void 0)}function W(){var M,Q,ne,ae;if(!r.current.search||u.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ee=0;for(let se of n.current){let me=(Q=(M=o.current.get(se))==null?void 0:M.value)!=null?Q:"",U=(ae=(ne=o.current.get(se))==null?void 0:ne.keywords)!=null?ae:[],ue=B(me,U);r.current.filtered.items.set(se,ue),ue>0&&ee++}for(let[se,me]of i.current)for(let U of me)if(r.current.filtered.items.get(U)>0){r.current.filtered.groups.add(se);break}r.current.filtered.count=ee}function ve(){var M,Q,ne;let ae=de();ae&&(((M=ae.parentElement)==null?void 0:M.firstChild)===ae&&((ne=(Q=ae.closest(nc))==null?void 0:Q.querySelector(xD))==null||ne.scrollIntoView({block:"nearest"})),ae.scrollIntoView({block:"nearest"}))}function de(){var M;return(M=_.current)==null?void 0:M.querySelector(`${G5}[aria-selected="true"]`)}function ge(){var M;return Array.from(((M=_.current)==null?void 0:M.querySelectorAll(rk))||[])}function le(M){let Q=ge()[M];Q&&T.setState("value",Q.getAttribute(vs))}function ie(M){var Q;let ne=de(),ae=ge(),ee=ae.findIndex(me=>me===ne),se=ae[ee+M];(Q=u.current)!=null&&Q.loop&&(se=ee+M<0?ae[ae.length-1]:ee+M===ae.length?ae[0]:ae[ee+M]),se&&T.setState("value",se.getAttribute(vs))}function X(M){let Q=de(),ne=Q==null?void 0:Q.closest(nc),ae;for(;ne&&!ae;)ne=M>0?CD(ne,nc):PD(ne,nc),ae=ne==null?void 0:ne.querySelector(rk);ae?T.setState("value",ae.getAttribute(vs)):ie(M)}let te=()=>le(ge().length-1),re=M=>{M.preventDefault(),M.metaKey?te():M.altKey?X(1):ie(1)},D=M=>{M.preventDefault(),M.metaKey?le(0):M.altKey?X(-1):ie(-1)};return x.createElement(Jt.div,{ref:t,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:M=>{var Q;(Q=N.onKeyDown)==null||Q.call(N,M);let ne=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||ne))switch(M.key){case"n":case"j":{k&&M.ctrlKey&&re(M);break}case"ArrowDown":{re(M);break}case"p":case"k":{k&&M.ctrlKey&&D(M);break}case"ArrowUp":{D(M);break}case"Home":{M.preventDefault(),le(0);break}case"End":{M.preventDefault(),te();break}case"Enter":{M.preventDefault();let ae=de();if(ae){let ee=new Event(kv);ae.dispatchEvent(ee)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:MD},f),bh(e,M=>x.createElement(q5.Provider,{value:T},x.createElement(V5.Provider,{value:F},M))))}),bD=x.forwardRef((e,t)=>{var r,n;let i=gi(),o=x.useRef(null),c=x.useContext(Q5),u=ru(),f=Z5(e),h=(n=(r=f.current)==null?void 0:r.forceMount)!=null?n:c==null?void 0:c.forceMount;xo(()=>{if(!h)return u.item(i,c==null?void 0:c.id)},[h]);let m=X5(i,o,[e.value,e.children,o],e.keywords),p=Ux(),v=ka(O=>O.value&&O.value===m.current),b=ka(O=>h||u.filter()===!1?!0:O.search?O.filtered.items.get(i)>0:!0);x.useEffect(()=>{let O=o.current;if(!(!O||e.disabled))return O.addEventListener(kv,S),()=>O.removeEventListener(kv,S)},[b,e.onSelect,e.disabled]);function S(){var O,T;w(),(T=(O=f.current).onSelect)==null||T.call(O,m.current)}function w(){p.setState("value",m.current,!0)}if(!b)return null;let{disabled:k,value:N,onSelect:E,forceMount:C,keywords:A,..._}=e;return x.createElement(Jt.div,{ref:Ws(o,t),..._,id:i,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!v,"data-disabled":!!k,"data-selected":!!v,onPointerMove:k||u.getDisablePointerSelection()?void 0:w,onClick:k?void 0:S},e.children)}),wD=x.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:i,...o}=e,c=gi(),u=x.useRef(null),f=x.useRef(null),h=gi(),m=ru(),p=ka(b=>i||m.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);xo(()=>m.group(c),[]),X5(c,u,[e.value,e.heading,f]);let v=x.useMemo(()=>({id:c,forceMount:i}),[i]);return x.createElement(Jt.div,{ref:Ws(u,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&x.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),bh(e,b=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},x.createElement(Q5.Provider,{value:v},b))))}),kD=x.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,i=x.useRef(null),o=ka(c=>!c.search);return!r&&!o?null:x.createElement(Jt.div,{ref:Ws(i,t),...n,"cmdk-separator":"",role:"separator"})}),jD=x.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,i=e.value!=null,o=Ux(),c=ka(h=>h.search),u=ka(h=>h.selectedItemId),f=ru();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Jt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":u,id:f.inputId,type:"text",value:i?e.value:c,onChange:h=>{i||o.setState("search",h.target.value),r==null||r(h.target.value)}})}),SD=x.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...i}=e,o=x.useRef(null),c=x.useRef(null),u=ka(h=>h.selectedItemId),f=ru();return x.useEffect(()=>{if(c.current&&o.current){let h=c.current,m=o.current,p,v=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let b=h.offsetHeight;m.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return v.observe(h),()=>{cancelAnimationFrame(p),v.unobserve(h)}}},[]),x.createElement(Jt.div,{ref:Ws(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":u,"aria-label":n,id:f.listId},bh(e,h=>x.createElement("div",{ref:Ws(c,f.listInnerRef),"cmdk-list-sizer":""},h)))}),ND=x.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:i,contentClassName:o,container:c,...u}=e;return x.createElement(L5,{open:r,onOpenChange:n},x.createElement(z5,{container:c},x.createElement(F5,{"cmdk-overlay":"",className:i}),x.createElement(B5,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Y5,{ref:t,...u}))))}),ED=x.forwardRef((e,t)=>ka(r=>r.filtered.count===0)?x.createElement(Jt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),AD=x.forwardRef((e,t)=>{let{progress:r,children:n,label:i="Loading...",...o}=e;return x.createElement(Jt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},bh(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),ss=Object.assign(Y5,{List:SD,Item:bD,Input:jD,Group:wD,Separator:kD,Dialog:ND,Empty:ED,Loading:AD});function CD(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function PD(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Z5(e){let t=x.useRef(e);return xo(()=>{t.current=e}),t}var xo=typeof window>"u"?x.useEffect:x.useLayoutEffect;function xs(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function ka(e){let t=Ux(),r=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,r,r)}function X5(e,t,r,n=[]){let i=x.useRef(),o=ru();return xo(()=>{var c;let u=(()=>{var h;for(let m of r){if(typeof m=="string")return m.trim();if(typeof m=="object"&&"current"in m)return m.current?(h=m.current.textContent)==null?void 0:h.trim():i.current}})(),f=n.map(h=>h.trim());o.value(e,u,f),(c=t.current)==null||c.setAttribute(vs,u),i.current=u}),i}var OD=()=>{let[e,t]=x.useState(),r=xs(()=>new Map);return xo(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,i)=>{r.current.set(n,i),t({})}};function _D(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function bh({asChild:e,children:t},r){return e&&x.isValidElement(t)?x.cloneElement(_D(t),{ref:t.ref},r(t.props.children)):r(t)}var MD={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function ID({onNavigate:e}){const[t,r]=x.useState(!1);return x.useEffect(()=>{const n=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),r(o=>!o))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),s.jsx(ss.Dialog,{open:t,onOpenChange:r,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh] overscroll-contain",onClick:()=>r(!1),children:s.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:n=>n.stopPropagation(),children:[s.jsx(ss.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"}),s.jsxs(ss.List,{className:"max-h-80 overflow-y-auto p-2",children:[s.jsx(ss.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),s.jsx(ss.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:gs.map(n=>s.jsxs(ss.Item,{value:`${n.label} ${n.hint}`,onSelect:()=>{e(n.id),r(!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:[s.jsx(n.icon,{className:"h-4 w-4 text-primary"}),s.jsx("span",{children:n.label}),s.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:n.hint})]},n.id))})]})]})})}const J5="mc_expert_mode",jv="mc-expert-mode-change",TD=()=>{try{return localStorage.getItem(J5)==="true"}catch{return!1}};function DD(e){return window.addEventListener(jv,e),window.addEventListener("storage",e),()=>{window.removeEventListener(jv,e),window.removeEventListener("storage",e)}}function nk(e){localStorage.setItem(J5,String(e)),window.dispatchEvent(new Event(jv))}function Wx(){return x.useSyncExternalStore(DD,TD,()=>!1)}function eE(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=$D(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:c=>{const u=c.split(Hx);return u[0]===""&&u.length!==1&&u.shift(),tE(u,t)||RD(c)},getConflictingClassGroupIds:(c,u)=>{const f=r[c]||[];return u&&n[c]?[...f,...n[c]]:f}}},tE=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),i=n?tE(e.slice(1),n):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Hx);return(c=t.validators.find(({validator:u})=>u(o)))==null?void 0:c.classGroupId},ik=/^\[(.+)\]$/,RD=e=>{if(ik.test(e)){const t=ik.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},$D=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return FD(Object.entries(e.classGroups),r).forEach(([o,c])=>{Sv(c,n,o,t)}),n},Sv=(e,t,r,n)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ak(t,i);o.classGroupId=r;return}if(typeof i=="function"){if(zD(i)){Sv(i(n),t,r,n);return}t.validators.push({validator:i,classGroupId:r});return}Object.entries(i).forEach(([o,c])=>{Sv(c,ak(t,o),r,n)})})},ak=(e,t)=>{let r=e;return t.split(Hx).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},zD=e=>e.isThemeGetter,FD=(e,t)=>t?e.map(([r,n])=>{const i=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([c,u])=>[t+c,u])):o);return[r,i]}):e,BD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const i=(o,c)=>{r.set(o,c),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let c=r.get(o);if(c!==void 0)return c;if((c=n.get(o))!==void 0)return i(o,c),c},set(o,c){r.has(o)?r.set(o,c):i(o,c)}}},rE="!",UD=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,i=t[0],o=t.length,c=u=>{const f=[];let h=0,m=0,p;for(let k=0;km?p-m:void 0;return{modifiers:f,hasImportantModifier:b,baseClassName:S,maybePostfixModifierPosition:w}};return r?u=>r({className:u,parseClassName:c}):c},WD=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},HD=e=>({cache:BD(e.cacheSize),parseClassName:UD(e),...LD(e)}),KD=/\s+/,GD=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i}=t,o=[],c=e.trim().split(KD);let u="";for(let f=c.length-1;f>=0;f-=1){const h=c[f],{modifiers:m,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:b}=r(h);let S=!!b,w=n(S?v.substring(0,b):v);if(!w){if(!S){u=h+(u.length>0?" "+u:u);continue}if(w=n(v),!w){u=h+(u.length>0?" "+u:u);continue}S=!1}const k=WD(m).join(":"),N=p?k+rE:k,E=N+w;if(o.includes(E))continue;o.push(E);const C=i(w,S);for(let A=0;A0?" "+u:u)}return u};function VD(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;np(m),e());return r=HD(h),n=r.cache.get,i=r.cache.set,o=u,u(f)}function u(f){const h=n(f);if(h)return h;const m=GD(f,r);return i(f,m),m}return function(){return o(VD.apply(null,arguments))}}const st=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},iE=/^\[(?:([a-z-]+):)?(.+)\]$/i,QD=/^\d+\/\d+$/,YD=new Set(["px","full","screen"]),ZD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XD=/\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$/,JD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,eL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,si=e=>js(e)||YD.has(e)||QD.test(e),Xi=e=>il(e,"length",cL),js=e=>!!e&&!Number.isNaN(Number(e)),gg=e=>il(e,"number",js),ic=e=>!!e&&Number.isInteger(Number(e)),rL=e=>e.endsWith("%")&&js(e.slice(0,-1)),Fe=e=>iE.test(e),Ji=e=>ZD.test(e),nL=new Set(["length","size","percentage"]),iL=e=>il(e,nL,aE),aL=e=>il(e,"position",aE),oL=new Set(["image","url"]),sL=e=>il(e,oL,dL),lL=e=>il(e,"",uL),ac=()=>!0,il=(e,t,r)=>{const n=iE.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},cL=e=>XD.test(e)&&!JD.test(e),aE=()=>!1,uL=e=>eL.test(e),dL=e=>tL.test(e),fL=()=>{const e=st("colors"),t=st("spacing"),r=st("blur"),n=st("brightness"),i=st("borderColor"),o=st("borderRadius"),c=st("borderSpacing"),u=st("borderWidth"),f=st("contrast"),h=st("grayscale"),m=st("hueRotate"),p=st("invert"),v=st("gap"),b=st("gradientColorStops"),S=st("gradientColorStopPositions"),w=st("inset"),k=st("margin"),N=st("opacity"),E=st("padding"),C=st("saturate"),A=st("scale"),_=st("sepia"),O=st("skew"),T=st("space"),F=st("translate"),B=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",Fe,t],W=()=>[Fe,t],ve=()=>["",si,Xi],de=()=>["auto",js,Fe],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],le=()=>["solid","dashed","dotted","double","none"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],te=()=>["","0",Fe],re=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[js,Fe];return{cacheSize:500,separator:":",theme:{colors:[ac],spacing:[si,Xi],blur:["none","",Ji,Fe],brightness:D(),borderColor:[e],borderRadius:["none","","full",Ji,Fe],borderSpacing:W(),borderWidth:ve(),contrast:D(),grayscale:te(),hueRotate:D(),invert:te(),gap:W(),gradientColorStops:[e],gradientColorStopPositions:[rL,Xi],inset:q(),margin:q(),opacity:D(),padding:W(),saturate:D(),scale:D(),sepia:te(),skew:D(),space:W(),translate:W()},classGroups:{aspect:[{aspect:["auto","square","video",Fe]}],container:["container"],columns:[{columns:[Ji]}],"break-after":[{"break-after":re()}],"break-before":[{"break-before":re()}],"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:[...ge(),Fe]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],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",ic,Fe]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Fe]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:["first","last","none",ic,Fe]}],"grid-cols":[{"grid-cols":[ac]}],"col-start-end":[{col:["auto",{span:["full",ic,Fe]},Fe]}],"col-start":[{"col-start":de()}],"col-end":[{"col-end":de()}],"grid-rows":[{"grid-rows":[ac]}],"row-start-end":[{row:["auto",{span:[ic,Fe]},Fe]}],"row-start":[{"row-start":de()}],"row-end":[{"row-end":de()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Fe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Fe]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Fe,t]}],"min-w":[{"min-w":[Fe,t,"min","max","fit"]}],"max-w":[{"max-w":[Fe,t,"none","full","min","max","fit","prose",{screen:[Ji]},Ji]}],h:[{h:[Fe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Fe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ji,Xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gg]}],"font-family":[{font:[ac]}],"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",Fe]}],"line-clamp":[{"line-clamp":["none",js,gg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",si,Fe]}],"list-image":[{"list-image":["none",Fe]}],"list-style-type":[{list:["none","disc","decimal",Fe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",si,Xi]}],"underline-offset":[{"underline-offset":["auto",si,Fe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:W()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe]}],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",Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),aL]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",iL]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sL]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...le(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:le()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...le()]}],"outline-offset":[{"outline-offset":[si,Fe]}],"outline-w":[{outline:[si,Xi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[si,Xi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ji,lL]}],"shadow-color":[{shadow:[ac]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...ie(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Ji,Fe]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Fe]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",Fe]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",Fe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[A]}],"scale-x":[{"scale-x":[A]}],"scale-y":[{"scale-y":[A]}],rotate:[{rotate:[ic,Fe]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Fe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"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",Fe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[si,Xi,gg]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hL=qD(fL);function J(...e){return hL(nt(e))}function Nv(e){return e?e.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function oE(){const e=Wx();return s.jsxs("div",{className:"flex items-center rounded-md border border-border/40 bg-background/40 p-0.5",role:"group","aria-label":"Ansichtsmodus",title:"Einfach zeigt nur das Wichtigste. Experte zeigt alle technischen Details.",children:[s.jsxs("button",{onClick:()=>nk(!1),"aria-pressed":!e,className:J("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",e?"text-muted-foreground hover:text-foreground":"bg-primary/15 text-primary shadow-sm"),children:[s.jsx(va,{className:"h-3.5 w-3.5"})," Einfach"]}),s.jsxs("button",{onClick:()=>nk(!0),"aria-pressed":e,className:J("flex items-center gap-1 rounded px-2 py-1 text-xs font-semibold transition-all cursor-pointer",e?"bg-primary/15 text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),children:[s.jsx(wI,{className:"h-3.5 w-3.5"})," Experte"]})]})}async function ye(e,t){var f;const r={"Content-Type":"application/json",...t==null?void 0:t.headers},n=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");n&&(r["X-Sudo-Password"]=n);let o=t==null?void 0:t.body;if((((f=t==null?void 0:t.method)==null?void 0:f.toUpperCase())||"GET")==="POST"){if(typeof o=="string")try{const h=JSON.parse(o);let m=!1;n&&!("sudo_password"in h)&&(h.sudo_password=n,m=!0),i&&!("hf_token"in h)&&(h.hf_token=i,m=!0),m&&(o=JSON.stringify(h))}catch{}else if(!o){const h={};n&&(h.sudo_password=n),i&&(h.hf_token=i),Object.keys(h).length>0&&(o=JSON.stringify(h))}}const u=await fetch(e,{...t,headers:r,body:o});if(!u.ok)throw new Error(`${u.status} ${u.statusText}`);return u.json()}const sE=(e,t,r=!1,n=!0)=>ye("/api/groups",{method:"PUT",body:JSON.stringify({group:e,members:t,swap:r,persist:n})}),mL=e=>ye("/api/routing/policy",{method:"PUT",body:JSON.stringify(e)}),ze={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:e=>["drafts",e??""],connect:e=>["connect",e??""],connectHealth:["connect-health"],memory:(e,t)=>["memory",e??"",t??""],memoryGraph:["memory-graph"],voiceTrace:["voice-trace"],auftragsbuch:["auftragsbuch"],chronik:["chronik"],wissen:["wissen"],zeitmaschine:["zeitmaschine"],reminders:["reminders"]},lE=(e=8e3)=>vt({queryKey:ze.auftragsbuch,queryFn:()=>ye("/api/auftragsbuch"),refetchInterval:e}),cE=(e=150,t=15e3)=>vt({queryKey:ze.chronik,queryFn:()=>ye(`/api/chronik?limit=${e}`),refetchInterval:t,select:r=>r.items??[]}),pL=()=>vt({queryKey:ze.wissen,queryFn:()=>ye("/api/wissen")}),gL=(e=3e4)=>vt({queryKey:ze.zeitmaschine,queryFn:()=>ye("/api/zeitmaschine"),refetchInterval:e}),vL=(e=2e4)=>vt({queryKey:ze.reminders,queryFn:()=>ye("/api/reminders"),refetchInterval:e,select:t=>t.items??[]}),xL=(e=12,t=4e3)=>vt({queryKey:ze.voiceTrace,queryFn:()=>ye(`/api/voice/trace?limit=${e}`),refetchInterval:t,select:r=>r.turns??[]}),yL=(e=!0)=>vt({queryKey:ze.memoryGraph,queryFn:()=>ye("/api/memory/graph"),enabled:e}),Kx=()=>vt({queryKey:ze.health,queryFn:()=>ye("/api/health"),refetchInterval:1e4}),Co=(e=5e3)=>vt({queryKey:ze.systemStatus,queryFn:()=>ye("/api/system/status"),refetchInterval:e}),uE=(e=3e3)=>vt({queryKey:ze.services,queryFn:()=>ye("/api/system/services"),refetchInterval:e}),Si=(e=4e3)=>vt({queryKey:ze.models,queryFn:()=>ye("/api/models"),refetchInterval:e}),Gx=(e=8e3)=>vt({queryKey:ze.groups,queryFn:()=>ye("/api/groups"),refetchInterval:e}),bL=()=>vt({queryKey:ze.routingPolicy,queryFn:()=>ye("/api/routing/policy")}),wL=(e=2e3)=>vt({queryKey:ze.jobs,queryFn:()=>ye("/api/jobs"),refetchInterval:e,select:t=>t.jobs??[]}),dE=(e=3e3)=>vt({queryKey:ze.tokenStats,queryFn:()=>ye("/api/system/token-stats"),refetchInterval:e}),Vx=(e=5e3)=>vt({queryKey:ze.agentStatus,queryFn:()=>ye("/api/agent/status"),refetchInterval:e}),fE=(e=6e4)=>vt({queryKey:ze.hermesBrain,queryFn:()=>ye("/api/agent/brain"),refetchInterval:e}),wh=e=>vt({queryKey:ze.updates,queryFn:()=>ye("/api/maintenance/updates"),refetchInterval:e}),kL=()=>vt({queryKey:ze.discover,queryFn:()=>ye("/api/discover")}),jL=e=>vt({queryKey:ze.drafts(e),queryFn:()=>ye(`/api/models/drafts?target=${encodeURIComponent(e??"")}`),enabled:!!e}),SL=e=>vt({queryKey:ze.connect(e),queryFn:()=>ye(e?`/api/connect?${e}`:"/api/connect")}),hE=()=>vt({queryKey:ze.connectHealth,queryFn:()=>ye("/api/connect/health"),refetchInterval:15e3}),Ev=e=>vt({queryKey:ze.memory(e==null?void 0:e.q,e==null?void 0:e.category),queryFn:()=>{const t=new URLSearchParams;return e!=null&&e.q&&t.set("q",e.q),e!=null&&e.category&&t.set("category",e.category),ye(`/api/memory?${t}`)},select:t=>e!=null&&e.limit?t.slice(0,e.limit):t});function mE({type:e,title:t,message:r,defaultValue:n,autoValue:i,autoLabel:o,onConfirm:c,onCancel:u}){const f=x.useRef(null);return s.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":t,children:s.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:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[s.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:t}),s.jsx("button",{onClick:u||(()=>c()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:s.jsx(Br,{className:"h-4 w-4","aria-hidden":"true"})})]}),s.jsx("p",{className:"max-h-72 overflow-y-auto whitespace-pre-line text-xs text-muted-foreground leading-relaxed scrollbar-thin",children:r}),e==="prompt"&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{ref:f,type:"text",defaultValue:n,"aria-label":t,className:"flex-1 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 m;h.key==="Enter"&&c((m=f.current)==null?void 0:m.value)}}),i!==void 0&&s.jsx("button",{type:"button",onClick:()=>{f.current&&(f.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:o||"Auto"})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(e==="confirm"||e==="prompt")&&s.jsx("button",{onClick:u,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"}),s.jsx("button",{onClick:()=>{var m;const h=e==="prompt"?(m=f.current)==null?void 0:m.value:void 0;c(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:e==="confirm"?"Ja, fortfahren":e==="prompt"?"Übernehmen":"OK"})]})]})})}function Nn(){const[e,t]=x.useState(null),r=x.useCallback(()=>t(null),[]),n=x.useCallback((u,f,h)=>{t({type:"alert",title:u,message:f,onConfirm:()=>{t(null),h==null||h()}})},[]),i=x.useCallback((u,f,h,m)=>{t({type:"confirm",title:u,message:f,onConfirm:()=>{t(null),h()},onCancel:()=>{t(null),m==null||m()}})},[]),o=x.useCallback((u,f,h,m,p,v)=>{t({type:"prompt",title:u,message:f,defaultValue:h,autoValue:v==null?void 0:v.autoValue,autoLabel:v==null?void 0:v.autoLabel,onConfirm:b=>{t(null),m(b)},onCancel:()=>{t(null),p==null||p()}})},[]),c=e?s.jsx(mE,{...e}):null;return{showAlert:n,showConfirm:i,showPrompt:o,close:r,dialogElement:c}}function Jr(e){return(e/1024**3).toFixed(1)}function Av(e){return e?e>1024**3?`${(e/1024**3).toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`:""}function lr(e){if(!e)return"—";const t=e/1024**3;return t>=1?`${t.toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`}function NL(e){if(!e)return"";const t=Math.floor(e/60);return t>0?`${t} min`:`${e} s`}function Cv(e){return e?`${Math.round(e/1024)}k`:"—"}function EL(){const e=Hr(),{data:t=[]}=wL(2e3),{showAlert:r,dialogElement:n}=Nn();async function i(u){try{await ye(`/api/jobs/${u}/cancel`,{method:"POST"}),e.invalidateQueries({queryKey:ze.jobs})}catch(f){r("Fehler",f.message)}}const o=t.filter(u=>u.state==="running"||u.state==="queued"),c=t.filter(u=>u.state!=="running"&&u.state!=="queued").slice(-3);return o.length===0&&c.length===0?null:s.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:[s.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),o.map(u=>s.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[s.jsxs("div",{className:"flex justify-between items-center text-xs",children:[s.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:u.label}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"text-muted-foreground font-mono",children:[u.progress??0,"% • ",Av(u.done_bytes),"/",Av(u.total_bytes),u.eta_s?` • ETA ${NL(u.eta_s)}`:""]}),s.jsx("button",{onClick:()=>i(u.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"})]})]}),s.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${u.progress??0}%`}})})]},u.id)),c.map(u=>s.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[s.jsx("span",{className:"truncate",children:u.label}),s.jsx("span",{className:J("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",u.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:u.state})]},u.id)),n]})}function Fa({children:e,tone:t="muted"}){const r={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return s.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${r[t]}`,children:e})}function Pv({caps:e}){return e?s.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[e.coder&&s.jsx(Fa,{children:"💻 Code"}),e.vision&&s.jsx(Fa,{children:"👁 Bild"}),e.reasoning&&s.jsx(Fa,{children:"🧠 Reason"}),e.moe&&s.jsxs(Fa,{tone:"primary",children:["🧩 MoE",e.active_b?`·${e.active_b}b`:""]}),e.tools==="yes"&&s.jsx(Fa,{tone:"primary",children:"🛠 Tools"}),e.tools==="likely"&&s.jsx(Fa,{tone:"warn",children:"🛠 Tools?"}),e.embedding&&s.jsx(Fa,{children:"🔢 Embed"})]}):null}const qx=[{role:"hermes",label:"Lucys Hirn",short:"Hirn",icon:Sa,desc:"Lucys Alltags-Verstand — denkt und redet mit dir. Immer bereit.",tone:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25",protected:!0},{role:"embed",label:"Lucys Gedächtnis",short:"Gedächtnis",icon:t5,desc:"Merkt sich Wichtiges und findet es später wieder.",tone:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",protected:!0},{role:"reranker",label:"Gedächtnis-Sortierer",short:"Sortierer",icon:aI,desc:"Ordnet gefundene Erinnerungen nach echter Relevanz — die Feinsortierung hinter dem Gedächtnis.",tone:"bg-lime-500/15 text-lime-400 border-lime-500/25"},{role:"vision",label:"Lucys Augen",short:"Augen",icon:Cc,desc:"Sieht Bilder und Screenshots und beschreibt, was drauf ist.",tone:"bg-pink-500/15 text-pink-400 border-pink-500/25"},{role:"heavy",label:"Großes Hirn",short:"Groß",icon:RM,desc:"Das schwere Geschütz — wird für besonders knifflige Fragen dazugeholt.",tone:"bg-amber-500/15 text-amber-400 border-amber-500/25"},{role:"coder-lite",label:"Programmierer (schnell)",short:"Code schnell",icon:Fs,desc:"Schnelles Programmieren im Alltag.",tone:"bg-violet-500/15 text-violet-400 border-violet-500/25"},{role:"coder",label:"Programmierer (gründlich)",short:"Code gründlich",icon:Fs,desc:"Schreibt und prüft Code besonders sorgfältig — für schwere Coding-Aufgaben.",tone:"bg-fuchsia-500/15 text-fuchsia-400 border-fuchsia-500/25"},{role:"scout",label:"Späher",short:"Späher",icon:SI,desc:"Schneller erster Blick und grobe Einschätzung.",tone:"bg-teal-500/15 text-teal-400 border-teal-500/25"},{role:"kritiker",label:"Kritiker",short:"Kritiker",icon:m5,desc:"Die unbestechliche Zweitmeinung — prüft Behauptungen und Patches (anderer Hersteller als das Hirn).",tone:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25"}],AL=qx.map(e=>e.role),ok=Object.fromEntries(qx.map(e=>[e.role,e])),sk=e=>({role:e||"?",label:e||"unbekannt",short:e||"?",icon:Sa,desc:"Rolle ohne hinterlegten Klartext-Namen.",tone:"bg-slate-500/15 text-slate-300 border-slate-500/25"}),CL={fast:"hermes",coder_lite:"coder-lite"};function dt(e){return e&&(ok[e]||ok[CL[e]])||sk(e)}function mo({role:e,dense:t=!1,className:r}){const n=dt(e),i=n.icon;return s.jsxs("span",{className:J("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-semibold border tracking-wide",n.tone,r),title:`${n.desc} (${n.role})`,children:[s.jsx(i,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),t?n.short:n.label]})}function PL({fit:e}){const t={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"}[e.level];return s.jsxs("span",{className:J("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",t),children:[e.text," • ",e.req_gb," GB RAM"]})}function pf(e){const t=e.toLowerCase();return t.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:t.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:t.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:t.includes("mistral")||t.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:t.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:t.includes("hermes")||t.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:t.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 pE({model:e,onClose:t,onChanged:r}){var w,k;const{data:n,isLoading:i}=jL(e.gguf_path),[o,c]=x.useState(null),[u,f]=x.useState(""),h=n==null?void 0:n.target_vocab,m=(n==null?void 0:n.drafts)??[],p=m.filter(N=>N.compatible===!0),v=e.spec_draft_model;async function b(N){c(N??"__clear__"),f("");try{await ye(`/api/models/${encodeURIComponent(e.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:N})}),r(),t()}catch(E){f(String((E==null?void 0:E.message)||E)),c(null)}}const S=N=>{var E;return N?`${N.pre??"?"} · ${((E=N.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return s.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-lg 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:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[s.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[s.jsx(wa,{className:"h-4 w-4"})," Speculative Draft"]}),s.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:s.jsx(Br,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',s.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),s.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:(w=e.name.split("/").pop())==null?void 0:w.replace(/\.gguf$/i,"")}),s.jsxs("span",{className:"text-foreground",children:["Vocab: ",S(h)]})]}),e.spec_active&&v&&s.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[s.jsx(Mt,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",v]}),s.jsx("button",{onClick:()=>b(null),disabled:o!==null,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 shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(n!=null&&n.target_exists)&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[s.jsx(vr,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),s.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?s.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):m.length===0?s.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",s.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):m.map(N=>{var A,_;const E=N.filename===v,C=N.compatible===!0;return s.jsxs("div",{className:J("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",C?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate flex items-center gap-1.5",children:[N.filename,N.mtp&&s.jsx("span",{className:"shrink-0 rounded bg-indigo-500/15 px-1.5 py-0.5 text-[8px] font-bold uppercase tracking-wider text-indigo-400 border border-indigo-500/25",title:"MTP-Kopf (Multi-Token-Prediction) — by-construction vocab-identisch, höchste Akzeptanzrate",children:"MTP"})]}),s.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[lr(N.size_bytes)," · Vocab: ",S(N.vocab)]})]}),C?E?s.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[s.jsx(Mt,{className:"h-3.5 w-3.5"})," Aktiv"]}):s.jsx("button",{onClick:()=>b(N.path),disabled:o!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):s.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:N.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(A=N.vocab)==null?void 0:A.pre}/${(_=N.vocab)==null?void 0:_.n_vocab} ≠ Modell ${h==null?void 0:h.pre}/${h==null?void 0:h.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," ",N.compatible===!1?"Vocab ≠":"n/a"]})]},N.path)})}),!i&&(n==null?void 0:n.target_exists)&&m.length>0&&p.length===0&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",s.jsx("span",{className:"font-mono",children:h==null?void 0:h.pre}),", n_vocab=",s.jsx("span",{className:"font-mono",children:(k=h==null?void 0:h.n_vocab)==null?void 0:k.toLocaleString()}),")."]}),u&&s.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:u})]})})}const lk={hermes:{bar:"bg-indigo-500",dot:"bg-indigo-500",text:"text-indigo-400"},embed:{bar:"bg-emerald-500",dot:"bg-emerald-500",text:"text-emerald-400"},vision:{bar:"bg-pink-500",dot:"bg-pink-500",text:"text-pink-400"},heavy:{bar:"bg-amber-500",dot:"bg-amber-500",text:"text-amber-400"},"coder-lite":{bar:"bg-violet-500",dot:"bg-violet-500",text:"text-violet-400"},coder:{bar:"bg-fuchsia-500",dot:"bg-fuchsia-500",text:"text-fuchsia-400"},scout:{bar:"bg-teal-500",dot:"bg-teal-500",text:"text-teal-400"},kritiker:{bar:"bg-cyan-500",dot:"bg-cyan-500",text:"text-cyan-400"},reranker:{bar:"bg-lime-500",dot:"bg-lime-500",text:"text-lime-400"}},OL={fast:"hermes",coder_lite:"coder-lite"},ck={bar:"bg-slate-400",dot:"bg-slate-400",text:"text-slate-300"};function gf(e){return e&&(lk[e]||lk[OL[e]])||ck}const uk=1024**3,dk=e=>{var t;return((t=e.split("/").pop())==null?void 0:t.replace(/\.gguf$/i,""))??e};function _L({running:e,capacityBytes:t,realUsedBytes:r,selected:n,onSelect:i}){const o=t>2*uk?t:124*uk,c=e.reduce((h,m)=>h+(m.size_bytes||0),0),u=Math.max(0,o-c),f=u/o*100;return s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex flex-wrap items-end justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ga,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Arbeitsspeicher"}),s.jsxs("div",{className:"font-space text-xl font-bold tracking-tight text-foreground",children:[Jr(o)," GB ",s.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"gesamt"})]})]})]}),s.jsxs("div",{className:"text-right text-[11px] font-mono text-muted-foreground",children:[s.jsxs("div",{children:[s.jsxs("span",{className:"font-bold text-foreground",children:[Jr(c)," GB"]})," Modelle geladen"]}),r>0&&s.jsxs("div",{children:[Jr(r)," GB real belegt (inkl. KV-Cache)"]}),s.jsxs("div",{className:"text-emerald-400",children:[Jr(u)," GB frei"]})]})]}),s.jsx("div",{className:"flex h-12 w-full overflow-hidden rounded-xl border border-border/40 bg-background/50 p-1",children:e.length===0?s.jsx("div",{className:"flex w-full items-center justify-center text-[11px] italic text-muted-foreground/60",children:"Kein Modell geladen — Auto-Swap holt bei Anfrage automatisch das passende."}):s.jsxs(s.Fragment,{children:[e.map(h=>{const m=(h.size_bytes||0)/o*100,p=gf(h.role),v=n===h.name;return s.jsxs("button",{onClick:()=>i==null?void 0:i(h.name),style:{width:`${m}%`},title:`${dt(h.role).label} · ${dk(h.name)} · ${lr(h.size_bytes)}`,className:J("group flex h-full min-w-[2.5rem] shrink-0 flex-col justify-center gap-0.5 rounded-lg px-2 text-left text-white transition-all",p.bar,v?"ring-2 ring-white/70":"opacity-90 hover:opacity-100"),children:[s.jsx("span",{className:"truncate font-space text-[10px] font-bold leading-tight tracking-wide",children:dt(h.role).short}),s.jsx("span",{className:"truncate font-mono text-[9px] leading-tight opacity-85",children:lr(h.size_bytes)})]},h.name)}),f>1.5&&s.jsx("div",{style:{width:`${f}%`},className:"flex h-full min-w-[2rem] items-center justify-center rounded-lg text-[9px] font-mono text-muted-foreground/50",title:`${Jr(u)} GB frei`,children:"frei"})]})}),e.length>0&&s.jsxs("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5",children:[e.map(h=>{const m=gf(h.role);return s.jsxs("button",{onClick:()=>i==null?void 0:i(h.name),className:"flex items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[s.jsx("span",{className:J("h-2.5 w-2.5 rounded-sm",m.dot)}),s.jsx("span",{className:J("font-semibold",m.text),children:dt(h.role).short}),s.jsx("span",{className:"font-mono text-muted-foreground/70",children:dk(h.name)})]},h.name)}),s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/60",children:[s.jsx("span",{className:"h-2.5 w-2.5 rounded-sm border border-border/50 bg-background/50"})," frei · ",Jr(u)," GB"]})]})]})}const fk=1024**3,Ga=e=>{var t;return((t=e.split("/").pop())==null?void 0:t.replace(/\.gguf$/i,""))??e};function ML(){var M,Q,ne,ae;const e=Hr(),{data:t,isLoading:r,error:n}=Si(4e3),{data:i}=Co(),{data:o}=Gx(),{showAlert:c,showConfirm:u,showPrompt:f,dialogElement:h}=Nn(),m=Wx(),p=(t==null?void 0:t.models)??[],v=(t==null?void 0:t.running)??[],b=ee=>!!dt(ee).protected,S=(M=o==null?void 0:o.groups)==null?void 0:M.brains,w=(S==null?void 0:S.members)??[],k=ee=>w.includes(ee),[N,E]=x.useState(null),[C,A]=x.useState(""),[_,O]=x.useState("all"),[T,F]=x.useState(null),B=()=>{e.invalidateQueries({queryKey:ze.models}),e.invalidateQueries({queryKey:ze.routing}),e.invalidateQueries({queryKey:ze.groups})},$=p.filter(ee=>v.includes(ee.name)),q=((Q=i==null?void 0:i.gpu)==null?void 0:Q.gtt_total)||((ne=i==null?void 0:i.gpu)==null?void 0:ne.vram_total)||0,W=((ae=i==null?void 0:i.gpu)==null?void 0:ae.gtt_used)||0,ve=q>2*fk?q:124*fk,de=x.useMemo(()=>{const ee=C.trim().toLowerCase();return p.filter(se=>_==="in_use"?!!se.role||v.includes(se.name):!0).filter(se=>ee?se.name.toLowerCase().includes(ee):!0).sort((se,me)=>{const U=v.includes(se.name)?0:1,ue=v.includes(me.name)?0:1;return U!==ue?U-ue:Ga(se.name).localeCompare(Ga(me.name))})},[p,v,_,C]),ge=p.find(ee=>ee.name===N)??null;async function le(ee){try{await ye(`/api/models/${encodeURIComponent(ee)}/load`,{method:"POST"}),B()}catch(se){c("Fehler",`Laden fehlgeschlagen: ${se.message||se}`)}}async function ie(ee){const se=w.some(me=>v.includes(me));if(S&&se&&!k(ee)){const me=w.filter(U=>v.includes(U)).map(Ga).join(", ");u("Verdrängt das Hirn?",`„${Ga(ee)}" ist nicht ko-resident. Beim Laden wirft es das warme Hirn (${me}) raus — Lucy verliert Hirn bzw. Augen. -Trotzdem exklusiv laden?`,()=>le(ee));return}le(ee)}async function X(ee){const se=p.find(me=>me.name===ee);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await ye(`/api/models/${encodeURIComponent(ee)}/unload`,{method:"POST"}),B()}catch(me){c("Fehler",`Entladen fehlgeschlagen: ${me.message||me}`)}}async function te(ee,se){try{const me=await ye(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:ee||null})});B(),me!=null&&me.warning&&c("Rolle gesetzt — Hinweis",me.warning)}catch(me){c("Fehler",`Rolle zuweisen fehlgeschlagen: ${me.message||me}`)}}async function re(ee,se){let me=null;try{me=await ye(`/api/models/${encodeURIComponent(ee)}/ctx/auto`)}catch{}const U=me?`Optimal für dein Setup: ${(me.ctx/1024).toFixed(0)}k (${me.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",U,String(se||32768),async ue=>{if(ue)try{await ye(`/api/models/${encodeURIComponent(ee)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ue,10)})}),B()}catch(be){c("Fehler",`Kontext setzen fehlgeschlagen: ${be.message||be}`)}},void 0,me?{autoValue:String(me.ctx),autoLabel:`Auto (${(me.ctx/1024).toFixed(0)}k)`}:void 0)}async function D(ee){const se=p.find(me=>me.name===ee);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}u("Modell löschen?",`„${Ga(ee)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await ye(`/api/models/${encodeURIComponent(ee)}`,{method:"DELETE"}),N===ee&&E(null),B()}catch(me){c("Fehler",`Löschen fehlgeschlagen: ${me.message||me}`)}})}return r?s.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):n?s.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 (",String(n),")."]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(_L,{running:$,capacityBytes:ve,realUsedBytes:W,selected:N,onSelect:E}),s.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-4 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(rl,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),s.jsx("input",{value:C,onChange:ee=>A(ee.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),s.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(ee=>s.jsx("button",{onClick:()=>O(ee),className:J("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",_===ee?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:ee==="all"?"Alle":"In Benutzung"},ee))})]}),s.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:de.length===0?s.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):de.map(ee=>{const se=v.includes(ee.name),me=N===ee.name,U=pf(ee.name),ue=gf(ee.role);return s.jsxs("button",{onClick:()=>E(ee.name),className:J("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",me?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[s.jsx("span",{className:J("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",U.color),children:U.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:Ga(ee.name)}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[ee.role&&s.jsx("span",{className:J("h-2 w-2 rounded-sm",ue.dot)}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:ee.role?dt(ee.role).short:"keine Rolle"}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",lr(ee.size_bytes)]})]})]}),se?s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):ee.incomplete?s.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):s.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},ee.name)})})]}),s.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:ge?s.jsx(IL,{m:ge,warm:v.includes(ge.name),expert:m,protectedRole:b(ge.role),coresident:k(ge.name),onLoad:()=>ie(ge.name),onUnload:()=>X(ge.name),onRole:ee=>te(ee,ge.name),onCtx:()=>re(ge.name,ge.ctx),onSpec:()=>F(ge),onDelete:()=>D(ge.name)}):s.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[s.jsx(yi,{className:"h-8 w-8 opacity-40"}),s.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),s.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),T&&s.jsx(pE,{model:T,onClose:()=>F(null),onChanged:B}),h]})}function IL({m:e,warm:t,expert:r,protectedRole:n,coresident:i,onLoad:o,onUnload:c,onRole:u,onCtx:f,onSpec:h,onDelete:m}){const p=pf(e.name),v=t&&n;return s.jsxs("div",{className:"flex h-full flex-col gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:J("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",p.color),children:p.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:Ga(e.name)}),s.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.role?s.jsx(mo,{role:e.role}):s.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),n&&s.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[s.jsx(u5,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),i&&s.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[s.jsx(Sa,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),t&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),s.jsxs("button",{onClick:t?c:o,disabled:e.incomplete&&!t||v,className:J("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",t?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:v?`„${dt(e.role).label}" bleibt geladen (geschützt).`:void 0,children:[t?s.jsx(mI,{className:"h-4 w-4"}):s.jsx(h5,{className:"h-4 w-4"}),v?"🔒 bleibt geladen":t?"Entladen":"Ins Warm-Set laden"]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(hk,{active:!e.role,onClick:()=>u(""),dot:"bg-slate-400",label:"keine"}),qx.map(b=>s.jsx(hk,{active:e.role===b.role,onClick:()=>u(b.role),dot:gf(b.role).dot,label:b.short},b.role))]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[s.jsx(TL,{icon:ga,label:"Größe",value:lr(e.size_bytes)}),s.jsxs("button",{onClick:f,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[s.jsx(f5,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),s.jsx("div",{className:"font-semibold text-foreground",children:Cv(e.ctx)})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),r&&s.jsxs("button",{onClick:h,className:J("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",e.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":e.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[s.jsx(wa,{className:"h-3 w-3"})," Spec"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.spec_active&&s.jsx(Ld,{tone:"emerald",label:"Spec-Decoding aktiv"}),!e.spec_active&&e.spec_draft_model&&s.jsx(Ld,{tone:"amber",label:"Spec inaktiv"}),e.prompt_cache&&s.jsx(Ld,{tone:"cyan",label:"Prompt-Cache"}),e.parallel_slots>1&&s.jsx(Ld,{tone:"violet",label:`${e.parallel_slots} Slots`}),!e.spec_active&&!e.spec_draft_model&&!e.prompt_cache&&e.parallel_slots<=1&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:s.jsx(Pv,{caps:e.capabilities})}),s.jsxs("button",{onClick:m,disabled:n,className:J("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",n?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[s.jsx(Us,{className:"h-3.5 w-3.5"})," ",n?"geschützt — nicht löschbar":"Modell löschen"]})]})}function hk({active:e,onClick:t,dot:r,label:n}){return s.jsxs("button",{onClick:t,className:J("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",e?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[s.jsx("span",{className:J("h-2 w-2 rounded-sm",r)}),n,e&&s.jsx(Mt,{className:"h-3 w-3 text-primary"})]})}function TL({icon:e,label:t,value:r}){return s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[s.jsx(e,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t}),s.jsx("div",{className:"font-semibold text-foreground",children:r})]})]})}function Ld({tone:e,label:t}){const r={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[e];return s.jsx("span",{className:J("rounded border px-1.5 py-0.5 text-[10px] font-semibold",r),children:t})}const DL=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],LL=["fast","heavy","coder","vision","hermes","scout"],RL=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function mk(e){return RL.format(e)}function $L(){const{data:e}=Si(),t=(e==null?void 0:e.models)??[],[r,n]=x.useState(""),[i,o]=x.useState([]),[c,u]=x.useState(!1),[f,h]=x.useState(""),[m,p]=x.useState("popular"),[v,b]=x.useState(""),[S,w]=x.useState(null),[k,N]=x.useState([]),[E,C]=x.useState("Q4_K_M"),[A,_]=x.useState(""),[O,T]=x.useState(null),[F,B]=x.useState(!1),[$,q]=x.useState({});async function W(M){u(!0),h("");try{const Q=await ye(`/api/hf/search?q=${encodeURIComponent(M)}`);o(Q.results),Q.results.length||h("Keine Ergebnisse.")}catch(Q){h(`Suche fehlgeschlagen: ${Q}`)}finally{u(!1)}}x.useEffect(()=>{W("")},[]);function ve(M){p(M.key),n(""),W(M.q)}function de(){p(""),W(r)}async function ge(M,Q,ne){B(!1);try{const ae=await ye(`/api/fit?params_b=0&quant=${encodeURIComponent(Q)}&ctx=8192&name=${encodeURIComponent(M)}&role=${encodeURIComponent(ne)}`);T(ae)}catch{T(null)}}async function le(M){if(S===M){w(null);return}w(M),N([]),T(null),_(""),B(!1),h("Analysiere Repository…");try{const Q=await ye(`/api/hf/quants?repo=${encodeURIComponent(M)}`);N(Q.quants);const ne=Q.quants.includes("Q4_K_M")?"Q4_K_M":Q.quants[0]||"Q4_K_M";C(ne),h(Q.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),Q.quants.length&&ge(Q.repo,ne,"")}catch(Q){h(`Fehler: ${Q}`)}}function ie(){const M=v.trim();M&&(o(Q=>Q.some(ne=>ne.repo===M)?Q:[{repo:M,downloads:0,likes:0},...Q]),b(""),le(M))}const X=A?t.find(M=>(M.role||"").toLowerCase()===A):void 0;async function te(M){if((O==null?void 0:O.fit.level)==="too_tight"&&!F){B(!0);return}q(Q=>({...Q,[M]:"Starte…"}));try{await ye("/api/models/install",{method:"POST",body:JSON.stringify({repo:M,quant:E,role:A||void 0,jinja:!0})}),q(Q=>({...Q,[M]:"Download läuft"})),B(!1)}catch{q(ne=>({...ne,[M]:"Fehler"}))}}const re=M=>{var ne;const Q=((ne=M.split("/").pop())==null?void 0:ne.toLowerCase().replace(/-gguf$/i,""))||"";return Q.length>3&&t.some(ae=>ae.name.toLowerCase().includes(Q))},D=M=>M==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":M==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(rl,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx("input",{value:r,onChange:M=>n(M.target.value),onKeyDown:M=>M.key==="Enter"&&de(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsx("button",{onClick:de,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:DL.map(M=>s.jsxs("button",{onClick:()=>ve(M),className:J("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",m===M.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[M.key==="popular"&&s.jsx(QM,{className:"h-3 w-3"}),M.label]},M.key))}),c?s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):s.jsxs("div",{className:"space-y-2",children:[i.map(M=>{const Q=S===M.repo,ne=re(M.repo),ae=M.repo.includes("/")?M.repo.split("/")[0]:"—",ee=M.repo.split("/").pop();return s.jsxs("div",{className:J("rounded-xl border bg-card/45 backdrop-blur-md transition-all",Q?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[s.jsxs("button",{onClick:()=>le(M.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:M.repo,children:ee}),ne&&s.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[s.jsx(Mt,{className:"h-2.5 w-2.5"})," installiert"]})]}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[s.jsx("span",{children:ae}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-3 w-3"})," ",mk(M.downloads)]}),M.likes>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eI,{className:"h-3 w-3"})," ",mk(M.likes)]})]})]}),Q?s.jsx(r5,{className:"h-4 w-4 text-muted-foreground shrink-0"}):s.jsx(tl,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),Q&&s.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:k.length===0?s.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:f||"Lade Quants…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),s.jsx("select",{value:E,onChange:se=>{C(se.target.value),ge(M.repo,se.target.value,A)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:k.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))}),s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),s.jsxs("select",{value:A,onChange:se=>{_(se.target.value),ge(M.repo,E,se.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[s.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),LL.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))]}),s.jsx("button",{onClick:()=>te(M.repo),disabled:!!$[M.repo]&&$[M.repo]==="Download läuft",className:J("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",F?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:$[M.repo]?$[M.repo]:F?s.jsxs(s.Fragment,{children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):s.jsxs(s.Fragment,{children:[s.jsx(Bs,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),O&&s.jsxs("div",{className:J("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",D(O.fit.level)),children:[s.jsx("span",{className:"font-bold uppercase tracking-wide",children:O.fit.text}),s.jsxs("span",{className:"font-mono opacity-90",children:["~",O.params_b,"B · ~",O.fit.req_gb," GB / ",O.sys_ram_gb," GB · ~",O.fit.tps," t/s"]}),O.fit.level!=="too_tight"?s.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(O.assigned_ctx/1024).toFixed(0),"k"]}):s.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),X&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[s.jsx(vr,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),s.jsxs("span",{children:["Rolle ",s.jsxs("strong",{children:["„",A,'"']})," hält aktuell ",s.jsx("strong",{children:X.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},M.repo)}),!i.length&&!c&&s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:f||"Keine Ergebnisse."})]}),s.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),s.jsx("input",{value:v,onChange:M=>b(M.target.value),onKeyDown:M=>M.key==="Enter"&&ie(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (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 font-mono"}),s.jsx("button",{onClick:ie,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:"Laden"})]})]})}const zL={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wa},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:Sa},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Fs},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Cc},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:LM},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:vv},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:m5},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:rl}};function FL(){const{data:e,isLoading:t,error:r}=kL(),{data:n}=Si(),{data:i}=wh(),o=(n==null?void 0:n.models)??[],c=r?String(r):"",[u,f]=x.useState({}),[h,m]=x.useState({}),[p,v]=x.useState("recommended");async function b(S,w,k,N){f(E=>({...E,[S]:"Starte..."}));try{await ye("/api/models/install",{method:"POST",body:JSON.stringify({repo:S,role:w,quant:k,jinja:N})}),f(E=>({...E,[S]:"Download läuft"}))}catch{f(C=>({...C,[S]:"Fehler"}))}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([S,w])=>s.jsx("button",{onClick:()=>v(S),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",p===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:w},S))}),p==="browse"?s.jsx($L,{}):t?s.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):c||!e?s.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 (",c,")."]}):s.jsxs("div",{className:"space-y-8",children:[s.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:[s.jsxs("div",{children:["Modell-Registry geladen für ",s.jsxs("span",{className:"text-foreground font-bold",children:[e.sys_ram_gb," GB"]})," System-RAM."]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(jI,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),s.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),s.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:e.categories.map(S=>{const w=zL[S.role]||{title:S.title||S.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:l5},k=w.icon,N=o.find(T=>T.role===S.role||(T.aliases||[]).includes(S.role)),E=i==null?void 0:i.model_list.find(T=>T.role===S.role),C=S.models.find(T=>T.repo===S.recommended)||S.models[0];if(!C)return null;const A=u[C.repo],_=S.models.filter(T=>T.repo!==S.recommended),O=!!h[S.role];return s.jsxs("div",{className:J("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",N?"border-border/60":"border-primary/20 shadow-primary/5"),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:s.jsx(k,{className:"h-5.5 w-5.5"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:w.title}),s.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: ",S.role]})]})]}),N?s.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:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):s.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"})]}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:w.desc}),s.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:N?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:N.name,children:N.name.split("/").pop()}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[s.jsxs("span",{children:["Größe: ",Av(N.size_bytes||0)]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",N.quant||"GGUF"]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:C.name,children:C.name}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:["Ersteller: ",C.author]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",C.quant]})]}),s.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:s.jsx(PL,{fit:C.fit})})]})}),s.jsx("div",{className:"pt-1",children:N?E?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),s.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),s.jsxs("button",{onClick:()=>b(E.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!u[E.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:[s.jsx(Bs,{className:"h-3.5 w-3.5"}),u[E.repo]||"Auf neue Version aktualisieren"]})]}):s.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:[s.jsx(Mt,{className:"h-4 w-4"})," Auf neuestem Stand"]}):s.jsxs("button",{onClick:()=>b(C.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!A,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",A?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[s.jsx(Bs,{className:"h-3.5 w-3.5"}),A||"Optimales Modell einsetzen"]})})]}),_.length>0&&s.jsxs("div",{className:"border-t border-border/20 pt-3",children:[s.jsxs("button",{onClick:()=>m(T=>({...T,[S.role]:!O})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[O?s.jsx(r5,{className:"h-3 w-3"}):s.jsx(tl,{className:"h-3 w-3"}),s.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",_.length,")"]})]}),O&&s.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:_.map(T=>s.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),s.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[s.jsxs("span",{children:["Quant: ",T.quant]}),s.jsx("span",{children:"•"}),s.jsx("span",{children:T.fit.text})]})]}),s.jsx("button",{onClick:()=>b(T.repo,S.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!u[T.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:u[T.repo]||"Installieren"})]},T.repo))})]})]},S.role)})})]})]})}function BL(){const[e,t]=x.useState("cockpit");return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[s.jsxs("div",{children:[s.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"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(r=>s.jsx("button",{onClick:()=>t(r),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",e===r?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:r==="cockpit"?"Werkbank":"Modelle finden"},r))})]}),s.jsx(EL,{}),s.jsx("div",{className:"transition-all duration-300",children:e==="cockpit"?s.jsx(ML,{}):s.jsx(FL,{})})]})}const pk={hermes_desktop:"Hermes Desktop: Browser-Login",kilo:"Kilo: Einstellungen → API Provider",claude_code:"env / Übersetzer"};function vg({line:e,loading:t}){return t||!e?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[s.jsx(Bt,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):e.ok?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[s.jsx(n5,{className:"h-3 w-3"})," ",e.detail]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[s.jsx(UM,{className:"h-3 w-3"})," ",e.detail]})}function xg({tool:e,fileName:t,accent:r,copied:n,onCopy:i}){return s.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[s.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),s.jsx("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:s.jsx("span",{children:t})}),s.jsxs("button",{onClick:i,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:[n?s.jsx(Mt,{className:"h-3.5 w-3.5 text-emerald-400"}):s.jsx(xv,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:n?"Kopiert":"Kopieren"})]})]}),s.jsx("pre",{className:J("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",r==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:s.jsx("code",{children:e.snippet})})]})}function gE(){const[e,t]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[r,n]=x.useState(localStorage.getItem("mc_mcp_path")||""),[i,o]=x.useState("kilo"),[c,u]=x.useState(!1),[f,h]=x.useState(null),m=new URLSearchParams({host:e});r&&m.set("mcp_path",r);const{data:p,error:v}=SL(m.toString()),{data:b,isLoading:S}=hE(),w=v?String(v):"";function k(_){t(_),_&&localStorage.setItem("mc_host",_)}function N(_){n(_),localStorage.setItem("mc_mcp_path",_)}const E=p==null?void 0:p.tools.hermes_desktop,C=p==null?void 0:p.tools[i];async function A(_,O){O&&(await navigator.clipboard.writeText(O),h(_),setTimeout(()=>h(null),1500))}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.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"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:"Hermes Desktop"})," ist die Tür zur Box — einmal verbinden, fertig. Für Spezialfälle gibt es darunter die rohen Leitungen (Gateway /v1 + Gedächtnis-MCP) für sonstige Tools."]})]}),s.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[s.jsx(og,{className:"h-7 w-7 mx-auto text-muted-foreground"}),s.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),s.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Hermes Desktop · Kilo Code · Claude Code …"})]}),s.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[s.jsx(yi,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),s.jsx(vg,{line:b==null?void 0:b.gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[s.jsx(Sa,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),s.jsx(vg,{line:b==null?void 0:b.memory,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-emerald-500/25 bg-emerald-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-emerald-300",children:[s.jsx(og,{className:"h-3.5 w-3.5"})," Leitung 3 — Desktop-Gateway"]}),s.jsx(vg,{line:b==null?void 0:b.desktop_gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-emerald-300/80",children:"Desktop-Gateway · :9119 · API-Status"})]})]})]})]}),s.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",s.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",s.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," und das Desktop-Gateway bietet die Agenten-Schnittstelle — alle drei Leitungen werden unabhängig eingerichtet."]})]}),s.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:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(XM,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),s.jsx("input",{value:e,onChange:_=>k(_.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,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"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(a5,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",s.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),s.jsx("input",{value:r,onChange:_=>N(_.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,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-violet-500/50 text-foreground"})]})]}),w&&s.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: ",w]}),p&&s.jsxs("div",{className:"space-y-5",children:[E&&s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-emerald-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx(og,{className:"h-4 w-4 text-emerald-400"}),"Hermes Desktop anbinden",s.jsx("span",{className:"text-[10px] font-medium text-emerald-400/90 normal-case",children:"der Hauptweg"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Die Desktop-App dockt remote an die Box an — volle Agent-Oberfläche, Projekte, Review, Gedächtnis inklusive."})]}),E.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),s.jsx("span",{children:E.note})]}),s.jsx(xg,{tool:E,fileName:pk.hermes_desktop,accent:"teal",copied:f==="desktop",onCopy:()=>A("desktop",E.snippet)})]}),s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/30",children:[s.jsxs("button",{onClick:()=>u(_=>!_),className:"flex w-full items-center gap-2 p-4 text-sm font-space font-bold text-foreground cursor-pointer hover:text-primary transition-colors",children:[c?s.jsx(tl,{className:"h-4 w-4"}):s.jsx(Kn,{className:"h-4 w-4"}),"Sonstige Tools (roher /v1-Zugang + Gedächtnis-MCP)",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"Kilo Code · Claude Code · Eigenbau"})]}),c&&s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2 p-4 pt-0",children:[s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(p.tools).filter(([_])=>_!=="hermes_desktop").map(([_,O])=>s.jsx("button",{onClick:()=>o(_),className:J("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===_?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:O.label},_))}),C&&s.jsxs(s.Fragment,{children:[C.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:C.note})]}),s.jsx(xg,{tool:C,fileName:pk[i]||"config.json",accent:"teal",copied:f==="model",onCopy:()=>A("model",C.snippet)})]})]}),s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",s.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),s.jsx("span",{children:p.memory.note})]}),s.jsx(xg,{tool:p.memory,fileName:"mcp.json",accent:"violet",copied:f==="memory",onCopy:()=>A("memory",p.memory.snippet)})]})]})]})]})]})}const UL="modulepreload",WL=function(e){return"/"+e},gk={},HL=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=c(r.map(h=>{if(h=WL(h),h in gk)return;gk[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":UL,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((b,S)=>{v.addEventListener("load",b),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return i.then(c=>{for(const u of c||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class vk extends x.Component{constructor(){super(...arguments);ns(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[s.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),s.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const xk=x.lazy(()=>HL(()=>import("./GraphView-CpsmWoAD.js"),[]).then(e=>({default:e.GraphView}))),Rd=["identity","knowledge","rules","events"],yk=new Set(["auto","agent","hermes"]),yg={identity:{label:"Identität",icon:NI,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:nl,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:xI,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:mh,bg:"bg-amber-500/10",text:"text-amber-400"}},bk={label:"Gedächtnis",icon:gv,text:"text-muted-foreground"},KL={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},wk=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: +Trotzdem exklusiv laden?`,()=>le(ee));return}le(ee)}async function X(ee){const se=p.find(me=>me.name===ee);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" ist lebenswichtig und bleibt geladen.`);return}try{await ye(`/api/models/${encodeURIComponent(ee)}/unload`,{method:"POST"}),B()}catch(me){c("Fehler",`Entladen fehlgeschlagen: ${me.message||me}`)}}async function te(ee,se){try{const me=await ye(`/api/models/${encodeURIComponent(se)}/role`,{method:"POST",body:JSON.stringify({role:ee||null})});B(),me!=null&&me.warning&&c("Rolle gesetzt — Hinweis",me.warning)}catch(me){c("Fehler",`Rolle zuweisen fehlgeschlagen: ${me.message||me}`)}}async function re(ee,se){let me=null;try{me=await ye(`/api/models/${encodeURIComponent(ee)}/ctx/auto`)}catch{}const U=me?`Optimal für dein Setup: ${(me.ctx/1024).toFixed(0)}k (${me.ctx}). »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",U,String(se||32768),async ue=>{if(ue)try{await ye(`/api/models/${encodeURIComponent(ee)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(ue,10)})}),B()}catch(be){c("Fehler",`Kontext setzen fehlgeschlagen: ${be.message||be}`)}},void 0,me?{autoValue:String(me.ctx),autoLabel:`Auto (${(me.ctx/1024).toFixed(0)}k)`}:void 0)}async function D(ee){const se=p.find(me=>me.name===ee);if(se&&b(se.role)){c("Geschützt",`„${dt(se.role).label}" kann nicht gelöscht werden. Weise die Rolle zuerst einem anderen Modell zu.`);return}u("Modell löschen?",`„${Ga(ee)}" und alle GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await ye(`/api/models/${encodeURIComponent(ee)}`,{method:"DELETE"}),N===ee&&E(null),B()}catch(me){c("Fehler",`Löschen fehlgeschlagen: ${me.message||me}`)}})}return r?s.jsx("div",{className:"py-16 text-center text-xs text-muted-foreground",children:"Werkbank wird geladen …"}):n?s.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 (",String(n),")."]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(_L,{running:$,capacityBytes:ve,realUsedBytes:W,selected:N,onSelect:E}),s.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)]",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-4 shadow-lg shadow-black/15 backdrop-blur-md",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(rl,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"}),s.jsx("input",{value:C,onChange:ee=>A(ee.target.value),placeholder:"Modell suchen …",className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 pl-8 pr-2 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-primary/50 focus:outline-none"})]}),s.jsx("div",{className:"flex rounded-lg border border-border/40 bg-background/30 p-0.5",children:["all","in_use"].map(ee=>s.jsx("button",{onClick:()=>O(ee),className:J("rounded-md px-2 py-1 text-[9px] font-bold uppercase transition-all cursor-pointer",_===ee?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:ee==="all"?"Alle":"In Benutzung"},ee))})]}),s.jsx("div",{className:"max-h-[60vh] space-y-1.5 overflow-y-auto scrollbar-thin pr-1",children:de.length===0?s.jsx("div",{className:"rounded-xl border border-dashed border-border/50 p-8 text-center text-xs text-muted-foreground",children:"Keine Modelle."}):de.map(ee=>{const se=v.includes(ee.name),me=N===ee.name,U=pf(ee.name),ue=gf(ee.role);return s.jsxs("button",{onClick:()=>E(ee.name),className:J("flex w-full items-center gap-2.5 rounded-xl border p-2.5 text-left transition-all cursor-pointer",me?"border-primary/60 bg-primary/10":"border-border/40 bg-background/20 hover:border-primary/30 hover:bg-background/40"),children:[s.jsx("span",{className:J("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border text-[10px] font-bold",U.color),children:U.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-mono text-xs font-semibold text-foreground",children:Ga(ee.name)}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[ee.role&&s.jsx("span",{className:J("h-2 w-2 rounded-sm",ue.dot)}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:ee.role?dt(ee.role).short:"keine Rolle"}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:["· ",lr(ee.size_bytes)]})]})]}),se?s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[9px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]}):ee.incomplete?s.jsx("span",{className:"shrink-0 text-[9px] font-bold uppercase text-amber-400",children:"⚠ fehlt"}):s.jsx("span",{className:"shrink-0 text-[9px] font-semibold uppercase text-muted-foreground/50",children:"bereit"})]},ee.name)})})]}),s.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 p-5 shadow-lg shadow-black/15 backdrop-blur-md",children:ge?s.jsx(IL,{m:ge,warm:v.includes(ge.name),expert:m,protectedRole:b(ge.role),coresident:k(ge.name),onLoad:()=>ie(ge.name),onUnload:()=>X(ge.name),onRole:ee=>te(ee,ge.name),onCtx:()=>re(ge.name,ge.ctx),onSpec:()=>F(ge),onDelete:()=>D(ge.name)}):s.jsxs("div",{className:"flex h-full min-h-[16rem] flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[s.jsx(yi,{className:"h-8 w-8 opacity-40"}),s.jsx("p",{className:"text-sm font-semibold",children:"Links ein Modell wählen"}),s.jsx("p",{className:"text-xs",children:"Dann verwaltest du es hier — laden, Rolle, Kontext, löschen."})]})})]}),T&&s.jsx(pE,{model:T,onClose:()=>F(null),onChanged:B}),h]})}function IL({m:e,warm:t,expert:r,protectedRole:n,coresident:i,onLoad:o,onUnload:c,onRole:u,onCtx:f,onSpec:h,onDelete:m}){const p=pf(e.name),v=t&&n;return s.jsxs("div",{className:"flex h-full flex-col gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:J("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border text-sm font-bold",p.color),children:p.initial}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"break-all font-mono text-sm font-bold text-foreground",children:Ga(e.name)}),s.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[e.role?s.jsx(mo,{role:e.role}):s.jsx("span",{className:"rounded border border-dashed border-border/50 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"keine Rolle"}),n&&s.jsxs("span",{className:"rounded bg-background/40 px-1.5 py-0.5 text-[10px] text-muted-foreground",title:"Lebenswichtig — geschützt",children:[s.jsx(u5,{className:"mr-0.5 inline h-3 w-3"}),"geschützt"]}),i&&s.jsxs("span",{className:"rounded border border-fuchsia-500/30 bg-fuchsia-500/10 px-1.5 py-0.5 text-[10px] font-bold uppercase text-fuchsia-300",children:[s.jsx(Sa,{className:"mr-0.5 inline h-3 w-3"}),"Ko-resident"]}),t&&s.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase text-emerald-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"warm"]})]})]})]}),s.jsxs("button",{onClick:t?c:o,disabled:e.incomplete&&!t||v,className:J("flex h-11 w-full items-center justify-center gap-2 rounded-xl border text-sm font-bold transition-all cursor-pointer disabled:cursor-not-allowed disabled:opacity-50",t?"border-amber-500/40 bg-amber-500/10 text-amber-300 hover:bg-amber-500/20":"border-primary/40 bg-primary/10 text-primary hover:bg-primary/20"),title:v?`„${dt(e.role).label}" bleibt geladen (geschützt).`:void 0,children:[t?s.jsx(mI,{className:"h-4 w-4"}):s.jsx(h5,{className:"h-4 w-4"}),v?"🔒 bleibt geladen":t?"Entladen":"Ins Warm-Set laden"]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Rolle"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(hk,{active:!e.role,onClick:()=>u(""),dot:"bg-slate-400",label:"keine"}),qx.map(b=>s.jsx(hk,{active:e.role===b.role,onClick:()=>u(b.role),dot:gf(b.role).dot,label:b.short},b.role))]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[s.jsx(TL,{icon:ga,label:"Größe",value:lr(e.size_bytes)}),s.jsxs("button",{onClick:f,className:"group flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5 text-left transition-colors hover:border-primary/40 cursor-pointer",children:[s.jsx(f5,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:"Kontext · ändern"}),s.jsx("div",{className:"font-semibold text-foreground",children:Cv(e.ctx)})]})]})]}),s.jsxs("div",{className:"rounded-xl border border-border/30 bg-background/20 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Beschleuniger"}),r&&s.jsxs("button",{onClick:h,className:J("flex h-6 items-center gap-1 rounded-lg border px-2 text-[9px] font-bold uppercase transition-colors cursor-pointer",e.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":e.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),children:[s.jsx(wa,{className:"h-3 w-3"})," Spec"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.spec_active&&s.jsx(Ld,{tone:"emerald",label:"Spec-Decoding aktiv"}),!e.spec_active&&e.spec_draft_model&&s.jsx(Ld,{tone:"amber",label:"Spec inaktiv"}),e.prompt_cache&&s.jsx(Ld,{tone:"cyan",label:"Prompt-Cache"}),e.parallel_slots>1&&s.jsx(Ld,{tone:"violet",label:`${e.parallel_slots} Slots`}),!e.spec_active&&!e.spec_draft_model&&!e.prompt_cache&&e.parallel_slots<=1&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"keine aktiv"})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:s.jsx(Pv,{caps:e.capabilities})}),s.jsxs("button",{onClick:m,disabled:n,className:J("mt-auto flex h-9 items-center justify-center gap-1.5 rounded-lg border text-xs font-semibold transition-colors",n?"cursor-not-allowed border-border/30 text-muted-foreground/40":"border-red-500/30 text-red-400 hover:bg-red-500/10 cursor-pointer"),children:[s.jsx(Us,{className:"h-3.5 w-3.5"})," ",n?"geschützt — nicht löschbar":"Modell löschen"]})]})}function hk({active:e,onClick:t,dot:r,label:n}){return s.jsxs("button",{onClick:t,className:J("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[10px] font-semibold transition-all cursor-pointer",e?"border-primary/60 bg-primary/15 text-foreground":"border-border/40 bg-background/20 text-muted-foreground hover:border-primary/30"),children:[s.jsx("span",{className:J("h-2 w-2 rounded-sm",r)}),n,e&&s.jsx(Mt,{className:"h-3 w-3 text-primary"})]})}function TL({icon:e,label:t,value:r}){return s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/30 bg-background/20 p-2.5",children:[s.jsx(e,{className:"h-4 w-4 text-primary/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t}),s.jsx("div",{className:"font-semibold text-foreground",children:r})]})]})}function Ld({tone:e,label:t}){const r={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20",cyan:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",violet:"bg-violet-500/10 text-violet-400 border-violet-500/20"}[e];return s.jsx("span",{className:J("rounded border px-1.5 py-0.5 text-[10px] font-semibold",r),children:t})}const DL=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],LL=["fast","heavy","coder","vision","hermes","scout"],RL=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function mk(e){return RL.format(e)}function $L(){const{data:e}=Si(),t=(e==null?void 0:e.models)??[],[r,n]=x.useState(""),[i,o]=x.useState([]),[c,u]=x.useState(!1),[f,h]=x.useState(""),[m,p]=x.useState("popular"),[v,b]=x.useState(""),[S,w]=x.useState(null),[k,N]=x.useState([]),[E,C]=x.useState("Q4_K_M"),[A,_]=x.useState(""),[O,T]=x.useState(null),[F,B]=x.useState(!1),[$,q]=x.useState({});async function W(M){u(!0),h("");try{const Q=await ye(`/api/hf/search?q=${encodeURIComponent(M)}`);o(Q.results),Q.results.length||h("Keine Ergebnisse.")}catch(Q){h(`Suche fehlgeschlagen: ${Q}`)}finally{u(!1)}}x.useEffect(()=>{W("")},[]);function ve(M){p(M.key),n(""),W(M.q)}function de(){p(""),W(r)}async function ge(M,Q,ne){B(!1);try{const ae=await ye(`/api/fit?params_b=0&quant=${encodeURIComponent(Q)}&ctx=8192&name=${encodeURIComponent(M)}&role=${encodeURIComponent(ne)}`);T(ae)}catch{T(null)}}async function le(M){if(S===M){w(null);return}w(M),N([]),T(null),_(""),B(!1),h("Analysiere Repository…");try{const Q=await ye(`/api/hf/quants?repo=${encodeURIComponent(M)}`);N(Q.quants);const ne=Q.quants.includes("Q4_K_M")?"Q4_K_M":Q.quants[0]||"Q4_K_M";C(ne),h(Q.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),Q.quants.length&&ge(Q.repo,ne,"")}catch(Q){h(`Fehler: ${Q}`)}}function ie(){const M=v.trim();M&&(o(Q=>Q.some(ne=>ne.repo===M)?Q:[{repo:M,downloads:0,likes:0},...Q]),b(""),le(M))}const X=A?t.find(M=>(M.role||"").toLowerCase()===A):void 0;async function te(M){if((O==null?void 0:O.fit.level)==="too_tight"&&!F){B(!0);return}q(Q=>({...Q,[M]:"Starte…"}));try{await ye("/api/models/install",{method:"POST",body:JSON.stringify({repo:M,quant:E,role:A||void 0,jinja:!0})}),q(Q=>({...Q,[M]:"Download läuft"})),B(!1)}catch{q(ne=>({...ne,[M]:"Fehler"}))}}const re=M=>{var ne;const Q=((ne=M.split("/").pop())==null?void 0:ne.toLowerCase().replace(/-gguf$/i,""))||"";return Q.length>3&&t.some(ae=>ae.name.toLowerCase().includes(Q))},D=M=>M==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":M==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(rl,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),s.jsx("input",{value:r,onChange:M=>n(M.target.value),onKeyDown:M=>M.key==="Enter"&&de(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),s.jsx("button",{onClick:de,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:DL.map(M=>s.jsxs("button",{onClick:()=>ve(M),className:J("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",m===M.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[M.key==="popular"&&s.jsx(QM,{className:"h-3 w-3"}),M.label]},M.key))}),c?s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):s.jsxs("div",{className:"space-y-2",children:[i.map(M=>{const Q=S===M.repo,ne=re(M.repo),ae=M.repo.includes("/")?M.repo.split("/")[0]:"—",ee=M.repo.split("/").pop();return s.jsxs("div",{className:J("rounded-xl border bg-card/45 backdrop-blur-md transition-all",Q?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[s.jsxs("button",{onClick:()=>le(M.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:M.repo,children:ee}),ne&&s.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[s.jsx(Mt,{className:"h-2.5 w-2.5"})," installiert"]})]}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[s.jsx("span",{children:ae}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-3 w-3"})," ",mk(M.downloads)]}),M.likes>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(eI,{className:"h-3 w-3"})," ",mk(M.likes)]})]})]}),Q?s.jsx(r5,{className:"h-4 w-4 text-muted-foreground shrink-0"}):s.jsx(tl,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),Q&&s.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:k.length===0?s.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:f||"Lade Quants…"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),s.jsx("select",{value:E,onChange:se=>{C(se.target.value),ge(M.repo,se.target.value,A)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:k.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))}),s.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),s.jsxs("select",{value:A,onChange:se=>{_(se.target.value),ge(M.repo,E,se.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[s.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),LL.map(se=>s.jsx("option",{value:se,className:"bg-popover text-foreground",children:se},se))]}),s.jsx("button",{onClick:()=>te(M.repo),disabled:!!$[M.repo]&&$[M.repo]==="Download läuft",className:J("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",F?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:$[M.repo]?$[M.repo]:F?s.jsxs(s.Fragment,{children:[s.jsx(vr,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):s.jsxs(s.Fragment,{children:[s.jsx(Bs,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),O&&s.jsxs("div",{className:J("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",D(O.fit.level)),children:[s.jsx("span",{className:"font-bold uppercase tracking-wide",children:O.fit.text}),s.jsxs("span",{className:"font-mono opacity-90",children:["~",O.params_b,"B · ~",O.fit.req_gb," GB / ",O.sys_ram_gb," GB · ~",O.fit.tps," t/s"]}),O.fit.level!=="too_tight"?s.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(O.assigned_ctx/1024).toFixed(0),"k"]}):s.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),X&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-400",children:[s.jsx(vr,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),s.jsxs("span",{children:["Rolle ",s.jsxs("strong",{children:["„",A,'"']})," hält aktuell ",s.jsx("strong",{children:X.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},M.repo)}),!i.length&&!c&&s.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:f||"Keine Ergebnisse."})]}),s.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[s.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),s.jsx("input",{value:v,onChange:M=>b(M.target.value),onKeyDown:M=>M.key==="Enter"&&ie(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (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 font-mono"}),s.jsx("button",{onClick:ie,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:"Laden"})]})]})}const zL={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wa},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:Sa},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:Fs},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:Cc},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:LM},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:vv},kritiker:{title:"Kritisches Prüf-Hirn",desc:"Schärfer Blick für Fehler, Schwachstellen und Sicherheitslücken — denkt skeptisch, bevor du deployst.",icon:m5},reranker:{title:"Gedächtnis-Sortierer",desc:"Sortiert und gewichtet gespeicherte Fakten nach Relevanz — damit die richtige Info sofort da ist.",icon:rl}};function FL(){const{data:e,isLoading:t,error:r}=kL(),{data:n}=Si(),{data:i}=wh(),o=(n==null?void 0:n.models)??[],c=r?String(r):"",[u,f]=x.useState({}),[h,m]=x.useState({}),[p,v]=x.useState("recommended");async function b(S,w,k,N){f(E=>({...E,[S]:"Starte..."}));try{await ye("/api/models/install",{method:"POST",body:JSON.stringify({repo:S,role:w,quant:k,jinja:N})}),f(E=>({...E,[S]:"Download läuft"}))}catch{f(C=>({...C,[S]:"Fehler"}))}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([S,w])=>s.jsx("button",{onClick:()=>v(S),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",p===S?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:w},S))}),p==="browse"?s.jsx($L,{}):t?s.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):c||!e?s.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 (",c,")."]}):s.jsxs("div",{className:"space-y-8",children:[s.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:[s.jsxs("div",{children:["Modell-Registry geladen für ",s.jsxs("span",{className:"text-foreground font-bold",children:[e.sys_ram_gb," GB"]})," System-RAM."]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(jI,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),s.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),s.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:e.categories.map(S=>{const w=zL[S.role]||{title:S.title||S.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:l5},k=w.icon,N=o.find(T=>T.role===S.role||(T.aliases||[]).includes(S.role)),E=i==null?void 0:i.model_list.find(T=>T.role===S.role),C=S.models.find(T=>T.repo===S.recommended)||S.models[0];if(!C)return null;const A=u[C.repo],_=S.models.filter(T=>T.repo!==S.recommended),O=!!h[S.role];return s.jsxs("div",{className:J("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",N?"border-border/60":"border-primary/20 shadow-primary/5"),children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:s.jsx(k,{className:"h-5.5 w-5.5"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:w.title}),s.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: ",S.role]})]})]}),N?s.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:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):s.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"})]}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:w.desc}),s.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:N?s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:N.name,children:N.name.split("/").pop()}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[s.jsxs("span",{children:["Größe: ",Av(N.size_bytes||0)]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",N.quant||"GGUF"]})]})]}):s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),s.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:C.name,children:C.name}),s.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{children:["Ersteller: ",C.author]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Quant: ",C.quant]})]}),s.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:s.jsx(PL,{fit:C.fit})})]})}),s.jsx("div",{className:"pt-1",children:N?E?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),s.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),s.jsxs("button",{onClick:()=>b(E.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!u[E.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:[s.jsx(Bs,{className:"h-3.5 w-3.5"}),u[E.repo]||"Auf neue Version aktualisieren"]})]}):s.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:[s.jsx(Mt,{className:"h-4 w-4"})," Auf neuestem Stand"]}):s.jsxs("button",{onClick:()=>b(C.repo,S.role,C.quant||"Q4_K_M",C.caps.tools!=="no"),disabled:!!A,className:J("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",A?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[s.jsx(Bs,{className:"h-3.5 w-3.5"}),A||"Optimales Modell einsetzen"]})})]}),_.length>0&&s.jsxs("div",{className:"border-t border-border/20 pt-3",children:[s.jsxs("button",{onClick:()=>m(T=>({...T,[S.role]:!O})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[O?s.jsx(r5,{className:"h-3 w-3"}):s.jsx(tl,{className:"h-3 w-3"}),s.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",_.length,")"]})]}),O&&s.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:_.map(T=>s.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),s.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[s.jsxs("span",{children:["Quant: ",T.quant]}),s.jsx("span",{children:"•"}),s.jsx("span",{children:T.fit.text})]})]}),s.jsx("button",{onClick:()=>b(T.repo,S.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!u[T.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:u[T.repo]||"Installieren"})]},T.repo))})]})]},S.role)})})]})]})}function BL(){const[e,t]=x.useState("cockpit");return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[s.jsxs("div",{children:[s.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"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),s.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(r=>s.jsx("button",{onClick:()=>t(r),className:J("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",e===r?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:r==="cockpit"?"Werkbank":"Modelle finden"},r))})]}),s.jsx(EL,{}),s.jsx("div",{className:"transition-all duration-300",children:e==="cockpit"?s.jsx(ML,{}):s.jsx(FL,{})})]})}const pk={hermes_desktop:"Hermes Desktop: Browser-Login",kilo:"Kilo: Einstellungen → API Provider",claude_code:"env / Übersetzer"};function vg({line:e,loading:t}){return t||!e?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[s.jsx(Bt,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):e.ok?s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[s.jsx(n5,{className:"h-3 w-3"})," ",e.detail]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[s.jsx(UM,{className:"h-3 w-3"})," ",e.detail]})}function xg({tool:e,fileName:t,accent:r,copied:n,onCopy:i}){return s.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[s.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),s.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),s.jsx("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:s.jsx("span",{children:t})}),s.jsxs("button",{onClick:i,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:[n?s.jsx(Mt,{className:"h-3.5 w-3.5 text-emerald-400"}):s.jsx(xv,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:n?"Kopiert":"Kopieren"})]})]}),s.jsx("pre",{className:J("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",r==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:s.jsx("code",{children:e.snippet})})]})}function gE(){const[e,t]=x.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[r,n]=x.useState(localStorage.getItem("mc_mcp_path")||""),[i,o]=x.useState("kilo"),[c,u]=x.useState(!1),[f,h]=x.useState(null),m=new URLSearchParams({host:e});r&&m.set("mcp_path",r);const{data:p,error:v}=SL(m.toString()),{data:b,isLoading:S}=hE(),w=v?String(v):"";function k(_){t(_),_&&localStorage.setItem("mc_host",_)}function N(_){n(_),localStorage.setItem("mc_mcp_path",_)}const E=p==null?void 0:p.tools.hermes_desktop,C=p==null?void 0:p.tools[i];async function A(_,O){O&&(await navigator.clipboard.writeText(O),h(_),setTimeout(()=>h(null),1500))}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.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"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:"Hermes Desktop"})," ist die Tür zur Box — einmal verbinden, fertig. Für Spezialfälle gibt es darunter die rohen Leitungen (Gateway /v1 + Gedächtnis-MCP) für sonstige Tools."]})]}),s.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[s.jsx(og,{className:"h-7 w-7 mx-auto text-muted-foreground"}),s.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),s.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Hermes Desktop · Kilo Code · Claude Code …"})]}),s.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[s.jsx(yi,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),s.jsx(vg,{line:b==null?void 0:b.gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[s.jsx(Sa,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),s.jsx(vg,{line:b==null?void 0:b.memory,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wc,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 rounded-xl border border-emerald-500/25 bg-emerald-500/5 px-3.5 py-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-emerald-300",children:[s.jsx(og,{className:"h-3.5 w-3.5"})," Leitung 3 — Desktop-Gateway"]}),s.jsx(vg,{line:b==null?void 0:b.desktop_gateway,loading:S})]}),s.jsx("div",{className:"mt-1 text-[11px] font-mono text-emerald-300/80",children:"Desktop-Gateway · :9119 · API-Status"})]})]})]})]}),s.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",s.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",s.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," und das Desktop-Gateway bietet die Agenten-Schnittstelle — alle drei Leitungen werden unabhängig eingerichtet."]})]}),s.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:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(XM,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),s.jsx("input",{value:e,onChange:_=>k(_.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,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"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[s.jsx(a5,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",s.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),s.jsx("input",{value:r,onChange:_=>N(_.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,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-violet-500/50 text-foreground"})]})]}),w&&s.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: ",w]}),p&&s.jsxs("div",{className:"space-y-5",children:[E&&s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-emerald-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx(og,{className:"h-4 w-4 text-emerald-400"}),"Hermes Desktop anbinden",s.jsx("span",{className:"text-[10px] font-medium text-emerald-400/90 normal-case",children:"der Hauptweg"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Die Desktop-App dockt remote an die Box an — volle Agent-Oberfläche, Projekte, Review, Gedächtnis inklusive."})]}),E.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-emerald-400 shrink-0 mt-0.5"}),s.jsx("span",{children:E.note})]}),s.jsx(xg,{tool:E,fileName:pk.hermes_desktop,accent:"teal",copied:f==="desktop",onCopy:()=>A("desktop",E.snippet)})]}),s.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/30",children:[s.jsxs("button",{onClick:()=>u(_=>!_),className:"flex w-full items-center gap-2 p-4 text-sm font-space font-bold text-foreground cursor-pointer hover:text-primary transition-colors",children:[c?s.jsx(tl,{className:"h-4 w-4"}):s.jsx(Kn,{className:"h-4 w-4"}),"Sonstige Tools (roher /v1-Zugang + Gedächtnis-MCP)",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"Kilo Code · Claude Code · Eigenbau"})]}),c&&s.jsxs("div",{className:"grid gap-5 lg:grid-cols-2 p-4 pt-0",children:[s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(p.tools).filter(([_])=>_!=="hermes_desktop").map(([_,O])=>s.jsx("button",{onClick:()=>o(_),className:J("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===_?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:O.label},_))}),C&&s.jsxs(s.Fragment,{children:[C.note&&s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:C.note})]}),s.jsx(xg,{tool:C,fileName:pk[i]||"config.json",accent:"teal",copied:f==="model",onCopy:()=>A("model",C.snippet)})]})]}),s.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",s.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",s.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[s.jsx(ag,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),s.jsx("span",{children:p.memory.note})]}),s.jsx(xg,{tool:p.memory,fileName:"mcp.json",accent:"violet",copied:f==="memory",onCopy:()=>A("memory",p.memory.snippet)})]})]})]})]})]})}const UL="modulepreload",WL=function(e){return"/"+e},gk={},HL=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=c(r.map(h=>{if(h=WL(h),h in gk)return;gk[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":UL,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((b,S)=>{v.addEventListener("load",b),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return i.then(c=>{for(const u of c||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};class vk extends x.Component{constructor(){super(...arguments);ns(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?s.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[s.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),s.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const xk=x.lazy(()=>HL(()=>import("./GraphView-CU6ClVtS.js"),[]).then(e=>({default:e.GraphView}))),Rd=["identity","knowledge","rules","events"],yk=new Set(["auto","agent","hermes"]),yg={identity:{label:"Identität",icon:NI,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:nl,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:xI,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:mh,bg:"bg-amber-500/10",text:"text-amber-400"}},bk={label:"Gedächtnis",icon:gv,text:"text-muted-foreground"},KL={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},wk=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: 1) wer ich bin und woran ich gerade arbeite, 2) wie ich angesprochen werden möchte, 3) meine bevorzugten Tools, Sprachen und Arbeitsweise, diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 4a7b614..18e2fa9 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/views/GraphView.tsx b/frontend/src/views/GraphView.tsx index ffe2230..c9bce80 100644 --- a/frontend/src/views/GraphView.tsx +++ b/frontend/src/views/GraphView.tsx @@ -155,11 +155,13 @@ export function GraphView({ data, selectedNodeId, onNodeSelect }: { backgroundColor="rgba(0,0,0,0)" cooldownTicks={120} - // Ultraschneller, statischer Klick- & Hover-Puffer auf dem Hit-Canvas (verhindert teure Echtzeitrechnungen) + // Exakte Hit-Map auf unsichtbarem Canvas proportional zur visuellen Knotengröße zeichnen (inkl. 5px Puffer) nodePointerAreaPaint={(node: any, color: string, ctx: CanvasRenderingContext2D) => { ctx.fillStyle = color ctx.beginPath() - ctx.arc(node.x ?? 0, node.y ?? 0, 16, 0, 2 * Math.PI, false) + const nId = typeof node === "object" ? node.id : node + const size = 6 + Math.min(degree[nId] || 0, 15) * 0.8 + ctx.arc(node.x ?? 0, node.y ?? 0, size + 5, 0, 2 * Math.PI, false) ctx.fill() }}