217 lines
813 KiB
JavaScript
217 lines
813 KiB
JavaScript
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const d of a.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(o){if(o.ep)return;o.ep=!0;const a=s(o);fetch(o.href,a)}})();const Ot={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Al(this.context.count)},getNextContextId(){return Al(this.context.count++)}};function Al(e){const r=String(e),s=r.length-1;return Ot.context.id+(s?String.fromCharCode(96+s):"")+r}function En(e){Ot.context=e}const Oi=!1,Po=(e,r)=>e===r,vn=Symbol("solid-proxy"),Li=typeof Proxy=="function",oa=Symbol("solid-track"),da={equals:Po};let Ds=null,Ri=Bi;const mn=1,Os=2,Ii={owned:null,cleanups:null,context:null,owner:null},Ma={};var qt=null;let ot=null,Eo=null,dr=null,Wr=null,jr=null,va=0;function On(e,r){const s=dr,l=qt,o=e.length===0,a=r===void 0?l:r,d=o?Ii:{owned:null,cleanups:null,context:a?a.context:null,owner:a},c=o?e:()=>e(()=>Fr(()=>qn(d)));qt=d,dr=null;try{return cn(c,!0)}finally{dr=s,qt=l}}function Z(e,r){r=r?Object.assign({},da,r):da;const s={value:e,observers:null,observerSlots:null,comparator:r.equals||void 0},l=o=>(typeof o=="function"&&(ot&&ot.running&&ot.sources.has(s)?o=o(s.tValue):o=o(s.value)),Ui(s,o));return[Hi.bind(s),l]}function Dl(e,r,s){const l=Hs(e,r,!0,mn);ms(l)}function q(e,r,s){const l=Hs(e,r,!1,mn);ms(l)}function ft(e,r,s){Ri=jo;const l=Hs(e,r,!1,mn),o=ts&&Rn(ts);o&&(l.suspense=o),(!s||!s.render)&&(l.user=!0),jr?jr.push(l):ms(l)}function pe(e,r,s){s=s?Object.assign({},da,s):da;const l=Hs(e,r,!0,0);return l.observers=null,l.observerSlots=null,l.comparator=s.equals||void 0,ms(l),Hi.bind(l)}function No(e){return e&&typeof e=="object"&&"then"in e}function Oo(e,r,s){let l,o,a;l=!0,o=e,a={};let d=null,c=Ma,g=null,b=!1,p=!1,m="initialValue"in a,S=typeof l=="function"&&pe(l);const z=new Set,[ie,ne]=(a.storage||Z)(a.initialValue),[W,X]=Z(void 0),[I,L]=Z(void 0,{equals:!1}),[H,se]=Z(m?"ready":"unresolved");Ot.context&&(g=Ot.getNextContextId(),a.ssrLoadFrom==="initial"?c=a.initialValue:Ot.load&&Ot.has(g)&&(c=Ot.load(g)));function le(_,B,$,D){return d===_&&(d=null,D!==void 0&&(m=!0),(_===c||B===c)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(D,{value:B})),c=Ma,ot&&_&&b?(ot.promises.delete(_),b=!1,cn(()=>{ot.running=!0,ee(B,$)},!1)):ee(B,$)),B}function ee(_,B){cn(()=>{B===void 0&&ne(()=>_),se(B!==void 0?"errored":m?"ready":"unresolved"),X(B);for(const $ of z.keys())$.decrement();z.clear()},!1)}function U(){const _=ts&&Rn(ts),B=ie(),$=W();if($!==void 0&&!d)throw $;return dr&&!dr.user&&_&&Dl(()=>{I(),d&&(_.resolved&&ot&&b?ot.promises.add(d):z.has(_)||(_.increment(),z.add(_)))}),B}function Y(_=!0){if(_!==!1&&p)return;p=!1;const B=S?S():l;if(b=ot&&ot.running,B==null||B===!1){le(d,Fr(ie));return}ot&&d&&ot.promises.delete(d);let $;const D=c!==Ma?c:Fr(()=>{try{return o(B,{value:ie(),refetching:_})}catch(f){$=f}});if($!==void 0){le(d,void 0,ra($),B);return}else if(!No(D))return le(d,D,void 0,B),D;return d=D,"v"in D?(D.s===1?le(d,D.v,void 0,B):le(d,void 0,ra(D.v),B),D):(p=!0,queueMicrotask(()=>p=!1),cn(()=>{se(m?"refreshing":"pending"),L()},!1),D.then(f=>le(D,f,void 0,B),f=>le(D,void 0,ra(f),B)))}Object.defineProperties(U,{state:{get:()=>H()},error:{get:()=>W()},loading:{get(){const _=H();return _==="pending"||_==="refreshing"}},latest:{get(){if(!m)return U();const _=W();if(_&&!d)throw _;return ie()}}});let oe=qt;return S?Dl(()=>(oe=qt,Y(!1))):Y(!1),[U,{refetch:_=>ka(oe,()=>Y(_)),mutate:ne}]}function Lo(e){return cn(e,!1)}function Fr(e){if(dr===null)return e();const r=dr;dr=null;try{return e()}finally{dr=r}}function Wn(e,r,s){const l=Array.isArray(e);let o;return a=>{let d;if(l){d=Array(e.length);for(let g=0;g<e.length;g++)d[g]=e[g]()}else d=e();const c=Fr(()=>r(d,o,a));return o=d,c}}function vr(e){ft(()=>Fr(e))}function Ar(e){return qt===null||(qt.cleanups===null?qt.cleanups=[e]:qt.cleanups.push(e)),e}function Ro(e,r){Ds||(Ds=Symbol("error")),qt=Hs(void 0,void 0,!0),qt.context={...qt.context,[Ds]:[r]},ot&&ot.running&&ot.sources.add(qt);try{return e()}catch(s){Us(s)}finally{qt=qt.owner}}function rl(){return dr}function Ls(){return qt}function ka(e,r){const s=qt,l=dr;qt=e,dr=null;try{return cn(r,!0)}catch(o){Us(o)}finally{qt=s,dr=l}}function Io(e){if(ot&&ot.running)return e(),ot.done;const r=dr,s=qt;return Promise.resolve().then(()=>{dr=r,qt=s;let l;return ts&&(l=ot||(ot={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),l.done||(l.done=new Promise(o=>l.resolve=o)),l.running=!0),cn(e,!1),dr=qt=null,l?l.done:void 0})}const[Fw,Ml]=Z(!1);function Ho(e){jr.push.apply(jr,e),e.length=0}function fs(e,r){const s=Symbol("context");return{id:s,Provider:Fo(s),defaultValue:e}}function Rn(e){let r;return qt&&qt.context&&(r=qt.context[e.id])!==void 0?r:e.defaultValue}function pl(e){const r=pe(e),s=pe(()=>nl(r()));return s.toArray=()=>{const l=s();return Array.isArray(l)?l:l!=null?[l]:[]},s}let ts;function Uo(){return ts||(ts=fs())}function Hi(){const e=ot&&ot.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===mn)ms(this);else{const r=Wr;Wr=null,cn(()=>ua(this),!1),Wr=r}if(dr){const r=this.observers?this.observers.length:0;dr.sources?(dr.sources.push(this),dr.sourceSlots.push(r)):(dr.sources=[this],dr.sourceSlots=[r]),this.observers?(this.observers.push(dr),this.observerSlots.push(dr.sources.length-1)):(this.observers=[dr],this.observerSlots=[dr.sources.length-1])}return e&&ot.sources.has(this)?this.tValue:this.value}function Ui(e,r,s){let l=ot&&ot.running&&ot.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(l,r)){if(ot){const o=ot.running;(o||!s&&ot.sources.has(e))&&(ot.sources.add(e),e.tValue=r),o||(e.value=r)}else e.value=r;e.observers&&e.observers.length&&cn(()=>{for(let o=0;o<e.observers.length;o+=1){const a=e.observers[o],d=ot&&ot.running;d&&ot.disposed.has(a)||((d?!a.tState:!a.state)&&(a.pure?Wr.push(a):jr.push(a),a.observers&&ji(a)),d?a.tState=mn:a.state=mn)}if(Wr.length>1e6)throw Wr=[],new Error},!1)}return r}function ms(e){if(!e.fn)return;qn(e);const r=va;Pl(e,ot&&ot.running&&ot.sources.has(e)?e.tValue:e.value,r),ot&&!ot.running&&ot.sources.has(e)&&queueMicrotask(()=>{cn(()=>{ot&&(ot.running=!0),dr=qt=e,Pl(e,e.tValue,r),dr=qt=null},!1)})}function Pl(e,r,s){let l;const o=qt,a=dr;dr=qt=e;try{l=e.fn(r)}catch(d){return e.pure&&(ot&&ot.running?(e.tState=mn,e.tOwned&&e.tOwned.forEach(qn),e.tOwned=void 0):(e.state=mn,e.owned&&e.owned.forEach(qn),e.owned=null)),e.updatedAt=s+1,Us(d)}finally{dr=a,qt=o}(!e.updatedAt||e.updatedAt<=s)&&(e.updatedAt!=null&&"observers"in e?Ui(e,l,!0):ot&&ot.running&&e.pure?(ot.sources.add(e),e.tValue=l):e.value=l,e.updatedAt=s)}function Hs(e,r,s,l=mn,o){const a={fn:e,state:l,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:r,owner:qt,context:qt?qt.context:null,pure:s};return ot&&ot.running&&(a.state=0,a.tState=l),qt===null||qt!==Ii&&(ot&&ot.running&&qt.pure?qt.tOwned?qt.tOwned.push(a):qt.tOwned=[a]:qt.owned?qt.owned.push(a):qt.owned=[a]),a}function ca(e){const r=ot&&ot.running;if((r?e.tState:e.state)===0)return;if((r?e.tState:e.state)===Os)return ua(e);if(e.suspense&&Fr(e.suspense.inFallback))return e.suspense.effects.push(e);const s=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<va);){if(r&&ot.disposed.has(e))return;(r?e.tState:e.state)&&s.push(e)}for(let l=s.length-1;l>=0;l--){if(e=s[l],r){let o=e,a=s[l+1];for(;(o=o.owner)&&o!==a;)if(ot.disposed.has(o))return}if((r?e.tState:e.state)===mn)ms(e);else if((r?e.tState:e.state)===Os){const o=Wr;Wr=null,cn(()=>ua(e,s[0]),!1),Wr=o}}}function cn(e,r){if(Wr)return e();let s=!1;r||(Wr=[]),jr?s=!0:jr=[],va++;try{const l=e();return Bo(s),l}catch(l){s||(jr=null),Wr=null,Us(l)}}function Bo(e){if(Wr&&(Bi(Wr),Wr=null),e)return;let r;if(ot){if(!ot.promises.size&&!ot.queue.size){const l=ot.sources,o=ot.disposed;jr.push.apply(jr,ot.effects),r=ot.resolve;for(const a of jr)"tState"in a&&(a.state=a.tState),delete a.tState;ot=null,cn(()=>{for(const a of o)qn(a);for(const a of l){if(a.value=a.tValue,a.owned)for(let d=0,c=a.owned.length;d<c;d++)qn(a.owned[d]);a.tOwned&&(a.owned=a.tOwned),delete a.tValue,delete a.tOwned,a.tState=0}Ml(!1)},!1)}else if(ot.running){ot.running=!1,ot.effects.push.apply(ot.effects,jr),jr=null,Ml(!0);return}}const s=jr;jr=null,s.length&&cn(()=>Ri(s),!1),r&&r()}function Bi(e){for(let r=0;r<e.length;r++)ca(e[r])}function jo(e){let r,s=0;for(r=0;r<e.length;r++){const l=e[r];l.user?e[s++]=l:ca(l)}if(Ot.context){if(Ot.count){Ot.effects||(Ot.effects=[]),Ot.effects.push(...e.slice(0,s));return}En()}for(Ot.effects&&(Ot.done||!Ot.count)&&(e=[...Ot.effects,...e],s+=Ot.effects.length,delete Ot.effects),r=0;r<s;r++)ca(e[r])}function ua(e,r){const s=ot&&ot.running;s?e.tState=0:e.state=0;for(let l=0;l<e.sources.length;l+=1){const o=e.sources[l];if(o.sources){const a=s?o.tState:o.state;a===mn?o!==r&&(!o.updatedAt||o.updatedAt<va)&&ca(o):a===Os&&ua(o,r)}}}function ji(e){const r=ot&&ot.running;for(let s=0;s<e.observers.length;s+=1){const l=e.observers[s];(r?!l.tState:!l.state)&&(r?l.tState=Os:l.state=Os,l.pure?Wr.push(l):jr.push(l),l.observers&&ji(l))}}function qn(e){let r;if(e.sources)for(;e.sources.length;){const s=e.sources.pop(),l=e.sourceSlots.pop(),o=s.observers;if(o&&o.length){const a=o.pop(),d=s.observerSlots.pop();l<o.length&&(a.sourceSlots[d]=l,o[l]=a,s.observerSlots[l]=d)}}if(e.tOwned){for(r=e.tOwned.length-1;r>=0;r--)qn(e.tOwned[r]);delete e.tOwned}if(ot&&ot.running&&e.pure)Fi(e,!0);else if(e.owned){for(r=e.owned.length-1;r>=0;r--)qn(e.owned[r]);e.owned=null}if(e.cleanups){for(r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}ot&&ot.running?e.tState=0:e.state=0}function Fi(e,r){if(r||(e.tState=0,ot.disposed.add(e)),e.owned)for(let s=0;s<e.owned.length;s++)Fi(e.owned[s])}function ra(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function El(e,r,s){try{for(const l of r)l(e)}catch(l){Us(l,s&&s.owner||null)}}function Us(e,r=qt){const s=Ds&&r&&r.context&&r.context[Ds],l=ra(e);if(!s)throw l;jr?jr.push({fn(){El(l,s,r)},state:mn}):El(l,s,r)}function nl(e){if(typeof e=="function"&&!e.length)return nl(e());if(Array.isArray(e)){const r=[];for(let s=0;s<e.length;s++){const l=nl(e[s]);Array.isArray(l)?r.push.apply(r,l):r.push(l)}return r}return e}function Fo(e,r){return function(l){let o;return q(()=>o=Fr(()=>(qt.context={...qt.context,[e]:l.value},pl(()=>l.children))),void 0),o}}const sl=Symbol("fallback");function ga(e){for(let r=0;r<e.length;r++)e[r]()}function Vo(e,r,s={}){let l=[],o=[],a=[],d=0,c=r.length>1?[]:null;return Ar(()=>ga(a)),()=>{let g=e()||[],b=g.length,p,m;return g[oa],Fr(()=>{let z,ie,ne,W,X,I,L,H,se;if(b===0)d!==0&&(ga(a),a=[],l=[],o=[],d=0,c&&(c=[])),s.fallback&&(l=[sl],o[0]=On(le=>(a[0]=le,s.fallback())),d=1);else if(d===0){for(o=new Array(b),m=0;m<b;m++)l[m]=g[m],o[m]=On(S);d=b}else{for(ne=new Array(b),W=new Array(b),c&&(X=new Array(b)),I=0,L=Math.min(d,b);I<L&&l[I]===g[I];I++);for(L=d-1,H=b-1;L>=I&&H>=I&&l[L]===g[H];L--,H--)ne[H]=o[L],W[H]=a[L],c&&(X[H]=c[L]);for(z=new Map,ie=new Array(H+1),m=H;m>=I;m--)se=g[m],p=z.get(se),ie[m]=p===void 0?-1:p,z.set(se,m);for(p=I;p<=L;p++)se=l[p],m=z.get(se),m!==void 0&&m!==-1?(ne[m]=o[p],W[m]=a[p],c&&(X[m]=c[p]),m=ie[m],z.set(se,m)):a[p]();for(m=I;m<b;m++)m in ne?(o[m]=ne[m],a[m]=W[m],c&&(c[m]=X[m],c[m](m))):o[m]=On(S);o=o.slice(0,d=b),l=g.slice(0)}return o});function S(z){if(a[m]=z,c){const[ie,ne]=Z(m);return c[m]=ne,r(g[m],ie)}return r(g[m])}}}function Go(e,r,s={}){let l=[],o=[],a=[],d=[],c=0,g;return Ar(()=>ga(a)),()=>{const b=e()||[],p=b.length;return b[oa],Fr(()=>{if(p===0)return c!==0&&(ga(a),a=[],l=[],o=[],c=0,d=[]),s.fallback&&(l=[sl],o[0]=On(S=>(a[0]=S,s.fallback())),c=1),o;for(l[0]===sl&&(a[0](),a=[],l=[],o=[],c=0),g=0;g<p;g++)g<l.length&&l[g]!==b[g]?d[g](()=>b[g]):g>=l.length&&(o[g]=On(m));for(;g<l.length;g++)a[g]();return c=d.length=a.length=p,l=b.slice(0),o=o.slice(0,c)});function m(S){a[g]=S;const[z,ie]=Z(b[g]);return d[g]=ie,r(z,g)}}}function n(e,r){return Fr(()=>e(r||{}))}function Ws(){return!0}const al={get(e,r,s){return r===vn?s:e.get(r)},has(e,r){return r===vn?!0:e.has(r)},set:Ws,deleteProperty:Ws,getOwnPropertyDescriptor(e,r){return{configurable:!0,enumerable:!0,get(){return e.get(r)},set:Ws,deleteProperty:Ws}},ownKeys(e){return e.keys()}};function Pa(e){return(e=typeof e=="function"?e():e)?e:{}}function zo(){for(let e=0,r=this.length;e<r;++e){const s=this[e]();if(s!==void 0)return s}}function kr(...e){let r=!1;for(let d=0;d<e.length;d++){const c=e[d];r=r||!!c&&vn in c,e[d]=typeof c=="function"?(r=!0,pe(c)):c}if(Li&&r)return new Proxy({get(d){for(let c=e.length-1;c>=0;c--){const g=Pa(e[c])[d];if(g!==void 0)return g}},has(d){for(let c=e.length-1;c>=0;c--)if(d in Pa(e[c]))return!0;return!1},keys(){const d=[];for(let c=0;c<e.length;c++)d.push(...Object.keys(Pa(e[c])));return[...new Set(d)]}},al);const s={},l=Object.create(null);for(let d=e.length-1;d>=0;d--){const c=e[d];if(!c)continue;const g=Object.getOwnPropertyNames(c);for(let b=g.length-1;b>=0;b--){const p=g[b];if(p==="__proto__"||p==="constructor")continue;const m=Object.getOwnPropertyDescriptor(c,p);if(!l[p])l[p]=m.get?{enumerable:!0,configurable:!0,get:zo.bind(s[p]=[m.get.bind(c)])}:m.value!==void 0?m:void 0;else{const S=s[p];S&&(m.get?S.push(m.get.bind(c)):m.value!==void 0&&S.push(()=>m.value))}}}const o={},a=Object.keys(l);for(let d=a.length-1;d>=0;d--){const c=a[d],g=l[c];g&&g.get?Object.defineProperty(o,c,g):o[c]=g?g.value:void 0}return o}function rs(e,...r){if(Li&&vn in e){const o=new Set(r.length>1?r.flat():r[0]),a=r.map(d=>new Proxy({get(c){return d.includes(c)?e[c]:void 0},has(c){return d.includes(c)&&c in e},keys(){return d.filter(c=>c in e)}},al));return a.push(new Proxy({get(d){return o.has(d)?void 0:e[d]},has(d){return o.has(d)?!1:d in e},keys(){return Object.keys(e).filter(d=>!o.has(d))}},al)),a}const s={},l=r.map(()=>({}));for(const o of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,o),d=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let c=!1,g=0;for(const b of r)b.includes(o)&&(c=!0,d?l[g][o]=a.value:Object.defineProperty(l[g],o,a)),++g;c||(d?s[o]=a.value:Object.defineProperty(s,o,a))}return[...l,s]}function Wo(e){let r,s;const l=o=>{const a=Ot.context;if(a){const[c,g]=Z();Ot.count||(Ot.count=0),Ot.count++,(s||(s=e())).then(b=>{!Ot.done&&En(a),Ot.count--,g(()=>b.default),En()}),r=c}else if(!r){const[c]=Oo(()=>(s||(s=e())).then(g=>g.default));r=c}let d;return pe(()=>(d=r())?Fr(()=>{if(!a||Ot.done)return d(o);const c=Ot.context;En(a);const g=d(o);return En(c),g}):"")};return l.preload=()=>s||((s=e()).then(o=>r=()=>o.default),s),l}const qo=e=>`Stale read from <${e}>.`;function ze(e){const r="fallback"in e&&{fallback:()=>e.fallback};return pe(Vo(()=>e.each,e.children,r||void 0))}function Nl(e){const r="fallback"in e&&{fallback:()=>e.fallback};return pe(Go(()=>e.each,e.children,r||void 0))}function h(e){const r=e.keyed,s=pe(()=>e.when,void 0,void 0),l=r?s:pe(s,void 0,{equals:(o,a)=>!o==!a});return pe(()=>{const o=l();if(o){const a=e.children;return typeof a=="function"&&a.length>0?Fr(()=>a(r?o:()=>{if(!Fr(l))throw qo("Show");return s()})):a}return e.fallback},void 0,void 0)}let os;function Ol(){os&&[...os].forEach(e=>e())}function Ko(e){let r;Ot.context&&Ot.load&&(r=Ot.load(Ot.getContextId()));const[s,l]=Z(r,void 0);return os||(os=new Set),os.add(l),Ar(()=>os.delete(l)),pe(()=>{let o;if(o=s()){const a=e.fallback;return typeof a=="function"&&a.length?Fr(()=>a(o,()=>l())):a}return Ro(()=>e.children,l)},void 0,void 0)}const Jo=fs();function Qo(e){let r=0,s,l,o,a,d;const[c,g]=Z(!1),b=Uo(),p={increment:()=>{++r===1&&g(!0)},decrement:()=>{--r===0&&g(!1)},inFallback:c,effects:[],resolved:!1},m=Ls();if(Ot.context&&Ot.load){const ie=Ot.getContextId();let ne=Ot.load(ie);if(ne&&(typeof ne!="object"||ne.s!==1?o=ne:Ot.gather(ie)),o&&o!=="$$f"){const[W,X]=Z(void 0,{equals:!1});a=W,o.then(()=>{if(Ot.done)return X();Ot.gather(ie),En(l),X(),En()},I=>{d=I,X()})}}const S=Rn(Jo);S&&(s=S.register(p.inFallback));let z;return Ar(()=>z&&z()),n(b.Provider,{value:p,get children(){return pe(()=>{if(d)throw d;if(l=Ot.context,a)return a(),a=void 0;l&&o==="$$f"&&En();const ie=pe(()=>e.children);return pe(ne=>{const W=p.inFallback(),{showContent:X=!0,showFallback:I=!0}=s?s():{};if((!W||o&&o!=="$$f")&&X)return p.resolved=!0,z&&z(),z=l=o=void 0,Ho(p.effects),ie();if(I)return z?ne:On(L=>(z=L,l&&(En({id:l.id+"F",count:0}),l=void 0),e.fallback),m)})})}})}const Yo=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Xo=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline",...Yo]),Zo=new Set(["innerHTML","textContent","innerText","children"]),ed=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),td=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function rd(e,r){const s=td[e];return typeof s=="object"?s[r]?s.$:void 0:s}const nd=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),sd=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),ad={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},$e=e=>pe(()=>e());function ld(e,r,s){let l=s.length,o=r.length,a=l,d=0,c=0,g=r[o-1].nextSibling,b=null;for(;d<o||c<a;){if(r[d]===s[c]){d++,c++;continue}for(;r[o-1]===s[a-1];)o--,a--;if(o===d){const p=a<l?c?s[c-1].nextSibling:s[a-c]:g;for(;c<a;)e.insertBefore(s[c++],p)}else if(a===c)for(;d<o;)(!b||!b.has(r[d]))&&r[d].remove(),d++;else if(r[d]===s[a-1]&&s[c]===r[o-1]){const p=r[--o].nextSibling;e.insertBefore(s[c++],r[d++].nextSibling),e.insertBefore(s[--a],p),r[o]=s[a]}else{if(!b){b=new Map;let m=c;for(;m<a;)b.set(s[m],m++)}const p=b.get(r[d]);if(p!=null)if(c<p&&p<a){let m=d,S=1,z;for(;++m<o&&m<a&&!((z=b.get(r[m]))==null||z!==p+S);)S++;if(S>p-c){const ie=r[d];for(;c<p;)e.insertBefore(s[c++],ie)}else e.replaceChild(s[c++],r[d++])}else d++;else r[d++].remove()}}}const Ll="_$DX_DELEGATE";function id(e,r,s,l={}){let o;return On(a=>{o=a,r===document?e():t(r,e(),r.firstChild?null:void 0,s)},l.owner),()=>{o(),r.textContent=""}}function i(e,r,s,l){let o;const a=()=>{const c=document.createElement("template");return c.innerHTML=e,c.content.firstChild},d=()=>(o||(o=a())).cloneNode(!0);return d.cloneNode=d,d}function Xt(e,r=window.document){const s=r[Ll]||(r[Ll]=new Set);for(let l=0,o=e.length;l<o;l++){const a=e[l];s.has(a)||(s.add(a),r.addEventListener(a,fd))}}function Te(e,r,s){ns(e)||(s==null?e.removeAttribute(r):e.setAttribute(r,s))}function od(e,r,s,l){ns(e)||(l==null?e.removeAttributeNS(r,s):e.setAttributeNS(r,s,l))}function dd(e,r,s){ns(e)||(s?e.setAttribute(r,""):e.removeAttribute(r))}function y(e,r){ns(e)||(r==null?e.removeAttribute("class"):e.className=r)}function Gr(e,r,s,l){if(l)Array.isArray(s)?(e[`$$${r}`]=s[0],e[`$$${r}Data`]=s[1]):e[`$$${r}`]=s;else if(Array.isArray(s)){const o=s[0];e.addEventListener(r,s[0]=a=>o.call(e,s[1],a))}else e.addEventListener(r,s,typeof s!="function"&&s)}function cd(e,r,s={}){const l=Object.keys(r||{}),o=Object.keys(s);let a,d;for(a=0,d=o.length;a<d;a++){const c=o[a];!c||c==="undefined"||r[c]||(Rl(e,c,!1),delete s[c])}for(a=0,d=l.length;a<d;a++){const c=l[a],g=!!r[c];!c||c==="undefined"||s[c]===g||!g||(Rl(e,c,!0),s[c]=g)}return s}function xs(e,r,s){if(!r)return s?Te(e,"style"):r;const l=e.style;if(typeof r=="string")return l.cssText=r;typeof s=="string"&&(l.cssText=s=void 0),s||(s={}),r||(r={});let o,a;for(a in s)r[a]==null&&l.removeProperty(a),delete s[a];for(a in r)o=r[a],o!==s[a]&&(l.setProperty(a,o),s[a]=o);return s}function bs(e,r={},s,l){const o={};return l||q(()=>o.children=Rs(e,r.children,o.children)),q(()=>typeof r.ref=="function"&&fr(r.ref,e)),q(()=>ud(e,r,s,!0,o,!0)),o}function fr(e,r,s){return Fr(()=>e(r,s))}function t(e,r,s,l){if(s!==void 0&&!l&&(l=[]),typeof r!="function")return Rs(e,r,l,s);q(o=>Rs(e,r(),o,s),l)}function ud(e,r,s,l,o={},a=!1){r||(r={});for(const d in o)if(!(d in r)){if(d==="children")continue;o[d]=Il(e,d,null,o[d],s,a,r)}for(const d in r){if(d==="children")continue;const c=r[d];o[d]=Il(e,d,c,o[d],s,a,r)}}function gd(e){let r,s;return!ns()||!(r=Ot.registry.get(s=md()))?e():(Ot.completed&&Ot.completed.add(r),Ot.registry.delete(s),r)}function ns(e){return!!Ot.context&&!Ot.done&&(!e||e.isConnected)}function hd(e){return e.toLowerCase().replace(/-([a-z])/g,(r,s)=>s.toUpperCase())}function Rl(e,r,s){const l=r.trim().split(/\s+/);for(let o=0,a=l.length;o<a;o++)e.classList.toggle(l[o],s)}function Il(e,r,s,l,o,a,d){let c,g,b,p,m;if(r==="style")return xs(e,s,l);if(r==="classList")return cd(e,s,l);if(s===l)return l;if(r==="ref")a||s(e);else if(r.slice(0,3)==="on:"){const S=r.slice(3);l&&e.removeEventListener(S,l,typeof l!="function"&&l),s&&e.addEventListener(S,s,typeof s!="function"&&s)}else if(r.slice(0,10)==="oncapture:"){const S=r.slice(10);l&&e.removeEventListener(S,l,!0),s&&e.addEventListener(S,s,!0)}else if(r.slice(0,2)==="on"){const S=r.slice(2).toLowerCase(),z=nd.has(S);if(!z&&l){const ie=Array.isArray(l)?l[0]:l;e.removeEventListener(S,ie)}(z||s)&&(Gr(e,S,s,z),z&&Xt([S]))}else if(r.slice(0,5)==="attr:")Te(e,r.slice(5),s);else if(r.slice(0,5)==="bool:")dd(e,r.slice(5),s);else if((m=r.slice(0,5)==="prop:")||(b=Zo.has(r))||!o&&((p=rd(r,e.tagName))||(g=Xo.has(r)))||(c=e.nodeName.includes("-")||"is"in d)){if(m)r=r.slice(5),g=!0;else if(ns(e))return s;r==="class"||r==="className"?y(e,s):c&&!g&&!b?e[hd(r)]=s:e[p||r]=s}else{const S=o&&r.indexOf(":")>-1&&ad[r.split(":")[0]];S?od(e,S,r,s):Te(e,ed[r]||r,s)}return s}function fd(e){if(Ot.registry&&Ot.events&&Ot.events.find(([g,b])=>b===e))return;let r=e.target;const s=`$$${e.type}`,l=e.target,o=e.currentTarget,a=g=>Object.defineProperty(e,"target",{configurable:!0,value:g}),d=()=>{const g=r[s];if(g&&!r.disabled){const b=r[`${s}Data`];if(b!==void 0?g.call(r,b,e):g.call(r,e),e.cancelBubble)return}return r.host&&typeof r.host!="string"&&!r.host._$host&&r.contains(e.target)&&a(r.host),!0},c=()=>{for(;d()&&(r=r._$host||r.parentNode||r.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return r||document}}),Ot.registry&&!Ot.done&&(Ot.done=_$HY.done=!0),e.composedPath){const g=e.composedPath();a(g[0]);for(let b=0;b<g.length-2&&(r=g[b],!!d());b++){if(r._$host){r=r._$host,c();break}if(r.parentNode===o)break}}else c();a(l)}function Rs(e,r,s,l,o){const a=ns(e);if(a){!s&&(s=[...e.childNodes]);let g=[];for(let b=0;b<s.length;b++){const p=s[b];p.nodeType===8&&p.data.slice(0,2)==="!$"?p.remove():g.push(p)}s=g}for(;typeof s=="function";)s=s();if(r===s)return s;const d=typeof r,c=l!==void 0;if(e=c&&s[0]&&s[0].parentNode||e,d==="string"||d==="number"){if(a||d==="number"&&(r=r.toString(),r===s))return s;if(c){let g=s[0];g&&g.nodeType===3?g.data!==r&&(g.data=r):g=document.createTextNode(r),s=as(e,s,l,g)}else s!==""&&typeof s=="string"?s=e.firstChild.data=r:s=e.textContent=r}else if(r==null||d==="boolean"){if(a)return s;s=as(e,s,l)}else{if(d==="function")return q(()=>{let g=r();for(;typeof g=="function";)g=g();s=Rs(e,g,s,l)}),()=>s;if(Array.isArray(r)){const g=[],b=s&&Array.isArray(s);if(ll(g,r,s,o))return q(()=>s=Rs(e,g,s,l,!0)),()=>s;if(a){if(!g.length)return s;if(l===void 0)return s=[...e.childNodes];let p=g[0];if(p.parentNode!==e)return s;const m=[p];for(;(p=p.nextSibling)!==l;)m.push(p);return s=m}if(g.length===0){if(s=as(e,s,l),c)return s}else b?s.length===0?Hl(e,g,l):ld(e,s,g):(s&&as(e),Hl(e,g));s=g}else if(r.nodeType){if(a&&r.parentNode)return s=c?[r]:r;if(Array.isArray(s)){if(c)return s=as(e,s,l,r);as(e,s,null,r)}else s==null||s===""||!e.firstChild?e.appendChild(r):e.replaceChild(r,e.firstChild);s=r}}return s}function ll(e,r,s,l){let o=!1;for(let a=0,d=r.length;a<d;a++){let c=r[a],g=s&&s[e.length],b;if(!(c==null||c===!0||c===!1))if((b=typeof c)=="object"&&c.nodeType)e.push(c);else if(Array.isArray(c))o=ll(e,c,g)||o;else if(b==="function")if(l){for(;typeof c=="function";)c=c();o=ll(e,Array.isArray(c)?c:[c],Array.isArray(g)?g:[g])||o}else e.push(c),o=!0;else{const p=String(c);g&&g.nodeType===3&&g.data===p?e.push(g):e.push(document.createTextNode(p))}}return o}function Hl(e,r,s=null){for(let l=0,o=r.length;l<o;l++)e.insertBefore(r[l],s)}function as(e,r,s,l){if(s===void 0)return e.textContent="";const o=l||document.createTextNode("");if(r.length){let a=!1;for(let d=r.length-1;d>=0;d--){const c=r[d];if(o!==c){const g=c.parentNode===e;!a&&!d?g?e.replaceChild(o,c):e.insertBefore(o,s):g&&c.remove()}else a=!0}}else e.insertBefore(o,s);return[o]}function md(){return Ot.getNextContextId()}const xd=!1,bd="http://www.w3.org/2000/svg";function Vi(e,r=!1){return r?document.createElementNS(bd,e):document.createElement(e)}function ps(e){const{useShadow:r}=e,s=document.createTextNode(""),l=()=>e.mount||document.body,o=Ls();let a,d=!!Ot.context;return ft(()=>{d&&(Ls().user=d=!1),a||(a=ka(o,()=>pe(()=>e.children)));const c=l();if(c instanceof HTMLHeadElement){const[g,b]=Z(!1),p=()=>b(!0);On(m=>t(c,()=>g()?m():a(),null)),Ar(p)}else{const g=Vi(e.isSVG?"g":"div",e.isSVG),b=r&&g.attachShadow?g.attachShadow({mode:"open"}):g;Object.defineProperty(g,"_$host",{get(){return s.parentNode},configurable:!0}),t(b,a),c.appendChild(g),e.ref&&e.ref(g),Ar(()=>c.removeChild(g))}},void 0,{render:!d}),s}function pd(e,r){const s=pe(e);return pe(()=>{const l=s();switch(typeof l){case"function":return Fr(()=>l(r));case"string":const o=sd.has(l),a=Ot.context?gd():Vi(l,o);return bs(a,r,o),a}})}function yd(e){const[,r]=rs(e,["component"]);return pd(()=>e.component,r)}const vd="modulepreload",kd=function(e){return"/"+e},Ul={},Ln=function(r,s,l){let o=Promise.resolve();if(s&&s.length>0){let d=function(b){return Promise.all(b.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),g=c?.nonce||c?.getAttribute("nonce");o=d(s.map(b=>{if(b=kd(b),b in Ul)return;Ul[b]=!0;const p=b.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${b}"]${m}`))return;const S=document.createElement("link");if(S.rel=p?"stylesheet":vd,p||(S.as="script"),S.crossOrigin="",S.href=b,g&&S.setAttribute("nonce",g),document.head.appendChild(S),p)return new Promise((z,ie)=>{S.addEventListener("load",z),S.addEventListener("error",()=>ie(new Error(`Unable to preload CSS for ${b}`)))})}))}function a(d){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=d,window.dispatchEvent(c),!c.defaultPrevented)throw d}return o.then(d=>{for(const c of d||[])c.status==="rejected"&&a(c.reason);return r().catch(a)})};function wd(){let e=new Set;function r(o){return e.add(o),()=>e.delete(o)}let s=!1;function l(o,a){if(s)return!(s=!1);const d={to:o,options:a,defaultPrevented:!1,preventDefault:()=>d.defaultPrevented=!0};for(const c of e)c.listener({...d,from:c.location,retry:g=>{g&&(s=!0),c.navigate(o,{...a,resolve:!1})}});return!d.defaultPrevented}return{subscribe:r,confirm:l}}const $d=/^(?:[a-z0-9]+:)?\/\//i,_d=/^\/+|(\/)\/+$/g,Gi="http://sr";function Ms(e,r=!1){const s=e.replace(_d,"$1");return s?r||/^[?#]/.test(s)?s:"/"+s:""}function na(e,r,s){if($d.test(r))return;const l=Ms(e),o=s&&Ms(s);let a="";return!o||r.startsWith("/")?a=l:o.toLowerCase().indexOf(l.toLowerCase())!==0?a=l+o:a=o,(a||"/")+Ms(r,!a)}function Cd(e,r){if(e==null)throw new Error(r);return e}function Sd(e,r){return Ms(e).replace(/\/*(\*.*)?$/g,"")+Ms(r)}function zi(e){const r={};return e.searchParams.forEach((s,l)=>{r[l]=s}),r}function Td(e,r,s){const[l,o]=e.split("/*",2),a=l.split("/").filter(Boolean),d=a.length;return c=>{const g=c.split("/").filter(Boolean),b=g.length-d;if(b<0||b>0&&o===void 0&&!r)return null;const p={path:d?"":"/",params:{}},m=S=>s===void 0?void 0:s[S];for(let S=0;S<d;S++){const z=a[S],ie=g[S],ne=z[0]===":",W=ne?z.slice(1):z;if(ne&&Ea(ie,m(W)))p.params[W]=ie;else if(ne||!Ea(ie,z))return null;p.path+=`/${ie}`}if(o){const S=b?g.slice(-b).join("/"):"";if(Ea(S,m(o)))p.params[o]=S;else return null}return p}}function Ea(e,r){const s=l=>l.localeCompare(e,void 0,{sensitivity:"base"})===0;return r===void 0?!0:typeof r=="string"?s(r):typeof r=="function"?r(e):Array.isArray(r)?r.some(s):r instanceof RegExp?r.test(e):!1}function Ad(e){const[r,s]=e.pattern.split("/*",2),l=r.split("/").filter(Boolean);return l.reduce((o,a)=>o+(a.startsWith(":")?2:3),l.length-(s===void 0?0:1))}function Wi(e){const r=new Map,s=Ls();return new Proxy({},{get(l,o){return r.has(o)||ka(s,()=>r.set(o,pe(()=>e()[o]))),r.get(o)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())}})}function qi(e){let r=/(\/?\:[^\/]+)\?/.exec(e);if(!r)return[e];let s=e.slice(0,r.index),l=e.slice(r.index+r[0].length);const o=[s,s+=r[1]];for(;r=/^(\/\:[^\/]+)\?/.exec(l);)o.push(s+=r[1]),l=l.slice(r[0].length);return qi(l).reduce((a,d)=>[...a,...o.map(c=>c+d)],[])}const Dd=100,Ki=fs(),yl=fs(),Ji=()=>Cd(Rn(Ki),"Make sure your app is wrapped in a <Router />"),In=()=>Ji().navigatorFactory(),Bs=()=>Ji().location;function Md(e,r=""){const{component:s,load:l,children:o,metadata:a}=e,d=!o||Array.isArray(o)&&!o.length,c={key:e,component:s,load:l,metadata:a};return Qi(e.path).reduce((g,b)=>{for(const p of qi(b)){const m=Sd(r,p);let S=d?m:m.split("/*",1)[0];S=S.split("/").map(z=>z.startsWith(":")||z.startsWith("*")?z:encodeURIComponent(z)).join("/"),g.push({...c,originalPath:p,pattern:S,matcher:Td(S,!d,e.matchFilters)})}return g},[])}function Pd(e,r=0){return{routes:e,score:Ad(e[e.length-1])*1e4-r,matcher(s){const l=[];for(let o=e.length-1;o>=0;o--){const a=e[o],d=a.matcher(s);if(!d)return null;l.unshift({...d,route:a})}return l}}}function Qi(e){return Array.isArray(e)?e:[e]}function Yi(e,r="",s=[],l=[]){const o=Qi(e);for(let a=0,d=o.length;a<d;a++){const c=o[a];if(c&&typeof c=="object"){c.hasOwnProperty("path")||(c.path="");const g=Md(c,r);for(const b of g){s.push(b);const p=Array.isArray(c.children)&&c.children.length===0;if(c.children&&!p)Yi(c.children,b.pattern,s,l);else{const m=Pd([...s],l.length);l.push(m)}s.pop()}}}return s.length?l:l.sort((a,d)=>d.score-a.score)}function Xi(e,r){for(let s=0,l=e.length;s<l;s++){const o=e[s].matcher(r);if(o)return o}return[]}function Ed(e,r){const s=new URL(Gi),l=pe(g=>{const b=e();try{return new URL(b,s)}catch{return console.error(`Invalid path ${b}`),g}},s,{equals:(g,b)=>g.href===b.href}),o=pe(()=>l().pathname),a=pe(()=>l().search,!0),d=pe(()=>l().hash),c=()=>"";return{get pathname(){return o()},get search(){return a()},get hash(){return d()},get state(){return r()},get key(){return c()},query:Wi(Wn(a,()=>zi(l())))}}let Gn;function Nd(e,r,s={}){const{signal:[l,o],utils:a={}}=e,d=a.parsePath||(Y=>Y),c=a.renderPath||(Y=>Y),g=a.beforeLeave||wd(),b=na("",s.base||"");if(b===void 0)throw new Error(`${b} is not a valid base path`);b&&!l().value&&o({value:b,replace:!0,scroll:!1});const[p,m]=Z(!1),S=async Y=>{m(!0);try{await Io(Y)}finally{m(!1)}},[z,ie]=Z(l().value),[ne,W]=Z(l().state),X=Ed(z,ne),I=[],L=Z([]),H={pattern:b,params:{},path:()=>b,outlet:()=>null,resolvePath(Y){return na(b,Y)}};return q(()=>{const{value:Y,state:oe}=l();Fr(()=>{Y!==z()&&S(()=>{Gn="native",ie(Y),W(oe),Ol(),L[1]([])}).then(()=>{Gn=void 0})})}),{base:H,location:X,isRouting:p,renderPath:c,parsePath:d,navigatorFactory:le,beforeLeave:g,preloadRoute:U,submissions:L};function se(Y,oe,_){Fr(()=>{if(typeof oe=="number"){oe&&(a.go?g.confirm(oe,_)&&a.go(oe):console.warn("Router integration does not support relative routing"));return}const{replace:B,resolve:$,scroll:D,state:f}={replace:!1,resolve:!0,scroll:!0,..._},j=$?Y.resolvePath(oe):na("",oe);if(j===void 0)throw new Error(`Path '${oe}' is not a routable path`);if(I.length>=Dd)throw new Error("Too many redirects");const K=z();if((j!==K||f!==ne())&&!xd){if(g.confirm(j,_)){const C=I.push({value:K,replace:B,scroll:D,state:ne()});S(()=>{Gn="navigate",ie(j),W(f),Ol(),L[1]([])}).then(()=>{I.length===C&&(Gn=void 0,ee({value:j,state:f}))})}}})}function le(Y){return Y=Y||Rn(yl)||H,(oe,_)=>se(Y,oe,_)}function ee(Y){const oe=I[0];oe&&((Y.value!==oe.value||Y.state!==oe.state)&&o({...Y,replace:oe.replace,scroll:oe.scroll}),I.length=0)}function U(Y,oe){const _=Xi(r(),Y.pathname),B=Gn;Gn="preload";for(let $ in _){const{route:D,params:f}=_[$];D.component&&D.component.preload&&D.component.preload(),oe&&D.load&&D.load({params:f,location:{pathname:Y.pathname,search:Y.search,hash:Y.hash,query:zi(Y),state:null,key:""},intent:"preload"})}Gn=B}}function Od(e,r,s,l,o){const{base:a,location:d}=e,{pattern:c,component:g,load:b}=l().route,p=pe(()=>l().path);g&&g.preload&&g.preload();const m=b?b({params:o,location:d,intent:Gn||"initial"}):void 0;return{parent:r,pattern:c,path:p,params:o,outlet:()=>g?n(g,{params:o,location:d,data:m,get children(){return s()}}):s(),resolvePath(z){return na(a.path(),z,p())}}}const Ld=e=>r=>{const{base:s}=r,l=pl(()=>r.children),o=pe(()=>Yi(r.root?{component:r.root,children:l()}:l(),r.base||"")),a=Nd(e,o,{base:s});return e.create&&e.create(a),n(Ki.Provider,{value:a,get children(){return n(Rd,{routerState:a,get branches(){return o()}})}})};function Rd(e){const r=pe(()=>Xi(e.branches,e.routerState.location.pathname)),s=Wi(()=>{const d=r(),c={};for(let g=0;g<d.length;g++)Object.assign(c,d[g].params);return c}),l=[];let o;const a=pe(Wn(r,(d,c,g)=>{let b=c&&d.length===c.length;const p=[];for(let m=0,S=d.length;m<S;m++){const z=c&&c[m],ie=d[m];g&&z&&ie.route.key===z.route.key?p[m]=g[m]:(b=!1,l[m]&&l[m](),On(ne=>{l[m]=ne,p[m]=Od(e.routerState,p[m-1]||e.routerState.base,Id(()=>a()[m+1]),()=>r()[m],s)}))}return l.splice(d.length).forEach(m=>m()),g&&b?g:(o=p[0],p)}));return n(h,{get when(){return a()&&o},keyed:!0,children:d=>n(yl.Provider,{value:d,get children(){return d.outlet()}})})}const Id=e=>()=>n(h,{get when(){return e()},keyed:!0,children:r=>n(yl.Provider,{value:r,get children(){return r.outlet()}})}),pn=e=>{const r=pl(()=>e.children);return kr(e,{get children(){return r()}})};function Hd([e,r],s,l){return[e,l?o=>r(l(o)):r]}function Ud(e){if(e==="#")return null;try{return document.querySelector(e)}catch{return null}}function Bd(e){let r=!1;const s=o=>typeof o=="string"?{value:o}:o,l=Hd(Z(s(e.get()),{equals:(o,a)=>o.value===a.value}),void 0,o=>(!r&&e.set(o),o));return e.init&&Ar(e.init((o=e.get())=>{r=!0,l[1](s(o)),r=!1})),Ld({signal:l,create:e.create,utils:e.utils})}function jd(e,r,s){return e.addEventListener(r,s),()=>e.removeEventListener(r,s)}function Fd(e,r){const s=Ud(`#${e}`);s?s.scrollIntoView():r&&window.scrollTo(0,0)}const ha=Symbol("store-raw"),ds=Symbol("store-node"),Mn=Symbol("store-has"),Zi=Symbol("store-self");function eo(e){let r=e[vn];if(!r&&(Object.defineProperty(e,vn,{value:r=new Proxy(e,zd)}),!Array.isArray(e))){const s=Object.keys(e),l=Object.getOwnPropertyDescriptors(e);for(let o=0,a=s.length;o<a;o++){const d=s[o];l[d].get&&Object.defineProperty(e,d,{enumerable:l[d].enumerable,get:l[d].get.bind(r)})}}return r}function us(e){let r;return e!=null&&typeof e=="object"&&(e[vn]||!(r=Object.getPrototypeOf(e))||r===Object.prototype||Array.isArray(e))}function gs(e,r=new Set){let s,l,o,a;if(s=e!=null&&e[ha])return s;if(!us(e)||r.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):r.add(e);for(let d=0,c=e.length;d<c;d++)o=e[d],(l=gs(o,r))!==o&&(e[d]=l)}else{Object.isFrozen(e)?e=Object.assign({},e):r.add(e);const d=Object.keys(e),c=Object.getOwnPropertyDescriptors(e);for(let g=0,b=d.length;g<b;g++)a=d[g],!c[a].get&&(o=e[a],(l=gs(o,r))!==o&&(e[a]=l))}return e}function fa(e,r){let s=e[r];return s||Object.defineProperty(e,r,{value:s=Object.create(null)}),s}function Is(e,r,s){if(e[r])return e[r];const[l,o]=Z(s,{equals:!1,internal:!0});return l.$=o,e[r]=l}function Vd(e,r){const s=Reflect.getOwnPropertyDescriptor(e,r);return!s||s.get||!s.configurable||r===vn||r===ds||(delete s.value,delete s.writable,s.get=()=>e[vn][r]),s}function to(e){rl()&&Is(fa(e,ds),Zi)()}function Gd(e){return to(e),Reflect.ownKeys(e)}const zd={get(e,r,s){if(r===ha)return e;if(r===vn)return s;if(r===oa)return to(e),s;const l=fa(e,ds),o=l[r];let a=o?o():e[r];if(r===ds||r===Mn||r==="__proto__")return a;if(!o){const d=Object.getOwnPropertyDescriptor(e,r);rl()&&(typeof a!="function"||e.hasOwnProperty(r))&&!(d&&d.get)&&(a=Is(l,r,a)())}return us(a)?eo(a):a},has(e,r){return r===ha||r===vn||r===oa||r===ds||r===Mn||r==="__proto__"?!0:(rl()&&Is(fa(e,Mn),r)(),r in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Gd,getOwnPropertyDescriptor:Vd};function hs(e,r,s,l=!1){if(!l&&e[r]===s)return;const o=e[r],a=e.length;s===void 0?(delete e[r],e[Mn]&&e[Mn][r]&&o!==void 0&&e[Mn][r].$()):(e[r]=s,e[Mn]&&e[Mn][r]&&o===void 0&&e[Mn][r].$());let d=fa(e,ds),c;if((c=Is(d,r,o))&&c.$(()=>s),Array.isArray(e)&&e.length!==a){for(let g=e.length;g<a;g++)(c=d[g])&&c.$();(c=Is(d,"length",a))&&c.$(e.length)}(c=d[Zi])&&c.$()}function ro(e,r){const s=Object.keys(r);for(let l=0;l<s.length;l+=1){const o=s[l];hs(e,o,r[o])}}function Wd(e,r){if(typeof r=="function"&&(r=r(e)),r=gs(r),Array.isArray(r)){if(e===r)return;let s=0,l=r.length;for(;s<l;s++){const o=r[s];e[s]!==o&&hs(e,s,o)}hs(e,"length",l)}else ro(e,r)}function Ts(e,r,s=[]){let l,o=e;if(r.length>1){l=r.shift();const d=typeof l,c=Array.isArray(e);if(Array.isArray(l)){for(let g=0;g<l.length;g++)Ts(e,[l[g]].concat(r),s);return}else if(c&&d==="function"){for(let g=0;g<e.length;g++)l(e[g],g)&&Ts(e,[g].concat(r),s);return}else if(c&&d==="object"){const{from:g=0,to:b=e.length-1,by:p=1}=l;for(let m=g;m<=b;m+=p)Ts(e,[m].concat(r),s);return}else if(r.length>1){Ts(e[l],r,[l].concat(s));return}o=e[l],s=[l].concat(s)}let a=r[0];typeof a=="function"&&(a=a(o,s),a===o)||l===void 0&&a==null||(a=gs(a),l===void 0||us(o)&&us(a)&&!Array.isArray(a)?ro(o,a):hs(e,l,a))}function Ps(...[e,r]){const s=gs(e||{}),l=Array.isArray(s),o=eo(s);function a(...d){Lo(()=>{l&&d.length===1?Wd(s,d[0]):Ts(s,d)})}return[o,a]}const ma=new WeakMap,no={get(e,r){if(r===ha)return e;const s=e[r];let l;return us(s)?ma.get(s)||(ma.set(s,l=new Proxy(s,no)),l):s},set(e,r,s){return hs(e,r,gs(s)),!0},deleteProperty(e,r){return hs(e,r,void 0,!0),!0}};function qd(e){return r=>{if(us(r)){let s;(s=ma.get(r))||ma.set(r,s=new Proxy(r,no)),e(s)}return r}}const Kd=new Map;function Jd(e=!0,r=!1,s="/_server"){return l=>{const o=l.base.path(),a=l.navigatorFactory(l.base);let d={};function c(ie){return ie.namespaceURI==="http://www.w3.org/2000/svg"}function g(ie){if(ie.defaultPrevented||ie.button!==0||ie.metaKey||ie.altKey||ie.ctrlKey||ie.shiftKey)return;const ne=ie.composedPath().find(se=>se instanceof Node&&se.nodeName.toUpperCase()==="A");if(!ne||r&&!ne.hasAttribute("link"))return;const W=c(ne),X=W?ne.href.baseVal:ne.href;if((W?ne.target.baseVal:ne.target)||!X&&!ne.hasAttribute("state"))return;const L=(ne.getAttribute("rel")||"").split(/\s+/);if(ne.hasAttribute("download")||L&&L.includes("external"))return;const H=W?new URL(X,document.baseURI):new URL(X);if(!(H.origin!==window.location.origin||o&&H.pathname&&!H.pathname.toLowerCase().startsWith(o.toLowerCase())))return[ne,H]}function b(ie){const ne=g(ie);if(!ne)return;const[W,X]=ne,I=l.parsePath(X.pathname+X.search+X.hash),L=W.getAttribute("state");ie.preventDefault(),a(I,{resolve:!1,replace:W.hasAttribute("replace"),scroll:!W.hasAttribute("noscroll"),state:L&&JSON.parse(L)})}function p(ie){const ne=g(ie);if(!ne)return;const[W,X]=ne;d[X.pathname]||l.preloadRoute(X,W.getAttribute("preload")!=="false")}function m(ie){const ne=g(ie);if(!ne)return;const[W,X]=ne;d[X.pathname]||(d[X.pathname]=setTimeout(()=>{l.preloadRoute(X,W.getAttribute("preload")!=="false"),delete d[X.pathname]},200))}function S(ie){const ne=g(ie);if(!ne)return;const[,W]=ne;d[W.pathname]&&(clearTimeout(d[W.pathname]),delete d[W.pathname])}function z(ie){let ne=ie.submitter&&ie.submitter.hasAttribute("formaction")?ie.submitter.getAttribute("formaction"):ie.target.getAttribute("action");if(!ne)return;if(!ne.startsWith("https://action/")){const X=new URL(ne,Gi);if(ne=l.parsePath(X.pathname+X.search),!ne.startsWith(s))return}if(ie.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const W=Kd.get(ne);if(W){ie.preventDefault();const X=new FormData(ie.target);ie.submitter&&ie.submitter.name&&X.append(ie.submitter.name,ie.submitter.value),W.call(l,X)}}Xt(["click","submit"]),document.addEventListener("click",b),e&&(document.addEventListener("mouseover",m),document.addEventListener("mouseout",S),document.addEventListener("focusin",p),document.addEventListener("touchstart",p)),document.addEventListener("submit",z),Ar(()=>{document.removeEventListener("click",b),e&&(document.removeEventListener("mouseover",m),document.removeEventListener("mouseout",S),document.removeEventListener("focusin",p),document.removeEventListener("touchstart",p)),document.removeEventListener("submit",z)})}}function Qd(e){return Bd({get:()=>({value:window.location.pathname+window.location.search+window.location.hash,state:history.state}),set({value:r,replace:s,scroll:l,state:o}){s?window.history.replaceState(o,"",r):window.history.pushState(o,"",r),Fd(window.location.hash.slice(1),l)},init:r=>jd(window,"popstate",()=>r()),create:Jd(e.preload,e.explicitLinks,e.actionBase),utils:{go:r=>window.history.go(r)}})(e)}function qs(e){const r=In(),s=Bs(),{href:l,state:o}=e,a=typeof l=="function"?l({navigate:r,location:s}):l;return r(a,{replace:!0,state:o}),null}const Sr={debug:(e,r)=>{},info:(e,r)=>{(e.includes("established")||e.includes("error")||e.includes("failed"))&&console.log(`[INFO] ${e}`,r||"")},warn:(e,r)=>{console.warn(`[WARN] ${e}`,r||"")},error:(e,r)=>{console.error(`[ERROR] ${e}`,r||"")}},so=Sr.error,xa={RECONNECT_BASE:1e3,RECONNECT_MAX:3e4,DATA_FLASH:1e3,TOAST_DURATION:5e3},$s={PING_INTERVAL:25e3,MESSAGE_TYPES:{INITIAL_STATE:"initialState",RAW_DATA:"rawData",ERROR:"error"}},_n={DARK_MODE:"darkMode",VIEW_MODE:"viewMode",DISPLAY_MODE:"displayMode",SORT_KEY:"sortKey",SORT_DIRECTION:"sortDirection",ALERT_THRESHOLDS:"alertThresholds",ACTIVE_TAB:"activeTab"},[Yd,Bl]=Ps([]),Yt={notifications:Yd,add:e=>{const r=Date.now().toString();return Bl(s=>[...s,{...e,id:r}]),e.duration&&e.duration>0&&setTimeout(()=>{Yt.remove(r)},e.duration),r},remove:e=>{Bl(r=>r.filter(s=>s.id!==e))},success:(e,r=5e3)=>Yt.add({message:e,type:"success",duration:r}),error:(e,r=1e4)=>Yt.add({message:e,type:"error",duration:r}),info:(e,r=5e3)=>Yt.add({message:e,type:"info",duration:r})};class Xd{handlers=new Map;on(r,s){return this.handlers.has(r)||this.handlers.set(r,new Set),this.handlers.get(r).add(s),()=>{this.handlers.get(r)?.delete(s)}}off(r,s){this.handlers.get(r)?.delete(s)}emit(r,s){const l=this.handlers.get(r);l&&l.forEach(o=>o(s))}}const dn=new Xd;function Zd(e){const[r,s]=Z(!1),[l,o]=Z(!1),[a,d]=Z(!1),[c,g]=Ps({nodes:[],vms:[],containers:[],dockerHosts:[],storage:[],cephClusters:[],physicalDisks:[],pbs:[],pmg:[],metrics:[],pveBackups:{backupTasks:[],storageBackups:[],guestSnapshots:[]},pbsBackups:[],performance:{apiCallDuration:{},lastPollDuration:0,pollingStartTime:"",totalApiCalls:0,failedApiCalls:0,cacheHits:0,cacheMisses:0},connectionHealth:{},stats:{startTime:new Date().toISOString(),uptime:0,pollingCycles:0,webSocketClients:0,version:"2.0.0"},activeAlerts:[],recentlyResolved:[],lastUpdate:""}),[b,p]=Ps({}),[m,S]=Ps({}),[z,ie]=Z(null);let ne=0,W=!1;const X=new Map;let I=null,L,H,se=0,le=!1;const ee=xa.RECONNECT_MAX,U=xa.RECONNECT_BASE,Y=3e4,oe=()=>{try{if(I&&((I.readyState===WebSocket.OPEN||I.readyState===WebSocket.CONNECTING)&&I.close(1e3,"Reconnecting"),I=null),se>0){const $=Math.min(100*se,1e3);setTimeout(()=>{I=new WebSocket(e),B()},$);return}I=new WebSocket(e),B()}catch($){Sr.error("Failed to create WebSocket",$),_()}},_=()=>{if(le)return;le=!0,o(!0),L&&(window.clearTimeout(L),L=0);const $=Math.min(U*Math.pow(2,se),ee);Sr.info(`Reconnecting in ${$}ms (attempt ${se+1})`),se++,L=window.setTimeout(()=>{le=!1,oe()},$)},B=()=>{I&&(I.onopen=()=>{s(!0),o(!1),se=0,le=!1,ne=0,W=!1,H&&window.clearInterval(H),H=window.setInterval(()=>{I&&I.readyState===WebSocket.OPEN&&I.send(JSON.stringify({type:"ping",data:{timestamp:Date.now()}}))},Y)},I.onmessage=$=>{let D;try{D=JSON.parse($.data)}catch(f){Sr.error("Failed to parse WebSocket message",f);return}try{const f=D;if(f.type===$s.MESSAGE_TYPES.INITIAL_STATE||f.type===$s.MESSAGE_TYPES.RAW_DATA){if(f.data){if(f.type===$s.MESSAGE_TYPES.INITIAL_STATE&&d(!0),f.data.nodes!==void 0&&(console.log("[WebSocket] Updating nodes:",f.data.nodes?.length||0),g("nodes",f.data.nodes)),f.data.vms!==void 0){const j=f.data.vms.map(K=>{const C=K.tags;let ge;return C&&typeof C=="string"&&C.trim()?ge=C.split(",").map(J=>J.trim()).filter(J=>J.length>0):Array.isArray(C)?ge=C.filter(J=>typeof J=="string"&&J.trim().length>0):ge=[],{...K,tags:ge}});g("vms",j)}if(f.data.containers!==void 0){const j=f.data.containers.map(K=>{const C=K.tags;let ge;return C&&typeof C=="string"&&C.trim()?ge=C.split(",").map(J=>J.trim()).filter(J=>J.length>0):Array.isArray(C)?ge=C.filter(J=>typeof J=="string"&&J.trim().length>0):ge=[],{...K,tags:ge}});g("containers",j)}if(f.data.dockerHosts!==void 0&&f.data.dockerHosts!==null)if(Array.isArray(f.data.dockerHosts)){const j=f.data.dockerHosts;j.length===0?(ne+=1,!W||ne>=3||f.type===$s.MESSAGE_TYPES.INITIAL_STATE?(console.log("[WebSocket] Updating dockerHosts:",j.length,"hosts"),g("dockerHosts",j)):console.debug("[WebSocket] Skipping transient empty dockerHosts payload",ne)):(ne=0,W=!0,console.log("[WebSocket] Updating dockerHosts:",j.length,"hosts"),g("dockerHosts",j))}else console.warn("[WebSocket] Received non-array dockerHosts:",typeof f.data.dockerHosts);else f.data.dockerHosts===null&&console.log("[WebSocket] Received null dockerHosts, ignoring");if(f.data.storage!==void 0&&g("storage",f.data.storage),f.data.cephClusters!==void 0&&g("cephClusters",f.data.cephClusters),f.data.pbs!==void 0&&g("pbs",f.data.pbs),f.data.pmg!==void 0&&g("pmg",f.data.pmg),f.data.pbsBackups!==void 0&&g("pbsBackups",f.data.pbsBackups),f.data.metrics!==void 0&&g("metrics",f.data.metrics),f.data.pveBackups!==void 0&&g("pveBackups",f.data.pveBackups),f.data.performance!==void 0&&g("performance",f.data.performance),f.data.connectionHealth!==void 0&&g("connectionHealth",f.data.connectionHealth),f.data.stats!==void 0&&g("stats",f.data.stats),f.data.physicalDisks!==void 0&&g("physicalDisks",f.data.physicalDisks),f.data.activeAlerts!==void 0){const j={};f.data.activeAlerts&&Array.isArray(f.data.activeAlerts)&&f.data.activeAlerts.forEach(C=>{j[C.id]=C}),Object.keys(b).forEach(C=>{j[C]||p(C,void 0)}),Object.entries(j).forEach(([C,ge])=>{if(X.has(C)){const J=X.get(C);if(J.ack){if(!ge.acknowledged){Sr.debug(`Skipping update for alert ${C} - awaiting server acknowledgment confirmation`);return}const N=ge.ackTime||"",F=J.previousAckTime||"";N===F&&Sr.debug(`Server ack time for alert ${C} unchanged (${N}); treating as confirmed`)}else if(ge.acknowledged){Sr.debug(`Skipping update for alert ${C} - awaiting server unacknowledge confirmation`);return}X.delete(C)}p(C,ge)}),g("activeAlerts",f.data.activeAlerts)}if(f.data.recentlyResolved!==void 0){const j={};f.data.recentlyResolved&&Array.isArray(f.data.recentlyResolved)&&f.data.recentlyResolved.forEach(C=>{j[C.id]=C}),Object.keys(m).forEach(C=>{j[C]||S(C,void 0)}),Object.entries(j).forEach(([C,ge])=>{S(C,ge)})}g("lastUpdate",f.data.lastUpdate||new Date().toISOString())}Sr.debug("message",{type:f.type,hasData:!!f.data,nodeCount:f.data?.nodes?.length||0,vmCount:f.data?.vms?.length||0,containerCount:f.data?.containers?.length||0})}else if(f.type===$s.MESSAGE_TYPES.ERROR)Sr.debug("error",f.error);else if(f.type==="ping")I&&I.readyState===WebSocket.OPEN&&I.send(JSON.stringify({type:"pong",data:{timestamp:Date.now()}}));else if(f.type==="pong")Sr.debug("Received pong from server");else if(f.type==="welcome")Sr.info("WebSocket connection established");else if(f.type==="alert")Sr.warn("New alert received (will sync with next state update)",f.data);else if(f.type==="alertResolved")Sr.info("Alert resolved (will sync with next state update)",{alertId:f.data.alertId});else if(f.type==="update:progress")ie(f.data),Sr.info("Update progress:",f.data);else if(f.type==="node_auto_registered"){const j=f.data,K=j.name||j.host,C=j.type==="pve"?"Proxmox VE":"Proxmox Backup Server";Yt.success(`🎉 ${C} node "${K}" was successfully auto-registered and is now being monitored!`,8e3),Sr.info("Node auto-registered:",j),dn.emit("node_auto_registered",j),dn.emit("refresh_nodes")}else f.type==="node_deleted"||f.type==="nodes_changed"?dn.emit("refresh_nodes"):f.type==="discovery_update"?dn.emit("discovery_updated",f.data):f.type==="discovery_started"?dn.emit("discovery_status",{scanning:!0,subnet:f.data?.subnet,timestamp:f.data?.timestamp}):f.type==="discovery_complete"?dn.emit("discovery_status",{scanning:!1,timestamp:f.data?.timestamp}):f.type==="settingsUpdate"&&f.data?.theme&&(dn.emit("theme_changed",f.data.theme),Sr.info("Theme update received via WebSocket:",f.data.theme))}catch(f){Sr.error("Failed to process WebSocket message",f)}},I.onclose=$=>{Sr.debug("disconnect",{code:$.code,reason:$.reason}),s(!1),d(!1),H&&(window.clearInterval(H),H=0),!($.code===1e3&&$.reason==="Reconnecting")&&_()},I.onerror=$=>{r()})};return oe(),Ar(()=>{window.clearTimeout(L),window.clearInterval(H),I&&I.close(1e3,"Component unmounting")}),{state:c,activeAlerts:b,recentlyResolved:m,connected:r,reconnecting:l,initialDataReceived:a,updateProgress:z,reconnect:()=>{I?.close(),window.clearTimeout(L),se=0,oe()},removeAlerts:$=>{const D=[];Object.entries(b).forEach(([f,j])=>{if(!j){D.push(f);return}try{$(j)&&(X.delete(f),D.push(f))}catch(K){Sr.error("Failed to evaluate alert removal predicate",K)}}),D.length>0&&p(qd(f=>{D.forEach(j=>{delete f[j]})}))},updateAlert:($,D)=>{const f=b[$];if(f){if("acknowledged"in D){const j=f.ackTime;X.set($,{ack:!!D.acknowledged,previousAckTime:j}),setTimeout(()=>{X.has($)&&(Sr.warn(`Clearing stale pending ack change for alert ${$}`),X.delete($),Yt.error("Server did not confirm the alert acknowledgment in time. Re-syncing from latest data."))},15e3)}p($,{...f,...D})}}}}function Na(){if(!window.__pulseWsStore){const r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;window.__pulseWsStore=Zd(r)}return window.__pulseWsStore}function Zt(e,r=1){if(!e||e<0)return"0 B";const s=1024,l=["B","KB","MB","GB","TB","PB"],o=Math.floor(Math.log(e)/Math.log(s));return`${(e/Math.pow(s,o)).toFixed(r)} ${l[o]}`}function ec(e,r=0){return!e||e<0?"0 B/s":`${Zt(e,r)}/s`}function js(e){if(!e||e<0)return"0s";const r=Math.floor(e/86400),s=Math.floor(e%86400/3600),l=Math.floor(e%3600/60);return r>0?`${r}d ${s}h`:s>0?`${s}h ${l}m`:`${l}m`}function ao(e){if(!e)return"";const r=new Date(e),l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()],o=r.getDate(),a=r.getHours().toString().padStart(2,"0"),d=r.getMinutes().toString().padStart(2,"0");return`${o} ${l} ${a}:${d}`}function An(e){if(!e)return"";const s=Date.now()-e;if(isNaN(s)||!isFinite(s))return"";if(s<0)return"0s ago";const l=Math.floor(s/1e3),o=Math.floor(l/60),a=Math.floor(o/60),d=Math.floor(a/24),c=Math.floor(d/30),g=Math.floor(d/365);return l<60?`${l}s ago`:o<60?o===1?"1 min ago":`${o} mins ago`:a<24?a===1?"1 hour ago":`${a} hours ago`:d<30?d===1?"1 day ago":`${d} days ago`:c<12?c===1?"1 month ago":`${c} months ago`:g===1?"1 year ago":`${g} years ago`}var tc=i('<div class=metric-text><div class="relative min-w-[96px] w-full h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600"><div></div><span class="absolute inset-0 flex items-center justify-center text-[10px] font-medium text-gray-800 dark:text-gray-100 leading-none"><span class="whitespace-nowrap px-0.5">');function un(e){const r=pe(()=>Math.min(e.value,100)),s=pe(()=>{const a=e.value,d=e.type||"generic";return d==="cpu"?a>=90?"red":a>=80?"yellow":"green":d==="memory"?a>=85?"red":a>=75?"yellow":"green":d==="disk"?a>=90?"red":a>=80?"yellow":"green":a>=90?"red":a>=75?"yellow":"green"}),l=pe(()=>({red:"bg-red-500/60 dark:bg-red-500/50",yellow:"bg-yellow-500/60 dark:bg-yellow-500/50",green:"bg-green-500/60 dark:bg-green-500/50"})[s()]||"bg-gray-500/60 dark:bg-gray-500/50"),o=pe(()=>e.sublabel?`${e.label} (${e.sublabel})`:e.label);return(()=>{var a=tc(),d=a.firstChild,c=d.firstChild,g=c.nextSibling,b=g.firstChild;return t(b,o),q(p=>{var m=`absolute top-0 left-0 h-full ${l()}`,S=`${r()}%`;return m!==p.e&&y(c,p.e=m),S!==p.t&&((p.t=S)!=null?c.style.setProperty("width",S):c.style.removeProperty("width")),p},{e:void 0,t:void 0}),a})()}var rc=i("<div class=metric-container style=position:relative;display:inline-block;overflow:visible;><span style=position:relative;z-index:2;display:inline-block;>"),nc=i("<span style=position:absolute;top:0;left:0;z-index:1;>");const sc=e=>{const[r,s]=Z(e.value),[l,o]=Z(e.value),[a,d]=Z(!1),[c,g]=Z("");let b,p=!1;ft(()=>{const S=e.value,z=r();if(!p){p=!0,s(S),o(S);return}S!==z&&(clearTimeout(b),o(z),d(!0),S>z?(g("up"),console.log("[AnimatedMetric] Going UP:",z,"->",S)):(g("down"),console.log("[AnimatedMetric] Going DOWN:",z,"->",S)),s(S),b=window.setTimeout(()=>{d(!1),g("")},500))}),Ar(()=>clearTimeout(b));const m=e.formatter||(S=>Zt(S)+"/s");return(()=>{var S=rc(),z=S.firstChild;return t(S,(()=>{var ie=$e(()=>!!a());return()=>ie()&&(()=>{var ne=nc();return t(ne,()=>m(l())),q(()=>y(ne,`metric-ghost metric-ghost-${c()}`)),ne})()})(),z),t(z,()=>m(r())),q(()=>y(z,`metric-value ${a()?`metric-entering-${c()}`:""}`)),S})()};var ac=i("<div>"),lc=i('<div class="min-h-[24px] flex items-center text-sm text-gray-400">-');function Ks(e){const r=()=>typeof e.value=="function"?e.value():e.value,[s,l]=Z(r()||0);ft(()=>{const a=r()||0,d=s();a!==d&&l(a)});const o=pe(()=>{if(e.disabled)return"text-gray-400 dark:text-gray-500";const a=s()/(1024*1024);return a<1?"text-gray-300 dark:text-gray-400":a<10?"text-green-600 dark:text-green-400":a<50?"text-yellow-600 dark:text-yellow-400":"text-red-600 dark:text-red-400"});return n(h,{get when(){return!e.disabled},get fallback(){return lc()},get children(){var a=ac();return t(a,n(sc,{get value(){return s()},formatter:d=>ec(d,0)})),q(()=>y(a,`min-h-[24px] text-sm font-mono ${o()} flex items-center`)),a}})}function lo(e){let r=0;for(let s=0;s<e.length;s++){const l=e.charCodeAt(s);r=(r<<5)-r+l,r=r&r}return Math.abs(r)}function ic(e){const s=lo(e.toLowerCase())%360,l=65;return{bg:`hsl(${s}, ${l}%, 60%)`,text:`hsl(${s}, ${l}%, 25%)`,border:`hsl(${s}, ${l}%, 50%)`}}function oc(e){const s=lo(e.toLowerCase())%360,l=55;return{bg:`hsl(${s}, ${l}%, 35%)`,text:`hsl(${s}, ${l}%, 85%)`,border:`hsl(${s}, ${l}%, 45%)`}}const Oa={production:{light:{bg:"rgb(254, 226, 226)",text:"rgb(153, 27, 27)",border:"rgb(239, 68, 68)"},dark:{bg:"rgb(127, 29, 29)",text:"rgb(254, 202, 202)",border:"rgb(185, 28, 28)"}},staging:{light:{bg:"rgb(254, 243, 199)",text:"rgb(146, 64, 14)",border:"rgb(245, 158, 11)"},dark:{bg:"rgb(120, 53, 15)",text:"rgb(253, 230, 138)",border:"rgb(217, 119, 6)"}},development:{light:{bg:"rgb(220, 252, 231)",text:"rgb(22, 101, 52)",border:"rgb(34, 197, 94)"},dark:{bg:"rgb(20, 83, 45)",text:"rgb(187, 247, 208)",border:"rgb(34, 197, 94)"}},backup:{light:{bg:"rgb(219, 234, 254)",text:"rgb(30, 58, 138)",border:"rgb(59, 130, 246)"},dark:{bg:"rgb(30, 58, 138)",text:"rgb(191, 219, 254)",border:"rgb(59, 130, 246)"}}};function dc(e,r){const s=e.toLowerCase();return Oa[s]?r?Oa[s].dark:Oa[s].light:r?oc(e):ic(e)}var cc=i('<div class="fixed z-[9999] px-3 py-2 text-xs whitespace-pre-line rounded-lg border shadow-xl pointer-events-none bg-white/95 text-gray-900 border-gray-200 backdrop-blur-sm leading-tight dark:bg-gray-900/95 dark:text-gray-100 dark:border-gray-700"> ');function uc(e){return e.replace(/<[^>]*>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const gc=e=>{let r;const[s,l]=Z({left:0,top:0});return ft(()=>{if(!e.visible){l({left:e.x,top:e.y});return}requestAnimationFrame(()=>{if(!r)return;const o=r.getBoundingClientRect(),a=8;let d=e.x,c=e.y;const g=e.align??"center",b=e.direction??"up";g==="center"&&(d=e.x-o.width/2),b==="up"?c=e.y-o.height-a:c=e.y+a;const p=4,m=window.innerWidth-o.width-p,S=window.innerHeight-o.height-p;d=Math.min(Math.max(d,p),Math.max(m,p)),c=Math.min(Math.max(c,p),Math.max(S,p)),l({left:d,top:c})})}),n(h,{get when(){return e.visible},get children(){return n(ps,{get mount(){return document.body},get children(){var o=cc(),a=o.firstChild,d=r;return typeof d=="function"?fr(d,o):r=o,o.style.setProperty("transition","opacity 120ms ease-out"),q(c=>{var g=`${s().left}px`,b=`${s().top}px`,p=`${e.maxWidth??240}px`,m=e.visible?"1":"0",S=uc(e.content);return g!==c.e&&((c.e=g)!=null?o.style.setProperty("left",g):o.style.removeProperty("left")),b!==c.t&&((c.t=b)!=null?o.style.setProperty("top",b):o.style.removeProperty("top")),p!==c.a&&((c.a=p)!=null?o.style.setProperty("max-width",p):o.style.removeProperty("max-width")),m!==c.o&&((c.o=m)!=null?o.style.setProperty("opacity",m):o.style.removeProperty("opacity")),S!==c.i&&(a.data=c.i=S),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o}})}})};let vl=null;function hc(){const[e,r]=Z(!1),[s,l]=Z(""),[o,a]=Z({x:0,y:0}),[d,c]=Z({});return vl={show:(g,b,p,m)=>{l(g),a({x:b,y:p}),c(m||{}),r(!0)},hide:()=>{r(!1)}},()=>n(gc,{get content(){return s()},get x(){return o().x},get y(){return o().y},get visible(){return e()},get align(){return d().align},get direction(){return d().direction},get maxWidth(){return d().maxWidth}})}function Xn(e,r,s,l){vl?.show(e,r,s,l)}function Cn(){vl?.hide()}var fc=i('<div class=relative><div class="w-2 h-2 rounded-full hover:scale-150 transition-transform duration-200 ease-out cursor-pointer">'),mc=i('<div class=relative><div class="inline-flex items-center text-[10px] text-gray-500 dark:text-gray-400 whitespace-nowrap leading-none cursor-pointer hover:text-gray-700 dark:hover:text-gray-300 hover:scale-125 transition-transform duration-200 ease-out">+'),xc=i('<div class="inline-flex items-center gap-1 ml-2">');const bc=e=>{const r=()=>e.maxVisible??3,s=Hw(),l=()=>e.isDarkMode??s(),o=()=>e.tags?.slice(0,r())||[],a=()=>e.tags?.slice(r())||[],d=c=>{const g=()=>dc(c.tag,l()),b=()=>e.activeSearch?.includes(`tags:${c.tag}`)||!1;return(()=>{var p=fc(),m=p.firstChild;return p.$$click=S=>{S.stopPropagation(),e.onTagClick?.(c.tag)},p.addEventListener("mouseleave",()=>{Cn()}),p.addEventListener("mouseenter",S=>{const z=S.currentTarget.getBoundingClientRect();Xn(c.tag,z.left+z.width/2,z.top,{align:"center",direction:"up"})}),q(S=>{var z=g().bg,ie=b()?l()?"0 0 0 2.5px rgba(255, 255, 255, 0.9)":"0 0 0 2.5px rgba(0, 0, 0, 0.8)":"none";return z!==S.e&&((S.e=z)!=null?m.style.setProperty("background-color",z):m.style.removeProperty("background-color")),ie!==S.t&&((S.t=ie)!=null?m.style.setProperty("box-shadow",ie):m.style.removeProperty("box-shadow")),S},{e:void 0,t:void 0}),p})()};return n(h,{get when(){return e.tags&&e.tags.length>0},get children(){var c=xc();return t(c,n(ze,{get each(){return o()},children:g=>n(d,{tag:g})}),null),t(c,n(h,{get when(){return a().length===1},get children(){return n(d,{get tag(){return a()[0]}})}}),null),t(c,n(h,{get when(){return a().length>1},get children(){var g=mc(),b=g.firstChild;return b.firstChild,g.addEventListener("mouseleave",()=>{Cn()}),g.addEventListener("mouseenter",p=>{const m=p.currentTarget.getBoundingClientRect(),S=a().join(`
|
||
`);S&&Xn(S,m.left+m.width/2,m.top,{align:"center",direction:"up",maxWidth:260})}),t(b,()=>a().length,null),g}}),null),c}})};Xt(["click"]);var pc=i('<div class="flex flex-col gap-1.5">'),yc=i('<span class="text-gray-400 text-sm cursor-help">-'),vc=i('<div class="rounded border border-gray-200 bg-gray-50 px-1.5 py-1 text-[10px] leading-tight shadow-sm dark:border-gray-700 dark:bg-gray-800/80"><div class="truncate text-gray-700 dark:text-gray-200"></div><div class="mt-0.5 text-[9px] text-gray-500 dark:text-gray-400"></div><div class="relative mt-1 h-1.5 w-full overflow-hidden rounded bg-gray-200 dark:bg-gray-600"><div></div></div><div class="mt-0.5 flex items-center justify-between text-[9px] font-medium text-gray-600 dark:text-gray-300"><span></span><span>');function kc(e){const r=o=>!o.total||o.total<=0?0:o.used/o.total*100,s=o=>o>=90?"bg-red-500/60 dark:bg-red-500/50":o>=80?"bg-yellow-500/60 dark:bg-yellow-500/50":"bg-green-500/60 dark:bg-green-500/50",l=()=>{switch(e.diskStatusReason){case"agent-not-running":return"Guest agent not running. Install and start qemu-guest-agent in the VM.";case"agent-timeout":return"Guest agent timeout. Agent may need to be restarted.";case"permission-denied":return"Permission denied. Check that your Pulse user/token has VM.Monitor permission (PVE 8) or VM.GuestAgent.Audit permission (PVE 9).";case"agent-disabled":return"Guest agent is disabled in VM configuration. Enable it in VM Options.";case"no-filesystems":return"No filesystems found. VM may be booting or using a Live ISO.";case"special-filesystems-only":return"Only special filesystems detected (ISO/squashfs). This is normal for Live systems.";case"agent-error":return"Error communicating with guest agent.";case"no-data":return"No disk data available from Proxmox API.";default:return"Disk stats unavailable. Guest agent may not be installed."}};return n(h,{get when(){return e.disks&&e.disks.length>0},get fallback(){return(()=>{var o=yc();return q(()=>Te(o,"title",l())),o})()},get children(){var o=pc();return t(o,n(ze,{get each(){return e.disks},children:a=>{const d=r(a),c=a.mountpoint||a.device||"Unknown",g=a.total&&a.total>0;return(()=>{var b=vc(),p=b.firstChild,m=p.nextSibling,S=m.nextSibling,z=S.firstChild,ie=S.nextSibling,ne=ie.firstChild,W=ne.nextSibling;return Te(p,"title",c!=="Unknown"?c:void 0),t(p,c),t(m,()=>g?`${Zt(a.used)}/${Zt(a.total)}`:"Usage unavailable"),t(ne,()=>g?`${d.toFixed(0)}%`:"—"),t(W,()=>a.type?.toUpperCase()??""),q(X=>{var I=`absolute inset-y-0 left-0 ${s(d)}`,L=`${Math.min(d,100)}%`;return I!==X.e&&y(z,X.e=I),L!==X.t&&((X.t=L)!=null?z.style.setProperty("width",L):z.style.removeProperty("width")),X},{e:void 0,t:void 0}),b})()}})),o}})}const wc="online",$c="running";function _c(e){if(!e||e.status!==wc||(e.uptime??0)<=0)return!1;const r=e.connectionHealth;return!(r==="offline"||r==="error")}function io(e,r=!0){return!e||!r?!1:e.status===$c}function Cc(e,r=!0){return io(e,r)}var Sc=i('<a target=_blank rel="noopener noreferrer"class="text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-150 cursor-pointer truncate">'),Tc=i('<span class="text-[10px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide">Lock: '),Ac=i('<tr><td><div class="flex items-center gap-2"><div class=flex data-prevent-toggle></div></div></td><td class="py-0.5 px-2 whitespace-nowrap w-[48px] sm:w-[56px] lg:w-[60px] xl:w-[64px] 2xl:w-[72px]"><div class="flex h-[24px] items-center"><span></span></div></td><td class="py-0.5 px-2 whitespace-nowrap w-[56px] sm:w-[64px] lg:w-[72px] xl:w-[80px] 2xl:w-[90px] text-sm text-gray-600 dark:text-gray-400 align-middle"></td><td></td><td class="py-0.5 px-2 w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px]"></td><td class="py-0.5 px-2 w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px]"><div></div></td><td class="py-0.5 px-2 w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px]"></td><td class="py-0.5 px-2 w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px]"><div class="flex h-[24px] items-center"></div></td><td class="py-0.5 px-2 w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px]"><div class="flex h-[24px] items-center"></div></td><td class="py-0.5 px-2 w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px]"><div class="flex h-[24px] items-center"></div></td><td class="py-0.5 px-2 w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px]"><div class="flex h-[24px] items-center">'),Dc=i("<span class=font-medium>"),Mc=i('<span class="text-gray-400 dark:text-gray-500">•'),Pc=i("<span>"),Ec=i('<div class="flex flex-wrap items-center gap-1 text-gray-600 dark:text-gray-300">'),jl=i('<div class="flex flex-wrap gap-1">'),Nc=i('<div class="min-w-[220px] rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Guest Overview</div><div class="mt-1 space-y-1">'),Oc=i('<div class="min-w-[220px] rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Memory</div><div class="mt-1 space-y-1 text-gray-600 dark:text-gray-300">'),Lc=i('<div class="min-w-[220px] rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Filesystems</div><div class="mt-1 text-gray-600 dark:text-gray-300">'),Rc=i('<div class="min-w-[220px] flex-1 rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Network Interfaces</div><div class="mt-1 text-[10px] text-gray-400 dark:text-gray-500">Row charts show current rate; totals below are cumulative since boot.</div><div class="mt-1 space-y-1 text-gray-600 dark:text-gray-300">'),Ic=i('<tr><td class="px-4 py-2"colspan=11><div>'),Hc=i('<span class="text-sm font-medium text-gray-900 dark:text-gray-100 truncate">'),Fl=i('<span class="text-sm text-gray-400">-'),Uc=i('<span class="text-gray-400 text-sm cursor-help">-'),Bc=i("<p>"),jc=i("<p>Install and run the qemu-guest-agent inside this VM so Pulse can surface OS, network, and filesystem details."),Fc=i('<div class="min-w-[220px] rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Guest details unavailable</div><div class="mt-1 space-y-1 text-gray-600 dark:text-gray-300">'),Vc=i("<p>Start this container and ensure the Pulse user has sufficient Proxmox permissions to collect guest metrics."),Vl=i('<span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">'),Gc=i("<div>"),zc=i('<span class="text-[10px] text-gray-400 dark:text-gray-500">'),Wc=i('<div class="flex items-center gap-3 text-[10px] text-gray-500 dark:text-gray-400"><span>Total RX </span><span>Total TX '),qc=i('<div class="space-y-1 rounded border border-dashed border-gray-200 p-2 last:mb-0 dark:border-gray-700"><div class="flex items-center gap-2 font-medium text-gray-700 dark:text-gray-200"><span class=truncate>');const Js=new Map,Gl=e=>e.id?e.id:e.instance===e.node?`${e.node}-${e.vmid}`:`${e.instance}-${e.node}-${e.vmid}`,Qs=e=>e.type==="qemu";function Kc(e){const[r,s]=Z(e.customUrl),l=Gl(e.guest),[o,a]=Z(Js.get(l)??!1),d=pe(()=>Gl(e.guest)),c=pe(()=>(e.guest.disks?.length??0)>0),g=pe(()=>e.guest.ipAddresses??[]),b=pe(()=>e.guest.networkInterfaces??[]),p=pe(()=>b().length>0),m=pe(()=>e.guest.osName?.trim()??""),S=pe(()=>e.guest.osVersion?.trim()??""),z=pe(()=>m().length>0||S().length>0);ft(()=>{s(e.customUrl)});const ie=pe(()=>(e.guest.cpu||0)*100),ne=pe(()=>e.guest.memory&&e.guest.memory.usage||0),W=pe(()=>{if(!e.guest.memory)return;const F=e.guest.memory.used??0,P=e.guest.memory.total??0;return`${Zt(F)}/${Zt(P)}`}),X=pe(()=>{if(!e.guest.memory)return;const F=[],P=e.guest.memory.total??0;if(e.guest.memory.balloon&&e.guest.memory.balloon>0&&e.guest.memory.balloon!==P&&F.push(`Balloon: ${Zt(e.guest.memory.balloon)}`),e.guest.memory.swapTotal&&e.guest.memory.swapTotal>0){const E=e.guest.memory.swapUsed??0;F.push(`Swap: ${Zt(E)} / ${Zt(e.guest.memory.swapTotal)}`)}return F.length>0?F:void 0}),I=pe(()=>X()?.join(`
|
||
`)??void 0),L=pe(()=>z()||g().length>0||(X()?.length??0)>0||c()||p()),H=pe(()=>!L()&&(e.guest.type==="qemu"||e.guest.type==="lxc")),se=pe(()=>L()||H());ft(Wn(d,F=>{const P=Js.get(F);a(P!==void 0?P:!1)})),ft(()=>{Js.set(d(),o())}),ft(()=>{!se()&&o()&&(a(!1),Js.set(d(),!1))});const le=F=>{!se()||F.target.closest("a, button, [data-prevent-toggle]")||a(E=>!E)},ee=pe(()=>!e.guest.disk||e.guest.disk.total===0?0:e.guest.disk.usage===-1?-1:e.guest.disk.used/e.guest.disk.total*100),U=pe(()=>!e.guest.disk||e.guest.disk.total<=0?!1:ee()!==-1),Y=pe(()=>e.parentNodeOnline!==!1),oe=pe(()=>io(e.guest,Y())),_=pe(()=>Cc(e.guest,Y())),B=pe(()=>(e.guest.lock||"").trim()),$=()=>{if(!Qs(e.guest))return"Disk stats unavailable";switch(e.guest.diskStatusReason){case"agent-not-running":return"Guest agent not running. Install and start qemu-guest-agent in the VM.";case"agent-timeout":return"Guest agent timeout. Agent may need to be restarted.";case"permission-denied":return"Permission denied. Check that your Pulse user/token has VM.Monitor permission (PVE 8) or VM.GuestAgent.Audit permission (PVE 9).";case"agent-disabled":return"Guest agent is disabled in VM configuration. Enable it in VM Options.";case"no-filesystems":return"No filesystems found. VM may be booting or using a Live ISO.";case"special-filesystems-only":return"Only special filesystems detected (ISO/squashfs). This is normal for Live systems.";case"agent-error":return"Error communicating with guest agent.";case"no-data":return"No disk data available from Proxmox API.";default:return"Disk stats unavailable. Guest agent may not be installed."}},D=pe(()=>!!e.alertStyles?.hasUnacknowledgedAlert),f=pe(()=>!!e.alertStyles?.hasAcknowledgedOnlyAlert),j=pe(()=>D()||f()),K=pe(()=>{if(j())return D()?e.alertStyles?.severity==="critical"?"#ef4444":"#eab308":"#9ca3af"}),C=pe(()=>!oe()),ge=pe(()=>{const F="transition-all duration-200 relative",P="hover:shadow-sm",E=D()?e.alertStyles?.severity==="critical"?"bg-red-50 dark:bg-red-950/30":"bg-yellow-50 dark:bg-yellow-950/20":"",u=D()?"":"hover:bg-gray-50 dark:hover:bg-gray-700/30",v=oe()?"":"opacity-60",V=se()?"cursor-pointer":"",A=o()&&!D()?"bg-gray-50 dark:bg-gray-800/40":"";return`${F} ${P} ${u} ${E} ${v} ${V} ${A}`}),J=pe(()=>"py-0.5 pr-2 whitespace-nowrap relative w-[130px] sm:w-[150px] lg:w-[180px] xl:w-[200px] 2xl:w-[240px] pl-4"),N=pe(()=>{if(!j())return{};const F=K();return F?{"box-shadow":`inset 4px 0 0 0 ${F}`}:{}});return[(()=>{var F=Ac(),P=F.firstChild,E=P.firstChild,u=E.firstChild,v=P.nextSibling,V=v.firstChild,A=V.firstChild,k=v.nextSibling,w=k.nextSibling,de=w.nextSibling,fe=de.nextSibling,x=fe.firstChild,R=fe.nextSibling,Q=R.nextSibling,G=Q.firstChild,T=Q.nextSibling,te=T.firstChild,ae=T.nextSibling,M=ae.firstChild,ce=ae.nextSibling,ue=ce.firstChild;return F.$$click=le,t(E,n(h,{get when(){return r()},get fallback(){return(()=>{var re=Hc();return t(re,()=>e.guest.name),q(()=>Te(re,"title",e.guest.name)),re})()},get children(){var re=Sc();return re.$$click=O=>O.stopPropagation(),t(re,()=>e.guest.name),q(O=>{var xe=r(),he=`${e.guest.name} - Click to open custom URL`;return xe!==O.e&&Te(re,"href",O.e=xe),he!==O.t&&Te(re,"title",O.t=he),O},{e:void 0,t:void 0}),re}}),u),u.$$click=re=>re.stopPropagation(),t(u,n(bc,{get tags(){return Array.isArray(e.guest.tags)?e.guest.tags:[]},maxVisible:3,get onTagClick(){return e.onTagClick},get activeSearch(){return e.activeSearch}})),t(E,n(h,{get when(){return B()},get children(){var re=Tc();return re.firstChild,t(re,B,null),q(()=>Te(re,"title",`Guest is locked (${B()})`)),re}}),null),t(A,()=>Qs(e.guest)?"VM":"LXC"),t(k,()=>e.guest.vmid),t(w,n(h,{get when(){return oe()},fallback:"-",get children(){return js(e.guest.uptime)}})),t(de,n(h,{get when(){return _()},get fallback(){return Fl()},get children(){return n(un,{get value(){return ie()},get label(){return`${ie().toFixed(0)}%`},get sublabel(){return $e(()=>!!e.guest.cpus)()?`${((e.guest.cpu||0)*e.guest.cpus).toFixed(1)}/${e.guest.cpus} cores`:void 0},type:"cpu"})}})),t(x,n(h,{get when(){return _()},get fallback(){return Fl()},get children(){return n(un,{get value(){return ne()},get label(){return`${ne().toFixed(0)}%`},get sublabel(){return W()},type:"memory"})}})),t(R,n(h,{get when(){return U()},get fallback(){return(()=>{var re=Uc();return q(()=>Te(re,"title",$())),re})()},get children(){return n(un,{get value(){return ee()},get label(){return`${ee().toFixed(0)}%`},get sublabel(){return $e(()=>!!e.guest.disk)()?`${Zt(e.guest.disk.used)}/${Zt(e.guest.disk.total)}`:void 0},type:"disk"})}})),t(G,n(Ks,{get value(){return e.guest.diskRead},get disabled(){return!oe()}})),t(te,n(Ks,{get value(){return e.guest.diskWrite},get disabled(){return!oe()}})),t(M,n(Ks,{get value(){return e.guest.networkIn},get disabled(){return!oe()}})),t(ue,n(Ks,{get value(){return e.guest.networkOut},get disabled(){return!oe()}})),q(re=>{var O=ge(),xe=N(),he=o(),me=J(),_e=`inline-block px-1.5 py-0.5 text-xs font-medium rounded ${e.guest.type==="qemu"?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"}`,Ce=`py-0.5 px-2 w-[76px] sm:w-[86px] lg:w-[96px] xl:w-[108px] 2xl:w-[128px] text-sm whitespace-nowrap align-middle ${e.guest.uptime<3600?"text-orange-500":"text-gray-600 dark:text-gray-400"}`,Oe=I()??void 0;return O!==re.e&&y(F,re.e=O),re.t=xs(F,xe,re.t),he!==re.a&&Te(F,"aria-expanded",re.a=he),me!==re.o&&y(P,re.o=me),_e!==re.i&&y(A,re.i=_e),Ce!==re.n&&y(w,re.n=Ce),Oe!==re.s&&Te(x,"title",re.s=Oe),re},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),F})(),n(h,{get when(){return $e(()=>!!o())()&&se()},get children(){var F=Ic(),P=F.firstChild,E=P.firstChild;return t(E,n(h,{get when(){return L()},get fallback(){return(()=>{var u=Fc(),v=u.firstChild,V=v.nextSibling;return t(V,n(h,{get when(){return Qs(e.guest)},get fallback(){return Vc()},get children(){return[(()=>{var A=Bc();return t(A,$),A})(),jc()]}})),u})()},get children(){return[n(h,{get when(){return z()||g().length>0},get children(){var u=Nc(),v=u.firstChild,V=v.nextSibling;return t(V,n(h,{get when(){return z()},get children(){var A=Ec();return t(A,n(h,{get when(){return m().length>0},get children(){var k=Dc();return t(k,m),q(()=>Te(k,"title",m())),k}}),null),t(A,n(h,{get when(){return $e(()=>m().length>0)()&&S().length>0},get children(){return Mc()}}),null),t(A,n(h,{get when(){return S().length>0},get children(){var k=Pc();return t(k,S),q(()=>Te(k,"title",S())),k}}),null),A}}),null),t(V,n(h,{get when(){return g().length>0},get children(){var A=jl();return t(A,n(ze,{get each(){return g()},children:k=>(()=>{var w=Vl();return t(w,k),w})()})),A}}),null),u}}),n(h,{get when(){return $e(()=>!!X())()&&X().length>0},get children(){var u=Oc(),v=u.firstChild,V=v.nextSibling;return t(V,n(ze,{get each(){return X()},children:A=>(()=>{var k=Gc();return t(k,A),k})()})),u}}),n(h,{get when(){return c()&&e.guest.disks&&e.guest.disks.length>0},get children(){var u=Lc(),v=u.firstChild,V=v.nextSibling;return t(V,n(kc,{get disks(){return e.guest.disks||[]},get diskStatusReason(){return Qs(e.guest)?e.guest.diskStatusReason:void 0}})),u}}),n(h,{get when(){return p()},get children(){var u=Rc(),v=u.firstChild,V=v.nextSibling,A=V.nextSibling;return t(A,n(ze,{get each(){return b()},children:k=>{const w=k.addresses??[],de=(k.rxBytes??0)>0||(k.txBytes??0)>0;return(()=>{var fe=qc(),x=fe.firstChild,R=x.firstChild;return t(R,()=>k.name||"interface"),t(x,n(h,{get when(){return k.mac},get children(){var Q=zc();return t(Q,()=>k.mac),q(()=>Te(Q,"title",k.mac)),Q}}),null),t(fe,n(h,{get when(){return w.length>0},get children(){var Q=jl();return t(Q,n(ze,{each:w,children:G=>(()=>{var T=Vl();return t(T,G),T})()})),Q}}),null),t(fe,n(h,{when:de,get children(){var Q=Wc(),G=Q.firstChild;G.firstChild;var T=G.nextSibling;return T.firstChild,t(G,()=>Zt(k.rxBytes??0),null),t(T,()=>Zt(k.txBytes??0),null),Q}}),null),q(()=>Te(R,"title",k.name)),fe})()}})),u}})]}})),q(u=>{var v=`text-[11px] ${oe()&&e.parentNodeOnline!==!1?"bg-gray-50/60 text-gray-600 dark:bg-gray-800/40 dark:text-gray-300":"bg-gray-100/70 text-gray-400 dark:bg-gray-900/30 dark:text-gray-500"}`,V=!oe()||e.parentNodeOnline===!1,A=`flex flex-wrap gap-3 justify-start ${C()?"opacity-50 saturate-75 pointer-events-none":""}`;return v!==u.e&&y(F,u.e=v),V!==u.t&&Te(F,"aria-hidden",u.t=V),A!==u.a&&y(E,u.a=A),u},{e:void 0,t:void 0,a:void 0}),F}})]}Xt(["click"]);const wa=(e,r)=>{const s=Object.values(r).filter(z=>z.resourceId===e),l=s.filter(z=>!z.acknowledged),o=s.filter(z=>z.acknowledged);let a=null,d=!1,c=!1;l.forEach(z=>{(z.level==="critical"||z.level==="warning"&&a!=="critical")&&(a=z.level),z.type==="powered-off"?d=!0:c=!0});const g=s.length,b=l.length,p=o.length,m=b>0,S=g>0;return a==="critical"?{rowClass:"bg-red-50 dark:bg-red-950/30 border-l-4 border-red-500 dark:border-red-400",indicatorClass:"bg-red-500",badgeClass:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",hasAlert:S,alertCount:g,severity:"critical",hasPoweredOffAlert:d,hasNonPoweredOffAlert:c,hasUnacknowledgedAlert:m,unacknowledgedCount:b,acknowledgedCount:p,hasAcknowledgedOnlyAlert:!m&&p>0}:a==="warning"?{rowClass:"bg-yellow-50 dark:bg-yellow-950/20 border-l-4 border-yellow-500 dark:border-yellow-400",indicatorClass:"bg-yellow-500",badgeClass:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",hasAlert:S,alertCount:g,severity:"warning",hasPoweredOffAlert:d,hasNonPoweredOffAlert:c,hasUnacknowledgedAlert:m,unacknowledgedCount:b,acknowledgedCount:p,hasAcknowledgedOnlyAlert:!m&&p>0}:{rowClass:"",indicatorClass:"",badgeClass:"",hasAlert:S,alertCount:g,severity:null,hasPoweredOffAlert:d,hasNonPoweredOffAlert:c,hasUnacknowledgedAlert:m,unacknowledgedCount:b,acknowledgedCount:p,hasAcknowledgedOnlyAlert:!m&&p>0}};var Jc=i('<span class="text-[0.7rem] font-semibold uppercase tracking-[0.18em] text-gray-500 dark:text-gray-400">'),Qc=i("<p>"),Yc=i("<div><h2>");function rr(e){const r=kr({align:"left",size:"md",titleClass:"",descriptionClass:""},e),[s,l]=rs(r,["label","title","description","align","size","titleClass","descriptionClass","class"]),o=s.align==="center"?"text-center items-center":"text-left items-start",a=()=>{switch(s.size){case"sm":return"text-base";case"lg":return"text-2xl";default:return"text-lg"}};return(()=>{var d=Yc(),c=d.firstChild;return bs(d,kr({get class(){return`flex flex-col gap-1 ${o} ${s.class??""}`.trim()}},l),!1,!0),t(d,n(h,{get when(){return s.label},get children(){var g=Jc();return t(g,()=>s.label),g}}),c),t(c,()=>s.title),t(d,n(h,{get when(){return s.description},get children(){var g=Qc();return t(g,()=>s.description),q(()=>y(g,`text-sm text-gray-600 dark:text-gray-400 ${s.descriptionClass??""}`.trim())),g}}),null),q(()=>y(c,`${a()} font-semibold text-gray-900 dark:text-gray-100 ${s.titleClass??""}`.trim())),d})()}var Xc=i('<div class="min-h-screen flex items-center justify-center bg-gray-100 dark:bg-gray-900 p-4"><div class="max-w-md w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6"><div class="flex items-center mb-4"><svg class="w-12 h-12 text-red-500 mr-3"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div></div></div><div class="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mb-4"><p class="text-sm text-red-800 dark:text-red-200 font-mono"></p></div><div class="flex gap-2"><button type=button class="flex-1 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors">Try Again</button><button type=button class="flex-1 px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors">Reload Page</button></div><button type=button class="mt-4 text-sm text-gray-500 dark:text-gray-400 underline hover:text-gray-700 dark:hover:text-gray-300"> error details'),Zc=i('<div class="mt-4 p-3 bg-gray-100 dark:bg-gray-700 rounded overflow-x-auto"><pre class="text-xs text-gray-700 dark:text-gray-300 whitespace-pre-wrap">'),eu=i('<div class="p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded"><div class="flex items-center mb-2"><svg class="w-5 h-5 text-red-500 mr-2"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div><p class="text-xs text-red-700 dark:text-red-300 mb-2"></p><button type=button class="text-xs px-2 py-1 bg-red-600 text-white rounded hover:bg-red-700 transition-colors">Retry');const tu=e=>{const[r,s]=Z(!1);return(()=>{var l=Xc(),o=l.firstChild,a=o.firstChild,d=a.firstChild,c=d.nextSibling,g=a.nextSibling,b=g.firstChild,p=g.nextSibling,m=p.firstChild,S=m.nextSibling,z=p.nextSibling,ie=z.firstChild;return t(c,n(rr,{title:"Something went wrong",description:"An unexpected error occurred",size:"md",titleClass:"text-gray-900 dark:text-gray-100",descriptionClass:"text-sm text-gray-600 dark:text-gray-400"})),t(b,()=>e.error.message),Gr(m,"click",e.reset,!0),S.$$click=()=>window.location.reload(),z.$$click=()=>s(!r()),t(z,()=>r()?"Hide":"Show",ie),t(o,(()=>{var ne=$e(()=>!!r());return()=>ne()&&(()=>{var W=Zc(),X=W.firstChild;return t(X,()=>e.error.stack),W})()})(),null),l})()},oo=e=>n(Ko,{fallback:(r,s)=>(so("Error boundary caught error",r),e.onError&&e.onError(r),e.fallback?e.fallback(r,s):n(tu,{error:r,reset:s})),get children(){return e.children}}),il=e=>n(oo,{fallback:(r,s)=>(()=>{var l=eu(),o=l.firstChild;o.firstChild;var a=o.nextSibling,d=a.nextSibling;return t(o,n(rr,{get title(){return`Error in ${e.name}`},size:"sm",titleClass:"text-red-800 dark:text-red-200"}),null),t(a,()=>r.message),Gr(d,"click",s,!0),l})(),onError:r=>{so(`Error in component ${e.name}`,r)},get children(){return e.children}});Xt(["click"]);var ru=i('<div class="absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-white dark:from-gray-800 to-transparent z-10 pointer-events-none">'),nu=i('<div class="absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-white dark:from-gray-800 to-transparent z-10 pointer-events-none">'),su=i(`<div><div class=overflow-x-auto style=scrollbar-width:none;-ms-overflow-style:none;><style>
|
||
.overflow-x-auto::-webkit-scrollbar { display: none; }
|
||
</style><div>`);const ol=e=>{const[r,s]=Z(!1),[l,o]=Z(!1);let a;const d=()=>{if(!a)return;const{scrollLeft:c,scrollWidth:g,clientWidth:b}=a;s(c>0),o(c<g-b-1)};return vr(()=>{d(),window.addEventListener("resize",d)}),ft(()=>{if(a)return a.addEventListener("scroll",d),()=>a?.removeEventListener("scroll",d)}),(()=>{var c=su(),g=c.firstChild,b=g.firstChild,p=b.nextSibling;t(c,n(h,{get when(){return r()},get children(){return ru()}}),g);var m=a;return typeof m=="function"?fr(m,g):a=g,t(p,()=>e.children),t(c,n(h,{get when(){return l()},get children(){return nu()}}),null),q(S=>{var z=`relative ${e.class||""}`,ie=e.minWidth||"auto";return z!==S.e&&y(c,S.e=z),ie!==S.t&&((S.t=ie)!=null?p.style.setProperty("min-width",ie):p.style.removeProperty("min-width")),S},{e:void 0,t:void 0}),c})()};function au(e){e=e.trim();const r=e.match(/^(\w+)\s*(>|<|>=|<=|=|==)\s*(\d+(?:\.\d+)?)$/i);if(r){const[,l,o,a]=r,d=parseFloat(a);return isNaN(d)?{type:"raw",rawText:e}:{type:"metric",field:l.toLowerCase(),operator:o,value:d}}const s=e.match(/^(\w+)\s*:\s*(.+)$/i);if(s){const[,l,o]=s;return{type:"text",field:l.toLowerCase(),value:o.trim()}}return{type:"raw",rawText:e}}function dl(e){const r=e.trim();if(!r)return{filters:[],operators:[]};const s=/\s+(AND|OR)\s+/gi,l=r.split(s),o=[],a=[];for(let c=0;c<l.length;c++){const g=l[c].trim();if(g)if(c%2===0){const b=au(g);o.push(b)}else a.push(g.toUpperCase())}const d=a.length>0?a[0]:"AND";return{filters:o,operators:a,logicalOperator:d}}function lu(e,r){let s;switch(r.field){case"cpu":s=("cpu"in e&&e.cpu||0)*100;break;case"memory":s="memory"in e&&e.memory?e.memory.usage:0;break;case"disk":s="disk"in e&&e.disk?e.disk.usage:0;break;case"uptime":s="status"in e&&e.status==="running"&&"uptime"in e&&e.uptime||0;break;default:if(typeof e=="object"&&e!==null&&r.field in e){const l=e[r.field];if(l!==void 0)s=Number(l)||0;else return!1}else return!1}switch(r.operator){case">":return s>r.value;case"<":return s<r.value;case">=":return s>=r.value;case"<=":return s<=r.value;case"=":case"==":return Math.abs(s-r.value)<.01;default:return!1}}function zl(e,r){const s=r.value.toLowerCase();switch(r.field){case"name":return"name"in e&&e.name?e.name.toLowerCase().includes(s):!1;case"node":return"node"in e&&e.node?e.node.toLowerCase().includes(s):!1;case"vmid":return"vmid"in e&&e.vmid?e.vmid.toString().includes(s):!1;case"tags":if(!("tags"in e)||!e.tags)return!1;const l=Array.isArray(e.tags)?e.tags.filter(a=>typeof a=="string"):typeof e.tags=="string"?e.tags.split(",").map(a=>a.trim()).filter(a=>a.length>0):[];return l.length===0?!1:s.split(",").map(a=>a.trim()).filter(a=>a.length>0).some(a=>l.some(d=>d.toLowerCase().includes(a.toLowerCase())));default:if(typeof e=="object"&&e!==null&&r.field in e){const a=e[r.field];if(a){if(typeof a=="string")return a.toLowerCase().includes(s);if(typeof a=="number")return a.toString().includes(s);if(typeof a=="boolean")return a.toString()===s}}return!1}}function cl(e,r){if(r.filters.length===0)return!0;const s=r.filters.map(o=>{if(o.type==="metric"&&o.field&&o.operator&&o.value!==void 0){const a={field:o.field,operator:o.operator,value:o.value};return lu(e,a)}else if(o.type==="text"&&o.field&&o.value){if(o.field==="tags"){const d={field:"tags",value:o.value};return zl(e,d)}const a={field:o.field,value:o.value};return zl(e,a)}else if(o.type==="raw"&&o.rawText){const a=o.rawText.toLowerCase(),d="name"in e&&typeof e.name=="string"&&e.name.toLowerCase().includes(a),c="vmid"in e&&!!e.vmid&&e.vmid.toString().includes(a),g="node"in e&&typeof e.node=="string"&&e.node.toLowerCase().includes(a),b="status"in e&&typeof e.status=="string"&&e.status.toLowerCase().includes(a),p="tags"in e&&Array.isArray(e.tags)?e.tags.filter(m=>typeof m=="string").some(m=>m.toLowerCase().includes(a)):!1;return d||c||g||b||p}return!0});if(s.length===1)return s[0];let l=s[0];for(let o=0;o<r.operators.length&&o<s.length-1;o++){const a=r.operators[o],d=s[o+1];a==="AND"?l=l&&d:l=l||d}return l}var iu=i("<div>");const ou={default:"bg-white dark:bg-gray-800",muted:"bg-gray-50 dark:bg-gray-800/80",info:"bg-blue-50/70 dark:bg-blue-900/20",success:"bg-green-50/70 dark:bg-green-900/20",warning:"bg-amber-50/80 dark:bg-amber-900/20",danger:"bg-red-50/80 dark:bg-red-900/20"},du={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function it(e){const r=kr({tone:"default",padding:"md",hoverable:!1,border:!0},e),[s,l]=rs(r,["tone","padding","hoverable","border","class"]),o="rounded-lg shadow-sm transition-shadow duration-200",a=ou[s.tone],d=du[s.padding],c=s.border?"border border-gray-200 dark:border-gray-700":"",g=s.hoverable?"hover:shadow-md":"";return(()=>{var b=iu();return bs(b,kr({get class(){return`${o} ${a} ${d} ${c} ${g} ${s.class??""}`.trim()}},l),!1,!1),b})()}const La=e=>e.trim().toLowerCase().replace(/[^a-z0-9]/g,""),cu=e=>e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"$&"),uu=e=>{if(!e)return"";const s=e.trim().replace(/^[a-z]+:\/\//i,""),[l]=s.split("/");return l.replace(/:\d+$/,"")};function Nn(e){const r=typeof e.displayName=="string"?e.displayName.trim():"";if(r)return r;const s=typeof e.name=="string"?e.name.trim():"";if(s)return s;const l=typeof e.host=="string"?e.host.trim():"",o=uu(l);if(o)return o;const a=typeof e.instance=="string"?e.instance.trim():"";return a||""}function co(e){const r=typeof e.displayName=="string"?e.displayName.trim():"";if(!r)return!1;const s=typeof e.name=="string"?e.name.trim():"";if(!s)return!1;const l=r.toLowerCase(),o=s.toLowerCase();if(l===o)return!1;const a=La(r),d=La(s);if(a===d||new RegExp(`\\b${cu(o)}\\b`,"i").test(l))return!1;const[g=""]=l.split(".");return La(g)!==d}const Ra=e=>typeof e=="number"&&Number.isFinite(e),gu=e=>{if(!e?.available)return null;const r=[];return Ra(e.cpuPackage)&&r.push(e.cpuPackage),Ra(e.cpuMax)&&r.push(e.cpuMax),Array.isArray(e.cores)&&e.cores.forEach(s=>{Ra(s.temp)&&r.push(s.temp)}),r.length===0?null:Math.max(...r)};var hu=i('<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-20 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Temp '),fu=i('<div class=overflow-x-auto><table class="w-full min-w-[600px] border-collapse"><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="pl-3 pr-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-1/4 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500"tabindex=0 role=button> </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-24 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Uptime </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-32 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">CPU </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-32 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Memory </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-32 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"> </th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),mu=i('<th class="px-2 py-1.5 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-16 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"> '),xu=i('<span class="text-[9px] text-gray-500 dark:text-gray-400">(<!>)'),bu=i('<span class="text-[9px] px-1 py-0 rounded text-[8px] font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400">PVE'),Wl=i('<span class="text-[9px] text-gray-500 dark:text-gray-400">v'),pu=i("<span>"),yu=i('<span class="text-[9px] px-1 py-0 rounded text-[8px] font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400">PBS'),vu=i('<td class="px-2 py-0.5 whitespace-nowrap text-center">'),ku=i('<tr><td><div class="flex items-center gap-1"><a target=_blank class="font-medium text-[11px] text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400"></a></div></td><td class="px-2 py-0.5 whitespace-nowrap"><span></span></td><td class="px-2 py-0.5"></td><td class="px-2 py-0.5"></td><td class="px-2 py-0.5">'),Ia=i('<span class="text-xs text-gray-500 dark:text-gray-400">-'),wu=i('<span class="text-xs text-gray-400 dark:text-gray-500">-'),$u=i("<span>°C"),_u=i('<td class="px-2 py-0.5 whitespace-nowrap text-center"><span>');const Cu=e=>{const{activeAlerts:r,state:s}=qr(),[l,o]=Z("default"),[a,d]=Z("asc"),c=pe(()=>{switch(e.currentTab){case"dashboard":return[{header:"VMs",key:"vmCount"},{header:"Containers",key:"containerCount"}];case"storage":return[{header:"Storage",key:"storageCount"},{header:"Disks",key:"diskCount"}];case"backups":return[{header:"Backups",key:"backupCount"}];default:return[]}}),g=pe(()=>e.nodes?.some($=>$.temperature?.available)||!1),b=($,D)=>`${$??""}::${D??""}`,p=pe(()=>{const $={};return(e.vms??[]).forEach(D=>{const f=b(D.instance,D.node);$[f]=($[f]||0)+1}),$}),m=pe(()=>{const $={};return(e.containers??[]).forEach(D=>{const f=b(D.instance,D.node);$[f]=($[f]||0)+1}),$}),S=pe(()=>{const $={};return(e.storage??[]).forEach(D=>{const f=b(D.instance,D.node);$[f]=($[f]||0)+1}),$}),z=pe(()=>{const $={};return(s.physicalDisks??[]).forEach(D=>{const f=b(D.instance,D.node);$[f]=($[f]||0)+1}),$}),ie=$=>{if($.type!=="pve")return null;const D=$.data,f=gu(D.temperature);return f!==null?Math.round(f):null},ne=$=>{switch($){case"name":return"asc";default:return"desc"}},W=$=>{l()===$?a()==="asc"?d("desc"):(o("default"),d("asc")):(o($),d(ne($)))},X=$=>{if($.type==="pve"){const f=$.data;return f.status==="online"&&(f.uptime||0)>0}const D=$.data;return D.status==="healthy"||D.status==="online"},I=$=>($.datastores??[]).reduce((D,f)=>(D.used+=f.used||0,D.total+=f.total||0,D),{used:0,total:0}),L=$=>{if($.type==="pve"){const f=$.data;return Math.round((f.cpu||0)*100)}const D=$.data;return Math.round(D.cpu||0)},H=$=>{if($.type==="pve"){const f=$.data;return Math.round(f.memory?.usage||0)}const D=$.data;return D.memoryTotal?Math.round(D.memoryUsed/D.memoryTotal*100):0},se=$=>{if($.type==="pve"){const j=$.data;return!j.disk||j.disk.total===0?0:Math.round(j.disk.used/j.disk.total*100)}const D=$.data,f=I(D);return f.total===0?0:Math.round(f.used/f.total*100)},le=$=>{if($.type==="pve"){const j=$.data;return j.disk?`${Zt(j.disk.used)}/${Zt(j.disk.total)}`:void 0}const D=$.data;if(!D.datastores||D.datastores.length===0)return;const f=I(D);return`${Zt(f.used)}/${Zt(f.total)}`},ee=$=>ie($),U=($,D)=>{if($.type==="pbs"){const K=$.data;return D==="backupCount"?e.backupCounts?.[K.name]??0:null}const f=$.data,j=b(f.instance,f.name);switch(D){case"vmCount":return p()[j]??0;case"containerCount":return m()[j]??0;case"storageCount":return S()[j]??0;case"diskCount":return z()[j]??0;case"backupCount":return e.backupCounts?.[f.id]??0;default:return null}},Y=($,D)=>{switch(D){case"name":return $.type==="pve"?Nn($.data):$.data.name;case"uptime":return $.type==="pve",$.data.uptime??0;case"cpu":return L($);case"memory":return H($);case"disk":return se($);case"temperature":return ee($);case"vmCount":case"containerCount":case"storageCount":case"diskCount":case"backupCount":return U($,D);default:return null}},oe=($,D)=>{if($.type!==D.type)return $.type==="pve"?-1:1;const f=X($),j=X(D);if(f!==j)return f?-1:1;const K=$.type==="pve"?Nn($.data):$.data.name,C=D.type==="pve"?Nn(D.data):D.data.name;return K.localeCompare(C)},_=($,D)=>{const f=$==null||typeof $=="number"&&Number.isNaN($),j=D==null||typeof D=="number"&&Number.isNaN(D);if(f&&j)return 0;if(f)return 1;if(j)return-1;if(typeof $=="number"&&typeof D=="number")return $===D?0:$<D?-1:1;const K=String($).toLowerCase(),C=String(D).toLowerCase();return K===C?0:K<C?-1:1},B=pe(()=>{const $=[];e.nodes?.forEach(j=>$.push({type:"pve",data:j})),e.pbsInstances?.forEach(j=>$.push({type:"pbs",data:j}));const D=l(),f=a();return $.sort((j,K)=>{if(D==="default")return oe(j,K);const C=Y(j,D),ge=Y(K,D),J=_(C,ge);return J!==0?f==="asc"?J:-J:oe(j,K)})});return n(it,{padding:"none",class:"mb-4 overflow-hidden",get children(){var $=fu(),D=$.firstChild,f=D.firstChild,j=f.firstChild,K=j.firstChild,C=K.firstChild,ge=K.nextSibling;ge.firstChild;var J=ge.nextSibling;J.firstChild;var N=J.nextSibling;N.firstChild;var F=N.nextSibling,P=F.firstChild,E=f.nextSibling;return K.$$keydown=u=>u.key==="Enter"&&W("name"),K.$$click=()=>W("name"),t(K,()=>e.currentTab==="backups"?"Node / PBS":"Node",C),t(K,(()=>{var u=$e(()=>l()==="name");return()=>u()&&(a()==="asc"?"▲":"▼")})(),null),ge.$$click=()=>W("uptime"),t(ge,(()=>{var u=$e(()=>l()==="uptime");return()=>u()&&(a()==="asc"?"▲":"▼")})(),null),J.$$click=()=>W("cpu"),t(J,(()=>{var u=$e(()=>l()==="cpu");return()=>u()&&(a()==="asc"?"▲":"▼")})(),null),N.$$click=()=>W("memory"),t(N,(()=>{var u=$e(()=>l()==="memory");return()=>u()&&(a()==="asc"?"▲":"▼")})(),null),F.$$click=()=>W("disk"),t(F,()=>e.currentTab==="backups"&&e.pbsInstances?"Storage / Disk":"Disk",P),t(F,(()=>{var u=$e(()=>l()==="disk");return()=>u()&&(a()==="asc"?"▲":"▼")})(),null),t(j,n(h,{get when(){return g()},get children(){var u=hu();return u.firstChild,u.$$click=()=>W("temperature"),t(u,(()=>{var v=$e(()=>l()==="temperature");return()=>v()&&(a()==="asc"?"▲":"▼")})(),null),u}}),null),t(j,n(ze,{get each(){return c()},children:u=>(()=>{var v=mu(),V=v.firstChild;return v.$$click=()=>W(u.key),t(v,()=>u.header,V),t(v,(()=>{var A=$e(()=>l()===u.key);return()=>A()&&(a()==="asc"?"▲":"▼")})(),null),v})()}),null),t(E,n(ze,{get each(){return B()},children:u=>{const v=u.type==="pve",V=u.type==="pbs",A=v?u.data:null,k=V?u.data:null,w=X(u),de=L(u),fe=H(u),x=se(u),R=le(u),Q=ie(u),G=v?A?.uptime??0:V?k?.uptime??0:0,T=()=>v?Nn(A):k.name,te=()=>v&&co(A),ae=v?A.id:k.name,M=()=>e.selectedNode===ae,ce=v?A.id||A.name:k.id||k.name,ue=wa(ce,r),re=ue.hasUnacknowledgedAlert&&w,O=pe(()=>{const he={},me=[];if(re){const _e=ue.severity==="critical"?"#ef4444":"#eab308";me.push(`inset 4px 0 0 0 ${_e}`)}return M()&&(me.push("0 0 0 1px rgba(59, 130, 246, 0.5)"),me.push("0 2px 4px -1px rgba(0, 0, 0, 0.1)")),me.length>0&&(he["box-shadow"]=me.join(", ")),he}),xe=pe(()=>{const he="cursor-pointer transition-all duration-200 relative hover:bg-gray-50 dark:hover:bg-gray-700/50 hover:shadow-sm";if(M())return"cursor-pointer transition-all duration-200 relative bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 hover:shadow-sm z-10";if(re)return ue.severity==="critical"?"cursor-pointer transition-all duration-200 relative bg-red-50 dark:bg-red-950/30 hover:bg-red-100 dark:hover:bg-red-950/40 hover:shadow-sm":"cursor-pointer transition-all duration-200 relative bg-yellow-50 dark:bg-yellow-950/20 hover:bg-yellow-100 dark:hover:bg-yellow-950/30 hover:shadow-sm";let me=he;return e.selectedNode&&e.selectedNode!==ae&&(me+=" opacity-50 hover:opacity-80"),w||(me+=" opacity-60"),me});return(()=>{var he=ku(),me=he.firstChild,_e=me.firstChild,Ce=_e.firstChild,Oe=me.nextSibling,tt=Oe.firstChild,Ze=Oe.nextSibling,bt=Ze.nextSibling,ct=bt.nextSibling;return he.$$click=()=>e.onNodeClick(ae,u.type),y(me,`pr-2 py-0.5 whitespace-nowrap ${re?"pl-4":"pl-3"}`),Ce.$$click=qe=>qe.stopPropagation(),t(Ce,T),t(_e,n(h,{get when(){return te()},get children(){var qe=xu(),Ke=qe.firstChild,Xe=Ke.nextSibling;return Xe.nextSibling,t(qe,()=>A.name,Xe),qe}}),null),t(_e,n(h,{when:v,get children(){return bu()}}),null),t(_e,n(h,{get when(){return v&&A.pveVersion},get children(){var qe=Wl();return qe.firstChild,t(qe,()=>A.pveVersion.split("/")[1]||A.pveVersion,null),qe}}),null),t(_e,n(h,{get when(){return v&&A.isClusterMember!==void 0},get children(){var qe=pu();return t(qe,()=>A.isClusterMember?A.clusterName:"Standalone"),q(()=>y(qe,`text-[9px] px-1 py-0 rounded text-[8px] font-medium whitespace-nowrap ${A.isClusterMember?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"bg-gray-100 text-gray-600 dark:bg-gray-700/50 dark:text-gray-400"}`)),qe}}),null),t(_e,n(h,{when:V,get children(){return yu()}}),null),t(_e,n(h,{get when(){return V&&k.version},get children(){var qe=Wl();return qe.firstChild,t(qe,()=>k.version,null),qe}}),null),t(tt,n(h,{when:w&&G,fallback:"-",get children(){return js(G)}})),t(Ze,n(h,{when:w&&de!==null,get fallback(){return Ia()},get children(){return n(un,{value:de??0,label:`${de}%`,get sublabel(){return v&&A.cpuInfo?.cores?`${A.cpuInfo.cores} cores`:void 0},type:"cpu"})}})),t(bt,n(h,{when:w&&fe!==null,get fallback(){return Ia()},get children(){return n(un,{value:fe??0,label:`${fe}%`,get sublabel(){return $e(()=>!!(v&&A.memory))()?`${Zt(A.memory.used)}/${Zt(A.memory.total)}`:$e(()=>!!(V&&k.memoryTotal))()?`${Zt(k.memoryUsed)}/${Zt(k.memoryTotal)}`:void 0},type:"memory"})}})),t(ct,n(h,{when:w&&x!==null,get fallback(){return Ia()},get children(){return n(un,{value:x??0,label:`${x}%`,sublabel:R,type:"disk"})}})),t(he,n(h,{get when(){return g()},get children(){var qe=vu();return t(qe,n(h,{get when(){return w&&v&&Q!==null&&(A.temperature?.hasCPU??A.temperature?.available)},get fallback(){return wu()},get children(){return(()=>{const Ke=Q,Xe=Ke>=80?"text-red-600 dark:text-red-400":Ke>=70?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400";return(()=>{var _t=$u(),Lt=_t.firstChild;return y(_t,`text-xs font-medium ${Xe}`),t(_t,Ke,Lt),_t})()})()}})),qe}}),null),t(he,n(ze,{get each(){return c()},children:qe=>{const Ke=U(u,qe.key),Xe=w?Ke??"-":"-",_t=w?"text-xs text-gray-700 dark:text-gray-300":"text-xs text-gray-400 dark:text-gray-500";return(()=>{var Lt=_u(),vt=Lt.firstChild;return y(vt,_t),t(vt,Xe),Lt})()}}),null),q(qe=>{var Ke=xe(),Xe=O(),_t=v?A.host||`https://${A.name}:8006`:k.host||`https://${k.name}:8007`,Lt=`text-xs ${v&&(A?.uptime??0)<3600?"text-orange-500":"text-gray-600 dark:text-gray-400"}`;return Ke!==qe.e&&y(he,qe.e=Ke),qe.t=xs(he,Xe,qe.t),_t!==qe.a&&Te(Ce,"href",qe.a=_t),Lt!==qe.o&&y(tt,qe.o=Lt),qe},{e:void 0,t:void 0,a:void 0,o:void 0}),he})()}})),q(()=>Te(K,"aria-label",`Sort by name ${l()==="name"?a()==="asc"?"ascending":"descending":""}`)),$}})};Xt(["click","keydown"]);var Su=i('<div class="space-y-2 mb-4">');const kl=e=>{const{state:r}=qr(),[s,l]=Z(null),o=g=>{g.key==="Escape"&&s()&&(l(null),e.onNodeSelect?.(null,null))};vr(()=>{document.addEventListener("keydown",o)}),Ar(()=>{document.removeEventListener("keydown",o)}),ft(()=>{e.currentTab,l(null)});const a=pe(()=>{const g={},b=e.nodes||r.nodes;return b&&b.forEach(p=>{let m=0;r.pveBackups?.storageBackups&&(m+=r.pveBackups.storageBackups.filter(S=>S.instance===p.instance&&S.node===p.name&&!S.isPBS).length),r.pveBackups?.guestSnapshots&&(m+=r.pveBackups.guestSnapshots.filter(S=>S.instance===p.instance&&S.node===p.name).length),g[p.id]=m}),r.pbs&&r.pbsBackups&&r.pbs.forEach(p=>{g[p.name]=r.pbsBackups?.filter(m=>m.instance===p.name).length||0}),g}),d=(g,b)=>{s()===g?(l(null),e.onNodeSelect?.(null,null)):(l(g),e.onNodeSelect?.(g,b))},c=pe(()=>e.nodes||r.nodes||[]);return(()=>{var g=Su();return t(g,n(Cu,{get nodes(){return c()},get pbsInstances(){return e.currentTab==="backups"?r.pbs:void 0},get vms(){return r.vms},get containers(){return r.containers},get storage(){return r.storage},get backupCounts(){return a()},get currentTab(){return e.currentTab},get selectedNode(){return s()},onNodeClick:d})),g})()};var Tu=i('<p class="mb-3 text-[11px] uppercase tracking-wide text-gray-400 dark:text-gray-500">'),Au=i('<code class="mr-1 rounded bg-blue-100 px-1 py-0.5 font-mono text-[11px] text-blue-700 dark:bg-blue-800/60 dark:text-blue-100">'),Du=i('<div class="mt-3 rounded-md bg-blue-50 px-3 py-2 text-[11px] text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">'),Mu=i('<div role=dialog><div class="flex items-center justify-between border-b border-gray-100 px-3 py-2 dark:border-gray-700"><span class="text-sm font-semibold text-gray-900 dark:text-gray-100"></span><button type=button class="rounded p-1 text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300"aria-label="Close search tips"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div class="px-3 py-3 text-xs text-gray-600 dark:text-gray-300"><div class=space-y-2>'),Pu=i("<div><button type=button>"),Eu=i('<svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),Nu=i("<span class=sr-only>"),Ou=i('<div class="flex items-start gap-2"><code class="rounded bg-gray-100 px-2 py-0.5 font-mono text-[11px] text-gray-700 dark:bg-gray-700 dark:text-gray-100"></code><span class="text-[12px] leading-snug text-gray-500 dark:text-gray-400">');const $a=e=>{const[r,s]=Z(!1);let l,o,a=!1;const d=()=>s(!1);ft(()=>{if(!r())return;const W=I=>{const L=I.target,H=l?.contains(L)??!1,se=o?.contains(L)??!1;!H&&!se&&d()},X=I=>{I.key==="Escape"&&d()};window.addEventListener("pointerdown",W),window.addEventListener("keydown",X),Ar(()=>{window.removeEventListener("pointerdown",W),window.removeEventListener("keydown",X)})});const c=e.align==="left"?"left-0":"right-0",g=e.popoverId??"search-tips-popover",b=e.triggerVariant??"button",p=e.openOnHover??!1,m=e.buttonLabel??"Search tips",S="text-xs font-medium focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900",z=b==="button"?`rounded-md border border-gray-200 px-2.5 py-1 text-gray-600 transition-colors hover:bg-gray-100 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700 ${S}`:b==="link"?`rounded px-1 py-0.5 text-gray-500 underline decoration-dotted underline-offset-4 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 ${S}`:`flex h-5 w-5 items-center justify-center rounded-full text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-100 ${S}`,ie=()=>{a=!0,s(!0)},ne=()=>{a=!1,s(!1)};return(()=>{var W=Pu(),X=W.firstChild;return Gr(W,"mouseleave",p?ne:void 0),Gr(W,"mouseenter",p?ie:void 0),X.addEventListener("blur",()=>{a||s(!1)}),X.addEventListener("focus",()=>s(!0)),Gr(X,"click",p?()=>s(!0):()=>s(I=>!I),!0),fr(I=>o=I,X),y(X,z),Te(X,"aria-controls",g),Te(X,"aria-label",m),t(X,b==="icon"?[Eu(),(()=>{var I=Nu();return t(I,m),I})()]:m),t(W,n(h,{get when(){return r()},get children(){var I=Mu(),L=I.firstChild,H=L.firstChild,se=H.nextSibling,le=L.nextSibling,ee=le.firstChild;return fr(U=>l=U,I),Te(I,"id",g),y(I,`absolute ${c} z-50 mt-2 w-72 overflow-hidden rounded-lg border border-gray-200 bg-white text-left shadow-xl dark:border-gray-600 dark:bg-gray-800`),t(H,()=>e.title??"Search tips"),se.$$click=d,t(le,n(h,{get when(){return e.intro},get children(){var U=Tu();return t(U,()=>e.intro),U}}),ee),t(ee,()=>e.tips.map(U=>(()=>{var Y=Ou(),oe=Y.firstChild,_=oe.nextSibling;return t(oe,()=>U.code),t(_,()=>U.description),Y})())),t(le,n(h,{get when(){return e.footerText||e.footerHighlight},get children(){var U=Du();return t(U,n(h,{get when(){return e.footerHighlight},get children(){var Y=Au();return t(Y,()=>e.footerHighlight),Y}}),null),t(U,()=>e.footerText,null),U}}),null),q(()=>Te(I,"aria-label",e.title??"Search tips")),I}}),null),q(I=>{var L=`relative ${e.class??""}`,H=r();return L!==I.e&&y(W,I.e=L),H!==I.t&&Te(X,"aria-expanded",I.t=H),I},{e:void 0,t:void 0}),W})()};Xt(["click"]);function Lu(e,r,s,l){const o=localStorage.getItem(e),a=o!==null?s?s(o):o:r,[d,c]=Z(a);return ft(()=>{const g=d();g==null?localStorage.removeItem(e):localStorage.setItem(e,l?l(g):String(g))}),[d,c]}function Ru(e,r=!1){return Lu(e,r,s=>s==="true",s=>String(s))}const Fs={BACKUPS_USE_RELATIVE_TIME:"backupsUseRelativeTime",BACKUPS_SEARCH_HISTORY:"backupsSearchHistory",DASHBOARD_SEARCH_HISTORY:"dashboardSearchHistory",STORAGE_SEARCH_HISTORY:"storageSearchHistory",DOCKER_SEARCH_HISTORY:"dockerSearchHistory"},uo=10;function go(){return typeof window<"u"&&typeof window.localStorage<"u"}function ba(e){if(!go())return[];try{const r=window.localStorage.getItem(e);if(!r)return[];const s=JSON.parse(r);return Array.isArray(s)?s.filter(l=>typeof l=="string"):[]}catch(r){return console.warn(`[searchHistory] Failed to parse history for key "${e}":`,r),[]}}function wl(e,r){if(go())try{window.localStorage.setItem(e,JSON.stringify(r))}catch(s){console.warn(`[searchHistory] Failed to persist history for key "${e}":`,s)}}function Iu(e){return ba(e)}function Hu(e,r,s=uo){const l=r.trim();if(!l)return ba(e);const o=ba(e),a=l.toLowerCase(),d=o.filter(g=>g.toLowerCase()!==a),c=[l,...d].slice(0,Math.max(1,s));return wl(e,c),c}function Uu(e,r){const l=ba(e).filter(o=>o!==r);return wl(e,l),l}function Bu(e){return wl(e,[]),[]}function _a(e,r){const s=uo;return{read:()=>Iu(e),add:c=>Hu(e,c,s),remove:c=>Uu(e,c),clear:()=>Bu(e)}}var ju=i('<button type=button class="absolute right-9 top-1/2 -translate-y-1/2 transform text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"aria-label="Clear search"title="Clear search"><svg class="h-4 w-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Fu=i('<div class="max-h-52 overflow-y-auto py-1">'),Vu=i('<button type=button class="flex w-full items-center justify-center gap-2 border-t border-gray-200 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700/80 dark:hover:text-gray-200"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3m-9 0h12"></path></svg>Clear history'),Gu=i('<div class="absolute left-0 right-0 top-full z-50 mt-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white text-sm shadow-xl dark:border-gray-700 dark:bg-gray-800"role=listbox>'),zu=i('<div class="flex flex-col lg:flex-row gap-3"><div class="flex gap-2 flex-1 items-center"><div class="relative flex-1"><input type=text placeholder="Search or filter..."class="w-full pl-9 pr-16 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all"><svg class="absolute left-3 top-2 h-4 w-4 text-gray-400 dark:text-gray-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><div class="absolute inset-y-0 right-2 flex items-center gap-1"><button type=button class="flex h-6 w-6 items-center justify-center rounded-lg border border-transparent text-gray-400 transition-colors hover:border-gray-200 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:border-gray-700 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"aria-haspopup=listbox><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l2.5 1.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class=sr-only>Show search history</span></button></div></div></div><div class="flex flex-wrap items-center gap-2"><div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>All</button><button type=button>VMs</button><button type=button>LXCs</button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>All</button><button type=button>Running</button><button type=button>Stopped</button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button title="Group by node">Grouped</button><button type=button title="Flat list view">List</button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><button title="Reset all filters"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg><span class="ml-1 hidden sm:inline">Reset'),Wu=i('<div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400">Searches you run will appear here.'),qu=i('<div class="flex items-center justify-between px-2 py-1.5 hover:bg-blue-50 dark:hover:bg-blue-900/20"><button type=button class="flex-1 truncate pr-2 text-left text-sm text-gray-700 transition-colors hover:text-blue-600 focus:outline-none dark:text-gray-200 dark:hover:text-blue-300"></button><button type=button class="ml-1 flex h-6 w-6 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:bg-gray-700/70 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"title="Remove from history"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg><span class=sr-only>Remove from history');const Ku=e=>{const r=_a(Fs.DASHBOARD_SEARCH_HISTORY),[s,l]=Z([]),[o,a]=Z(!1);let d,c,g;vr(()=>{l(r.read())});const b=X=>{const I=r.add(X);l(I)},p=X=>{l(r.remove(X))},m=()=>{l(r.clear()),a(!1),queueMicrotask(()=>g?.blur())},S=()=>{a(!1),queueMicrotask(()=>g?.blur())},z=X=>{const I=X.target,L=c?.contains(I)??!1,H=g?.contains(I)??!1;!L&&!H&&S()};ft(()=>{o()?document.addEventListener("mousedown",z):document.removeEventListener("mousedown",z)}),Ar(()=>{document.removeEventListener("mousedown",z)});const ie=()=>{queueMicrotask(()=>d?.focus())};let ne=!1;const W=()=>{ne=!0,queueMicrotask(()=>{ne=!1})};return n(it,{class:"dashboard-filter mb-3",padding:"sm",get children(){var X=zu(),I=X.firstChild,L=I.firstChild,H=L.firstChild,se=H.nextSibling,le=se.nextSibling,ee=le.firstChild,U=I.nextSibling,Y=U.firstChild,oe=Y.firstChild,_=oe.nextSibling,B=_.nextSibling,$=Y.nextSibling,D=$.nextSibling,f=D.firstChild,j=f.nextSibling,K=j.nextSibling,C=D.nextSibling,ge=C.nextSibling,J=ge.firstChild,N=J.nextSibling,F=ge.nextSibling,P=F.nextSibling;return H.addEventListener("blur",E=>{if(ne)return;const u=E.relatedTarget,v=u?c?.contains(u)||g?.contains(u):!1,V=u?.getAttribute("aria-controls")==="dashboard-search-help";!v&&!V&&b(E.currentTarget.value)}),H.$$keydown=E=>{E.key==="Enter"?(b(E.currentTarget.value),S()):E.key==="ArrowDown"&&s().length>0&&(E.preventDefault(),a(!0))},H.$$input=E=>e.setSearch(E.currentTarget.value),fr(E=>{d=E,e.searchInputRef?.(E)},H),t(L,n(h,{get when(){return e.search()},get children(){var E=ju();return E.$$mousedown=W,E.$$click=()=>e.setSearch(""),E}}),le),ee.$$mousedown=W,ee.$$click=()=>a(E=>{const u=!E;return u||queueMicrotask(()=>g?.blur()),u}),fr(E=>g=E,ee),t(le,n($a,{popoverId:"dashboard-search-help",intro:"Combine filters to narrow results",tips:[{code:"media",description:'Guests with "media" in the name'},{code:"cpu>80",description:"Highlight guests using more than 80% CPU"},{code:"memory<20",description:"Find guests under 20% memory usage"},{code:"tags:prod",description:"Filter by tag"},{code:"node:pve1",description:"Show guests on a specific node"}],footerHighlight:"node:pve1 cpu>60",footerText:"Stack filters to get laser-focused results.",triggerVariant:"icon",buttonLabel:"Search tips",openOnHover:!0}),null),t(L,n(h,{get when(){return o()},get children(){var E=Gu();return fr(u=>c=u,E),t(E,n(h,{get when(){return s().length>0},get fallback(){return Wu()},get children(){return[(()=>{var u=Fu();return t(u,n(ze,{get each(){return s()},children:v=>(()=>{var V=qu(),A=V.firstChild,k=A.nextSibling;return A.$$mousedown=W,A.$$click=()=>{e.setSearch(v),b(v),a(!1),ie()},t(A,v),k.$$mousedown=W,k.$$click=()=>p(v),V})()})),u})(),(()=>{var u=Vu();return u.$$mousedown=W,u.$$click=m,u})()]}})),E}}),null),oe.$$click=()=>e.setViewMode("all"),_.$$click=()=>e.setViewMode(e.viewMode()==="vm"?"all":"vm"),B.$$click=()=>e.setViewMode(e.viewMode()==="lxc"?"all":"lxc"),f.$$click=()=>e.setStatusMode("all"),j.$$click=()=>e.setStatusMode(e.statusMode()==="running"?"all":"running"),K.$$click=()=>e.setStatusMode(e.statusMode()==="stopped"?"all":"stopped"),J.$$click=()=>e.setGroupingMode("grouped"),N.$$click=()=>e.setGroupingMode(e.groupingMode()==="flat"?"grouped":"flat"),P.$$click=()=>{e.setSearch(""),e.setSortKey("vmid"),e.setSortDirection("asc"),e.setViewMode("all"),e.setStatusMode("all"),e.setGroupingMode("grouped")},q(E=>{var u=o(),v=s().length>0?"Show recent searches":"No recent searches yet",V=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="all"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,A=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="vm"?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,k=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="lxc"?"bg-white dark:bg-gray-800 text-green-600 dark:text-green-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,w=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.statusMode()==="all"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,de=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.statusMode()==="running"?"bg-white dark:bg-gray-800 text-green-600 dark:text-green-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,fe=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.statusMode()==="stopped"?"bg-white dark:bg-gray-800 text-red-600 dark:text-red-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,x=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupingMode()==="grouped"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,R=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupingMode()==="flat"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,Q=`flex items-center justify-center px-2.5 py-1 text-xs font-medium rounded-lg transition-colors ${e.search()||e.viewMode()!=="all"||e.statusMode()!=="all"||e.groupingMode()!=="grouped"?"text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-900/70":"text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600"}`;return u!==E.e&&Te(ee,"aria-expanded",E.e=u),v!==E.t&&Te(ee,"title",E.t=v),V!==E.a&&y(oe,E.a=V),A!==E.o&&y(_,E.o=A),k!==E.i&&y(B,E.i=k),w!==E.n&&y(f,E.n=w),de!==E.s&&y(j,E.s=de),fe!==E.h&&y(K,E.h=fe),x!==E.r&&y(J,E.r=x),R!==E.d&&y(N,E.d=R),Q!==E.l&&y(P,E.l=Q),E},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),q(()=>H.value=e.search()),X}})};Xt(["input","keydown","click","mousedown"]);class Ju{authHeader=null;apiToken=null;csrfToken=null;constructor(){this.loadStoredAuth(),this.loadCSRFToken()}loadCSRFToken(){const r=document.cookie.split(";");for(const s of r){const[l,o]=s.trim().split("=");if(l==="pulse_csrf"){this.csrfToken=decodeURIComponent(o);break}}}loadStoredAuth(){try{const r=sessionStorage.getItem("pulse_auth");if(r){const{type:s,value:l}=JSON.parse(r);s==="basic"?this.authHeader=l:s==="token"&&(this.apiToken=l)}}catch{}}setBasicAuth(r,s){const l=btoa(`${r}:${s}`);this.authHeader=`Basic ${l}`,sessionStorage.setItem("pulse_auth",JSON.stringify({type:"basic",value:this.authHeader})),sessionStorage.setItem("pulse_auth_user",r)}setApiToken(r){this.apiToken=r,sessionStorage.setItem("pulse_auth",JSON.stringify({type:"token",value:r}))}clearAuth(){this.authHeader=null,this.apiToken=null,sessionStorage.removeItem("pulse_auth"),sessionStorage.removeItem("pulse_auth_user")}hasAuth(){return!!(this.authHeader||this.apiToken)}async fetch(r,s={}){const{skipAuth:l=!1,headers:o={},...a}=s,d={...o};r.startsWith("/api/")&&(d["X-Requested-With"]="XMLHttpRequest",d.Accept||(d.Accept="application/json")),l||(this.authHeader&&(d.Authorization=this.authHeader),this.apiToken&&(d["X-API-Token"]=this.apiToken));const c=(a.method||"GET").toUpperCase();this.csrfToken&&c!=="GET"&&c!=="HEAD"&&c!=="OPTIONS"&&(d["X-CSRF-Token"]=this.csrfToken);const g={...a,headers:d,credentials:"include"},b=await fetch(r,g);if(b.status===401&&this.hasAuth()&&console.warn("Authentication failed - credentials may be incorrect"),b.status===403&&(await b.clone().text()).includes("CSRF")&&(this.loadCSRFToken(),this.csrfToken))return d["X-CSRF-Token"]=this.csrfToken,await fetch(r,{...a,headers:d,credentials:"include"});if(b.status===429){const p=b.headers.get("Retry-After"),m=p?parseInt(p)*1e3:2e3;return console.warn(`Rate limit hit, retrying after ${m}ms`),await new Promise(z=>setTimeout(z,m)),await fetch(r,{...a,headers:d,credentials:"include"})}return b}async fetchJSON(r,s={}){const l=await this.fetch(r,{...s,headers:{"Content-Type":"application/json",...s.headers}});if(!l.ok){const a=await l.text();let d=a;if(a.includes("<pre>")&&a.includes("</pre>")){const c=a.match(/<pre>(.*?)<\/pre>/s);c&&(d=c[1])}throw!a.includes("<")&&a.length<200?d=a:a.length>200&&(d=`Request failed with status ${l.status}`),new Error(d||`Request failed with status ${l.status}`)}const o=await l.text();if(!o)return null;try{return JSON.parse(o)}catch{throw console.error("Failed to parse JSON response:",o),new Error("Invalid JSON response from server")}}async checkAuthRequired(){try{return(await fetch("/api/state",{method:"GET",credentials:"omit"})).status===401}catch{try{const l=await(await fetch("/api/security/status")).json();return l.hasAuthentication||l.requiresAuth||!1}catch{return!1}}}}const Vs=new Ju,Zn=(e,r)=>Vs.fetch(e,r),Ft=(e,r)=>Vs.fetchJSON(e,r),ul=(e,r)=>Vs.setBasicAuth(e,r),Qu=()=>Vs.clearAuth(),zn=Object.freeze(Object.defineProperty({__proto__:null,apiClient:Vs,apiFetch:Zn,apiFetchJSON:Ft,clearAuth:Qu,setBasicAuth:ul},Symbol.toStringTag,{value:"Module"}));class gl{static baseUrl="/api/guests/metadata";static async getMetadata(r){return Ft(`${this.baseUrl}/${encodeURIComponent(r)}`)}static async getAllMetadata(){return Ft(this.baseUrl)}static async updateMetadata(r,s){return Ft(`${this.baseUrl}/${encodeURIComponent(r)}`,{method:"PUT",body:JSON.stringify(s)})}static async deleteMetadata(r){await Ft(`${this.baseUrl}/${encodeURIComponent(r)}`,{method:"DELETE"})}}var Ha=i("<div>");const Yu={default:"",info:"text-blue-700 dark:text-blue-300",success:"text-green-700 dark:text-green-300",warning:"text-amber-700 dark:text-amber-300",danger:"text-red-700 dark:text-red-300"},Xu={default:"",info:"text-blue-600 dark:text-blue-300",success:"text-green-600 dark:text-green-300",warning:"text-amber-600 dark:text-amber-300",danger:"text-red-600 dark:text-red-300"};function Ur(e){const r=kr({tone:"default",align:"center"},e),[s,l]=rs(r,["icon","title","description","actions","tone","align","class"]),o=s.align,a=s.tone,d=["flex flex-col gap-3",o==="center"?"items-center text-center":"items-start text-left",s.class??""].join(" ").trim();return(()=>{var c=Ha();return y(c,d),bs(c,l,!1,!0),t(c,n(h,{get when(){return s.icon},get children(){var g=Ha();return y(g,o==="center"?"flex justify-center":""),t(g,()=>s.icon),g}}),null),t(c,n(rr,{align:o,get title(){return s.title},get description(){return s.description},size:o==="center"?"sm":"md",class:o==="center"?"items-center":"items-start",get titleClass(){return Yu[a]},get descriptionClass(){return`text-xs ${Xu[a]}`.trim()}}),null),t(c,n(h,{get when(){return s.actions},get children(){var g=Ha();return y(g,o==="center"?"mt-2 flex flex-col items-center gap-2":"mt-2 flex flex-col gap-2"),t(g,()=>s.actions),g}}),null),c})()}var Zu=i('<span class="text-[10px] text-slate-500 dark:text-slate-400">(<!>)'),e0=i("<span>"),t0=i('<tr class="bg-gray-50 dark:bg-gray-900/40"><td class="py-1 pr-2 pl-4 text-[12px] sm:text-sm font-semibold text-slate-700 dark:text-slate-100"><div><a target=_blank rel="noopener noreferrer"class="transition-colors duration-150 hover:text-sky-600 dark:hover:text-sky-400">');const ho=e=>{const r=()=>e.node.status==="online"&&(e.node.uptime||0)>0,s=()=>e.node.host||`https://${e.node.name}:8006`,l=()=>Nn(e.node),o=()=>co(e.node);return(()=>{var a=t0(),d=a.firstChild,c=d.firstChild,g=c.firstChild;return t(g,l),t(c,n(h,{get when(){return o()},get children(){var b=Zu(),p=b.firstChild,m=p.nextSibling;return m.nextSibling,t(b,()=>e.node.name,m),b}}),null),t(c,n(h,{get when(){return e.node.isClusterMember!==void 0},get children(){var b=e0();return t(b,()=>e.node.isClusterMember?e.node.clusterName:"Standalone"),q(()=>y(b,`rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap ${e.node.isClusterMember?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"bg-slate-200 text-slate-600 dark:bg-slate-700/60 dark:text-slate-300"}`)),b}}),null),q(b=>{var p=e.colspan,m=`flex flex-wrap items-center gap-3 ${r()?"":"opacity-60"}`,S=r()?"Online":"Offline",z=s(),ie=`Open ${e.node.name} web interface`;return p!==b.e&&Te(d,"colspan",b.e=p),m!==b.t&&y(c,b.t=m),S!==b.a&&Te(c,"title",b.a=S),z!==b.o&&Te(g,"href",b.o=z),ie!==b.i&&Te(g,"title",b.i=ie),b},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()};var r0=i('<div aria-label="Proxmox sections">'),n0=i("<button type=button><span>");const s0=[{id:"overview",label:"Overview",path:"/proxmox/overview"},{id:"storage",label:"Storage",path:"/proxmox/storage"},{id:"mail",label:"Mail Gateway",path:"/proxmox/mail"},{id:"backups",label:"Backups",path:"/proxmox/backups"}],Ca=e=>{const r=In(),{state:s}=qr(),l=pe(()=>{const a=s.pmg&&s.pmg.length>0;return s0.filter(d=>d.id!=="mail"||a)}),o="inline-flex items-center px-2 sm:px-3 py-1 text-xs sm:text-sm font-medium border-b-2 border-transparent text-gray-600 dark:text-gray-400 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-900";return(()=>{var a=r0();return t(a,n(ze,{get each(){return l()},children:d=>{const c=d.id===e.current,g=c?`${o} text-blue-600 dark:text-blue-300 border-blue-500 dark:border-blue-400`:`${o} hover:text-blue-500 dark:hover:text-blue-300 hover:border-blue-300/70 dark:hover:border-blue-500/50`;return(()=>{var b=n0(),p=b.firstChild;return b.$$click=()=>r(d.path),y(b,g),Te(b,"aria-pressed",c),t(p,()=>d.label),b})()}})),q(()=>y(a,`flex flex-wrap items-center gap-3 sm:gap-4 ${e.class??""}`)),a})()};Xt(["click"]);var a0=i('<table class="w-full min-w-[760px] md:min-w-[900px] table-fixed border-collapse"><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="pl-4 pr-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[130px] sm:w-[150px] lg:w-[180px] xl:w-[200px] 2xl:w-[240px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500"tabindex=0 role=button>Name </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[48px] sm:w-[56px] lg:w-[60px] xl:w-[64px] 2xl:w-[72px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Type </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[56px] sm:w-[64px] lg:w-[72px] xl:w-[80px] 2xl:w-[90px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">VMID </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[76px] sm:w-[86px] lg:w-[96px] xl:w-[108px] 2xl:w-[128px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Uptime </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">CPU </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Memory </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[100px] sm:w-[110px] lg:w-[130px] xl:w-[150px] 2xl:w-[180px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Disk </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Disk Read </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Disk Write </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Net In </th><th class="px-2 py-1 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider w-[56px] sm:w-[62px] lg:w-[70px] xl:w-[78px] 2xl:w-[96px] cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600">Net Out </th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),l0=i('<div class=mb-4><div class="flex items-center gap-2 p-2 bg-gray-50 dark:bg-gray-700/50 border border-gray-200 dark:border-gray-700 rounded"><span class="flex items-center gap-1 text-xs text-gray-600 dark:text-gray-400"><span class="h-2 w-2 bg-green-500 rounded-full"></span> running</span><span class=text-gray-400>|</span><span class="flex items-center gap-1 text-xs text-gray-600 dark:text-gray-400"><span class="h-2 w-2 bg-red-500 rounded-full"></span> stopped'),i0=i("<div class=space-y-3>"),o0=i('<svg class="mx-auto h-12 w-12 animate-spin text-gray-400"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),d0=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">'),c0=i('<button type=button class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">Go to Settings'),u0=i('<svg class="h-12 w-12 text-red-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),g0=i('<button class="mt-2 inline-flex items-center px-4 py-2 text-xs font-medium rounded bg-red-600 text-white hover:bg-red-700 transition-colors">Reconnect now'),h0=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z">');function f0(e){const r=qr(),{connected:s,activeAlerts:l,initialDataReceived:o,reconnecting:a,reconnect:d}=r,[c,g]=Z(""),[b,p]=Z(!1),[m,S]=Z(null),[z,ie]=Z({}),ne=localStorage.getItem("dashboardViewMode"),[W,X]=Z(ne==="all"||ne==="vm"||ne==="lxc"?ne:"all"),I=localStorage.getItem("dashboardStatusMode"),[L,H]=Z(I==="all"||I==="running"||I==="stopped"?I:"all"),se=localStorage.getItem("dashboardGroupingMode"),[le,ee]=Z(se==="grouped"||se==="flat"?se:"grouped"),[U,Y]=Z(localStorage.getItem("dashboardShowFilters")!==null?localStorage.getItem("dashboardShowFilters")==="true":!1),[oe,_]=Z("vmid"),[B,$]=Z("asc");vr(async()=>{try{const u=await gl.getAllMetadata();ie(u||{})}catch(u){console.debug("Failed to load guest metadata:",u)}});const D=pe(()=>{const u={};return e.nodes.forEach(v=>{u[v.id]=v}),u}),f=u=>{if(!u)return;const v=D();if(u.id){const A=u.id.lastIndexOf("-");if(A>0){const k=u.id.slice(0,A);if(v[k])return v[k]}}const V=`${u.instance}-${u.node}`;if(v[V])return v[V]};ft(()=>{localStorage.setItem("dashboardViewMode",W())}),ft(()=>{localStorage.setItem("dashboardStatusMode",L())}),ft(()=>{localStorage.setItem("dashboardGroupingMode",le())}),ft(()=>{localStorage.setItem("dashboardShowFilters",U().toString())});const j=u=>{oe()===u?$(B()==="asc"?"desc":"asc"):(_(u),$(u==="cpu"||u==="memory"||u==="disk"||u==="diskRead"||u==="diskWrite"||u==="networkIn"||u==="networkOut"||u==="uptime"?"desc":"asc"))},K=u=>{const v=u?.disk;if(!v)return null;const V=A=>Math.min(100,Math.max(0,A));if(typeof v.usage=="number"&&Number.isFinite(v.usage)){const A=v.usage>1?v.usage:v.usage*100;return V(A)}return typeof v.used=="number"&&Number.isFinite(v.used)&&typeof v.total=="number"&&Number.isFinite(v.total)&&v.total>0?V(v.used/v.total*100):null};let C;ft(()=>{const u=v=>{const V=v.target,A=V.tagName==="INPUT"||V.tagName==="TEXTAREA"||V.tagName==="SELECT"||V.contentEditable==="true";v.key==="Escape"?c().trim()||oe()!=="vmid"||B()!=="asc"||m()!==null||W()!=="all"||L()!=="all"?(g(""),p(!1),_("vmid"),$("asc"),S(null),X("all"),H("all"),C&&document.activeElement===C&&C.blur()):Y(!U()):!A&&v.key.length===1&&!v.ctrlKey&&!v.metaKey&&!v.altKey&&(U()||Y(!0),C&&C.focus())};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)});const ge=pe(()=>{const u=e.vms||[],v=e.containers||[];return[...u,...v]}),J=pe(()=>{let u=ge();const v=m();if(v){const A=e.nodes.find(k=>k.id===v);A&&(u=u.filter(k=>k.instance===A.instance&&k.node===A.name))}W()==="vm"?u=u.filter(A=>A.type==="qemu"):W()==="lxc"&&(u=u.filter(A=>A.type==="lxc")),L()==="running"?u=u.filter(A=>A.status==="running"):L()==="stopped"&&(u=u.filter(A=>A.status!=="running"));const V=c().trim();if(V){const A=V.split(",").map(de=>de.trim()).filter(de=>de),k=[],w=[];if(A.forEach(de=>{de.includes(">")||de.includes("<")||de.includes(":")?k.push(de):w.push(de.toLowerCase())}),k.length>0){const de=k.join(" AND "),fe=dl(de);fe.filters.length>0&&(u=u.filter(x=>cl(x,fe)))}w.length>0&&(u=u.filter(de=>w.some(fe=>de.name.toLowerCase().includes(fe)||de.vmid.toString().includes(fe)||de.node.toLowerCase().includes(fe)||de.status.toLowerCase().includes(fe))))}return u}),N=pe(()=>{const u=J();if(le()==="flat"){const k={"":u},w=oe(),de=B();return w&&(k[""]=k[""].sort((fe,x)=>{let R=fe[w],Q=x[w];w==="cpu"?(R=fe.cpu*100,Q=x.cpu*100):w==="memory"?(R=fe.memory&&fe.memory.usage||0,Q=x.memory&&x.memory.usage||0):w==="disk"&&(R=K(fe),Q=K(x));const G=R==null||R==="",T=Q==null||Q==="";if(G&&T)return 0;if(G)return 1;if(T)return-1;if(typeof R=="number"&&typeof Q=="number"){const te=R<Q?-1:1;return de==="asc"?te:-te}else{const te=String(R).toLowerCase(),ae=String(Q).toLowerCase();if(te===ae)return 0;const M=te<ae?-1:1;return de==="asc"?M:-M}})),k}const v={};u.forEach(k=>{const w=`${k.instance}-${k.node}`;v[w]||(v[w]=[]),v[w].push(k)});const V=oe(),A=B();return V&&Object.keys(v).forEach(k=>{v[k]=v[k].sort((w,de)=>{let fe=w[V],x=de[V];V==="cpu"?(fe=w.cpu*100,x=de.cpu*100):V==="memory"?(fe=w.memory&&w.memory.usage||0,x=de.memory&&de.memory.usage||0):V==="disk"&&(fe=K(w),x=K(de));const R=fe==null||fe==="",Q=x==null||x==="";if(R&&Q)return 0;if(R)return 1;if(Q)return-1;if(typeof fe=="number"&&typeof x=="number"){const G=fe<x?-1:1;return A==="asc"?G:-G}else{const G=String(fe).toLowerCase(),T=String(x).toLowerCase();if(G===T)return 0;const te=G<T?-1:1;return A==="asc"?te:-te}})}),v}),F=pe(()=>{const u=J(),v=u.filter(k=>k.status==="running").length,V=u.filter(k=>k.type==="qemu").length,A=u.filter(k=>k.type==="lxc").length;return{total:u.length,running:v,stopped:u.length-v,vms:V,containers:A}}),P=(u,v)=>{console.log("handleNodeSelect called:",u,v),(v==="pve"||v===null)&&(S(u),console.log("Set selected node to:",u),u&&!U()&&Y(!0))},E=u=>{const v=c().trim(),V=`tags:${u}`;if(v.includes(V)){let A=v;v===V?A="":v.startsWith(V+",")?A=v.replace(V+",","").trim():v.endsWith(", "+V)?A=v.replace(", "+V,"").trim():v.includes(", "+V+",")?A=v.replace(", "+V+",",",").trim():v.includes(V+", ")&&(A=v.replace(V+", ","").trim()),g(A),A||p(!1)}else!v||b()?(g(V),p(!1)):g(`${v}, ${V}`),U()||Y(!0)};return(()=>{var u=i0();return t(u,n(Ca,{current:"overview"}),null),t(u,n(kl,{currentTab:"dashboard",onNodeSelect:P,get nodes(){return e.nodes},get filteredVms(){return J().filter(v=>v.type==="qemu")},get filteredContainers(){return J().filter(v=>v.type==="lxc")},get searchTerm(){return c()}}),null),t(u,n(Ku,{search:c,setSearch:g,isSearchLocked:b,viewMode:W,setViewMode:X,statusMode:L,setStatusMode:H,groupingMode:le,setGroupingMode:ee,setSortKey:_,setSortDirection:$,searchInputRef:v=>C=v}),null),t(u,n(h,{get when(){return $e(()=>!!s())()&&!o()},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return o0()},title:"Loading dashboard data...",get description(){return a()?"Reconnecting to monitoring service…":"Connecting to monitoring service"}})}})}}),null),t(u,n(h,{get when(){return s()&&o()&&e.nodes.filter(v=>v.type==="pve").length===0&&e.vms.length===0&&e.containers.length===0},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return d0()},title:"No Proxmox VE nodes configured",description:"Add a Proxmox VE node in the Settings tab to start monitoring your infrastructure.",get actions(){return(()=>{var v=c0();return v.$$click=()=>{document.querySelector('[role="tab"]:last-child')?.click()},v})()}})}})}}),null),t(u,n(h,{get when(){return!s()},get children(){return n(it,{padding:"lg",tone:"danger",get children(){return n(Ur,{get icon(){return u0()},title:"Connection lost",get description(){return a()?"Attempting to reconnect…":"Unable to connect to the backend server"},tone:"danger",get actions(){return $e(()=>!a())()?(()=>{var v=g0();return v.$$click=()=>d(),v})():void 0}})}})}}),null),t(u,n(h,{get when(){return $e(()=>!!(s()&&o()))()&&J().length>0},get children(){return n(il,{name:"Guest Table",get children(){return n(it,{padding:"none",class:"mb-4 overflow-hidden",get children(){return n(ol,{minWidth:"760px",get children(){var v=a0(),V=v.firstChild,A=V.firstChild,k=A.firstChild;k.firstChild;var w=k.nextSibling;w.firstChild;var de=w.nextSibling;de.firstChild;var fe=de.nextSibling;fe.firstChild;var x=fe.nextSibling;x.firstChild;var R=x.nextSibling;R.firstChild;var Q=R.nextSibling;Q.firstChild;var G=Q.nextSibling;G.firstChild;var T=G.nextSibling;T.firstChild;var te=T.nextSibling;te.firstChild;var ae=te.nextSibling;ae.firstChild;var M=V.nextSibling;return k.$$keydown=ce=>ce.key==="Enter"&&j("name"),k.$$click=()=>j("name"),t(k,(()=>{var ce=$e(()=>oe()==="name");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),w.$$click=()=>j("type"),t(w,(()=>{var ce=$e(()=>oe()==="type");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),de.$$click=()=>j("vmid"),t(de,(()=>{var ce=$e(()=>oe()==="vmid");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),fe.$$click=()=>j("uptime"),t(fe,(()=>{var ce=$e(()=>oe()==="uptime");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),x.$$click=()=>j("cpu"),t(x,(()=>{var ce=$e(()=>oe()==="cpu");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),R.$$click=()=>j("memory"),t(R,(()=>{var ce=$e(()=>oe()==="memory");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),Q.$$click=()=>j("disk"),t(Q,(()=>{var ce=$e(()=>oe()==="disk");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),G.$$click=()=>j("diskRead"),t(G,(()=>{var ce=$e(()=>oe()==="diskRead");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),T.$$click=()=>j("diskWrite"),t(T,(()=>{var ce=$e(()=>oe()==="diskWrite");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),te.$$click=()=>j("networkIn"),t(te,(()=>{var ce=$e(()=>oe()==="networkIn");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),ae.$$click=()=>j("networkOut"),t(ae,(()=>{var ce=$e(()=>oe()==="networkOut");return()=>ce()&&(B()==="asc"?"▲":"▼")})(),null),t(M,n(ze,{get each(){return Object.entries(N()).sort(([ce],[ue])=>{const re=D()[ce],O=D()[ue],xe=re?Nn(re):ce,he=O?Nn(O):ue,me=xe.localeCompare(he);return me!==0?me:ce.localeCompare(ue)})},fallback:[],children:([ce,ue])=>{const re=D()[ce];return[n(h,{get when(){return re&&le()==="grouped"},get children(){return n(ho,{node:re,colspan:11})}}),n(ze,{each:ue,fallback:[],children:O=>n(il,{name:"GuestRow",get children(){return(()=>{const xe=O.id||(O.instance===O.node?`${O.node}-${O.vmid}`:`${O.instance}-${O.node}-${O.vmid}`),he=z()[xe]||z()[`${O.node}-${O.vmid}`],me=re??f(O),_e=me?_c(me):!0;return n(Kc,{guest:O,get alertStyles(){return wa(xe,l)},get customUrl(){return he?.customUrl},onTagClick:E,get activeSearch(){return c()},parentNodeOnline:_e})})()}})})]}})),q(()=>Te(k,"aria-label",`Sort by name ${oe()==="name"?B()==="asc"?"ascending":"descending":""}`)),v}})}})}})}}),null),t(u,n(h,{get when(){return s()&&o()&&J().length===0&&(e.vms.length>0||e.containers.length>0)},get children(){return n(it,{padding:"lg",class:"mb-4",get children(){return n(Ur,{get icon(){return h0()},title:"No guests found",get description(){return $e(()=>!!(c()&&c().trim()!==""))()?`No guests match your search "${c()}"`:"No guests match your current filters"}})}})}}),null),t(u,n(h,{get when(){return $e(()=>!!s())()&&o()},get children(){var v=l0(),V=v.firstChild,A=V.firstChild,k=A.firstChild,w=k.nextSibling,de=A.nextSibling,fe=de.nextSibling,x=fe.firstChild,R=x.nextSibling;return t(A,()=>F().running,w),t(fe,()=>F().stopped,R),v}}),null),u})()}Xt(["click","keydown"]);var m0=i('<button type=button class="absolute right-9 top-1/2 -translate-y-1/2 transform text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"aria-label="Clear search"title="Clear search"><svg class="h-4 w-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),x0=i('<div class="max-h-52 overflow-y-auto py-1">'),b0=i('<button type=button class="flex w-full items-center justify-center gap-2 border-t border-gray-200 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700/80 dark:hover:text-gray-200"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3m-9 0h12"></path></svg>Clear history'),p0=i('<div class="absolute left-0 right-0 top-full z-50 mt-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white text-sm shadow-xl dark:border-gray-700 dark:bg-gray-800"role=listbox>'),y0=i('<div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>By Node</button><button type=button>By Storage'),v0=i('<div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block">'),k0=i('<div class="flex flex-col lg:flex-row gap-3"><div class="flex gap-2 flex-1 items-center"><div class="relative flex-1"><input type=text placeholder="Search storage or node:nodename"class="w-full pl-9 pr-16 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all"title="Search storage by name or filter by node"><svg class="absolute left-3 top-2 h-4 w-4 text-gray-400 dark:text-gray-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><div class="absolute inset-y-0 right-2 flex items-center gap-1"><button type=button class="flex h-6 w-6 items-center justify-center rounded-lg border border-transparent text-gray-400 transition-colors hover:border-gray-200 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:border-gray-700 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"aria-haspopup=listbox><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l2.5 1.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class=sr-only>Show search history</span></button></div></div></div><div class="flex flex-wrap items-center gap-2"><div class="flex items-center gap-2"><span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Sort</span><select class="px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400"></select><button type=button class="inline-flex items-center justify-center h-7 w-7 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path stroke-linecap=round stroke-linejoin=round d="M8 9l4-4 4 4m0 6l-4 4-4-4"></path></svg></button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><button title="Reset all filters"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg><span class="ml-1 hidden sm:inline">Reset'),w0=i('<div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400">Your recent storage searches will show here.'),$0=i('<div class="flex items-center justify-between px-2 py-1.5 hover:bg-blue-50 dark:hover:bg-blue-900/20"><button type=button class="flex-1 truncate pr-2 text-left text-sm text-gray-700 transition-colors hover:text-blue-600 focus:outline-none dark:text-gray-200 dark:hover:text-blue-300"></button><button type=button class="ml-1 flex h-6 w-6 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:bg-gray-700/70 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"title="Remove from history"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg><span class=sr-only>Remove from history'),_0=i("<option>");const C0=e=>{const r=e.sortOptions??[{value:"name",label:"Name"},{value:"node",label:"Node"},{value:"type",label:"Type"},{value:"status",label:"Status"},{value:"usage",label:"Usage %"},{value:"free",label:"Free Capacity"},{value:"total",label:"Total Capacity"}],s=_a(Fs.STORAGE_SEARCH_HISTORY),[l,o]=Z([]),[a,d]=Z(!1);let c,g,b;vr(()=>{o(s.read())});const p=I=>{const L=s.add(I);o(L)},m=I=>{o(s.remove(I))},S=()=>{o(s.clear()),d(!1),queueMicrotask(()=>b?.blur())},z=()=>{d(!1),queueMicrotask(()=>b?.blur())},ie=I=>{const L=I.target,H=g?.contains(L)??!1,se=b?.contains(L)??!1;!H&&!se&&z()};ft(()=>{a()?document.addEventListener("mousedown",ie):document.removeEventListener("mousedown",ie)}),Ar(()=>{document.removeEventListener("mousedown",ie)});const ne=()=>{queueMicrotask(()=>c?.focus())};let W=!1;const X=()=>{W=!0,queueMicrotask(()=>{W=!1})};return n(it,{class:"storage-filter mb-3",padding:"sm",get children(){var I=k0(),L=I.firstChild,H=L.firstChild,se=H.firstChild,le=se.nextSibling,ee=le.nextSibling,U=ee.firstChild,Y=L.nextSibling,oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=B.nextSibling,D=$.firstChild,f=oe.nextSibling,j=f.nextSibling;return se.addEventListener("blur",K=>{if(W)return;const C=K.relatedTarget,ge=C?g?.contains(C)||b?.contains(C):!1,J=C?.getAttribute("aria-controls")==="storage-search-help";!ge&&!J&&p(K.currentTarget.value)}),se.$$keydown=K=>{K.key==="Enter"?(p(K.currentTarget.value),z()):K.key==="ArrowDown"&&l().length>0&&(K.preventDefault(),d(!0))},se.$$input=K=>e.setSearch(K.currentTarget.value),fr(K=>{c=K,e.searchInputRef?.(K)},se),t(H,n(h,{get when(){return e.search()},get children(){var K=m0();return K.$$mousedown=X,K.$$click=()=>e.setSearch(""),K}}),ee),U.$$mousedown=X,U.$$click=()=>d(K=>{const C=!K;return C||queueMicrotask(()=>b?.blur()),C}),fr(K=>b=K,U),t(ee,n($a,{popoverId:"storage-search-help",intro:"Quick examples",tips:[{code:"local",description:'Storage with "local" in the name'},{code:"node:pve1",description:"Show storage on a specific node"},{code:"nfs",description:"Find NFS storage"}],footerHighlight:"node:pve1 nfs",footerText:"Combine filters to zero in on exactly what you need.",triggerVariant:"icon",buttonLabel:"Search tips",openOnHover:!0}),null),t(H,n(h,{get when(){return a()},get children(){var K=p0();return fr(C=>g=C,K),t(K,n(h,{get when(){return l().length>0},get fallback(){return w0()},get children(){return[(()=>{var C=x0();return t(C,n(ze,{get each(){return l()},children:ge=>(()=>{var J=$0(),N=J.firstChild,F=N.nextSibling;return N.$$mousedown=X,N.$$click=()=>{e.setSearch(ge),p(ge),d(!1),ne()},t(N,ge),F.$$mousedown=X,F.$$click=()=>m(ge),J})()})),C})(),(()=>{var C=b0();return C.$$mousedown=X,C.$$click=S,C})()]}})),K}}),null),t(Y,n(h,{get when(){return e.groupBy&&e.setGroupBy},get children(){return[(()=>{var K=y0(),C=K.firstChild,ge=C.nextSibling;return C.$$click=()=>e.setGroupBy("node"),ge.$$click=()=>e.setGroupBy(e.groupBy()==="storage"?"node":"storage"),q(J=>{var N=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupBy()==="node"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,F=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupBy()==="storage"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`;return N!==J.e&&y(C,J.e=N),F!==J.t&&y(ge,J.t=F),J},{e:void 0,t:void 0}),K})(),v0()]}}),oe),B.addEventListener("change",K=>e.setSortKey(K.currentTarget.value)),t(B,()=>r.map(K=>(()=>{var C=_0();return t(C,()=>K.label),q(()=>C.value=K.value),C})())),$.$$click=()=>e.setSortDirection(e.sortDirection()==="asc"?"desc":"asc"),j.$$click=()=>{e.setSearch(""),e.setSortKey("name"),e.setSortDirection("asc"),e.setGroupBy&&e.setGroupBy("node")},q(K=>{var C=a(),ge=l().length>0?"Show recent searches":"No recent searches yet",J=`Sort ${e.sortDirection()==="asc"?"descending":"ascending"}`,N=`h-4 w-4 transition-transform ${e.sortDirection()==="asc"?"rotate-180":""}`,F=`flex items-center justify-center px-2.5 py-1 text-xs font-medium rounded-lg transition-colors ${e.search().trim()!==""||e.sortKey()!=="name"||e.sortDirection()!=="asc"||e.groupBy&&e.groupBy()!=="node"?"text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-900/70":"text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600"}`;return C!==K.e&&Te(U,"aria-expanded",K.e=C),ge!==K.t&&Te(U,"title",K.t=ge),J!==K.a&&Te($,"title",K.a=J),N!==K.o&&Te(D,"class",K.o=N),F!==K.i&&y(j,K.i=F),K},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),q(()=>se.value=e.search()),q(()=>B.value=e.sortKey()),I}})};Xt(["input","keydown","click","mousedown"]);var S0=i('<div class=overflow-x-auto><table class=w-full><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Node</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Device</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Model</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Type</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">FS</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Health</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">SSD Life</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden sm:table-cell">Temp</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Size</th><th class="px-2 py-1.5 w-8"></th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),T0=i("<div>"),A0=i('<span class="text-[10px] font-mono text-gray-600 dark:text-gray-400">'),D0=i('<div class="relative w-24 h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600"><div></div><span class="absolute inset-0 flex items-center justify-center text-[10px] font-medium text-gray-800 dark:text-gray-100 leading-none"><span class="whitespace-nowrap px-0.5">%'),M0=i("<span>°C"),P0=i('<tr class="hover:bg-gray-50 dark:hover:bg-gray-700/30 transition-colors"><td class="px-2 py-1.5 text-xs"><span class="font-medium text-gray-900 dark:text-gray-100"></span></td><td class="px-2 py-1.5 text-xs"><span class="font-mono text-gray-600 dark:text-gray-400"></span></td><td class="px-2 py-1.5 text-xs"><span class="text-gray-700 dark:text-gray-300"></span></td><td class="px-2 py-1.5 text-xs"><span></span></td><td class="px-2 py-1.5 text-xs"></td><td class="px-2 py-1.5 text-xs"><span></span></td><td class="px-2 py-1.5 text-xs"></td><td class="px-2 py-1.5 text-xs hidden sm:table-cell"></td><td class="px-2 py-1.5 text-xs"><span class="text-gray-700 dark:text-gray-300"></span></td><td class="px-2 py-1.5">'),ql=i("<span class=text-gray-400>-"),E0=i('<span class="font-medium text-gray-400">-');const N0=e=>{const{state:r}=qr(),s=pe(()=>{let d=e.disks||[];if(e.selectedNode){const c=r.nodes?.find(g=>g.id===e.selectedNode);c&&(d=d.filter(g=>g.instance===c.instance&&g.node===c.name))}if(e.searchTerm){const c=e.searchTerm.toLowerCase();d=d.filter(g=>g.model.toLowerCase().includes(c)||g.devPath.toLowerCase().includes(c)||g.serial.toLowerCase().includes(c)||g.node.toLowerCase().includes(c))}return[...d].sort((c,g)=>c.node!==g.node?c.node.localeCompare(g.node):c.devPath.localeCompare(g.devPath))}),l=d=>{const g=(d.health||"").trim().toUpperCase();return g==="PASSED"||g==="OK"||g==="GOOD"?d.wearout>0&&d.wearout<10?{color:"text-yellow-700 dark:text-yellow-400",bgColor:"bg-yellow-100 dark:bg-yellow-900/30",text:"LOW LIFE"}:{color:"text-green-700 dark:text-green-400",bgColor:"bg-green-100 dark:bg-green-900/30",text:g==="PASSED"?"HEALTHY":g||"HEALTHY"}:g==="FAILED"?{color:"text-red-700 dark:text-red-400",bgColor:"bg-red-100 dark:bg-red-900/30",text:"FAILED"}:{color:"text-gray-700 dark:text-gray-400",bgColor:"bg-gray-100 dark:bg-gray-700",text:"UNKNOWN"}},o=d=>{switch(d.toLowerCase()){case"nvme":return"bg-purple-100 dark:bg-purple-900/30 text-purple-800 dark:text-purple-300";case"sata":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300";case"sas":return"bg-indigo-100 dark:bg-indigo-900/30 text-indigo-800 dark:text-indigo-300";default:return"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300"}},a=pe(()=>e.selectedNode&&r.nodes?.find(c=>c.id===e.selectedNode)?.name||null);return(()=>{var d=T0();return t(d,n(h,{get when(){return s().length===0},get children(){return n(it,{padding:"lg",class:"text-center text-gray-500",get children(){return["No physical disks found",$e(()=>$e(()=>!!a())()&&` for node ${a()}`),$e(()=>e.searchTerm&&` matching "${e.searchTerm}"`)]}})}}),null),t(d,n(h,{get when(){return s().length>0},get children(){return n(it,{padding:"none",class:"overflow-hidden",get children(){var c=S0(),g=c.firstChild,b=g.firstChild,p=b.nextSibling;return t(p,n(ze,{get each(){return s()},children:m=>{const S=l(m);return(()=>{var z=P0(),ie=z.firstChild,ne=ie.firstChild,W=ie.nextSibling,X=W.firstChild,I=W.nextSibling,L=I.firstChild,H=I.nextSibling,se=H.firstChild,le=H.nextSibling,ee=le.nextSibling,U=ee.firstChild,Y=ee.nextSibling,oe=Y.nextSibling,_=oe.nextSibling,B=_.firstChild;return t(ne,()=>m.node),t(X,()=>m.devPath),t(L,()=>m.model||"Unknown"),t(se,()=>m.type.toUpperCase()),t(le,n(h,{get when(){return m.used&&m.used!=="unknown"},get fallback(){return ql()},get children(){var $=A0();return t($,()=>m.used),$}})),t(U,()=>S.text),t(Y,n(h,{get when(){return m.wearout>0},get fallback(){return ql()},get children(){var $=D0(),D=$.firstChild,f=D.nextSibling,j=f.firstChild,K=j.firstChild;return t(j,()=>m.wearout,K),q(C=>{var ge=`absolute top-0 left-0 h-full ${m.wearout>=50?"bg-green-500/60 dark:bg-green-500/50":m.wearout>=20?"bg-yellow-500/60 dark:bg-yellow-500/50":m.wearout>=10?"bg-orange-500/60 dark:bg-orange-500/50":"bg-red-500/60 dark:bg-red-500/50"}`,J=`${m.wearout}%`;return ge!==C.e&&y(D,C.e=ge),J!==C.t&&((C.t=J)!=null?D.style.setProperty("width",J):D.style.removeProperty("width")),C},{e:void 0,t:void 0}),$}})),t(oe,n(h,{get when(){return typeof m.temperature=="number"&&m.temperature!==0},get fallback(){return E0()},get children(){var $=M0(),D=$.firstChild;return t($,()=>m.temperature,D),q(()=>y($,`font-medium ${m.temperature>70?"text-red-600 dark:text-red-400":m.temperature>60?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"}`)),$}})),t(B,()=>Zt(m.size)),q($=>{var D=`inline-block px-1.5 py-0.5 text-[10px] font-medium rounded ${o(m.type)}`,f=`inline-block px-1.5 py-0.5 text-[10px] font-medium rounded ${S.bgColor} ${S.color}`;return D!==$.e&&y(se,$.e=D),f!==$.t&&y(U,$.t=f),$},{e:void 0,t:void 0}),z})()}})),c}})}}),null),d})()};var O0=i('<div class=relative><input type=text placeholder="Search disks by model, path, or serial..."class="w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all"><svg class="absolute left-3 top-2 h-4 w-4 text-gray-400 dark:text-gray-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z">'),L0=i('<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden lg:table-cell">Shared'),R0=i(`<div class=overflow-x-auto style=scrollbar-width:none;-ms-overflow-style:none;><style>
|
||
.overflow-x-auto::-webkit-scrollbar { display: none; }
|
||
</style><table class=w-full><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Storage</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden md:table-cell">Type</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden lg:table-cell">Content</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden sm:table-cell">Status</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider min-w-[200px]">Usage</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider hidden sm:table-cell">Free</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Total</th><th class="px-2 py-1.5 w-8"></th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">`),I0=i('<div class=space-y-3><div class=mb-4><nav class="flex items-center gap-4"aria-label="Storage tabs"><button type=button>Storage Pools</button><button type=button>Physical Disks'),H0=i('<div class="mx-auto flex h-12 w-12 items-center justify-center"><svg class="h-8 w-8 animate-spin text-gray-400"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),U0=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">'),B0=i('<button type=button class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">Go to Settings'),j0=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z">'),Ua=i("<span>"),F0=i('<span class="px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300">ERRORS'),Kl=i('<span class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap truncate max-w-[240px]">(<!>)'),V0=i('<td class="p-0.5 px-1.5 hidden lg:table-cell"><span class="text-xs text-gray-600 dark:text-gray-400">'),G0=i('<tr><td><div class="flex items-center gap-2 min-w-0"><span></span></div></td><td class="p-0.5 px-1.5 hidden md:table-cell"><span class="inline-block px-1.5 py-0.5 text-[10px] font-medium rounded bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"></span></td><td class="p-0.5 px-1.5 hidden lg:table-cell"><span class="text-xs text-gray-600 dark:text-gray-400 whitespace-nowrap truncate max-w-[220px]"></span></td><td class="p-0.5 px-1.5 text-xs hidden sm:table-cell whitespace-nowrap"><span></span></td><td class="p-0.5 px-1.5"><div class="relative min-w-[200px] h-3.5 rounded overflow-hidden bg-gray-200 dark:bg-gray-600"><div></div><span class="absolute inset-0 flex items-center justify-center text-[10px] font-medium text-gray-800 dark:text-gray-100 leading-none"><span class="whitespace-nowrap px-0.5">% (<!>/<!>)</span></span></div></td><td class="p-0.5 px-1.5 text-xs hidden sm:table-cell whitespace-nowrap"></td><td class="p-0.5 px-1.5 text-xs whitespace-nowrap"></td><td class="p-0.5 px-1.5">'),z0=i('<div class="mt-2 text-[12px] text-gray-600 dark:text-gray-300">'),W0=i('<div class="mt-2 text-[11px] text-gray-500 dark:text-gray-400">'),q0=i('<div class="mt-2 text-[12px]">'),K0=i('<tr><td colspan=9 class="px-4 py-3"><div><div class="rounded-lg border border-gray-200 bg-white/80 p-4 shadow-sm dark:border-gray-600/60 dark:bg-gray-900/30"><div class="flex items-center gap-2 text-xs font-semibold text-gray-700 dark:text-gray-200"><span>Ceph Cluster</span><span></span></div></div><div class="rounded-lg border border-gray-200 bg-white/80 p-4 shadow-sm dark:border-gray-600/60 dark:bg-gray-900/30 text-gray-600 dark:text-gray-300"><div class="text-xs font-semibold text-gray-700 dark:text-gray-200">Pools'),J0=i('<span class="text-red-600 dark:text-red-400">Errors: <!> read, <!> write, <!> checksum'),Q0=i('<div class="ml-4 space-y-0.5">'),Y0=i('<tr class="bg-yellow-50 dark:bg-yellow-950/20 border-l-4 border-yellow-500"><td colspan=9 class=p-2><div class="text-xs space-y-1"><div class="flex items-center gap-2"><span class="font-semibold text-yellow-700 dark:text-yellow-400">ZFS Pool Status:</span><span>'),X0=i('<div class="mt-2 text-[12px] text-gray-500 dark:text-gray-400">No pool data available'),Z0=i("<span class=ml-1>(<!>R/<!>W/<!>C errors)"),eg=i('<div class="flex items-center gap-2 text-xs"><span class="text-gray-600 dark:text-gray-400">Device <!>:</span><span>'),tg=i('<span class="ml-1 text-gray-500 dark:text-gray-400">');const rg=()=>{const{state:e,connected:r,activeAlerts:s,initialDataReceived:l}=qr(),[o,a]=Z("node"),[d,c]=Z("pools"),[g,b]=Z(""),[p,m]=Z(null),[S,z]=Z(null),[ie,ne]=Z("name"),[W,X]=Z("asc"),I=pe(()=>{const K={};return(e.nodes||[]).forEach(C=>{K[C.id]=C}),K}),L=K=>{const C=(K||"").toLowerCase();return C==="rbd"||C==="cephfs"||C==="ceph"},H=K=>{if(!K)return"CEPH";const C=K.toUpperCase();return C.startsWith("HEALTH_")?C.replace("HEALTH_",""):C},se=K=>{const C=(K||"").toUpperCase();return C==="HEALTH_OK"?"bg-green-100 text-green-700 dark:bg-green-900/60 dark:text-green-300 border border-green-200 dark:border-green-800":C==="HEALTH_WARN"||C==="HEALTH_WARNING"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/60 dark:text-yellow-200 border border-yellow-300 dark:border-yellow-800":C==="HEALTH_ERR"||C==="HEALTH_ERROR"||C==="HEALTH_CRIT"?"bg-red-100 text-red-700 dark:bg-red-900/60 dark:text-red-200 border border-red-300 dark:border-red-800":"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-200 border border-blue-200 dark:border-blue-700"},le=pe(()=>e.cephClusters||[]),ee=pe(()=>{const K=le();if(K&&K.length>0)return K;const C=e.storage||[],ge=new Map;return C.forEach(J=>{if(!L(J?.type))return;const N=J.instance||"ceph";let F=ge.get(N);F||(F={total:0,used:0,nodes:new Set,storages:0},ge.set(N,F)),F.total+=Math.max(0,J.total||0),F.used+=Math.max(0,J.used||0),F.storages+=1,Array.isArray(J.nodes)?J.nodes.forEach(P=>P&&F.nodes.add(P)):J.node&&F.nodes.add(J.node)}),Array.from(ge.entries()).map(([J,N],F)=>{const P=N.total,E=N.used,u=Math.max(P-E,0),v=P>0?E/P*100:0,V=Math.max(1,N.storages*2),A=Math.min(3,Math.max(1,N.nodes.size));return{id:`${J}-derived-${F}`,instance:J,name:`${J} Ceph`,health:"HEALTH_UNKNOWN",healthMessage:"Derived from storage metrics – live Ceph telemetry unavailable.",totalBytes:P,usedBytes:E,availableBytes:u,usagePercent:v,numMons:A,numMgrs:A>1?2:1,numOsds:V,numOsdsUp:V,numOsdsIn:V,numPGs:Math.max(128,N.storages*128),pools:void 0,services:void 0,lastUpdated:Date.now()}})}),U=pe(()=>{const K={};return ee().forEach(C=>{C?.instance&&(K[C.instance]=C)}),K}),Y=[{value:"name",label:"Name"},{value:"node",label:"Node"},{value:"type",label:"Type"},{value:"status",label:"Status"},{value:"usage",label:"Usage %"},{value:"free",label:"Free Capacity"},{value:"total",label:"Total Capacity"}];vr(()=>{localStorage.getItem("storageViewMode")==="storage"&&a("storage");const C=localStorage.getItem("storageSortKey");C&&Y.some(J=>J.value===C)&&ne(C);const ge=localStorage.getItem("storageSortDirection");(ge==="desc"||ge==="asc")&&X(ge)}),ft(()=>{localStorage.setItem("storageViewMode",o())}),ft(()=>{localStorage.setItem("storageSortKey",ie())}),ft(()=>{localStorage.setItem("storageSortDirection",W())});const oe=pe(()=>{let K=e.storage||[];if(o()==="storage"){K=K.filter(ge=>ge.total>0);const C=new Map;K.forEach(ge=>{let J;const N=`${ge.instance}-${ge.node}`;if(ge.type==="pbs"&&ge.shared?J=`pbs-${ge.total}-${ge.used}`:ge.shared?J=`${ge.name}-${ge.type}`:J=`${ge.node}-${ge.name}-${ge.type}`,C.has(J)){const F=C.get(J),P=(ge.nodes??[]).filter(A=>!!A),E=P.length>0?P:[ge.node].filter(Boolean);(E.length>1?E.filter(A=>A!=="cluster"):E).forEach(A=>{F.nodes.includes(A)||F.nodes.push(A)}),F.nodeCount=F.nodes.length;const v=(ge.nodeIds??[]).filter(A=>!!A),V=v.length>0?v:[N].filter(Boolean);F.nodeIds||(F.nodeIds=[]),V.forEach(A=>{F.nodeIds.includes(A)||F.nodeIds.push(A)}),ge.type==="pbs"&&(F.pbsNames||(F.pbsNames=[]),(ge.pbsNames??[ge.name]).filter(k=>!!k).forEach(k=>{F.pbsNames.includes(k)||F.pbsNames.push(k)}))}else{const F=(ge.nodes??[]).filter(w=>!!w),P=(ge.nodeIds??[]).filter(w=>!!w),E=F.length>0?F:[ge.node].filter(Boolean),u=Array.from(new Set(E)),v=u.length>1?u.filter(w=>w!=="cluster"):u,V=v.length>0?v:u,A=Array.from(new Set(P.length>0?P:[N].filter(Boolean))),k=ge.type==="pbs"?Array.from(new Set((ge.pbsNames??[ge.name]).filter(w=>!!w))):void 0;C.set(J,{...ge,name:ge.type==="pbs"?"PBS Storage":ge.name,nodes:V,nodeIds:A,nodeCount:V.length,pbsNames:k})}}),K=Array.from(C.values())}return K}),_=pe(()=>{let K=[...oe()];const C=p();if(C){const F=e.nodes?.find(P=>P.id===C);if(F){const P=`${F.instance}-${F.name}`;K=K.filter(E=>{const u=E.instance===F.instance&&E.node===F.name,v=E.nodeIds??[];return u||v.includes(P)})}}let ge=g().toLowerCase().trim();if(ge){const F=/node:([a-z0-9_.:-]+)/i,P=ge.match(F);let E=null;if(P&&(E=P[1].toLowerCase(),ge=ge.replace(P[0],"").trim()),E&&(K=K.filter(u=>{const v=u.node?.toLowerCase(),V=u.nodes?.map(A=>A.toLowerCase())||[];return v===E||V.includes(E)})),ge){const u=ge.split(/\s+/).filter(Boolean);K=K.filter(v=>{const V=[v.name,v.node,v.type,v.content,v.status,...v.nodes??[],...v.pbsNames??[]].filter(Boolean).map(A=>A.toLowerCase());return u.every(A=>V.some(k=>k.includes(A)))})}}const J=(F,P)=>{const E=Number.isFinite(F)?F:-1/0,u=Number.isFinite(P)?P:-1/0;return E===u?0:E<u?-1:1};return K.sort((F,P)=>{let E=0;switch(ie()){case"node":{const u=(F.nodes&&F.nodes.length>0?F.nodes[0]:F.node)??"",v=(P.nodes&&P.nodes.length>0?P.nodes[0]:P.node)??"";E=u.localeCompare(v,void 0,{sensitivity:"base"});break}case"type":E=(F.type??"").localeCompare(P.type??"",void 0,{sensitivity:"base"});break;case"status":E=(F.status??"").localeCompare(P.status??"",void 0,{sensitivity:"base"});break;case"usage":E=J(F.usage??0,P.usage??0);break;case"free":E=J(F.free??0,P.free??0);break;case"total":E=J(F.total??0,P.total??0);break;case"name":default:E=(F.name??"").localeCompare(P.name??"",void 0,{sensitivity:"base"});break}return E===0&&(E=(F.name??"").localeCompare(P.name??"",void 0,{sensitivity:"base"})),W()==="asc"?E:-E})}),B=pe(()=>{const K=_();if(o()==="node"){const ge={};return K.forEach(J=>{if(J.shared){const F=[...(J.nodeIds??[]).map(u=>u.startsWith(`${J.instance}-`)?u.slice(J.instance.length+1):u).filter(u=>!!u),...(J.nodes??[]).filter(u=>!!u)],P=Array.from(new Set(F.map(u=>u.trim()).filter(u=>u&&u!=="shared"&&u!=="cluster")));(P.length>0?P:[J.node].map(u=>u?.trim()).filter(u=>!!u)).forEach(u=>{const v=`${J.instance}-${u}`;ge[v]||(ge[v]=[]),ge[v].push({...J,node:u})});return}const N=`${J.instance}-${J.node}`;ge[N]||(ge[N]=[]),ge[N].push(J)}),ge}else{const ge={};return K.forEach(J=>{ge[J.name]||(ge[J.name]=[]),ge[J.name].push(J)}),ge}}),$=K=>K>=90?"bg-red-500/60 dark:bg-red-500/50":K>=80?"bg-yellow-500/60 dark:bg-yellow-500/50":"bg-green-500/60 dark:bg-green-500/50",D=()=>{b(""),m(null),a("node"),ne("name"),X("asc")};let f;ft(()=>{const K=C=>{const ge=C.target,J=ge.tagName==="INPUT"||ge.tagName==="TEXTAREA"||ge.tagName==="SELECT"||ge.contentEditable==="true";C.key==="Escape"?(g().trim()||p()||o()!=="node")&&(D(),f&&document.activeElement===f&&f.blur()):!J&&C.key.length===1&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&f&&f.focus()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)});const j=K=>{m(K)};return(()=>{var K=I0(),C=K.firstChild,ge=C.firstChild,J=ge.firstChild,N=J.nextSibling;return t(K,n(Ca,{current:"storage"}),C),t(K,n(kl,{currentTab:"storage",onNodeSelect:j,get filteredStorage(){return _()},get searchTerm(){return g()}}),C),J.$$click=()=>c("pools"),N.$$click=()=>c("disks"),t(K,n(h,{get when(){return d()==="pools"},get children(){return n(C0,{search:g,setSearch:b,groupBy:o,setGroupBy:a,sortOptions:Y,sortKey:ie,setSortKey:ne,sortDirection:W,setSortDirection:X,searchInputRef:F=>f=F})}}),null),t(K,n(h,{get when(){return d()==="disks"},get children(){return n(it,{class:"mb-3",padding:"sm",get children(){var F=O0(),P=F.firstChild;return fr(E=>f=E,P),P.$$input=E=>b(E.currentTarget.value),q(()=>P.value=g()),F}})}}),null),t(K,n(h,{get when(){return $e(()=>!!r())()&&!l()},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return H0()},title:"Loading storage data...",description:"Connecting to monitoring service"})}})}}),null),t(K,n(h,{get when(){return $e(()=>!!(r()&&l()&&(e.nodes||[]).filter(F=>F.type==="pve").length===0&&_().length===0))()&&g().trim()===""},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return U0()},title:"No storage configured",description:"Add a Proxmox VE or PBS node in the Settings tab to start monitoring storage.",get actions(){return(()=>{var F=B0();return F.$$click=()=>{document.querySelector('[role="tab"]:last-child')?.click()},F})()}})}})}}),null),t(K,n(h,{get when(){return d()==="pools"},get children(){return[n(h,{get when(){return $e(()=>!!(r()&&l()&&_().length===0))()&&g().trim()!==""},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return j0()},title:"No storage found",get description(){return`No storage matches your search "${g()}"`}})}})}}),n(h,{get when(){return $e(()=>!!(r()&&l()))()&&_().length>0},get children(){return n(il,{name:"Storage Table",get children(){return n(it,{padding:"none",class:"mb-4 overflow-hidden",get children(){var F=R0(),P=F.firstChild,E=P.nextSibling,u=E.firstChild,v=u.firstChild,V=v.firstChild,A=V.nextSibling,k=A.nextSibling,w=k.nextSibling,de=w.nextSibling,fe=u.nextSibling;return t(v,n(h,{get when(){return o()==="node"},get children(){return L0()}}),de),t(fe,n(ze,{get each(){return Object.entries(B()).sort(([x],[R])=>{if(o()==="node"){const Q=I()[x],G=I()[R],T=Q?Nn(Q):x,te=G?Nn(G):R;return T.localeCompare(te)}return x.localeCompare(R)})},children:([x,R])=>{const Q=o()==="node"?I()[x]:null;return[n(h,{get when(){return o()==="node"&&Q},children:G=>n(ho,{get node(){return G()},colspan:9})}),n(ze,{each:R,fallback:[],children:G=>{const T=G.total>0?G.used/G.total*100:0,te=G.status!=="available",ae=pe(()=>{const Re=G.pbsNames?.filter(gt=>!!gt);return!Re||Re.length===0?"":[...Re].sort((gt,mt)=>gt.localeCompare(mt)).join(", ")}),M=pe(()=>(G.nodes&&G.nodes.length>0?G.nodes.filter(gt=>!!gt):[G.node].filter(gt=>!!gt)).join(", ")),ce=wa(G.id||`${G.instance}-${G.node}-${G.name}`,s),ue=pe(()=>o()==="node"&&Q?Q.status==="online"&&(Q.uptime||0)>0:!0),re=pe(()=>ce.hasUnacknowledgedAlert&&ue()),O=pe(()=>L(G.type)),xe=pe(()=>O()),he=G.zfsPool,me=pe(()=>G.id||`${G.instance}-${G.node}-${G.name}`),_e=pe(()=>U()[G.instance]),Ce=pe(()=>(e.storage||[]).filter(Re=>Re.instance===G.instance&&L(Re.type))),Oe=pe(()=>{const Re=(_e()?.health||"").toUpperCase();return!Re||Re==="HEALTH_UNKNOWN"?"":H(Re)}),tt=pe(()=>{const Re=(_e()?.health||"").toUpperCase();return!Re||Re==="HEALTH_UNKNOWN"?"":se(Re)}),Ze=pe(()=>te||!ue()),bt=pe(()=>{const Re=_e(),gt=[];if(Re&&Number.isFinite(Re.totalBytes)){const mt=Math.max(0,Re.totalBytes||0),Rt=Math.max(0,Re.usedBytes||0),It=mt>0?Rt/mt*100:0;gt.push(`${Zt(Rt)} / ${Zt(mt)} (${It.toFixed(1)}%)`),Number.isFinite(Re.numOsds)&&Number.isFinite(Re.numOsdsUp)&>.push(`OSDs ${Re.numOsdsUp}/${Re.numOsds}`),Number.isFinite(Re.numPGs)&&Re.numPGs>0&>.push(`PGs ${Re.numPGs.toLocaleString()}`)}else{const mt=Ce();if(mt.length>0){const Rt=mt.reduce((It,Ae)=>(It.total+=Math.max(0,Ae.total||0),It.used+=Math.max(0,Ae.used||0),It),{total:0,used:0});if(Rt.total>0){const It=Rt.used/Rt.total*100;gt.push(`${Zt(Rt.used)} / ${Zt(Rt.total)} (${It.toFixed(1)}%)`)}}}return gt.join(" • ")}),ct=pe(()=>{const Re=_e();if(Re&&Re.pools&&Re.pools.length>0)return Re.pools.slice(0,2).map(mt=>{if(!mt)return"";const Rt=Math.max(1,mt.storedBytes+mt.availableBytes),It=Rt>0?mt.storedBytes/Rt*100:0;return`${mt.name}: ${It.toFixed(1)}%`}).filter(Boolean).join(", ");const gt=Ce();return gt.length===0?"":gt.slice(0,2).map(mt=>{const Rt=Math.max(1,mt.total||0),It=Math.max(0,mt.used||0),Ae=Rt>0?It/Rt*100:0;return`${mt.name}: ${Ae.toFixed(1)}%`}).filter(Boolean).join(", ")}),qe=pe(()=>{const Re=_e();return Re?.healthMessage?Re.healthMessage:Re&&Re.health&&Re.health!=="HEALTH_UNKNOWN"?"":Ce().length>0?"Derived from storage metrics – live Ceph telemetry unavailable.":""}),Ke=pe(()=>S()===me()),Xe=pe(()=>ce.hasAcknowledgedOnlyAlert&&ue()),_t=pe(()=>{const Re=["transition-all duration-200","hover:bg-gray-50 dark:hover:bg-gray-700/30","hover:shadow-sm"];return re()?Re.push(ce.severity==="critical"?"bg-red-50 dark:bg-red-950/30":"bg-yellow-50 dark:bg-yellow-950/20"):Xe()&&Re.push("bg-gray-50/40 dark:bg-gray-800/40"),(te||!ue())&&Re.push("opacity-60"),xe()&&Re.push("cursor-pointer"),xe()&&Ke()&&Re.push("bg-gray-50 dark:bg-gray-800/40"),Re.join(" ")}),Lt=pe(()=>re()?{"box-shadow":`inset 4px 0 0 0 ${ce.severity==="critical"?"#ef4444":"#eab308"}`}:Xe()?{"box-shadow":"inset 4px 0 0 0 rgba(156, 163, 175, 0.8)"}:{}),vt=pe(()=>re()||Xe()),Ve=pe(()=>o()==="node"?vt()?"p-0.5 pl-7 pr-1.5":"p-0.5 pl-8 pr-1.5":(vt(),"p-0.5 pl-3 pr-1.5")),lt=()=>{xe()&&z(Re=>Re===me()?null:me())};return[(()=>{var Re=G0(),gt=Re.firstChild,mt=gt.firstChild,Rt=mt.firstChild,It=gt.nextSibling,Ae=It.firstChild,Fe=It.nextSibling,Qe=Fe.firstChild,xt=Fe.nextSibling,Vt=xt.firstChild,Et=xt.nextSibling,Jt=Et.firstChild,er=Jt.firstChild,Ut=er.nextSibling,lr=Ut.firstChild,Bt=lr.firstChild,et=Bt.nextSibling,we=et.nextSibling,Je=we.nextSibling;Je.nextSibling;var Ge=Et.nextSibling,pt=Ge.nextSibling;return Re.$$click=lt,t(Rt,()=>G.name),t(mt,n(h,{get when(){return he&&he.state!=="ONLINE"},get children(){var dt=Ua();return t(dt,()=>he?.state),q(()=>y(dt,`px-1.5 py-0.5 rounded text-[10px] font-medium ${he?.state==="DEGRADED"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300":"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300"}`)),dt}}),null),t(mt,n(h,{get when(){return he&&(he.readErrors>0||he.writeErrors>0||he.checksumErrors>0)},get children(){return F0()}}),null),t(mt,n(h,{get when(){return o()==="storage"},get children(){return[n(h,{get when(){return G.pbsNames},get children(){var dt=Kl(),ht=dt.firstChild,We=ht.nextSibling;return We.nextSibling,t(dt,ae,We),q(()=>Te(dt,"title",ae())),dt}}),n(h,{get when(){return!G.pbsNames},get children(){var dt=Kl(),ht=dt.firstChild,We=ht.nextSibling;return We.nextSibling,t(dt,M,We),q(()=>Te(dt,"title",M())),dt}})]}}),null),t(mt,n(h,{get when(){return $e(()=>!!O())()&&Oe()},get children(){var dt=Ua();return t(dt,Oe),q(ht=>{var We=`px-1.5 py-0.5 rounded text-[10px] font-medium ${tt()}`,st=_e()?.healthMessage;return We!==ht.e&&y(dt,ht.e=We),st!==ht.t&&Te(dt,"title",ht.t=st),ht},{e:void 0,t:void 0}),dt}}),null),t(Ae,()=>G.type),t(Qe,()=>G.content||"-"),t(Vt,()=>G.status||"unknown"),t(Re,n(h,{get when(){return o()==="node"},get children(){var dt=V0(),ht=dt.firstChild;return t(ht,()=>G.shared?"✓":"-"),dt}}),Et),`${T}%`!=null?er.style.setProperty("width",`${T}%`):er.style.removeProperty("width"),t(lr,()=>T.toFixed(0),Bt),t(lr,()=>Zt(G.used||0),et),t(lr,()=>Zt(G.total||0),Je),t(Ge,()=>Zt(G.free||0)),t(pt,()=>Zt(G.total||0)),q(dt=>{var ht=`${_t()} transition-colors`,We=Lt(),st=xe()&&Ke()?"true":"false",nr=`${Ve()} align-middle`,xr=`text-sm font-medium text-gray-900 dark:text-gray-100 truncate ${xe()?"max-w-[180px]":"max-w-[200px]"}`,cr=G.name,sr=G.content||"-",wr=`${G.status==="available"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,Gt=`absolute top-0 left-0 h-full ${$(T)}`;return ht!==dt.e&&y(Re,dt.e=ht),dt.t=xs(Re,We,dt.t),st!==dt.a&&Te(Re,"aria-expanded",dt.a=st),nr!==dt.o&&y(gt,dt.o=nr),xr!==dt.i&&y(Rt,dt.i=xr),cr!==dt.n&&Te(Rt,"title",dt.n=cr),sr!==dt.s&&Te(Qe,"title",dt.s=sr),wr!==dt.h&&y(Vt,dt.h=wr),Gt!==dt.r&&y(er,dt.r=Gt),dt},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),Re})(),n(h,{get when(){return $e(()=>!!O())()&&Ke()},get children(){var Re=K0(),gt=Re.firstChild,mt=gt.firstChild,Rt=mt.firstChild,It=Rt.firstChild,Ae=It.firstChild,Fe=Ae.nextSibling,Qe=Rt.nextSibling;return Qe.firstChild,t(Fe,()=>_e()?.name||G.instance),t(It,n(h,{get when(){return Oe()},get children(){var xt=Ua();return t(xt,Oe),q(()=>y(xt,`px-1.5 py-0.5 rounded text-[10px] font-medium ${tt()}`)),xt}}),null),t(Rt,n(h,{get when(){return bt()},get children(){var xt=z0();return t(xt,bt),xt}}),null),t(Rt,n(h,{get when(){return qe()},get children(){var xt=W0();return t(xt,qe),xt}}),null),t(Qe,n(h,{get when(){return ct()},get fallback(){return X0()},get children(){var xt=q0();return t(xt,ct),xt}}),null),q(xt=>{var Vt=`text-[11px] border-t border-gray-200 dark:border-gray-700 ${Ze()?"bg-gray-100/70 text-gray-400 dark:bg-gray-900/30 dark:text-gray-500":"bg-gray-50/60 text-gray-700 dark:bg-gray-900/30 dark:text-gray-300"}`,Et=`grid gap-3 md:grid-cols-2 xl:grid-cols-2 ${Ze()?"opacity-60 pointer-events-none":""}`;return Vt!==xt.e&&y(Re,xt.e=Vt),Et!==xt.t&&y(mt,xt.t=Et),xt},{e:void 0,t:void 0}),Re}}),n(h,{get when(){return G.zfsPool&&(G.zfsPool.state!=="ONLINE"||G.zfsPool.readErrors>0||G.zfsPool.writeErrors>0||G.zfsPool.checksumErrors>0)},get children(){var Re=Y0(),gt=Re.firstChild,mt=gt.firstChild,Rt=mt.firstChild,It=Rt.firstChild,Ae=It.nextSibling;return t(Ae,()=>G.zfsPool.state),t(Rt,n(h,{get when(){return G.zfsPool.readErrors>0||G.zfsPool.writeErrors>0||G.zfsPool.checksumErrors>0},get children(){var Fe=J0(),Qe=Fe.firstChild,xt=Qe.nextSibling,Vt=xt.nextSibling,Et=Vt.nextSibling,Jt=Et.nextSibling,er=Jt.nextSibling;return er.nextSibling,t(Fe,()=>G.zfsPool.readErrors,xt),t(Fe,()=>G.zfsPool.writeErrors,Et),t(Fe,()=>G.zfsPool.checksumErrors,er),Fe}}),null),t(mt,n(h,{get when(){return G.zfsPool.devices.some(Fe=>Fe.state!=="ONLINE"||Fe.readErrors>0||Fe.writeErrors>0||Fe.checksumErrors>0)},get children(){var Fe=Q0();return t(Fe,n(ze,{get each(){return G.zfsPool.devices.filter(Qe=>Qe.state!=="ONLINE"||Qe.readErrors>0||Qe.writeErrors>0||Qe.checksumErrors>0)},children:Qe=>(()=>{var xt=eg(),Vt=xt.firstChild,Et=Vt.firstChild,Jt=Et.nextSibling;Jt.nextSibling;var er=Vt.nextSibling;return t(Vt,()=>Qe.name,Jt),t(er,()=>Qe.state,null),t(er,n(h,{get when(){return Qe.readErrors>0||Qe.writeErrors>0||Qe.checksumErrors>0},get children(){var Ut=Z0(),lr=Ut.firstChild,Bt=lr.nextSibling,et=Bt.nextSibling,we=et.nextSibling,Je=we.nextSibling,Ge=Je.nextSibling;return Ge.nextSibling,t(Ut,()=>Qe.readErrors,Bt),t(Ut,()=>Qe.writeErrors,we),t(Ut,()=>Qe.checksumErrors,Ge),Ut}}),null),t(er,n(h,{get when(){return Qe.message?.trim()},children:Ut=>(()=>{var lr=tg();return t(lr,Ut),lr})()}),null),q(()=>y(er,`${Qe.state!=="ONLINE"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`)),xt})()})),Fe}}),null),q(()=>y(Ae,`px-1.5 py-0.5 rounded text-xs font-medium ${G.zfsPool.state==="ONLINE"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300":G.zfsPool.state==="DEGRADED"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300":"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300"}`)),Re}})]}})]}})),F}})}})}})]}}),null),t(K,n(h,{get when(){return d()==="disks"},get children(){return n(N0,{get disks(){return e.physicalDisks||[]},get selectedNode(){return p()},get searchTerm(){return g()}})}}),null),q(F=>{var P=`inline-flex items-center px-2 sm:px-3 py-1 text-sm font-medium border-b-2 border-transparent text-gray-600 dark:text-gray-400 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-900 ${d()==="pools"?"text-blue-600 dark:text-blue-300 border-blue-500 dark:border-blue-400":"hover:text-blue-500 dark:hover:text-blue-300 hover:border-blue-300/70 dark:hover:border-blue-500/50"}`,E=`inline-flex items-center px-2 sm:px-3 py-1 text-sm font-medium border-b-2 border-transparent text-gray-600 dark:text-gray-400 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-900 ${d()==="disks"?"text-blue-600 dark:text-blue-300 border-blue-500 dark:border-blue-400":"hover:text-blue-500 dark:hover:text-blue-300 hover:border-blue-300/70 dark:hover:border-blue-500/50"}`;return P!==F.e&&y(J,F.e=P),E!==F.t&&y(N,F.t=E),F},{e:void 0,t:void 0}),K})()};Xt(["click","input"]);var ng=i('<button type=button class="absolute right-9 top-1/2 -translate-y-1/2 transform text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"aria-label="Clear search"title="Clear search"><svg class="h-4 w-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),sg=i('<div class="max-h-52 overflow-y-auto py-1">'),ag=i('<button type=button class="flex w-full items-center justify-center gap-2 border-t border-gray-200 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700/80 dark:hover:text-gray-200"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3m-9 0h12"></path></svg>Clear history'),lg=i('<div class="absolute left-0 right-0 top-full z-50 mt-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white text-sm shadow-xl dark:border-gray-700 dark:bg-gray-800"role=listbox>'),ig=i('<div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>All Types</button><button type=button>VM</button><button type=button>LXC</button><button type=button>PMG'),og=i('<div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block">'),dg=i('<div class="flex flex-col lg:flex-row gap-3"><div class="flex gap-2 flex-1 items-center"><div class="relative flex-1"><input type=text placeholder="Search backups or node:nodename"class="w-full pl-9 pr-16 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all"title="Search backups by name or filter by node"><svg class="absolute left-3 top-2 h-4 w-4 text-gray-400 dark:text-gray-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><div class="absolute inset-y-0 right-2 flex items-center gap-1"><button type=button class="flex h-6 w-6 items-center justify-center rounded-lg border border-transparent text-gray-400 transition-colors hover:border-gray-200 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:border-gray-700 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"aria-haspopup=listbox><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l2.5 1.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class=sr-only>Show search history</span></button></div></div></div><div class="flex flex-wrap items-center gap-2"><div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>All</button><button type=button>Snapshots</button><button type=button>PVE</button><button type=button>PBS</button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>By Date</button><button type=button>By Guest</button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><div class="flex items-center gap-2"><span class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Sort</span><select class="px-2 py-1 text-xs border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400"></select><button type=button class="inline-flex items-center justify-center h-7 w-7 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path stroke-linecap=round stroke-linejoin=round d="M8 9l4-4 4 4m0 6l-4 4-4-4"></path></svg></button></div><div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"></div><button title="Reset all filters"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg><span class="ml-1 hidden sm:inline">Reset'),cg=i('<div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400">Your recent backup searches will show here.'),ug=i('<div class="flex items-center justify-between px-2 py-1.5 hover:bg-blue-50 dark:hover:bg-blue-900/20"><button type=button class="flex-1 truncate pr-2 text-left text-sm text-gray-700 transition-colors hover:text-blue-600 focus:outline-none dark:text-gray-200 dark:hover:text-blue-300"></button><button type=button class="ml-1 flex h-6 w-6 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:bg-gray-700/70 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"title="Remove from history"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg><span class=sr-only>Remove from history'),gg=i("<option>");const hg=e=>{const r=e.sortOptions??[{value:"backupTime",label:"Time"},{value:"name",label:"Guest Name"},{value:"node",label:"Node"},{value:"vmid",label:"VMID"},{value:"backupType",label:"Backup Type"},{value:"size",label:"Size"},{value:"storage",label:"Storage"},{value:"verified",label:"Verified"},{value:"type",label:"Guest Type"},{value:"owner",label:"Owner"}],s=_a(Fs.BACKUPS_SEARCH_HISTORY),[l,o]=Z([]),[a,d]=Z(!1);let c,g,b;vr(()=>{o(s.read())});const p=I=>{const L=s.add(I);o(L)},m=I=>{o(s.remove(I))},S=()=>{o(s.clear()),d(!1),queueMicrotask(()=>b?.blur())},z=()=>{d(!1),queueMicrotask(()=>b?.blur())},ie=I=>{const L=I.target,H=g?.contains(L)??!1,se=b?.contains(L)??!1;!H&&!se&&z()};ft(()=>{a()?document.addEventListener("mousedown",ie):document.removeEventListener("mousedown",ie)}),Ar(()=>{document.removeEventListener("mousedown",ie)});const ne=()=>{queueMicrotask(()=>c?.focus())};let W=!1;const X=()=>{W=!0,queueMicrotask(()=>{W=!1})};return n(it,{class:"backups-filter mb-3",padding:"sm",get children(){var I=dg(),L=I.firstChild,H=L.firstChild,se=H.firstChild,le=se.nextSibling,ee=le.nextSibling,U=ee.firstChild,Y=L.nextSibling,oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=B.nextSibling,D=$.nextSibling,f=oe.nextSibling,j=f.nextSibling,K=j.firstChild,C=K.nextSibling,ge=j.nextSibling,J=ge.nextSibling,N=J.firstChild,F=N.nextSibling,P=F.nextSibling,E=P.firstChild,u=J.nextSibling,v=u.nextSibling;return se.addEventListener("blur",V=>{if(W)return;const A=V.relatedTarget,k=A?g?.contains(A)||b?.contains(A):!1,w=A?.getAttribute("aria-controls")==="backups-search-help";!k&&!w&&p(V.currentTarget.value)}),se.$$keydown=V=>{V.key==="Enter"?(p(V.currentTarget.value),z()):V.key==="ArrowDown"&&l().length>0&&(V.preventDefault(),d(!0))},se.$$input=V=>e.setSearch(V.currentTarget.value),fr(V=>{c=V,e.searchInputRef?.(V)},se),t(H,n(h,{get when(){return e.search()},get children(){var V=ng();return V.$$mousedown=X,V.$$click=()=>e.setSearch(""),V}}),ee),U.$$mousedown=X,U.$$click=()=>d(V=>{const A=!V;return A||queueMicrotask(()=>b?.blur()),A}),fr(V=>b=V,U),t(ee,n($a,{popoverId:"backups-search-help",intro:"Quick examples",tips:[{code:"media",description:'Backups with "media" in the name'},{code:"node:pve1",description:"Show backups from a specific node"},{code:"vm-104",description:"Locate backups for VM 104"}],footerHighlight:"node:pve1 vm-104",footerText:"Mix terms to focus on the exact backups you need.",triggerVariant:"icon",buttonLabel:"Search tips",openOnHover:!0}),null),t(H,n(h,{get when(){return a()},get children(){var V=lg();return fr(A=>g=A,V),t(V,n(h,{get when(){return l().length>0},get fallback(){return cg()},get children(){return[(()=>{var A=sg();return t(A,n(ze,{get each(){return l()},children:k=>(()=>{var w=ug(),de=w.firstChild,fe=de.nextSibling;return de.$$mousedown=X,de.$$click=()=>{e.setSearch(k),p(k),d(!1),ne()},t(de,k),fe.$$mousedown=X,fe.$$click=()=>m(k),w})()})),A})(),(()=>{var A=ag();return A.$$mousedown=X,A.$$click=S,A})()]}})),V}}),null),_.$$click=()=>e.setViewMode("all"),B.$$click=()=>e.setViewMode(e.viewMode()==="snapshot"?"all":"snapshot"),$.$$click=()=>e.setViewMode(e.viewMode()==="pve"?"all":"pve"),D.$$click=()=>e.setViewMode(e.viewMode()==="pbs"?"all":"pbs"),t(Y,n(h,{get when(){return e.hasHostBackups&&e.hasHostBackups()&&e.typeFilter&&e.setTypeFilter},get children(){return[(()=>{var V=ig(),A=V.firstChild,k=A.nextSibling,w=k.nextSibling,de=w.nextSibling;return A.$$click=()=>e.setTypeFilter("all"),k.$$click=()=>e.setTypeFilter(e.typeFilter()==="VM"?"all":"VM"),w.$$click=()=>e.setTypeFilter(e.typeFilter()==="LXC"?"all":"LXC"),de.$$click=()=>e.setTypeFilter(e.typeFilter()==="Host"?"all":"Host"),q(fe=>{var x=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.typeFilter()==="all"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,R=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.typeFilter()==="VM"?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,Q=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.typeFilter()==="LXC"?"bg-white dark:bg-gray-800 text-green-600 dark:text-green-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,G=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.typeFilter()==="Host"?"bg-white dark:bg-gray-800 text-orange-600 dark:text-orange-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`;return x!==fe.e&&y(A,fe.e=x),R!==fe.t&&y(k,fe.t=R),Q!==fe.a&&y(w,fe.a=Q),G!==fe.o&&y(de,fe.o=G),fe},{e:void 0,t:void 0,a:void 0,o:void 0}),V})(),og()]}}),j),K.$$click=()=>e.setGroupBy("date"),C.$$click=()=>e.setGroupBy(e.groupBy()==="guest"?"date":"guest"),F.addEventListener("change",V=>e.setSortKey(V.currentTarget.value)),t(F,()=>r.map(V=>(()=>{var A=gg();return t(A,()=>V.label),q(()=>A.value=V.value),A})())),P.$$click=()=>e.setSortDirection(e.sortDirection()==="asc"?"desc":"asc"),v.$$click=()=>{e.onReset?e.onReset():(e.setSearch(""),e.setViewMode("all"),e.setGroupBy("date"))},q(V=>{var A=a(),k=l().length>0?"Show recent searches":"No recent searches yet",w=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="all"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,de=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="snapshot"?"bg-white dark:bg-gray-800 text-yellow-600 dark:text-yellow-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,fe=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="pve"?"bg-white dark:bg-gray-800 text-orange-600 dark:text-orange-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,x=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.viewMode()==="pbs"?"bg-white dark:bg-gray-800 text-purple-600 dark:text-purple-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,R=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupBy()==="date"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,Q=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupBy()==="guest"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,G=`Sort ${e.sortDirection()==="asc"?"descending":"ascending"}`,T=`h-4 w-4 transition-transform ${e.sortDirection()==="asc"?"rotate-180":""}`,te=`flex items-center justify-center px-2.5 py-1 text-xs font-medium rounded-lg transition-colors ${e.search().trim()!==""||e.viewMode()!=="all"||e.groupBy()!=="date"||e.sortKey()!=="backupTime"||e.sortDirection()!=="desc"||e.typeFilter&&e.typeFilter()!=="all"?"text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-900/70":"text-gray-600 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600"}`;return A!==V.e&&Te(U,"aria-expanded",V.e=A),k!==V.t&&Te(U,"title",V.t=k),w!==V.a&&y(_,V.a=w),de!==V.o&&y(B,V.o=de),fe!==V.i&&y($,V.i=fe),x!==V.n&&y(D,V.n=x),R!==V.s&&y(K,V.s=R),Q!==V.h&&y(C,V.h=Q),G!==V.r&&Te(P,"title",V.r=G),T!==V.d&&Te(E,"class",V.d=T),te!==V.l&&y(v,V.l=te),V},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),q(()=>se.value=e.search()),q(()=>F.value=e.sortKey()),I}})};Xt(["input","keydown","click","mousedown"]);var fg=i(`<div class=overflow-x-auto style=scrollbar-width:none;-ms-overflow-style:none;><style>
|
||
.overflow-x-auto::-webkit-scrollbar { display: none; }
|
||
</style><table class=w-full><thead><tr class="border-b border-gray-200 dark:border-gray-700"><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">PBS Instance</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Status</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">CPU</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Memory</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Storage</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Datastores</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Backups</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Uptime</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">`),mg=i('<button type=button class="p-0.5 px-1.5 text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded hover:bg-blue-200 dark:hover:bg-blue-800/50 transition-colors">Clear filter'),xg=i('<div class="mb-3 flex items-start justify-between gap-3"><div class="flex flex-col items-start gap-2 sm:items-end"><div class="flex flex-wrap items-center justify-end gap-2"><div class="flex items-center gap-1"><button type=button>7d</button><button type=button>30d</button><button type=button>90d</button><button type=button>1y</button></div><div class="h-4 w-px bg-gray-300 dark:bg-gray-600"></div><span class="text-gray-500 dark:text-gray-400">Last <!> days'),bg=i('<svg class="available-backups-svg w-full h-full"style=cursor:pointer>'),pg=i('<div class="h-32 relative bg-gray-100 dark:bg-gray-800 rounded overflow-hidden">'),yg=i('<div class="flex items-center gap-1"><span class="text-gray-500 dark:text-gray-400">Deduplication:</span><span class="font-medium text-green-600 dark:text-green-400">'),vg=i("<div>"),kg=i('<div class="flex justify-between items-center text-xs mt-2"><div class="flex items-center gap-3"><span class="flex items-center gap-1"><span class="inline-block w-3 h-3 rounded bg-yellow-500"></span><span class="text-gray-600 dark:text-gray-400">Snapshots</span></span><span class="flex items-center gap-1"><span class="inline-block w-3 h-3 rounded bg-orange-500"></span><span class="text-gray-600 dark:text-gray-400">PVE</span></span><span class="flex items-center gap-1"><span class="inline-block w-3 h-3 rounded bg-violet-500"></span><span class="text-gray-600 dark:text-gray-400">PBS'),wg=i('<div class="block lg:hidden space-y-3">'),$g=i('<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:80px;>Owner '),_g=i('<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:80px;>Size '),Cg=i('<th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:150px;>Location '),Sg=i('<th class="px-2 py-1.5 text-center text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:60px;>Verified '),Tg=i('<table class="backup-table hidden lg:table"><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:60px;> </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:60px;>Type </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:150px;>Name </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:100px;>Node </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:140px;>Time </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600"style=width:80px;>Backup </th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider"style=width:200px;>Details</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),Ag=i(`<div class=overflow-x-auto style=scrollbar-width:none;-ms-overflow-style:none;><style>
|
||
.overflow-x-auto::-webkit-scrollbar { display: none; }
|
||
.backup-table {
|
||
table-layout: fixed;
|
||
width: 100%;
|
||
min-width: 1200px;
|
||
}
|
||
.backup-table th,
|
||
.backup-table td {
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
`),Dg=i("<div class=space-y-4>"),Mg=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">'),Pg=i('<button type=button class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">Go to Settings'),Eg=i('<span class="text-[9px] text-gray-500 dark:text-gray-400">v'),Ng=i('<tr><td class="p-0.5 px-1.5 whitespace-nowrap"><div class="flex items-center gap-1"><a target=_blank class="font-medium text-xs text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400"></a></div></td><td class="p-0.5 px-1.5 whitespace-nowrap"><div class="flex items-center gap-1"><span></span><span class="text-xs text-gray-600 dark:text-gray-400"></span></div></td><td class="p-0.5 px-1.5 min-w-[180px]"></td><td class="p-0.5 px-1.5 min-w-[180px]"></td><td class="p-0.5 px-1.5 min-w-[180px]"></td><td class="p-0.5 px-1.5 whitespace-nowrap text-center"><span class="text-xs text-gray-700 dark:text-gray-300"></span></td><td class="p-0.5 px-1.5 whitespace-nowrap text-center"><span class="text-xs text-gray-700 dark:text-gray-300"></span></td><td class="p-0.5 px-1.5 whitespace-nowrap"><span class="text-xs text-gray-600 dark:text-gray-400">'),Og=i('<div class="flex items-center gap-1.5"><span>Available backups</span><button type=button class="text-gray-400 hover:text-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 dark:text-gray-500 dark:hover:text-gray-300"aria-label="Daily counts of backups still available for restore across snapshots, PVE storage, and PBS."><svg class="h-4 w-4"fill=none stroke=currentColor stroke-width=1.6 viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round d="M11.25 11.25h1.5v3.75m-.75-9.75h.008v.008H12.75V5.25H11.25Zm0 0a7.5 7.5 0 1 1-7.5 7.5 7.5 7.5 0 0 1 7.5-7.5Z">'),Lg=i('<div class="inline-flex items-center gap-2 rounded-full border border-blue-200 dark:border-blue-700 bg-blue-50 dark:bg-blue-900/30 px-3 py-1 text-xs text-blue-700 dark:text-blue-200"><span class="font-medium uppercase tracking-wide text-[10px] text-blue-600 dark:text-blue-300">Filtered Date</span><span class="font-mono text-[11px]">'),Rg=i('<div class="flex h-full items-center justify-center">'),Ig=i('<svg class="h-10 w-10 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M4 19h16M7 10h2v9H7zm4-5h2v14h-2zm4 8h2v6h-2z">'),Hg=i('<svg class="h-12 w-12 animate-spin text-gray-400"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),Ug=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z">'),Bg=i('<div class=space-y-1><div class="text-xs font-medium text-gray-600 dark:text-gray-400 px-2 py-1 sticky top-0 bg-gray-50 dark:bg-gray-900 z-10"> (<!>)'),jg=i('<div class="flex items-center justify-between gap-2 mb-1"><div class="flex items-center gap-2 min-w-0 flex-1"><span></span><span class="text-xs text-gray-500 shrink-0"></span><span class="font-medium text-xs truncate"></span></div><div class="flex items-center gap-2 shrink-0"><span>'),Fg=i("<span>"),Vg=i('<svg class="w-4 h-4 text-green-600 dark:text-green-400 inline"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M5 13l4 4L19 7">'),Gg=i('<span class="text-gray-500 dark:text-gray-400 text-[10px] truncate max-w-[100px]">'),zg=i('<div class="flex items-center justify-between gap-2 text-[11px]"><div class="flex items-center gap-3 text-gray-600 dark:text-gray-400"><span></span><span>'),Wg=i('<tr class="bg-gray-50 dark:bg-gray-900/40"><td class="py-1 pr-2 pl-3 text-[12px] sm:text-sm font-semibold text-slate-700 dark:text-slate-100"><div class="flex items-center justify-between gap-3"><span class=truncate></span><span class="text-[10px] font-medium text-slate-500 dark:text-slate-400">'),qg=i('<td class="p-0.5 px-1.5 text-xs align-middle text-gray-500 dark:text-gray-400">'),Kg=i("<td>"),Jg=i('<span title="Encrypted backup"class="text-green-600 dark:text-green-400 inline-block ml-1"><svg xmlns=http://www.w3.org/2000/svg class="h-4 w-4"viewBox="0 0 20 20"fill=currentColor><path fill-rule=evenodd d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"clip-rule=evenodd>'),Qg=i('<span title="Protected backup"class="text-blue-600 dark:text-blue-400 inline-block ml-1"><svg xmlns=http://www.w3.org/2000/svg class="h-4 w-4"viewBox="0 0 20 20"fill=currentColor><path fill-rule=evenodd d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"clip-rule=evenodd>'),Yg=i('<td class="p-0.5 px-1.5 text-sm align-middle">'),Xg=i('<td class="p-0.5 px-1.5 text-center align-middle">'),Zg=i('<tr class="border-t border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/30"><td class="p-0.5 pl-5 pr-1.5 text-sm align-middle"></td><td class="p-0.5 px-1.5 align-middle"><span></span></td><td class="p-0.5 px-1.5 text-sm align-middle"></td><td class="p-0.5 px-1.5 text-sm align-middle"></td><td></td><td class="p-0.5 px-1.5 align-middle"><div class="flex items-center gap-1"><span></span></div></td><td class="p-0.5 px-1.5 cursor-help align-middle">'),eh=i('<span title="PBS backup verified"><svg class="w-4 h-4 text-green-500 dark:text-green-400 inline"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M5 13l4 4L19 7">'),th=i('<span title="PBS backup not yet verified"><svg class="w-4 h-4 text-gray-400 dark:text-gray-500 inline"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),rh=i('<span class="text-gray-400 dark:text-gray-500"title="Verification only available for PBS backups">-');const nh=()=>{const{state:e}=qr(),[r,s]=Z(""),[l,o]=Z(null),[a,d]=Z("all"),[c,g]=Z("all"),[b,p]=Z("date"),m=pe(()=>{const k=c();return k==="all"?"all":k==="snapshot"?"snapshot":k==="local"?"pve":k==="remote"?"pbs":"all"}),S=k=>{k==="all"?g("all"):k==="snapshot"?g("snapshot"):k==="pve"?g("local"):k==="pbs"&&g("remote")},[z,ie]=Z("backupTime"),[ne,W]=Z("desc"),[X,I]=Z(null),[L,H]=Z(30),[se,le]=Z(!1),ee="Daily counts of backups still available for restore across snapshots, PVE storage, and PBS.",U=[{value:"backupTime",label:"Time"},{value:"name",label:"Guest Name"},{value:"node",label:"Node"},{value:"vmid",label:"VMID"},{value:"backupType",label:"Backup Type"},{value:"size",label:"Size"},{value:"storage",label:"Storage"},{value:"verified",label:"Verified"},{value:"type",label:"Guest Type"},{value:"owner",label:"Owner"}];vr(()=>{const k=localStorage.getItem("backupsSortKey");k&&U.some(de=>de.value===k)&&ie(k);const w=localStorage.getItem("backupsSortDirection");(w==="asc"||w==="desc")&&W(w)}),ft(()=>{localStorage.setItem("backupsSortKey",z())}),ft(()=>{localStorage.setItem("backupsSortDirection",ne())});const Y=pe(()=>{const w=r().match(/node:(\S+)/);return w&&e.pbs?.some(de=>de.name===w[1])?w[1]:null});ft(()=>{Y()?g("remote"):se()||g("all")});const[oe]=Ru(Fs.BACKUPS_USE_RELATIVE_TIME,!1),_=k=>{if(k>=11&&k<=13)return"th";switch(k%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},B=(k,w)=>{if(!k||k.length<=w)return k;const de=Math.ceil(w/2)-2,fe=Math.floor(w/2)-2;return k.substring(0,de)+"..."+k.substring(k.length-fe)},$=k=>oe()?An(k):ao(k),D=pe(()=>!e.pveBackups?.guestSnapshots&&!e.pveBackups?.storageBackups&&!e.pbsBackups?.length&&!e.pbs?.length),f=pe(()=>{const k=[],w=new Set,de=typeof window<"u"&&localStorage.getItem("debug-pmg")==="true";return e.pveBackups?.guestSnapshots?.forEach(x=>{let R="";const Q=e.vms?.find(T=>T.vmid===x.vmid&&T.instance===x.instance),G=e.containers?.find(T=>T.vmid===x.vmid&&T.instance===x.instance);Q?R=Q.name||"":G&&(R=G.name||""),k.push({backupType:"snapshot",vmid:x.vmid,name:R||`VM ${x.vmid}`,type:x.type==="qemu"?"VM":"LXC",node:x.node,instance:x.instance,backupTime:x.time?new Date(x.time).getTime()/1e3:0,backupName:x.name,description:x.description||"",status:"ok",size:null,storage:null,datastore:null,namespace:null,verified:null,protected:!1})}),(Y()?e.pbsBackups?.filter(x=>x.instance===Y()):e.pbsBackups)?.forEach(x=>{const R=new Date(x.backupTime),Q=R.toISOString().split("T")[0],G=R.toISOString().split("T")[1].split(".")[0].replace(/:/g,""),T=`${x.backupType}/${x.vmid}/${Q}_${G}`,te=Math.floor(R.getTime()/1e3),ae=`${x.vmid}-${te}`;w.add(ae),de&&console.log(`PBS backup: vmid=${x.vmid}, time=${te}, key=${ae}, verified=${x.verified}`);const M=x.files&&Array.isArray(x.files)&&x.files.some(O=>{if(typeof O=="string")return!1;const xe=O;return xe.crypt||xe.encrypted||typeof xe.filename=="string"&&xe.filename.includes(".enc")});let ce;const re=(typeof x.vmid=="string"?parseInt(x.vmid,10):x.vmid)===0;de&&re&&console.log("[PMG Debug] PBS backup with VMID=0:",{vmid:x.vmid,vmidType:typeof x.vmid,backupType:x.backupType,instance:x.instance,comment:x.comment,willBeMarkedAs:re?"Host":x.backupType==="ct"?"LXC":"Unknown"}),re||x.backupType==="host"?ce="Host":x.backupType==="vm"||x.backupType==="VM"?ce="VM":(x.backupType==="ct"||x.backupType,ce="LXC"),k.push({backupType:"remote",vmid:ce==="Host"?x.vmid:parseInt(x.vmid)||0,name:x.comment||"",type:ce,node:x.instance||"PBS",instance:x.instance||"PBS",backupTime:te,backupName:T,description:x.comment||"",status:x.verified?"verified":"unverified",size:x.size||null,storage:null,datastore:x.datastore||null,namespace:x.namespace||"root",verified:x.verified||!1,protected:x.protected||!1,encrypted:M,owner:x.owner})}),e.pveBackups?.storageBackups?.forEach(x=>{if(x.type==="vztmpl"||x.type==="iso")return;const R=x.isPBS?"remote":"local",Q=`${x.vmid}-${x.ctime}`;if(w.has(Q)){de&&console.log(`PVE storage backup duplicate skipped: vmid=${x.vmid}, ctime=${x.ctime}, key=${Q}, storage=${x.storage}`);return}w.add(Q);let G;const te=(typeof x.vmid=="string"?parseInt(x.vmid,10):x.vmid)===0;de&&te&&console.log("[PMG Debug] Storage backup with VMID=0:",{vmid:x.vmid,vmidType:typeof x.vmid,type:x.type,volid:x.volid,notes:x.notes,willBeMarkedAs:te?"Host":x.type==="lxc"?"LXC":"Unknown"}),te||x.type==="host"?G="Host":x.type==="qemu"||x.type==="vm"?G="VM":(x.type==="lxc"||x.type,G="LXC"),k.push({backupType:R,vmid:G==="Host"?x.vmid:x.vmid||0,name:x.notes||x.volid?.split("/").pop()||"",type:G,node:x.node||"",instance:x.instance||"",backupTime:x.ctime||0,backupName:x.volid?.split("/").pop()||"",description:x.notes||"",status:x.verified?"verified":"unverified",size:x.size||null,storage:x.storage||null,datastore:null,namespace:null,verified:x.verified||!1,protected:x.protected||!1,encrypted:!!x.encryption})}),k}),j=pe(()=>f().some(w=>w.type==="Host")),K=pe(()=>f().length>0),C=pe(()=>{let k=f();const w=r().toLowerCase(),de=a(),fe=c(),x=X(),R=l();if(x&&(k=k.filter(T=>T.backupTime>=x.start&&T.backupTime<=x.end)),R){const T=e.nodes?.find(te=>te.id===R);T&&(k=k.filter(te=>te.instance===T.instance&&te.node===T.name))}if(w)if(w.startsWith("pbs:")){const T=w.split(":");if(T.length>=4){const[,te,ae,...M]=T,ce=M.join(":");k=k.filter(ue=>ue.backupType!=="remote"||ue.node!==te||ue.datastore!==ae?!1:(ue.namespace||"/")===(ce||"/"))}}else{const T=w.split(",").map(M=>M.trim()).filter(M=>M),te=[],ae=[];if(T.forEach(M=>{M.includes(">")||M.includes("<")||M.includes(":")?te.push(M):ae.push(M.toLowerCase())}),te.length>0){const M=te.join(" AND "),ce=dl(M);ce.filters.length>0&&(k=k.filter(ue=>cl(ue,ce)))}ae.length>0&&(k=k.filter(M=>ae.some(ce=>[M.vmid?.toString(),M.name,M.node,M.backupName,M.description,M.storage,M.datastore,M.namespace].filter(Boolean).map(re=>re.toString().toLowerCase()).some(re=>re.includes(ce)))))}de!=="all"&&(k=k.filter(T=>T.type===de)),fe!=="all"&&(k=k.filter(T=>T.backupType===fe));const Q=z(),G=ne();return k=[...k].sort((T,te)=>{let ae=T[Q],M=te[Q];const ce=ae==null||ae==="",ue=M==null||M==="";if(ce&&ue)return 0;if(ce)return 1;if(ue)return-1;if((Q==="size"||Q==="vmid"||Q==="backupTime")&&(ae=typeof ae=="number"?ae:Number(ae)||0,M=typeof M=="number"?M:Number(M)||0),typeof ae=="number"&&typeof M=="number"){if(ae===M)return 0;const re=ae<M?-1:1;return G==="asc"?re:-re}else{const re=String(ae).toLowerCase(),O=String(M).toLowerCase();if(re===O)return 0;const xe=re<O?-1:1;return G==="asc"?xe:-xe}}),k}),ge=pe(()=>{const k=b(),w=C();if(k==="guest"){const T=[],te=new Map;return w.forEach(ae=>{const M=`${ae.type} ${ae.vmid}${ae.name?` - ${ae.name}`:""}`;te.has(M)||te.set(M,[]),te.get(M).push(ae)}),te.forEach((ae,M)=>{T.push({label:M,items:ae})}),T.sort((ae,M)=>{const ce=parseInt(ae.label.match(/\d+/)?.[0]||"0"),ue=parseInt(M.label.match(/\d+/)?.[0]||"0");return ce-ue}),T}if(z()!=="backupTime")return[{label:"All Backups",items:w}];const de=[],fe=new Map,x=new Date,R=new Date(x.getFullYear(),x.getMonth(),x.getDate()),Q=new Date(R);Q.setDate(Q.getDate()-1);const G=["January","February","March","April","May","June","July","August","September","October","November","December"];return w.forEach(T=>{const te=new Date(T.backupTime*1e3),ae=new Date(te.getFullYear(),te.getMonth(),te.getDate());let M;const ce=G[te.getMonth()],ue=te.getDate(),re=_(ue),O=`${ce} ${ue}${re}`;ae.getTime()===R.getTime()?M=`Today (${O})`:ae.getTime()===Q.getTime()?M=`Yesterday (${O})`:M=O,fe.has(M)||fe.set(M,[]),fe.get(M).push(T)}),fe.forEach((T,te)=>{de.push({label:te,items:T})}),ne()==="desc"?de.sort((T,te)=>{if(T.label.includes("Today"))return-1;if(te.label.includes("Today"))return 1;if(T.label.includes("Yesterday"))return te.label.includes("Today")?1:-1;if(te.label.includes("Yesterday"))return T.label.includes("Today")?-1:1;const ae=T.items[0]?.backupTime||0;return(te.items[0]?.backupTime||0)-ae}):de.sort((T,te)=>{if(T.label.includes("Today"))return 1;if(te.label.includes("Today"))return-1;if(T.label.includes("Yesterday"))return T.label.includes("Today")?-1:1;if(te.label.includes("Yesterday"))return te.label.includes("Today")?1:-1;const ae=T.items[0]?.backupTime||0,M=te.items[0]?.backupTime||0;return ae-M}),de}),J=k=>{if(z()===k){const w=ne()==="asc"?"desc":"asc";W(w)}else ie(k),W(k==="backupTime"||k==="size"?"desc":"asc")},N=()=>{s(""),o(null),le(!1),d("all"),g("all"),p("date"),ie("backupTime"),W("desc"),I(null),H(30)};let F;ft(()=>{const k=w=>{const de=w.target,fe=de.tagName==="INPUT"||de.tagName==="TEXTAREA"||de.tagName==="SELECT"||de.contentEditable==="true";w.key==="Escape"?(r().trim()||l()||a()!=="all"||c()!=="all"||X()!==null||z()!=="backupTime"||ne()!=="desc")&&(N(),F&&document.activeElement===F&&F.blur()):!fe&&w.key.length===1&&!w.ctrlKey&&!w.metaKey&&!w.altKey&&F&&F.focus()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)});const P=k=>{if(!k)return"text-gray-500 dark:text-gray-400";const fe=(Date.now()/1e3-k)/86400;return fe<3?"text-green-600 dark:text-green-400":fe<7?"text-yellow-600 dark:text-yellow-400":fe<30?"text-orange-500 dark:text-orange-400":"text-red-600 dark:text-red-400"},E=k=>{if(!k)return"";const w=k/(1024*1024*1024);return w<5?"text-green-600 dark:text-green-400":w<20?"text-yellow-600 dark:text-yellow-400":w<50?"text-orange-600 dark:text-orange-400":"text-red-600 dark:text-red-400"},u=pe(()=>{if(!e.pbs||e.pbs.length===0)return null;const k=[];return e.pbs.forEach(de=>{de.datastores&&de.datastores.forEach(fe=>{fe.deduplicationFactor&&fe.deduplicationFactor>0&&k.push(fe.deduplicationFactor)})}),k.length===0?null:(k.reduce((de,fe)=>de+fe,0)/k.length).toFixed(1)+"x"}),v=k=>{const[w,de,fe]=k.split("-"),x=Number(w),R=Number(de),Q=Number(fe);return!Number.isFinite(x)||!Number.isFinite(R)||!Number.isFinite(Q)?new Date(k):new Date(x,Math.max(0,R-1),Math.max(1,Q))},V=pe(()=>{const k=L(),w=new Date,de={};for(let ue=k-1;ue>=0;ue--){const re=new Date(w);re.setDate(re.getDate()-ue);const O=re.getFullYear(),xe=String(re.getMonth()+1).padStart(2,"0"),he=String(re.getDate()).padStart(2,"0"),me=`${O}-${xe}-${he}`;de[me]={snapshots:0,pve:0,pbs:0,total:0}}const fe=new Date(w);fe.setDate(fe.getDate()-(k-1)),fe.setHours(0,0,0,0);const x=fe.getTime(),R=new Date(w);R.setHours(23,59,59,999);const Q=R.getTime();let G=f();const T=r().toLowerCase(),te=a(),ae=c();if(T)if(T.startsWith("pbs:")){const ue=T.split(":");if(ue.length>=4){const[,re,O,...xe]=ue,he=xe.join(":");G=G.filter(me=>me.backupType!=="remote"||me.node!==re||me.datastore!==O?!1:(me.namespace||"/")===(he||"/"))}}else{const ue=T.split(",").map(xe=>xe.trim()).filter(xe=>xe),re=[],O=[];if(ue.forEach(xe=>{xe.includes(">")||xe.includes("<")||xe.includes(":")?re.push(xe):O.push(xe.toLowerCase())}),re.length>0){const xe=re.join(" AND "),he=dl(xe);he.filters.length>0&&(G=G.filter(me=>cl(me,he)))}O.length>0&&(G=G.filter(xe=>O.some(he=>[xe.vmid?.toString(),xe.name,xe.node,xe.backupName,xe.description,xe.storage,xe.datastore,xe.namespace].filter(Boolean).map(_e=>_e.toString().toLowerCase()).some(_e=>_e.includes(he)))))}te!=="all"&&(G=G.filter(ue=>ue.type===te)),ae!=="all"&&(G=G.filter(ue=>ue.backupType===ae)),G.forEach(ue=>{const re=ue.backupTime*1e3;if(re>=x&&re<=Q){const O=new Date(re),xe=O.getFullYear(),he=String(O.getMonth()+1).padStart(2,"0"),me=String(O.getDate()).padStart(2,"0"),_e=`${xe}-${he}-${me}`;de[_e]&&(de[_e].total++,ue.backupType==="snapshot"?de[_e].snapshots++:ue.backupType==="local"?de[_e].pve++:ue.backupType==="remote"&&de[_e].pbs++)}});const M=Object.entries(de).map(([ue,re])=>({date:ue,...re})),ce=Math.max(...M.map(ue=>ue.total),1);return{data:M,maxValue:ce}}),A=pe(()=>e.pbs?[...e.pbs].sort((k,w)=>{const de=k.status==="healthy"||k.status==="online",fe=w.status==="healthy"||w.status==="online";return de!==fe?de?-1:1:k.name.localeCompare(w.name)}):[]);return(()=>{var k=Dg();return t(k,n(h,{get when(){return!D()&&(e.nodes||[]).length===0&&(!e.pbs||e.pbs.length===0)},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return Mg()},title:"No backup sources configured",description:"Add a Proxmox VE or PBS node in the Settings tab to start monitoring backups.",get actions(){return(()=>{var w=Pg();return w.$$click=()=>{document.querySelector('[role="tab"]:last-child')?.click()},w})()}})}})}}),null),t(k,n(kl,{currentTab:"backups",onNodeSelect:w=>{o(w)},onNamespaceSelect:w=>{s(w),le(w!=="")},get searchTerm(){return r()}}),null),t(k,n(h,{get when(){return!1},get children(){return n(it,{padding:"none",class:"overflow-hidden",get children(){var w=fg(),de=w.firstChild,fe=de.nextSibling,x=fe.firstChild,R=x.nextSibling;return t(R,n(ze,{get each(){return A()},children:Q=>{const G=()=>Q.status==="healthy"||Q.status==="online",T=()=>Math.round(Q.cpu||0),te=()=>Q.memoryTotal?Math.round(Q.memoryUsed/Q.memoryTotal*100):0,M=(()=>{if(!Q.datastores)return{used:0,total:0,percent:0};const re=Q.datastores.reduce((O,xe)=>(O.used+=xe.used||0,O.total+=xe.total||0,O),{used:0,total:0});return{...re,percent:re.total>0?Math.round(re.used/re.total*100):0}})(),ce=()=>e.pbsBackups?.filter(re=>re.instance===Q.name).length||0,ue=()=>Y()===Q.name;return(()=>{var re=Ng(),O=re.firstChild,xe=O.firstChild,he=xe.firstChild,me=O.nextSibling,_e=me.firstChild,Ce=_e.firstChild,Oe=Ce.nextSibling,tt=me.nextSibling,Ze=tt.nextSibling,bt=Ze.nextSibling,ct=bt.nextSibling,qe=ct.firstChild,Ke=ct.nextSibling,Xe=Ke.firstChild,_t=Ke.nextSibling,Lt=_t.firstChild;return re.$$click=()=>{const vt=r(),Ve=`node:${Q.name}`;if(vt.includes(Ve))s(vt.replace(Ve,"").trim().replace(/,\s*,/g,",").replace(/^,|,$/g,"")),le(!1);else{const lt=vt.replace(/node:\S+/g,"").trim().replace(/,\s*,/g,",").replace(/^,|,$/g,""),Re=lt?`${lt}, ${Ve}`:Ve;s(Re),le(!0)}},he.$$click=vt=>vt.stopPropagation(),t(he,()=>Q.name),t(xe,n(h,{get when(){return Q.version},get children(){var vt=Eg();return vt.firstChild,t(vt,()=>Q.version,null),vt}}),null),t(Oe,()=>G()?"Online":"Offline"),t(tt,n(un,{get value(){return T()},get label(){return`${T()}%`},type:"cpu"})),t(Ze,n(un,{get value(){return te()},get label(){return`${te()}%`},get sublabel(){return $e(()=>!!Q.memoryTotal)()?`${Zt(Q.memoryUsed)}/${Zt(Q.memoryTotal)}`:void 0},type:"memory"})),t(bt,n(un,{get value(){return M.percent},get label(){return`${M.percent}%`},get sublabel(){return`${Zt(M.used)}/${Zt(M.total)}`},type:"disk"})),t(qe,()=>Q.datastores?.length||0),t(Xe,ce),t(Lt,n(h,{get when(){return G()&&Q.uptime},fallback:"-",get children(){return js(Q.uptime)}})),q(vt=>{var Ve=`hover:bg-gray-50 dark:hover:bg-gray-700/30 cursor-pointer transition-colors ${ue()?"bg-blue-50 dark:bg-blue-900/20":""}`,lt=Q.host||`https://${Q.name}:8007`,Re=`h-2 w-2 rounded-full ${G()?"bg-green-500":"bg-red-500"}`;return Ve!==vt.e&&y(re,vt.e=Ve),lt!==vt.t&&Te(he,"href",vt.t=lt),Re!==vt.a&&y(Ce,vt.a=Re),vt},{e:void 0,t:void 0,a:void 0}),re})()}})),w}})}}),null),t(k,n(h,{get when(){return(e.nodes||[]).length>0||e.pbs&&e.pbs.length>0},get children(){return[n(h,{get when(){return K()||X()!==null},get children(){return n(it,{padding:"md",get children(){return[(()=>{var w=xg(),de=w.firstChild,fe=de.firstChild,x=fe.firstChild,R=x.firstChild,Q=R.nextSibling,G=Q.nextSibling,T=G.nextSibling,te=x.nextSibling,ae=te.nextSibling,M=ae.firstChild,ce=M.nextSibling;return ce.nextSibling,t(w,n(rr,{get title(){return(()=>{var ue=Og(),re=ue.firstChild,O=re.nextSibling;return O.addEventListener("blur",()=>Cn()),O.addEventListener("mouseleave",()=>Cn()),O.addEventListener("focus",xe=>{const he=xe.currentTarget.getBoundingClientRect();Xn(ee,he.left+he.width/2,he.top,{align:"center",direction:"up"})}),O.addEventListener("mouseenter",xe=>{const he=xe.currentTarget.getBoundingClientRect();Xn(ee,he.left+he.width/2,he.top,{align:"center",direction:"up"})}),ue})()},size:"sm",class:"flex-1"}),de),t(de,n(h,{get when(){return X()},children:ue=>(()=>{var re=Lg(),O=re.firstChild,xe=O.nextSibling;return t(xe,()=>new Date(ue().start*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})),re})()}),fe),R.$$click=()=>H(7),Q.$$click=()=>H(30),G.$$click=()=>H(90),T.$$click=()=>H(365),t(ae,L,ce),t(fe,n(h,{get when(){return X()},get children(){var ue=mg();return ue.$$click=()=>{I(null),Cn()},ue}}),null),q(ue=>{var re=`p-0.5 px-1.5 text-xs border rounded transition-colors ${L()===7?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-700":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}`,O=`p-0.5 px-1.5 text-xs border rounded transition-colors ${L()===30?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-700":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}`,xe=`p-0.5 px-1.5 text-xs border rounded transition-colors ${L()===90?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-700":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}`,he=`p-0.5 px-1.5 text-xs border rounded transition-colors ${L()===365?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-700":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}`;return re!==ue.e&&y(R,ue.e=re),O!==ue.t&&y(Q,ue.t=O),xe!==ue.a&&y(G,ue.a=xe),he!==ue.o&&y(T,ue.o=he),ue},{e:void 0,t:void 0,a:void 0,o:void 0}),w})(),(()=>{var w=pg();return t(w,n(h,{get when(){return V().data.length>0},get fallback(){return(()=>{var de=Rg();return t(de,n(Ur,{class:"max-w-xs",align:"center",get icon(){return Ig()},title:"No backup data",description:"Adjust filters or expand the time range to see activity."})),de})()},get children(){var de=bg();return fr(fe=>{ft(()=>{!fe||V().data.length===0||requestAnimationFrame(()=>{const R=fe.getBoundingClientRect();if(R.width===0||R.height===0)return;const Q={top:10,right:10,bottom:30,left:30},G=R.width-Q.left-Q.right,T=128-Q.top-Q.bottom;for(fe.setAttribute("viewBox",`0 0 ${R.width} 128`);fe.firstChild;)fe.removeChild(fe.firstChild);const te=document.createElementNS("http://www.w3.org/2000/svg","g");te.setAttribute("transform",`translate(${Q.left},${Q.top})`),fe.appendChild(te);const ae=V().data,M=V().maxValue,ce=G/Math.max(ae.length,1),ue=Math.max(1,Math.min(ce-2,50)),re=T/M,O=document.createElementNS("http://www.w3.org/2000/svg","g");O.setAttribute("class","grid-lines"),te.appendChild(O);const xe=5;for(let me=0;me<=xe;me++){const _e=T-me*T/xe,Ce=document.createElementNS("http://www.w3.org/2000/svg","line");Ce.setAttribute("x1","0"),Ce.setAttribute("y1",_e.toString()),Ce.setAttribute("x2",G.toString()),Ce.setAttribute("y2",_e.toString()),Ce.setAttribute("stroke","currentColor"),Ce.setAttribute("stroke-opacity","0.1"),Ce.setAttribute("class","text-gray-300 dark:text-gray-600"),O.appendChild(Ce)}if(M<=5)for(let me=0;me<=M;me++){const _e=T-me*T/M,Ce=document.createElementNS("http://www.w3.org/2000/svg","text");Ce.setAttribute("x","-5"),Ce.setAttribute("y",(_e+3).toString()),Ce.setAttribute("text-anchor","end"),Ce.setAttribute("class","text-[10px] fill-gray-500 dark:fill-gray-400"),Ce.textContent=me.toString(),te.appendChild(Ce)}else for(let me=0;me<=xe;me++){const _e=Math.round(me*M/xe),Ce=T-me*T/xe;if(me===0||_e!==Math.round((me-1)*M/xe)){const Oe=document.createElementNS("http://www.w3.org/2000/svg","text");Oe.setAttribute("x","-5"),Oe.setAttribute("y",(Ce+3).toString()),Oe.setAttribute("text-anchor","end"),Oe.setAttribute("class","text-[10px] fill-gray-500 dark:fill-gray-400"),Oe.textContent=_e.toString(),te.appendChild(Oe)}}const he=document.createElementNS("http://www.w3.org/2000/svg","g");he.setAttribute("class","bars"),te.appendChild(he),ae.forEach((me,_e)=>{const Ce=me.total*re,Oe=Math.max(0,_e*ce+(ce-ue)/2),tt=T-Ce,Ze=v(me.date),bt=Ze.getTime(),ct=document.createElementNS("http://www.w3.org/2000/svg","g");ct.setAttribute("class","bar-group"),ct.setAttribute("data-date",me.date),ct.style.cursor="pointer";const qe=document.createElementNS("http://www.w3.org/2000/svg","rect");qe.setAttribute("x",Oe.toString()),qe.setAttribute("y",(T-2).toString()),qe.setAttribute("width",ue.toString()),qe.setAttribute("height","2"),qe.setAttribute("rx","1"),qe.setAttribute("fill","#d1d5db"),qe.setAttribute("fill-opacity","0.3"),ct.appendChild(qe);const Ke=document.createElementNS("http://www.w3.org/2000/svg","rect");Ke.setAttribute("x",(_e*ce).toString()),Ke.setAttribute("y","0"),Ke.setAttribute("width",Math.max(1,ce).toString()),Ke.setAttribute("height",T.toString()),Ke.setAttribute("fill","transparent"),Ke.style.cursor="pointer",ct.appendChild(Ke);const Xe=document.createElementNS("http://www.w3.org/2000/svg","rect");Xe.setAttribute("x",Oe.toString()),Xe.setAttribute("y",tt.toString()),Xe.setAttribute("width",ue.toString()),Xe.setAttribute("height",Ce.toString()),Xe.setAttribute("rx","2"),Xe.setAttribute("class","backup-bar"),Xe.setAttribute("data-date",me.date);let _t="#e5e7eb";if(me.total>0&&me.total<=5?_t="#60a5fa":me.total<=10?_t="#34d399":me.total>10&&(_t="#a78bfa"),Xe.setAttribute("fill",_t),Xe.style.transition="all 0.2s ease",X()&&bt>=X().start*1e3&&bt<=X().end*1e3?(Xe.setAttribute("fill-opacity","1"),Xe.setAttribute("stroke","#2563eb"),Xe.setAttribute("stroke-width","2"),Xe.setAttribute("filter","brightness(1.1)")):(Xe.setAttribute("fill-opacity","0.8"),Xe.setAttribute("stroke","none")),ct.appendChild(Xe),me.total>0){if(me.pbs>0){const Ve=me.pbs/me.total*Ce,lt=document.createElementNS("http://www.w3.org/2000/svg","rect");lt.setAttribute("x",Oe.toString()),lt.setAttribute("y",(tt+Ce-Ve).toString()),lt.setAttribute("width",ue.toString()),lt.setAttribute("height",Ve.toString()),lt.setAttribute("rx","2"),lt.setAttribute("fill","#8b5cf6"),lt.setAttribute("fill-opacity","0.9"),ct.appendChild(lt)}if(me.pve>0){const Ve=me.pve/me.total*Ce,lt=tt+me.snapshots/me.total*Ce,Re=document.createElementNS("http://www.w3.org/2000/svg","rect");Re.setAttribute("x",Oe.toString()),Re.setAttribute("y",lt.toString()),Re.setAttribute("width",ue.toString()),Re.setAttribute("height",Ve.toString()),Re.setAttribute("fill","#f97316"),Re.setAttribute("fill-opacity","0.9"),ct.appendChild(Re)}if(me.snapshots>0){const Ve=me.snapshots/me.total*Ce,lt=document.createElementNS("http://www.w3.org/2000/svg","rect");lt.setAttribute("x",Oe.toString()),lt.setAttribute("y",tt.toString()),lt.setAttribute("width",ue.toString()),lt.setAttribute("height",Ve.toString()),lt.setAttribute("rx","2"),lt.setAttribute("fill","#eab308"),lt.setAttribute("fill-opacity","0.9"),ct.appendChild(lt)}}ct.addEventListener("mouseenter",Ve=>{const lt=Ve;Xe.setAttribute("fill-opacity","1"),Xe.setAttribute("filter","brightness(1.2)");let gt=`${Ze.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}`;if(me.total>0){gt+=`
|
||
Available: ${me.total} backup${me.total>1?"s":""}`;const It=[];me.snapshots>0&&It.push(`Snapshots: ${me.snapshots}`),me.pve>0&&It.push(`PVE: ${me.pve}`),me.pbs>0&&It.push(`PBS: ${me.pbs}`),It.length>0&&(gt+=`
|
||
${It.join(" • ")}`)}else gt+=`
|
||
No backups available`;const mt=lt.clientX,Rt=lt.clientY;Xn(gt,mt,Rt,{align:"center",direction:"up"})}),ct.addEventListener("mouseleave",()=>{Xe.setAttribute("fill-opacity","0.8"),Xe.removeAttribute("filter"),Cn()}),ct.addEventListener("click",()=>{const Ve=new Date(Ze);Ve.setHours(0,0,0,0);const lt=new Date(Ze);lt.setHours(23,59,59,999);const Re={start:Ve.getTime()/1e3,end:lt.getTime()/1e3},gt=X();gt&>.start===Re.start&>.end===Re.end?I(null):I(Re),Cn()}),he.appendChild(ct);let vt=!1;if(L()<=7?vt=!0:L()<=30?vt=_e%Math.ceil(ae.length/10)===0||_e===ae.length-1:L()<=90?vt=Ze.getDay()===0||_e===0||_e===ae.length-1:vt=Ze.getDate()===1||_e===0||_e===ae.length-1,vt){const Ve=document.createElementNS("http://www.w3.org/2000/svg","text");Ve.setAttribute("x",(Oe+ue/2).toString()),Ve.setAttribute("y",(T+20).toString()),Ve.setAttribute("text-anchor","middle"),Ve.setAttribute("class","text-[8px] fill-gray-500 dark:fill-gray-400");let lt;L()<=7?lt=`${Ze.getMonth()+1}/${Ze.getDate()}`:L()<=30?lt=Ze.getDate()===1?`${Ze.getMonth()+1}/1`:Ze.getDate().toString():lt=`${Ze.getMonth()+1}/${Ze.getDate()}`,Ve.textContent=lt,te.appendChild(Ve)}})})})},de),de}})),w})(),(()=>{var w=kg(),de=w.firstChild;return t(w,n(h,{get when(){return u()},get children(){var fe=yg(),x=fe.firstChild,R=x.nextSibling;return t(R,u),fe}}),de),t(w,n(h,{get when(){return!u()},get children(){return vg()}}),de),w})()]}})}}),n(hg,{search:r,setSearch:s,viewMode:m,setViewMode:S,groupBy:b,setGroupBy:p,searchInputRef:w=>F=w,typeFilter:a,setTypeFilter:d,hasHostBackups:j,sortOptions:U,sortKey:z,setSortKey:w=>ie(w),sortDirection:ne,setSortDirection:W,onReset:N}),n(it,{padding:"none",class:"mb-4 overflow-hidden",get children(){var w=Ag();return w.firstChild,t(w,n(h,{get when(){return!D()},get fallback(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return Hg()},title:"Loading backup data...",description:"This may take up to 20 seconds on the first load."})}})},get children(){return n(h,{get when(){return ge().length>0},get fallback(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return Ug()},title:"No backups match your filters",description:"Try adjusting filters or selecting a different time range."})}})},get children(){return[(()=>{var de=wg();return t(de,n(ze,{get each(){return ge()},children:fe=>(()=>{var x=Bg(),R=x.firstChild,Q=R.firstChild,G=Q.nextSibling;return G.nextSibling,t(R,()=>fe.label,Q),t(R,()=>fe.items.length,G),t(x,n(ze,{get each(){return fe.items},children:T=>n(it,{padding:"sm",class:"hover:shadow-sm transition-shadow",get children(){return[(()=>{var te=jg(),ae=te.firstChild,M=ae.firstChild,ce=M.nextSibling,ue=ce.nextSibling,re=ae.nextSibling,O=re.firstChild;return t(M,()=>T.type),t(ce,()=>T.vmid),t(ue,()=>T.name||"Unnamed"),t(O,()=>T.backupType==="snapshot"?"SNAP":T.backupType==="local"?"PVE":"PBS"),q(xe=>{var he=`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium shrink-0 ${T.type==="VM"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"}`,me=`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium ${T.backupType==="snapshot"?"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200":T.backupType==="local"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200"}`;return he!==xe.e&&y(M,xe.e=he),me!==xe.t&&y(O,xe.t=me),xe},{e:void 0,t:void 0}),te})(),(()=>{var te=zg(),ae=te.firstChild,M=ae.firstChild,ce=M.nextSibling;return t(M,()=>T.node),t(ce,()=>$(T.backupTime*1e3)),t(ae,n(h,{get when(){return T.size},get children(){var ue=Fg();return t(ue,()=>Zt(T.size)),q(()=>y(ue,E(T.size))),ue}}),null),t(ae,n(h,{get when(){return T.backupType==="remote"&&T.verified},get children(){return Vg()}}),null),t(te,n(h,{get when(){return(T.storage||T.datastore)&&T.backupType!=="snapshot"},get children(){var ue=Gg();return t(ue,()=>T.storage||T.datastore&&(T.namespace&&T.namespace!=="root"?`${T.datastore}/${T.namespace}`:T.datastore)||"-"),ue}}),null),q(()=>y(ce,P(T.backupTime))),te})()]}})}),null),x})()})),de})(),(()=>{var de=Tg(),fe=de.firstChild,x=fe.firstChild,R=x.firstChild,Q=R.firstChild,G=R.nextSibling;G.firstChild;var T=G.nextSibling;T.firstChild;var te=T.nextSibling;te.firstChild;var ae=te.nextSibling;ae.firstChild;var M=ae.nextSibling;M.firstChild;var ce=M.nextSibling,ue=fe.nextSibling;return R.$$click=()=>J("vmid"),t(R,()=>j()?"VMID/Host":"VMID",Q),t(R,(()=>{var re=$e(()=>z()==="vmid");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),G.$$click=()=>J("type"),t(G,(()=>{var re=$e(()=>z()==="type");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),T.$$click=()=>J("name"),t(T,(()=>{var re=$e(()=>z()==="name");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),te.$$click=()=>J("node"),t(te,(()=>{var re=$e(()=>z()==="node");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),t(x,n(h,{get when(){return c()==="all"||c()==="remote"},get children(){var re=$g();return re.firstChild,re.$$click=()=>J("owner"),t(re,(()=>{var O=$e(()=>z()==="owner");return()=>O()&&(ne()==="asc"?"▲":"▼")})(),null),re}}),ae),ae.$$click=()=>J("backupTime"),t(ae,(()=>{var re=$e(()=>z()==="backupTime");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),t(x,n(h,{get when(){return c()!=="snapshot"},get children(){var re=_g();return re.firstChild,re.$$click=()=>J("size"),t(re,(()=>{var O=$e(()=>z()==="size");return()=>O()&&(ne()==="asc"?"▲":"▼")})(),null),re}}),M),M.$$click=()=>J("backupType"),t(M,(()=>{var re=$e(()=>z()==="backupType");return()=>re()&&(ne()==="asc"?"▲":"▼")})(),null),t(x,n(h,{get when(){return c()!=="snapshot"},get children(){var re=Cg();return re.firstChild,re.$$click=()=>J("storage"),t(re,(()=>{var O=$e(()=>z()==="storage");return()=>O()&&(ne()==="asc"?"▲":"▼")})(),null),re}}),ce),t(x,n(h,{get when(){return c()==="all"||c()==="remote"},get children(){var re=Sg();return re.firstChild,re.$$click=()=>J("verified"),t(re,(()=>{var O=$e(()=>z()==="verified");return()=>O()&&(ne()==="asc"?"▲":"▼")})(),null),re}}),ce),t(ue,n(ze,{get each(){return ge()},children:re=>[(()=>{var O=Wg(),xe=O.firstChild,he=xe.firstChild,me=he.firstChild,_e=me.nextSibling;return t(me,()=>re.label),t(_e,()=>re.items.length),q(Ce=>{var Oe=(()=>{let Ze=7;return(c()==="all"||c()==="remote")&&Ze++,c()!=="snapshot"&&Ze++,(c()==="all"||c()==="remote")&&Ze++,c()!=="snapshot"&&Ze++,Ze})(),tt=re.label;return Oe!==Ce.e&&Te(xe,"colspan",Ce.e=Oe),tt!==Ce.t&&Te(me,"title",Ce.t=tt),Ce},{e:void 0,t:void 0}),O})(),n(ze,{get each(){return re.items},children:O=>(()=>{var xe=Zg(),he=xe.firstChild,me=he.nextSibling,_e=me.firstChild,Ce=me.nextSibling,Oe=Ce.nextSibling,tt=Oe.nextSibling,Ze=tt.nextSibling,bt=Ze.firstChild,ct=bt.firstChild,qe=Ze.nextSibling;return t(he,()=>O.vmid),t(_e,()=>O.type),t(Ce,()=>O.name||"-"),t(Oe,()=>O.node),t(xe,n(h,{get when(){return c()==="all"||c()==="remote"},get children(){var Ke=qg();return t(Ke,(()=>{var Xe=$e(()=>!!O.owner);return()=>Xe()?O.owner.split("@")[0]:"-"})()),Ke}}),tt),t(tt,()=>$(O.backupTime*1e3)),t(xe,n(h,{get when(){return c()!=="snapshot"},get children(){var Ke=Kg();return t(Ke,(()=>{var Xe=$e(()=>!!O.size);return()=>Xe()?Zt(O.size):"-"})()),q(()=>y(Ke,`p-0.5 px-1.5 align-middle ${E(O.size)}`)),Ke}}),Ze),t(ct,()=>O.backupType==="snapshot"?"Snapshot":O.backupType==="local"?"PVE":"PBS"),t(bt,n(h,{get when(){return O.encrypted},get children(){return Jg()}}),null),t(bt,n(h,{get when(){return O.protected},get children(){return Qg()}}),null),t(xe,n(h,{get when(){return c()!=="snapshot"},get children(){var Ke=Yg();return t(Ke,()=>O.storage||O.datastore&&(O.namespace&&O.namespace!=="root"?`${O.datastore}/${O.namespace}`:O.datastore)||"-"),Ke}}),qe),t(xe,n(h,{get when(){return c()==="all"||c()==="remote"},get children(){var Ke=Xg();return t(Ke,(()=>{var Xe=$e(()=>O.backupType==="remote");return()=>Xe()?$e(()=>!!O.verified)()?eh():th():rh()})()),Ke}}),qe),qe.addEventListener("mouseleave",()=>{Cn()}),qe.addEventListener("mouseenter",Ke=>{const Xe=[];if(O.backupType==="snapshot")Xe.push(O.backupName),O.description&&Xe.push(O.description);else if(O.backupType==="local")Xe.push(O.backupName);else if(O.backupType==="remote"){O.protected&&Xe.push("Protected");const Lt=O.description||(O.name&&O.name!=="-"?O.name:"");Lt&&Lt.trim()&&Xe.push(Lt)}const _t=Xe.join(" • ")||"-";if(_t.length>35){const Lt=Ke.currentTarget.getBoundingClientRect();Xn(_t,Lt.left,Lt.top,{align:"left",direction:"up",maxWidth:260})}}),t(qe,()=>{const Ke=[];if(O.backupType==="snapshot")Ke.push(O.backupName),O.description&&Ke.push(O.description);else if(O.backupType==="local")Ke.push(B(O.backupName,30));else if(O.backupType==="remote"){O.protected&&Ke.push("Protected");const Lt=O.description||(O.name&&O.name!=="-"?O.name:"");Lt&&Lt.trim()&&Ke.push(Lt)}const Xe=Ke.join(" • ")||"-";return Xe.length>35?Xe.substring(0,32)+"...":Xe}),q(Ke=>{var Xe=`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${O.type==="VM"?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":O.type==="Host"?"bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"}`,_t=`p-0.5 px-1.5 text-xs align-middle ${P(O.backupTime)}`,Lt=`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${O.backupType==="snapshot"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/20 dark:text-yellow-300":O.backupType==="local"?"bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300":"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300"}`;return Xe!==Ke.e&&y(_e,Ke.e=Xe),_t!==Ke.t&&y(tt,Ke.t=_t),Lt!==Ke.a&&y(ct,Ke.a=Lt),Ke},{e:void 0,t:void 0,a:void 0}),xe})()})]})),de})()]}})}}),null),w}})]}}),null),k})()};Xt(["click"]);var sh=i("<div class=space-y-3>"),ah=i('<div class="inline-flex items-center justify-center w-12 h-12"><svg class="animate-spin h-8 w-8 text-blue-600 dark:text-blue-400"xmlns=http://www.w3.org/2000/svg fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),lh=i('<svg class="h-12 w-12 text-red-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">');const ih=()=>{const{state:e,connected:r}=qr();return(()=>{var s=sh();return t(s,n(Ca,{current:"backups"}),null),t(s,n(h,{get when(){return r()&&!e.pveBackups&&!e.pbs},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return ah()},title:"Loading backup information..."})}})}}),null),t(s,n(h,{get when(){return!r()},get children(){return n(it,{padding:"lg",tone:"danger",get children(){return n(Ur,{get icon(){return lh()},title:"Connection lost",description:"Unable to connect to the backend server. Attempting to reconnect...",tone:"danger"})}})}}),null),t(s,n(h,{get when(){return r()&&(e.pveBackups||e.pbs)},get children(){return n(nh,{})}}),null),s})()},fo=(e,r,s,l)=>{typeof window<"u"&&window.showToast?window.showToast(e,r,s,l):console.log(`[${e.toUpperCase()}] ${r}${s?": "+s:""}`)},Wt=(e,r)=>fo("success",e,r),$t=(e,r)=>fo("error",e,r);async function on(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.left="-999999px",r.style.top="-999999px",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}}catch(r){return console.error("Failed to copy to clipboard:",r),!1}}class rn{static baseUrl="/api/config/nodes";static async getNodes(){return await Ft(this.baseUrl)}static async addNode(r){return Ft(this.baseUrl,{method:"POST",body:JSON.stringify(r)})}static async updateNode(r,s){return Ft(`${this.baseUrl}/${r}`,{method:"PUT",body:JSON.stringify(s)})}static async deleteNode(r){return Ft(`${this.baseUrl}/${r}`,{method:"DELETE"})}static async testConnection(r){return Ft(`${this.baseUrl}/test-connection`,{method:"POST",body:JSON.stringify(r)})}static async testExistingNode(r){return Ft(`${this.baseUrl}/${r}/test`,{method:"POST"})}}const oh="flex flex-col gap-1",dh="text-sm font-medium text-gray-700 dark:text-gray-300",ch="text-xs text-gray-500 dark:text-gray-400",uh=["w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100"].join(" "),gh="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-800 dark:focus:ring-blue-400",mo=(e,r)=>r?`${e} ${r}`.trim():e,Ht=oh,hr=ch,Pn=gh;function yt(e){return mo(dh,e)}function Dt(e){return mo(uh,e)}var hh=i("<p>PBS requires HTTPS (not HTTP). Default port is 8007."),fh=i("<p>PMG API listens on HTTPS. Default port is 8006."),mh=i("<p>Must include realm (e.g., admin@pbs)."),xh=i("<p>Include realm (e.g., root@pam or api@pmg)."),Jl=i("<span class=text-red-500>*"),bh=i('<div class="grid grid-cols-1 gap-4 md:grid-cols-2"><div><label>Username <span class=text-red-500>*</span></label><input type=text></div><div><label>Password</label><input type=password>'),ph=i('<p class="text-xs text-gray-600 dark:text-gray-400 mb-3">The command below creates the monitoring user, applies read-only access, and adds the storage permissions Pulse needs to display backups.'),yh=i('<p class="text-blue-800 dark:text-blue-200">Just copy and run this one command on your Proxmox VE server:'),Ql=i('<code class="block text-blue-100 whitespace-pre-wrap break-words">'),vh=i(`<div class=space-y-3><div class="relative bg-gray-900 rounded-md p-3 font-mono text-xs overflow-x-auto"><button type=button class="absolute top-2 right-2 p-1.5 text-gray-400 hover:text-gray-200 bg-gray-700 rounded-md transition-colors"title="Copy command"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button></div><div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3"><div class="flex items-start space-x-2"><svg class="h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-xs text-amber-700 dark:text-amber-300"><p class="font-semibold mb-1">If the command doesn't work:</p><p>Your Proxmox server may not be able to reach Pulse. Use the alternative method below.</p></div></div></div><details class="bg-gray-50 dark:bg-gray-800/50 rounded-lg p-3"><summary class="cursor-pointer text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100">Alternative: Download script manually</summary><div class="mt-3 space-y-3"><button type=button class="w-full px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors text-sm font-medium">Download pulse-setup.sh</button><div class="text-xs text-gray-600 dark:text-gray-400">1. Click to download the script<br>2. Upload to your server via SCP/SFTP<br>3. Run: <code class="bg-gray-100 dark:bg-gray-800 px-1 rounded">bash pulse-setup.sh`),kh=i('<div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3"><p class="text-sm font-semibold text-blue-800 dark:text-blue-200 mb-2">What this does:</p><ul class="text-xs text-blue-700 dark:text-blue-300 space-y-1"><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Creates monitoring user <code class="bg-blue-100 dark:bg-blue-800/50 px-1 rounded">pulse-monitor@pam</code></span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Generates secure API token</span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Sets up monitoring permissions (PVEAuditor + guest agent access + backup visibility)</span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Automatically registers node with Pulse</span></li></ul><p class="text-xs text-green-600 dark:text-green-400 mt-2 font-semibold">✨ Fully automatic - no manual token copying needed!'),wh=i('<p class="text-blue-800 dark:text-blue-200 mb-2">Run these commands one by one on your Proxmox VE server:'),$h=i(`<div class=space-y-3><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">1. Create monitoring user:</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">pveum user add pulse-monitor@pam --comment "Pulse monitoring service"</code></div></div><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">2. Generate API token (save the output!):</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">pveum user token add pulse-monitor@pam pulse-token --privsep 0</code></div><p class="text-amber-600 dark:text-amber-400 text-xs mt-1">⚠️ Copy the token value immediately - it won't be shown again!</p></div><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">3. Set up monitoring permissions:</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs mb-1"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200 whitespace-pre-line"># Apply monitoring permissions - use built-in PVEAuditor role
|
||
pveum aclmod / -user pulse-monitor@pam -role PVEAuditor
|
||
|
||
# Gather additional privileges for VM metrics
|
||
EXTRA_PRIVS=()
|
||
|
||
# Sys.Audit (Ceph, cluster status)
|
||
if pveum role list 2>/dev/null | grep -q "Sys.Audit"; then
|
||
EXTRA_PRIVS+=("Sys.Audit")
|
||
else
|
||
if pveum role add PulseTmpSysAudit -privs Sys.Audit 2>/dev/null; then
|
||
EXTRA_PRIVS+=("Sys.Audit")
|
||
pveum role delete PulseTmpSysAudit 2>/dev/null
|
||
fi
|
||
fi
|
||
|
||
# VM guest agent / monitor privileges
|
||
VM_PRIV=""
|
||
if pveum role list 2>/dev/null | grep -q "VM.Monitor"; then
|
||
VM_PRIV="VM.Monitor"
|
||
elif pveum role list 2>/dev/null | grep -q "VM.GuestAgent.Audit"; then
|
||
VM_PRIV="VM.GuestAgent.Audit"
|
||
else
|
||
if pveum role add PulseTmpVMMonitor -privs VM.Monitor 2>/dev/null; then
|
||
VM_PRIV="VM.Monitor"
|
||
pveum role delete PulseTmpVMMonitor 2>/dev/null
|
||
elif pveum role add PulseTmpGuestAudit -privs VM.GuestAgent.Audit 2>/dev/null; then
|
||
VM_PRIV="VM.GuestAgent.Audit"
|
||
pveum role delete PulseTmpGuestAudit 2>/dev/null
|
||
fi
|
||
fi
|
||
|
||
if [ -n "$VM_PRIV" ]; then
|
||
EXTRA_PRIVS+=("$VM_PRIV")
|
||
fi
|
||
|
||
if [ \${#EXTRA_PRIVS[@]} -gt 0 ]; then
|
||
PRIV_STRING="\${EXTRA_PRIVS[*]}"
|
||
pveum role delete PulseMonitor 2>/dev/null
|
||
pveum role add PulseMonitor -privs "$PRIV_STRING"
|
||
pveum aclmod / -user pulse-monitor@pam -role PulseMonitor
|
||
fi</code></div><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">pveum aclmod /storage -user pulse-monitor@pam -role PVEDatastoreAdmin</code></div><p class="text-gray-600 dark:text-gray-400 text-xs mt-1">ℹ️ PVEAuditor gives read-only API access. PulseMonitor adds Sys.Audit plus either VM.Monitor (PVE 8) or VM.GuestAgent.Audit (PVE 9+) for disk and guest metrics. PVEDatastoreAdmin on /storage adds backup visibility.</p></div><div class="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-md p-2"><p class="text-sm font-medium text-green-900 dark:text-green-100 mb-1">4. Add to Pulse with:</p><ul class="text-xs text-green-800 dark:text-green-200 ml-4 list-disc"><li><strong>Token ID:</strong> pulse-monitor@pam!pulse-token</li><li><strong>Token Value:</strong> [The value from step 2]</li><li><strong>Host URL:</strong> `),Yl=i('<div class="space-y-3 text-xs"><div class="flex gap-2"><button type=button>Quick Setup</button><button type=button>Manual Setup'),_h=i('<p class="text-blue-800 dark:text-blue-200">Just copy and run this one command on your Proxmox Backup Server:'),Ch=i('<button type=button class="absolute top-2 right-2 p-1.5 text-gray-400 hover:text-gray-200 bg-gray-700 rounded-md transition-colors"title="Copy command"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1">'),Sh=i(`<div class=space-y-3><div class="relative bg-gray-900 rounded-md p-3 font-mono text-xs overflow-x-auto"></div><div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3"><div class="flex items-start space-x-2"><svg class="h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-xs text-amber-700 dark:text-amber-300"><p class="font-semibold mb-1">If the command doesn't work:</p><p>Your PBS server may not be able to reach Pulse. Use the alternative method below.</p></div></div></div><details class="bg-gray-50 dark:bg-gray-800/50 rounded-lg p-3"><summary class="cursor-pointer text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100">Alternative: Download script manually</summary><div class="mt-3 space-y-3"><button type=button class="w-full px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md transition-colors text-sm font-medium">Download pulse-pbs-setup.sh</button><div class="text-xs text-gray-600 dark:text-gray-400">1. Click to download the script<br>2. Upload to your PBS via SCP/SFTP<br>3. Run: <code class="bg-gray-100 dark:bg-gray-800 px-1 rounded">bash pulse-pbs-setup.sh`),Th=i('<div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3"><p class="text-sm font-semibold text-blue-800 dark:text-blue-200 mb-2">What this does:</p><ul class="text-xs text-blue-700 dark:text-blue-300 space-y-1"><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Creates monitoring user <code class="bg-blue-100 dark:bg-blue-800/50 px-1 rounded">pulse-monitor@pbs</code></span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Generates secure API token</span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Sets up Audit permissions (read-only access to backups + system stats)</span></li><li class="flex items-start"><span class="text-green-500 mr-2 mt-0.5">✓</span><span>Automatically registers server with Pulse</span></li></ul><p class="text-xs text-green-600 dark:text-green-400 mt-2 font-semibold">✨ Fully automatic - no manual token copying needed!'),Ah=i('<p class="text-blue-800 dark:text-blue-200 mb-2">Run these commands one by one on your Proxmox Backup Server:'),Dh=i(`<div class=space-y-3><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">1. Create monitoring user:</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">proxmox-backup-manager user create pulse-monitor@pbs</code></div></div><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">2. Generate API token (save the output!):</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">proxmox-backup-manager user generate-token pulse-monitor@pbs pulse-token</code></div><p class="text-amber-600 dark:text-amber-400 text-xs mt-1">⚠️ Copy the token value immediately - it won't be shown again!</p></div><div><p class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">3. Set up read-only permissions (includes system stats):</p><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs mb-1"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">proxmox-backup-manager acl update / Audit --auth-id pulse-monitor@pbs</code></div><div class="relative bg-white dark:bg-gray-800 rounded-md p-2 font-mono text-xs"><button type=button class="absolute top-1 right-1 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"title="Copy command"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=9 y=9 width=13 height=13 rx=2 ry=2></rect><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"></path></svg></button><code class="text-gray-800 dark:text-gray-200">proxmox-backup-manager acl update / Audit --auth-id 'pulse-monitor@pbs!pulse-token'</code></div></div><div class="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-md p-2"><p class="text-sm font-medium text-green-900 dark:text-green-100 mb-1">4. Add to Pulse with:</p><ul class="text-xs text-green-800 dark:text-green-200 ml-4 list-disc"><li><strong>Token ID:</strong> pulse-monitor@pbs!pulse-token</li><li><strong>Token Value:</strong> [The value from step 2]</li><li><strong>Host URL:</strong> </li></ul></div><div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-md p-2 mt-3"><p class="text-xs font-semibold text-amber-800 dark:text-amber-200 mb-1">About PBS Permissions:</p><ul class="text-xs text-amber-700 dark:text-amber-300 space-y-0.5"><li><strong>Basic (DatastoreAudit):</strong> View backups only</li><li><strong>Enhanced (Audit on /):</strong> View backups + CPU/memory/uptime stats</li><li class="text-amber-600 dark:text-amber-400">→ We use Enhanced for better monitoring visibility`),Mh=i('<div class="space-y-3 text-xs text-gray-700 dark:text-gray-200"><p>Generate a dedicated API token in <strong>Configuration → API Tokens</strong> on your Mail Gateway. We recommend creating a service user such as <code class=font-mono>pulse-monitor@pmg</code>with <em>Auditor</em> privileges.</p><ol class="list-decimal ml-4 space-y-1"><li>Click <em>Add</em> and choose the service user (or create one if needed).</li><li>Enable <em>Privilege Separation</em> and assign the <em>Auditor</em> role.</li><li>Copy the generated Token ID (e.g. <code class=font-mono>pulse-monitor@pmg!pulse-edge</code>) and the secret value into the fields below.</li></ol><p class="text-xs text-gray-500 dark:text-gray-400">Pulse only requires read-only access. Avoid granting administrator permissions to the token.'),Ph=i('<div class=space-y-4><div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4"><h5 class="text-sm font-medium text-blue-900 dark:text-blue-100 mb-3 flex items-center gap-2"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10></circle><path d="M12 6v6l4 2"></path></svg>Quick Token Setup</h5></div><div class="grid grid-cols-1 gap-4 md:grid-cols-2"><div><label>Token ID <span class=text-red-500>*</span></label><input type=text><p>Full token ID from Proxmox (user@realm!tokenname).</p></div><div><label>Token Value</label><input type=password><p>The secret value shown when creating the token.'),Eh=i('<div><label class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><div><div>Monitor physical disk health (SMART)</div><p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Polls disk SMART data every 5 minutes. Note: This will cause HDDs to spin up from standby. If you have HDDs that should stay idle, leave this disabled.'),Nh=i('<div class=space-y-3><p class="text-xs text-gray-600 dark:text-gray-400">Control which PMG data sets Pulse ingests. Disable individual collectors if you want to limit API usage.</p><label class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><div><div>Mail statistics & trends</div><p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Total mail volume, inbound/outbound breakdown, spam and virus counts.</p></div></label><label class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><div><div>Queue health insights</div><p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Track Postfix queue depth and rejection trends to spot delivery bottlenecks.</p></div></label><label class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><div><div>Quarantine totals</div><p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Mirror PMG quarantine sizes for spam, virus, and attachment buckets.</p></div></label><label class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><div><div>Domain-level statistics</div><p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Gather per-domain metrics for deeper mail routing analysis.'),Oh=i('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class="flex-shrink-0 mt-0.5"><path d="M9 12l2 2 4-4"></path><circle cx=12 cy=12 r=10>'),Lh=i('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class="flex-shrink-0 mt-0.5"><circle cx=12 cy=12 r=10></circle><line x1=15 y1=9 x2=9 y2=15></line><line x1=9 y1=9 x2=15 y2=15>'),Rh=i('<p class="mt-1 text-xs opacity-80">✨ Cluster detected! All cluster nodes will be automatically added.'),Ih=i('<div><div class="flex items-start gap-2"><div><p>'),Hh=i('<button type=button class="px-4 py-2 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors flex items-center gap-2"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=19 y1=12 x2=5 y2=12></line><polyline points="12 19 5 12 12 5"></polyline></svg>Back to Discovery'),Uh=i('<div class="fixed inset-0 z-50 overflow-y-auto"><div class="flex min-h-screen items-center justify-center p-4"><div class="fixed inset-0 bg-black/50 transition-opacity"></div><div class="relative w-full max-w-2xl bg-white dark:bg-gray-800 rounded-lg shadow-xl"><form><div class="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700"><button type=button class="text-gray-400 hover:text-gray-500 dark:hover:text-gray-300"><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18></line></svg></button></div><div class="p-6 space-y-6"><div><div class="grid grid-cols-1 gap-4 md:grid-cols-2"><div><label>Node Name <span class="text-xs text-gray-500">(optional)</span></label><input type=text placeholder="Will auto-detect from hostname"></div><div><label>Host URL <span class=text-red-500>*</span></label><input type=text required></div></div></div><div><div class=mb-4><div class="flex gap-4"><label class="flex items-center"><input type=radio name=authType value=password class=mr-2><span class="text-sm text-gray-700 dark:text-gray-300">Username & Password</span></label><label class="flex items-center"><input type=radio name=authType value=token class=mr-2><span class="text-sm text-gray-700 dark:text-gray-300">API Token <span class="text-green-600 dark:text-green-400 text-xs ml-1">(Recommended)</span></span></label></div></div></div><div><div class=space-y-3><label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox>Verify SSL certificate</label><div><label>SSL Fingerprint (optional)</label><input type=text placeholder=AA:BB:CC:DD:EE:FF:...><p>Useful when connecting to servers with self-signed certificates.</p></div></div></div><div><p class="text-sm text-gray-600 dark:text-gray-400"></p></div></div><div class="flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-700"><button type=button class="px-4 py-2 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"></button><div class="flex items-center gap-3"><button type=button class="px-4 py-2 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">Cancel</button><button type=submit class="px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"> Node'),Xl=i("<code class=text-blue-400>");const Ba=e=>{const[r,s]=Z(null),[l,o]=Z(!1),a=()=>({name:"",host:"",authType:"token",setupMode:"auto",user:"",password:"",tokenName:"",tokenValue:"",fingerprint:"",verifySSL:!0,monitorPhysicalDisks:!1,monitorMailStats:!0,monitorQueues:!0,monitorQuarantine:!0,monitorDomainStats:!1}),[d,c]=Z(a()),[g,b]=Z("");let p,m;ft(()=>{const W=e.resetKey,X=e.nodeType,I=e.isOpen,L=e.editingNode;if(W!==void 0&&W!==p){p=W,c(()=>a()),b(""),s(null);return}if(X!==m&&m!==void 0){m=X,c(()=>a()),b(""),s(null);return}m=X,I&&!L&&(c(()=>a()),b(""),s(null))}),ft(()=>{if(e.editingNode&&e.editingNode.type===e.nodeType){const W=e.editingNode;let X=("user"in W?W.user:"")||"",I=W.tokenName||"";W.type!=="pve"&&I&&I.includes("!")&&!W.hasPassword&&(X=I.split("!")[0]);const H=W.type==="pmg"?W:void 0;c({name:W.name||"",host:W.host||"",authType:W.hasPassword?"password":"token",setupMode:"auto",user:X,password:"",tokenName:I,tokenValue:"",fingerprint:("fingerprint"in W?W.fingerprint:"")||"",verifySSL:W.verifySSL??!0,monitorPhysicalDisks:W.type==="pve"?W.monitorPhysicalDisks??!1:!1,monitorMailStats:H?.monitorMailStats??!0,monitorQueues:H?.monitorQueues??!0,monitorQuarantine:H?.monitorQuarantine??!0,monitorDomainStats:H?.monitorDomainStats??!1})}});const S=W=>{W.preventDefault();const X=d(),I={type:e.nodeType,name:X.name||"",host:X.host,fingerprint:X.fingerprint,verifySSL:X.verifySSL};X.authType==="password"?(I.user=X.user,X.password&&(I.password=X.password)):(I.tokenName=X.tokenName,X.tokenValue&&(I.tokenValue=X.tokenValue)),e.nodeType==="pve"?Object.assign(I,{monitorVMs:!0,monitorContainers:!0,monitorStorage:!0,monitorBackups:!0,monitorPhysicalDisks:X.monitorPhysicalDisks}):e.nodeType==="pbs"?Object.assign(I,{monitorDatastores:!0,monitorSyncJobs:!0,monitorVerifyJobs:!0,monitorPruneJobs:!0,monitorGarbageJobs:!0}):Object.assign(I,{monitorMailStats:X.monitorMailStats,monitorQueues:X.monitorQueues,monitorQuarantine:X.monitorQuarantine,monitorDomainStats:X.monitorDomainStats}),e.onSave(I)},z=(W,X)=>{c(I=>({...I,[W]:X})),W==="host"&&b(""),W==="setupMode"&&X!=="auto"&&b("")},ie=async()=>{const W=d();if(e.editingNode){const I=W.authType==="password"&&W.password,L=W.authType==="token"&&W.tokenValue;if(!I&&!L){o(!0),s(null);try{const H=await rn.testExistingNode(e.editingNode.id);s({status:"success",message:H.message||"Connection successful"})}catch(H){console.error("Test existing node error:",H);let se="Connection failed";H instanceof Error&&(se=H.message.replace(/^API request failed: \d{3}\s*/,"")),s({status:"error",message:se})}finally{o(!1)}return}}if(!W.host){s({status:"error",message:"Host is required"});return}if(W.authType==="password"&&(!W.user||!W.password)){s({status:"error",message:"Username and password are required"});return}if(W.authType==="token"&&(!W.tokenName||!W.tokenValue)){s({status:"error",message:"Token ID and token value are required"});return}const X={type:e.nodeType,name:W.name||"",host:W.host,fingerprint:W.fingerprint,verifySSL:W.verifySSL};W.authType==="password"?(X.user=W.user,X.password=W.password):(X.tokenName=W.tokenName,X.tokenValue=W.tokenValue),o(!0),s(null);try{const I=await rn.testConnection(X);s({status:"success",message:I.message||"Connection successful",isCluster:I.isCluster})}catch(I){console.error("Test connection error:",I);let L="Connection failed";I instanceof Error&&(L=I.message.replace(/^API request failed: \d{3}\s*/,"")),s({status:"error",message:L})}finally{o(!1)}},ne=()=>{switch(e.nodeType){case"pve":return"Proxmox VE";case"pbs":return"Proxmox Backup Server";default:return"Proxmox Mail Gateway"}};return n(ps,{get children(){return n(h,{get when(){return e.isOpen},get children(){var W=Uh(),X=W.firstChild,I=X.firstChild,L=I.nextSibling,H=L.firstChild,se=H.firstChild,le=se.firstChild,ee=se.nextSibling,U=ee.firstChild,Y=U.firstChild,oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=oe.nextSibling,D=$.firstChild,f=D.nextSibling,j=U.nextSibling,K=j.firstChild,C=K.firstChild,ge=C.firstChild,J=ge.firstChild,N=ge.nextSibling,F=N.firstChild,P=j.nextSibling,E=P.firstChild,u=E.firstChild,v=u.firstChild,V=u.nextSibling,A=V.firstChild,k=A.nextSibling,w=k.nextSibling,de=P.nextSibling,fe=de.firstChild,x=ee.nextSibling,R=x.firstChild,Q=R.nextSibling,G=Q.firstChild,T=G.nextSibling,te=T.firstChild;return Gr(I,"click",e.onClose,!0),H.addEventListener("submit",S),t(se,n(rr,{get title(){return`${e.editingNode?"Edit":"Add"} ${ne()} node`},size:"md",class:"flex-1"}),le),Gr(le,"click",e.onClose,!0),t(U,n(rr,{title:"Basic information",size:"sm",class:"mb-4",titleClass:"text-gray-900 dark:text-gray-100"}),Y),y(oe,Ht),B.$$input=ae=>z("name",ae.currentTarget.value),y($,Ht),f.$$input=ae=>z("host",ae.currentTarget.value),t($,n(h,{get when(){return e.nodeType==="pbs"},get children(){var ae=hh();return y(ae,hr),ae}}),null),t($,n(h,{get when(){return e.nodeType==="pmg"},get children(){var ae=fh();return y(ae,hr),ae}}),null),t(j,n(rr,{title:"Authentication",size:"sm",class:"mb-4",titleClass:"text-gray-900 dark:text-gray-100"}),K),J.addEventListener("change",()=>z("authType","password")),F.addEventListener("change",()=>z("authType","token")),t(j,n(h,{get when(){return d().authType==="password"},get children(){var ae=bh(),M=ae.firstChild,ce=M.firstChild,ue=ce.nextSibling,re=M.nextSibling,O=re.firstChild;O.firstChild;var xe=O.nextSibling;return y(M,Ht),ue.$$input=he=>z("user",he.currentTarget.value),t(M,n(h,{get when(){return e.nodeType==="pbs"},get children(){var he=mh();return y(he,hr),he}}),null),t(M,n(h,{get when(){return e.nodeType==="pmg"},get children(){var he=xh();return y(he,hr),he}}),null),y(re,Ht),t(O,n(h,{get when(){return!e.editingNode},get children(){return Jl()}}),null),xe.$$input=he=>z("password",he.currentTarget.value),q(he=>{var me=yt(),_e=e.nodeType==="pve"?"root@pam":e.nodeType==="pbs"?"admin@pbs":"root@pam",Ce=d().authType==="password",Oe=Dt(),tt=yt("flex items-center gap-2"),Ze=e.editingNode?"Leave blank to keep existing":"Password",bt=d().authType==="password"&&!e.editingNode,ct=Dt();return me!==he.e&&y(ce,he.e=me),_e!==he.t&&Te(ue,"placeholder",he.t=_e),Ce!==he.a&&(ue.required=he.a=Ce),Oe!==he.o&&y(ue,he.o=Oe),tt!==he.i&&y(O,he.i=tt),Ze!==he.n&&Te(xe,"placeholder",he.n=Ze),bt!==he.s&&(xe.required=he.s=bt),ct!==he.h&&y(xe,he.h=ct),he},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),q(()=>ue.value=d().user),q(()=>xe.value=d().password),ae}}),null),t(j,n(h,{get when(){return d().authType==="token"},get children(){var ae=Ph(),M=ae.firstChild;M.firstChild;var ce=M.nextSibling,ue=ce.firstChild,re=ue.firstChild,O=re.nextSibling,xe=O.nextSibling,he=ue.nextSibling,me=he.firstChild;me.firstChild;var _e=me.nextSibling,Ce=_e.nextSibling;return t(M,n(h,{get when(){return e.nodeType==="pve"},get children(){var Oe=Yl(),tt=Oe.firstChild,Ze=tt.firstChild,bt=Ze.nextSibling;return Ze.$$click=()=>z("setupMode","auto"),bt.$$click=()=>z("setupMode","manual"),t(Oe,n(h,{get when(){return d().setupMode==="auto"||!d().setupMode},get children(){return[ph(),yh(),(()=>{var ct=vh(),qe=ct.firstChild,Ke=qe.firstChild,Xe=qe.nextSibling,_t=Xe.nextSibling,Lt=_t.firstChild,vt=Lt.nextSibling,Ve=vt.firstChild;return Ke.$$click=async()=>{console.log("[Quick Setup] Copy button clicked");try{if(!d().host||d().host.trim()===""){console.log("[Quick Setup] No host entered"),$t("Please enter the Host URL first");return}console.log("[Quick Setup] Generating setup URL for host:",d().host);const{apiFetch:lt}=await Ln(async()=>{const{apiFetch:gt}=await Promise.resolve().then(()=>zn);return{apiFetch:gt}},void 0),Re=await lt("/api/setup-script-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"pve",host:d().host,backupPerms:!0})});if(console.log("[Quick Setup] API response:",Re.status,Re.ok),Re.ok){const gt=await Re.json();if(console.log("[Quick Setup] Setup data received:",gt),gt.command){console.log("[Quick Setup] Copying command to clipboard:",gt.command),b(gt.command);const mt=await on(gt.command);console.log("[Quick Setup] Copy result:",mt),mt?Wt("Command copied to clipboard!"):$t("Failed to copy to clipboard")}else console.log("[Quick Setup] No command in response")}else $t("Failed to generate setup URL")}catch(lt){console.error("[Quick Setup] Error:",lt),$t("Failed to copy command")}},t(qe,n(h,{get when(){return g().length>0},get fallback(){return(()=>{var lt=Xl();return t(lt,()=>d().host?"Click the button above to copy the setup command":"⚠️ Please enter the Host URL above first"),lt})()},get children(){var lt=Ql();return t(lt,g),lt}}),null),Ve.$$click=async()=>{try{const lt=d().host||"",Re=encodeURIComponent(lt),gt=encodeURIComponent(window.location.origin),mt=`/api/setup-script?type=pve&host=${Re}&pulse_url=${gt}&backup_perms=true`,Rt=await fetch(mt);if(!Rt.ok)throw new Error("Failed to fetch setup script");const It=await Rt.text(),Ae=new Blob([It],{type:"text/plain"}),Fe=URL.createObjectURL(Ae),Qe=document.createElement("a");Qe.href=Fe,Qe.download="pulse-setup.sh",document.body.appendChild(Qe),Qe.click(),document.body.removeChild(Qe),URL.revokeObjectURL(Fe),Wt("Script downloaded! Upload it to your server and run: bash pulse-setup.sh")}catch(lt){console.error("Failed to download script:",lt),Wt("Failed to download script. Please check your connection.")}},ct})(),kh()]}}),null),t(Oe,n(h,{get when(){return d().setupMode==="manual"},get children(){return[wh(),(()=>{var ct=$h(),qe=ct.firstChild,Ke=qe.firstChild,Xe=Ke.nextSibling,_t=Xe.firstChild,Lt=qe.nextSibling,vt=Lt.firstChild,Ve=vt.nextSibling,lt=Ve.firstChild,Re=Lt.nextSibling,gt=Re.firstChild,mt=gt.nextSibling,Rt=mt.firstChild,It=mt.nextSibling,Ae=It.firstChild,Fe=Re.nextSibling,Qe=Fe.firstChild,xt=Qe.nextSibling,Vt=xt.firstChild,Et=Vt.nextSibling,Jt=Et.nextSibling,er=Jt.firstChild;return er.nextSibling,_t.$$click=async()=>{await on('pveum user add pulse-monitor@pam --comment "Pulse monitoring service"')&&Wt("Command copied!")},lt.$$click=async()=>{await on("pveum user token add pulse-monitor@pam pulse-token --privsep 0")&&Wt("Command copied!")},Rt.$$click=async()=>{await on('pveum aclmod / -user pulse-monitor@pam -role PVEAuditor && if pveum role list 2>/dev/null | grep -q "VM.Monitor" || pveum role add TestMonitor -privs VM.Monitor 2>/dev/null; then pveum role delete TestMonitor 2>/dev/null; pveum role delete PulseMonitor 2>/dev/null; pveum role add PulseMonitor -privs VM.Monitor; pveum aclmod / -user pulse-monitor@pam -role PulseMonitor; fi')&&Wt("Command copied!")},Ae.$$click=async()=>{await on("pveum aclmod /storage -user pulse-monitor@pam -role PVEDatastoreAdmin")&&Wt("Command copied!")},t(Jt,()=>d().host||"https://your-server:8006",null),ct})()]}}),null),q(ct=>{var qe=`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md border border-transparent transition-colors ${d().setupMode==="auto"?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-300 border-gray-300 dark:border-gray-600 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60"}`,Ke=`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md border border-transparent transition-colors ${d().setupMode==="manual"?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-300 border-gray-300 dark:border-gray-600 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60"}`;return qe!==ct.e&&y(Ze,ct.e=qe),Ke!==ct.t&&y(bt,ct.t=Ke),ct},{e:void 0,t:void 0}),Oe}}),null),t(M,n(h,{get when(){return e.nodeType==="pbs"},get children(){var Oe=Yl(),tt=Oe.firstChild,Ze=tt.firstChild,bt=Ze.nextSibling;return Ze.$$click=()=>z("setupMode","auto"),bt.$$click=()=>z("setupMode","manual"),t(Oe,n(h,{get when(){return d().setupMode==="auto"||!d().setupMode},get children(){return[_h(),(()=>{var ct=Sh(),qe=ct.firstChild,Ke=qe.nextSibling,Xe=Ke.nextSibling,_t=Xe.firstChild,Lt=_t.nextSibling,vt=Lt.firstChild;return t(qe,n(h,{get when(){return $e(()=>!!d().host)()&&d().host.trim()!==""},get children(){var Ve=Ch();return Ve.$$click=async()=>{try{if(!d().host||d().host.trim()===""){$t("Please enter the Host URL first");return}const{apiFetch:lt}=await Ln(async()=>{const{apiFetch:gt}=await Promise.resolve().then(()=>zn);return{apiFetch:gt}},void 0),Re=await lt("/api/setup-script-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"pbs",host:d().host,backupPerms:!1})});if(Re.ok){const gt=await Re.json();gt.command&&(b(gt.command),await on(gt.command)?Wt("Command copied to clipboard!"):$t("Failed to copy to clipboard"))}else $t("Failed to generate setup URL")}catch(lt){console.error("Failed to copy command:",lt),$t("Failed to copy command")}},Ve}}),null),t(qe,n(h,{get when(){return g().length>0},get fallback(){return(()=>{var Ve=Xl();return t(Ve,()=>d().host?"Click the button above to copy the setup command":"⚠️ Please enter the Host URL above first"),Ve})()},get children(){var Ve=Ql();return t(Ve,g),Ve}}),null),vt.$$click=async()=>{try{const Ve=d().host||"",lt=encodeURIComponent(Ve),Re=encodeURIComponent(window.location.origin),gt=`/api/setup-script?type=pbs&host=${lt}&pulse_url=${Re}`,mt=await fetch(gt);if(!mt.ok)throw new Error("Failed to fetch setup script");const Rt=await mt.text(),It=new Blob([Rt],{type:"text/plain"}),Ae=URL.createObjectURL(It),Fe=document.createElement("a");Fe.href=Ae,Fe.download="pulse-pbs-setup.sh",document.body.appendChild(Fe),Fe.click(),document.body.removeChild(Fe),URL.revokeObjectURL(Ae),Wt("Script downloaded! Upload it to your PBS and run: bash pulse-pbs-setup.sh")}catch(Ve){console.error("Failed to download script:",Ve),Wt("Failed to download script. Please check your connection.")}},ct})(),Th()]}}),null),t(Oe,n(h,{get when(){return d().setupMode==="manual"},get children(){return[Ah(),(()=>{var ct=Dh(),qe=ct.firstChild,Ke=qe.firstChild,Xe=Ke.nextSibling,_t=Xe.firstChild,Lt=qe.nextSibling,vt=Lt.firstChild,Ve=vt.nextSibling,lt=Ve.firstChild,Re=Lt.nextSibling,gt=Re.firstChild,mt=gt.nextSibling,Rt=mt.firstChild,It=mt.nextSibling,Ae=It.firstChild,Fe=Re.nextSibling,Qe=Fe.firstChild,xt=Qe.nextSibling,Vt=xt.firstChild,Et=Vt.nextSibling,Jt=Et.nextSibling,er=Jt.firstChild;return er.nextSibling,_t.$$click=async()=>{await on("proxmox-backup-manager user create pulse-monitor@pbs")&&Wt("Command copied!")},lt.$$click=async()=>{await on("proxmox-backup-manager user generate-token pulse-monitor@pbs pulse-token")&&Wt("Command copied!")},Rt.$$click=async()=>{await on("proxmox-backup-manager acl update / Audit --auth-id pulse-monitor@pbs")&&Wt("Command copied!")},Ae.$$click=async()=>{await on("proxmox-backup-manager acl update / Audit --auth-id 'pulse-monitor@pbs!pulse-token'")&&Wt("Command copied!")},t(Jt,()=>d().host||"https://your-server:8007",null),ct})()]}}),null),q(ct=>{var qe=`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md border border-transparent transition-colors ${d().setupMode==="auto"||!d().setupMode?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-300 border-gray-300 dark:border-gray-600 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60"}`,Ke=`inline-flex items-center px-3 py-1.5 text-sm font-medium rounded-md border border-transparent transition-colors ${d().setupMode==="manual"?"bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-300 border-gray-300 dark:border-gray-600 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60"}`;return qe!==ct.e&&y(Ze,ct.e=qe),Ke!==ct.t&&y(bt,ct.t=Ke),ct},{e:void 0,t:void 0}),Oe}}),null),t(M,n(h,{get when(){return e.nodeType==="pmg"},get children(){return Mh()}}),null),y(ue,Ht),O.$$input=Oe=>z("tokenName",Oe.currentTarget.value),y(xe,hr),y(he,Ht),t(me,n(h,{get when(){return!e.editingNode},get children(){return Jl()}}),null),_e.$$input=Oe=>z("tokenValue",Oe.currentTarget.value),y(Ce,hr),q(Oe=>{var tt=yt(),Ze=e.nodeType==="pve"?"pulse-monitor@pam!pulse-token":"pulse-monitor@pbs!pulse-token",bt=d().authType==="token",ct=Dt("font-mono"),qe=yt("flex items-center gap-2"),Ke=e.editingNode?"Leave blank to keep existing":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",Xe=d().authType==="token"&&!e.editingNode,_t=Dt("font-mono");return tt!==Oe.e&&y(re,Oe.e=tt),Ze!==Oe.t&&Te(O,"placeholder",Oe.t=Ze),bt!==Oe.a&&(O.required=Oe.a=bt),ct!==Oe.o&&y(O,Oe.o=ct),qe!==Oe.i&&y(me,Oe.i=qe),Ke!==Oe.n&&Te(_e,"placeholder",Oe.n=Ke),Xe!==Oe.s&&(_e.required=Oe.s=Xe),_t!==Oe.h&&y(_e,Oe.h=_t),Oe},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),q(()=>O.value=d().tokenName),q(()=>_e.value=d().tokenValue),ae}}),null),t(P,n(rr,{title:"SSL settings",size:"sm",class:"mb-4",titleClass:"text-gray-900 dark:text-gray-100"}),E),v.addEventListener("change",ae=>z("verifySSL",ae.currentTarget.checked)),y(v,Pn),y(V,Ht),k.$$input=ae=>z("fingerprint",ae.currentTarget.value),y(w,hr),t(de,n(rr,{title:"Monitoring coverage",size:"sm",class:"mb-2",titleClass:"text-gray-900 dark:text-gray-100"}),fe),t(fe,()=>e.nodeType==="pmg"?"Pulse captures mail flow analytics, rejection causes, and quarantine visibility without additional scripts.":"Pulse automatically tracks all supported resources for this node — virtual machines, containers, storage usage, backups, and PBS job activity — so you always get full visibility without extra configuration."),t(ee,n(h,{get when(){return e.nodeType==="pve"},get children(){var ae=Eh(),M=ae.firstChild,ce=M.firstChild;return t(ae,n(rr,{title:"Advanced monitoring",size:"sm",class:"mb-3",titleClass:"text-gray-900 dark:text-gray-100"}),M),ce.addEventListener("change",ue=>z("monitorPhysicalDisks",ue.currentTarget.checked)),y(ce,Pn+" mt-0.5"),q(()=>ce.checked=d().monitorPhysicalDisks),ae}}),null),t(ee,n(h,{get when(){return e.nodeType==="pmg"},get children(){var ae=Nh(),M=ae.firstChild,ce=M.nextSibling,ue=ce.firstChild,re=ce.nextSibling,O=re.firstChild,xe=re.nextSibling,he=xe.firstChild,me=xe.nextSibling,_e=me.firstChild;return t(ae,n(rr,{title:"Data collection",size:"sm",class:"mb-1",titleClass:"text-gray-900 dark:text-gray-100"}),M),ue.addEventListener("change",Ce=>z("monitorMailStats",Ce.currentTarget.checked)),y(ue,Pn+" mt-0.5"),O.addEventListener("change",Ce=>z("monitorQueues",Ce.currentTarget.checked)),y(O,Pn+" mt-0.5"),he.addEventListener("change",Ce=>z("monitorQuarantine",Ce.currentTarget.checked)),y(he,Pn+" mt-0.5"),_e.addEventListener("change",Ce=>z("monitorDomainStats",Ce.currentTarget.checked)),y(_e,Pn+" mt-0.5"),q(()=>ue.checked=d().monitorMailStats),q(()=>O.checked=d().monitorQueues),q(()=>he.checked=d().monitorQuarantine),q(()=>_e.checked=d().monitorDomainStats),ae}}),null),t(H,n(h,{get when(){return r()},get children(){return[$e(()=>(()=>{const ae=r();return console.log("Test result display:",{status:ae?.status,message:ae?.message}),null})()),(()=>{var ae=Ih(),M=ae.firstChild,ce=M.firstChild,ue=ce.firstChild;return t(M,n(h,{get when(){return r()?.status==="success"},get children(){return Oh()}}),ce),t(M,n(h,{get when(){return r()?.status==="error"},get children(){return Lh()}}),ce),t(ue,()=>r()?.message),t(ce,n(h,{get when(){return r()?.isCluster},get children(){return Rh()}}),null),q(()=>y(ae,`mx-6 p-3 rounded-lg text-sm ${r()?.status==="success"?"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-800 dark:text-red-200"}`)),ae})()]}}),x),R.$$click=ie,t(R,()=>l()?"Testing...":"Test Connection"),t(Q,n(h,{get when(){return e.showBackToDiscovery&&e.onBackToDiscovery},get children(){var ae=Hh();return ae.$$click=()=>{e.onBackToDiscovery(),e.onClose()},ae}}),G),Gr(G,"click",e.onClose,!0),t(T,()=>e.editingNode?"Update":"Add",te),q(ae=>{var M=yt("flex items-center gap-2"),ce=Dt(),ue=yt("flex items-center gap-1"),re=e.nodeType==="pve"?"https://proxmox.example.com:8006":e.nodeType==="pbs"?"https://backup.example.com:8007":"https://mail-gateway.example.com:8006",O=Dt(),xe=yt(),he=Dt("font-mono"),me=l();return M!==ae.e&&y(_,ae.e=M),ce!==ae.t&&y(B,ae.t=ce),ue!==ae.a&&y(D,ae.a=ue),re!==ae.o&&Te(f,"placeholder",ae.o=re),O!==ae.i&&y(f,ae.i=O),xe!==ae.n&&y(A,ae.n=xe),he!==ae.s&&y(k,ae.s=he),me!==ae.h&&(R.disabled=ae.h=me),ae},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),q(()=>B.value=d().name),q(()=>f.value=d().host),q(()=>J.checked=d().authType==="password"),q(()=>F.checked=d().authType==="token"),q(()=>v.checked=d().verifySSL),q(()=>k.value=d().fingerprint),W}})}})};Xt(["click","input"]);class Es{static async listTokens(){return(await Ft("/api/security/tokens")).tokens??[]}static async createToken(r){return Ft("/api/security/tokens",{method:"POST",body:JSON.stringify({name:r})})}static async deleteToken(r){await Ft(`/api/security/tokens/${r}`,{method:"DELETE"})}}const[xo,Zl]=Z(null),bo={state:xo,show(e){Zl({...e,issuedAt:Date.now()})},dismiss(){Zl(null)}},po=()=>xo,pa=e=>bo.show(e),Bh=()=>bo.dismiss();var jh=i('<div class="bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center gap-3"><div class="p-2 bg-blue-100 dark:bg-blue-900/50 rounded-lg"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z">'),Fh=i('<div class="flex items-center gap-2 rounded-md bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800 px-3 py-2 text-xs text-blue-800 dark:text-blue-200"><svg class="w-4 h-4 animate-spin"viewBox="0 0 24 24"fill=none stroke=currentColor><circle class=opacity-25 cx=12 cy=12 r=10 stroke-width=4 stroke=currentColor></circle><path class=opacity-75 d="M4 12a8 8 0 018-8"stroke-width=4 stroke-linecap=round stroke=currentColor></path></svg><span>Refreshing security status…'),Vh=i('<code class="rounded bg-green-100 dark:bg-green-900/50 px-1.5 py-0.5 font-mono text-[11px] text-green-800 dark:text-green-200">'),Gh=i('<p class="text-xs text-green-900/80 dark:text-green-200/80">Label <span class=font-semibold>'),zh=i('<div class="space-y-3 rounded-lg border border-green-300 dark:border-green-700 bg-green-50 dark:bg-green-900/30 p-4"><div class="flex items-start gap-3"><div class="flex-shrink-0 rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 p-2"><svg class="w-5 h-5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div><div class=space-y-2><h3 class="text-base font-semibold text-green-900 dark:text-green-100">Token ready to copy</h3><p class="text-sm text-green-800 dark:text-green-200 leading-snug">We keep the full token inside a secure dialog. Reopen it if you still need to copy the value before navigating away.</p></div></div><div class="flex flex-wrap gap-2"><button type=button class="inline-flex items-center gap-1 rounded-md bg-green-600 hover:bg-green-700 text-white text-sm font-semibold px-4 py-2 transition-colors shadow-sm"><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 7h4m0 0v4m0-4l-6 6-4-4-6 6"></path></svg>Show token dialog</button><button type=button class="inline-flex items-center rounded-md border border-green-400 dark:border-green-700 px-4 py-2 text-sm font-medium text-green-800 dark:text-green-200 hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors">Dismiss reminder'),Wh=i('<div class=overflow-x-auto><table class="w-full text-sm"><thead><tr class="border-b border-gray-200 dark:border-gray-700"><th class="text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400">Label</th><th class="text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400">Token hint</th><th class="text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400">Created</th><th class="text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400">Last used</th><th class="py-2 px-3 text-right font-medium text-gray-600 dark:text-gray-400">Actions</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),qh=i('<div class="p-6 space-y-6"><div class="text-xs text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3">Issue a dedicated token for each host or automation. That way, if a system is compromised, you can revoke just its token without disrupting anything else.</div><div class=space-y-3><h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Generate new token</h3><div class="flex gap-2"><input id=api-token-name type=text placeholder="e.g., docker-host-1"class="flex-1 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"><button type=button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap"></button></div></div><div class=space-y-3><h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Active tokens'),Kh=i('<p class="text-sm text-gray-600 dark:text-gray-400">No API tokens yet. Generate one above to get started.'),Jh=i('<span class="inline-flex items-center gap-1 rounded-full bg-blue-100 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide text-blue-700 dark:bg-blue-900/30 dark:text-blue-300">Docker'),Qh=i('<div class="mt-1 text-xs text-blue-700 dark:text-blue-300">Used by Docker <!>: '),Yh=i('<tr><td class="py-2 px-3 text-gray-900 dark:text-gray-100"><div class="flex items-center gap-2"><span></span></div></td><td class="py-2 px-3 font-mono text-xs text-gray-600 dark:text-gray-400"></td><td class="py-2 px-3 text-gray-600 dark:text-gray-400"></td><td class="py-2 px-3 text-gray-600 dark:text-gray-400"></td><td class="py-2 px-3 text-right"><button type=button class="inline-flex items-center px-3 py-1 text-xs font-medium text-red-700 dark:text-red-300 bg-red-50 dark:bg-red-900/30 rounded hover:bg-red-100 dark:hover:bg-red-900/50 transition-colors">Revoke');const Xh=e=>{const{state:r}=qr(),s=pe(()=>r.dockerHosts??[]),l=pe(()=>{const U=new Map;for(const Y of s()){const oe=Y.tokenId;if(!oe)continue;const _=Y.displayName?.trim()||Y.hostname||Y.id,B=U.get(oe);B?U.set(oe,{count:B.count+1,hosts:[...B.hosts,_]}):U.set(oe,{count:1,hosts:[_]})}return U}),[o,a]=Z([]),[d,c]=Z(!0),[g,b]=Z(!1),[p,m]=Z(null),[S,z]=Z(null),[ie,ne]=Z(""),W=po(),X=async()=>{c(!0);try{const U=await Es.listTokens();a(U)}catch(U){console.error("Failed to load API tokens",U),$t("Failed to load API tokens")}finally{c(!1)}};vr(()=>{X()});const I=async()=>{b(!0);try{const U=ie().trim()||void 0,{token:Y,record:oe}=await Es.createToken(U);a(_=>[oe,..._]),m(Y),z(oe),ne(""),pa({token:Y,record:oe,source:"security",note:"Copy this token now. You can reopen this dialog from Security → API tokens while this page stays open."}),Wt("New API token generated. Copy it below while it is still visible."),e.onTokensChanged?.();try{window.localStorage.setItem("apiToken",Y),window.dispatchEvent(new StorageEvent("storage",{key:"apiToken",newValue:Y}))}catch(_){console.warn("Unable to persist API token in localStorage",_)}}catch(U){console.error("Failed to generate API token",U),$t("Failed to generate API token")}finally{b(!1)}},L=U=>U.prefix&&U.suffix?`${U.prefix}…${U.suffix}`:U.prefix?`${U.prefix}…`:"—",H=U=>U.name?.trim()?U.name.trim():U.prefix&&U.suffix?`${U.prefix}…${U.suffix}`:U.prefix?`${U.prefix}…`:"unnamed token",se=async U=>{const Y=l().get(U.id),oe=H(U);let _=`Revoke token "${oe}"? Any agents or integrations using it will stop working.`;if(Y){const $=Y.hosts.slice(0,5).join(", "),D=Y.hosts.length-5,f=D>0?`${$}, +${D} more`:$,j=Y.count===1?"a Docker host":`${Y.count} Docker hosts`;_=`Token "${oe}" is currently used by ${j}.
|
||
Hosts: ${f}
|
||
|
||
Revoking it will cause those agents to stop reporting until you update them with a new token.
|
||
|
||
Continue?`}if(window.confirm(_))try{await Es.deleteToken(U.id),a(D=>D.filter(f=>f.id!==U.id)),Wt("Token revoked"),e.onTokensChanged?.();const $=S();$&&$.id===U.id&&(m(null),z(null))}catch($){console.error("Failed to revoke API token",$),$t("Failed to revoke API token")}},le=()=>{const U=W();return U?p()!==null&&U.token===p():!1},ee=()=>{const U=p(),Y=S();!U||!Y||pa({token:U,record:Y,source:"security",note:"Copy this token now. Close the dialog once you have stored it safely."})};return n(it,{padding:"none",class:"overflow-hidden border border-gray-200 dark:border-gray-700",border:!1,get children(){return[(()=>{var U=jh(),Y=U.firstChild;return Y.firstChild,t(Y,n(rr,{title:"API tokens",description:"Generate or revoke access tokens for automation and agents",size:"sm",class:"flex-1"}),null),U})(),(()=>{var U=qh(),Y=U.firstChild,oe=Y.nextSibling,_=oe.firstChild,B=_.nextSibling,$=B.firstChild,D=$.nextSibling,f=oe.nextSibling;return f.firstChild,t(U,n(h,{get when(){return e.refreshing},get children(){return Fh()}}),Y),t(U,n(h,{get when(){return $e(()=>!!p())()&&!le()},get children(){var j=zh(),K=j.firstChild,C=K.firstChild,ge=C.nextSibling,J=ge.firstChild;J.nextSibling;var N=K.nextSibling,F=N.firstChild,P=F.nextSibling;return t(ge,n(h,{get when(){return S()},get children(){var E=Gh(),u=E.firstChild,v=u.nextSibling;return t(v,()=>S()?.name||"Untitled token"),t(E,n(h,{get when(){return S()?.prefix||S()?.suffix},get children(){return[" ","· Hint"," ",(()=>{var V=Vh();return t(V,()=>L(S())),V})()]}}),null),E}}),null),F.$$click=ee,P.$$click=()=>{m(null),z(null)},j}}),Y),$.$$input=j=>ne(j.currentTarget.value),D.$$click=I,t(D,()=>g()?"Generating…":"Generate"),t(f,n(h,{get when(){return $e(()=>!d())()&&o().length>0},get fallback(){return Kh()},get children(){var j=Wh(),K=j.firstChild,C=K.firstChild,ge=C.nextSibling;return t(ge,n(ze,{get each(){return o()},children:J=>{const N=l().get(J.id),F=N?N.hosts.join(", "):void 0,P=N?N.hosts.slice(0,2).join(", "):"",E=N?N.hosts.length-2:0,u=N&&N.count===1?N.hosts[0]:N?`${P}${E>0?`, +${E} more`:""}`:"",v=N&&N.count===1?"host":N?"hosts":"";return(()=>{var V=Yh(),A=V.firstChild,k=A.firstChild,w=k.firstChild,de=A.nextSibling,fe=de.nextSibling,x=fe.nextSibling,R=x.nextSibling,Q=R.firstChild;return t(w,()=>J.name||"Untitled token"),t(k,n(h,{when:N,get children(){return Jh()}}),null),t(A,n(h,{when:N,get children(){var G=Qh(),T=G.firstChild,te=T.nextSibling;return te.nextSibling,Te(G,"title",F),t(G,v,te),t(G,u,null),G}}),null),t(de,()=>L(J)),t(fe,()=>An(new Date(J.createdAt).getTime())),t(x,(()=>{var G=$e(()=>!!J.lastUsedAt);return()=>G()?An(new Date(J.lastUsedAt).getTime()):"Never"})()),Q.$$click=()=>se(J),V})()}})),j}}),null),q(()=>D.disabled=g()),q(()=>$.value=ie()),U})()]}})};Xt(["click","input"]);var Zh=i('<div class="p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md"><p class="text-sm text-red-600 dark:text-red-400">'),ef=i('<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4"style=z-index:9999><div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full"><div class="flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700"><button type=button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-50"><svg class="w-6 h-6"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div><form class="p-6 space-y-4"><div><label for=current-password>Current Password</label><input id=current-password type=password required></div><div><label for=new-password>New Password</label><input id=new-password type=password required minlength=8><p>Minimum 8 characters</p></div><div><label for=confirm-password>Confirm New Password</label><input id=confirm-password type=password required></div><div class="flex justify-end space-x-3 pt-4"><button type=button class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50">Cancel</button><button type=submit class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md disabled:opacity-50">');const tf=e=>{const[r,s]=Z(""),[l,o]=Z(""),[a,d]=Z(""),[c,g]=Z(!1),[b,p]=Z(""),m=async z=>{if(z.preventDefault(),p(""),!r()||!l()||!a()){p("All fields are required");return}if(l()!==a()){p("New passwords do not match");return}if(l().length<8){p("Password must be at least 8 characters");return}g(!0);try{const ie=document.cookie.split("; ").find(I=>I.startsWith("pulse_csrf="))?.split("=")[1],ne=sessionStorage.getItem("pulse_auth_user")||"admin",W={"Content-Type":"application/json",Authorization:`Basic ${btoa(`${ne}:${r()}`)}`};ie&&(W["X-CSRF-Token"]=ie);const X=await fetch("/api/security/change-password",{method:"POST",headers:W,body:JSON.stringify({currentPassword:r(),newPassword:l()}),credentials:"include"});if(!X.ok){const I=await X.text();throw X.status===401?new Error("Current password is incorrect"):new Error(I||"Failed to change password")}Wt("Password changed successfully. Please log in with your new password."),s(""),o(""),d(""),e.onClose(),setTimeout(()=>{window.location.reload()},2e3)}catch(ie){const ne=ie instanceof Error?ie.message:"Failed to change password";p(ne),$t(ne)}finally{g(!1)}},S=()=>{c()||(s(""),o(""),d(""),p(""),e.onClose())};return n(h,{get when(){return e.isOpen},get children(){return n(ps,{get children(){var z=ef(),ie=z.firstChild,ne=ie.firstChild,W=ne.firstChild,X=ne.nextSibling,I=X.firstChild,L=I.firstChild,H=L.nextSibling,se=I.nextSibling,le=se.firstChild,ee=le.nextSibling,U=ee.nextSibling,Y=se.nextSibling,oe=Y.firstChild,_=oe.nextSibling,B=Y.nextSibling,$=B.firstChild,D=$.nextSibling;return t(ne,n(rr,{title:"Change password",size:"lg",class:"flex-1"}),W),W.$$click=S,X.addEventListener("submit",m),y(I,Ht),H.$$input=f=>s(f.currentTarget.value),y(se,Ht),ee.$$input=f=>o(f.currentTarget.value),y(U,`${hr} mt-1`),y(Y,Ht),_.$$input=f=>d(f.currentTarget.value),t(X,n(h,{get when(){return b()},get children(){var f=Zh(),j=f.firstChild;return t(j,b),f}}),B),$.$$click=S,t(D,()=>c()?"Changing...":"Change Password"),q(f=>{var j=c(),K=yt(),C=Dt("shadow-sm"),ge=c(),J=yt(),N=Dt("shadow-sm"),F=c(),P=yt(),E=Dt("shadow-sm"),u=c(),v=c(),V=c();return j!==f.e&&(W.disabled=f.e=j),K!==f.t&&y(L,f.t=K),C!==f.a&&y(H,f.a=C),ge!==f.o&&(H.disabled=f.o=ge),J!==f.i&&y(le,f.i=J),N!==f.n&&y(ee,f.n=N),F!==f.s&&(ee.disabled=f.s=F),P!==f.h&&y(oe,f.h=P),E!==f.r&&y(_,f.r=E),u!==f.d&&(_.disabled=f.d=u),v!==f.l&&($.disabled=f.l=v),V!==f.u&&(D.disabled=f.u=V),f},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0}),q(()=>H.value=r()),q(()=>ee.value=l()),q(()=>_.value=a()),z}})}})};Xt(["click","input"]);var rf=i('<div class="flex justify-end"><button type=button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">'),nf=i('<tr><td colspan=5 class="px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400">No guests found'),sf=i(`<div class="overflow-x-auto w-full"style=scrollbar-width:none;-ms-overflow-style:none;><style>
|
||
.overflow-x-auto::-webkit-scrollbar { display: none; }
|
||
</style><table class="min-w-full w-full table-auto"><thead><tr class="bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700"><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-32">Name</th><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-16">Type</th><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-16">VMID</th><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider"style=min-width:350px;>Custom URL</th><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-20">Actions</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">`),af=i('<div class="space-y-6 w-full"><div class=relative><input type=text placeholder="Search guests..."class="w-full px-4 py-2 pl-10 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent"><svg class="absolute left-3 top-2.5 w-4 h-4 text-gray-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg></div><div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden w-full">'),lf=i('<div class="flex items-center justify-center py-12"><div class="text-gray-500 dark:text-gray-400">Loading guest URLs...'),of=i('<tr class="node-header bg-gray-50 dark:bg-gray-700/50 font-semibold text-gray-700 dark:text-gray-300 text-xs"><td colspan=5 class="px-3 py-1 text-xs font-medium text-gray-500 dark:text-gray-400">'),df=i('<div class="text-xs text-red-600 dark:text-red-400 mt-1">'),cf=i('<tr class="hover:bg-gray-50 dark:hover:bg-gray-900/50 transition-colors"><td class="p-1 px-2"><div class="text-sm font-medium text-gray-900 dark:text-gray-100"></div></td><td class="p-1 px-2"><span></span></td><td class="p-1 px-2 text-sm text-gray-600 dark:text-gray-400"></td><td class="p-1 px-2"><div><input type=text placeholder=https://192.168.1.100:8006 style=min-width:300px;></div></td><td class="p-1 px-2"><div class="flex items-center gap-2"><button type=button><svg fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg>Test</button><button type=button><svg fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg>Clear');function uf(e){const{state:r}=qr(),[s,l]=Z({}),[o,a]=Z(""),[d,c]=Z(!1),[g,b]=Z(!0),[p,m]=Z({}),S=pe(()=>{const L=r.vms||[],H=r.containers||[];return[...L,...H]}),z=pe(()=>{const L=o().toLowerCase();let H=S();L&&(H=H.filter(le=>le.name.toLowerCase().includes(L)||le.vmid.toString().includes(L)||le.node.toLowerCase().includes(L)));const se={};return H.forEach(le=>{const ee=le.instance;se[ee]||(se[ee]=[]),se[ee].push(le)}),Object.keys(se).forEach(le=>{se[le]=se[le].sort((ee,U)=>ee.vmid-U.vmid)}),se});vr(async()=>{c(!0);try{const L=await gl.getAllMetadata();l(L||{})}catch(L){console.error("Failed to load guest metadata:",L),$t("Failed to load guest URLs")}finally{c(!1),b(!1)}});const ie=async()=>{c(!0);try{const L=s(),H=[];for(const[se,le]of Object.entries(L))if(le.customUrl!==void 0)try{await gl.updateMetadata(se,{customUrl:le.customUrl})}catch(ee){const U=ee.message||ee.toString();H.push(`${se}: ${U}`),console.error(`Failed to save URL for ${se}:`,ee)}H.length>0?$t(H.join(`
|
||
`)):(Wt("Guest URLs saved"),e.setHasUnsavedChanges(!1))}catch(L){console.error("Failed to save guest URLs:",L),$t("Failed to save guest URLs")}finally{c(!1)}},ne=L=>{if(!L)return null;if(L.endsWith(".")&&!L.includes(".."))return"URL appears incomplete - please enter a complete domain or IP address";if(!L.startsWith("http://")&&!L.startsWith("https://"))return"URL must start with http:// or https://";try{const H=new URL(L);return H.hostname?H.hostname.endsWith(".")&&!H.hostname.includes("..")?"Hostname appears incomplete":null:"URL must include a valid hostname or IP address"}catch{return"Invalid URL format"}},W=(L,H)=>{const se=s();return se[L]?L:se[H]?H:L},X=(L,H)=>{l(le=>({...le,[L]:{...le[L]||{id:L},customUrl:H}}));const se=ne(H);m(le=>{const ee={...le};return se?ee[L]=se:delete ee[L],ee}),e.setHasUnsavedChanges(!0)},I=L=>{l(H=>({...H,[L]:{...H[L]||{id:L},customUrl:""}})),m(H=>{const se={...H};return delete se[L],se}),e.setHasUnsavedChanges(!0)};return(()=>{var L=af(),H=L.firstChild,se=H.firstChild,le=H.nextSibling;return t(L,n(rr,{title:"Guest URL management",description:"Configure custom URLs for accessing guest web interfaces. These URLs appear as shortcuts from the dashboard.",size:"md"}),H),se.$$input=ee=>a(ee.currentTarget.value),t(L,n(h,{get when(){return $e(()=>!!e.hasUnsavedChanges())()&&Object.keys(p()).length===0},get children(){var ee=rf(),U=ee.firstChild;return U.$$click=ie,t(U,()=>d()?"Saving...":"Save Changes"),q(()=>U.disabled=d()),ee}}),le),t(le,n(h,{get when(){return!g()},get fallback(){return lf()},get children(){var ee=sf(),U=ee.firstChild,Y=U.nextSibling,oe=Y.firstChild,_=oe.nextSibling;return t(_,n(h,{get when(){return Object.keys(z()).length===0},get fallback(){return n(ze,{get each(){return Object.entries(z()).sort(([,B],[,$])=>{const D=B[0]?.node||"",f=$[0]?.node||"";return D.localeCompare(f)})},children:([B,$])=>[(()=>{var D=of(),f=D.firstChild;return t(f,()=>$[0]?.node||B),D})(),n(ze,{each:$,children:D=>{const f=D.id||`${D.instance}-${D.node}-${D.vmid}`,j=`${D.node}-${D.vmid}`,K=pe(()=>W(f,j)),C=pe(()=>s()[K()]),ge=pe(()=>C()?.customUrl||""),J=pe(()=>ge().trim().length>0),N=pe(()=>p()[K()]);return(()=>{var F=cf(),P=F.firstChild,E=P.firstChild,u=P.nextSibling,v=u.firstChild,V=u.nextSibling,A=V.nextSibling,k=A.firstChild,w=k.firstChild,de=A.nextSibling,fe=de.firstChild,x=fe.firstChild,R=x.firstChild,Q=x.nextSibling,G=Q.firstChild;return t(E,()=>D.name),t(v,()=>D.type==="qemu"?"VM":"LXC"),t(V,()=>D.vmid),w.$$input=T=>X(K(),T.currentTarget.value),t(k,n(h,{get when(){return N()},get children(){var T=df();return t(T,N),T}}),null),x.$$click=()=>{J()&&ge()&&window.open(ge(),"_blank","noopener,noreferrer")},Q.$$click=()=>I(K()),q(T=>{var te=`inline-block px-1.5 py-0.5 text-xs font-medium rounded ${D.type==="qemu"?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300"}`,ae=`w-full min-w-[300px] px-2 py-1 text-sm border rounded
|
||
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100
|
||
focus:ring-2 focus:border-transparent ${N()?"border-red-500 dark:border-red-400 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"}`,M=`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded border transition-colors ${J()?"text-blue-600 border-blue-500 hover:bg-blue-50 dark:text-blue-300 dark:border-blue-400 dark:hover:bg-blue-900/30":"text-gray-400 border-gray-300 dark:text-gray-500 dark:border-gray-600 cursor-not-allowed"}`,ce=!J(),ue=`w-3.5 h-3.5 ${J()?"text-current":"text-gray-400 dark:text-gray-500"}`,re=`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded border transition-colors ${J()?"text-red-600 border-red-500 hover:bg-red-50 dark:text-red-400 dark:border-red-500 dark:hover:bg-red-900/30":"text-gray-400 border-gray-300 dark:text-gray-500 dark:border-gray-600 cursor-not-allowed"}`,O=!J(),xe=`w-3.5 h-3.5 ${J()?"text-current":"text-gray-400 dark:text-gray-500"}`;return te!==T.e&&y(v,T.e=te),ae!==T.t&&y(w,T.t=ae),M!==T.a&&y(x,T.a=M),ce!==T.o&&(x.disabled=T.o=ce),ue!==T.i&&Te(R,"class",T.i=ue),re!==T.n&&y(Q,T.n=re),O!==T.s&&(Q.disabled=T.s=O),xe!==T.h&&Te(G,"class",T.h=xe),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),q(()=>w.value=ge()),F})()}})]})},get children(){return nf()}})),ee}})),q(()=>se.value=o()),L})()}Xt(["input","click"]);class _s{static baseUrl="/api";static async getState(){return Ft(`${this.baseUrl}/state`)}static async getPerformance(){return Ft(`${this.baseUrl}/performance`)}static async getStats(){return Ft(`${this.baseUrl}/stats`)}static async exportDiagnostics(){return(await Zn(`${this.baseUrl}/diagnostics/export`)).blob()}static async deleteDockerHost(r,s={}){const l=new URLSearchParams;s.hide&&l.set("hide","true"),s.force&&l.set("force","true");const o=l.toString(),a=`${this.baseUrl}/agents/docker/hosts/${encodeURIComponent(r)}${o?`?${o}`:""}`,d=await Zn(a,{method:"DELETE"});if(!d.ok){if(d.status===404)return{};let g=`Failed with status ${d.status}`;try{const b=await d.text();if(b?.trim()){g=b.trim();try{const p=JSON.parse(b);typeof p?.error=="string"&&p.error.trim()&&(g=p.error.trim())}catch{}}}catch{}throw new Error(g)}if(d.status===204)return{};const c=await d.text();if(!c?.trim())return{};try{return JSON.parse(c)}catch(g){throw new Error(g.message||"Failed to parse delete docker host response")}}static async unhideDockerHost(r){const s=`${this.baseUrl}/agents/docker/hosts/${encodeURIComponent(r)}/unhide`,l=await Zn(s,{method:"PUT"});if(!l.ok){if(l.status===404)return;let o=`Failed with status ${l.status}`;try{const a=await l.text();if(a?.trim()){o=a.trim();try{const d=JSON.parse(a);typeof d?.error=="string"&&d.error.trim()&&(o=d.error.trim())}catch{}}}catch{}throw new Error(o)}}static async markDockerHostPendingUninstall(r){const s=`${this.baseUrl}/agents/docker/hosts/${encodeURIComponent(r)}/pending-uninstall`,l=await Zn(s,{method:"PUT"});if(!l.ok){if(l.status===404)return;let o=`Failed with status ${l.status}`;try{const a=await l.text();if(a?.trim()){o=a.trim();try{const d=JSON.parse(a);typeof d?.error=="string"&&d.error.trim()&&(o=d.error.trim())}catch{}}}catch{}throw new Error(o)}}}var gf=i('<div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-100">Add a Docker host</h3><p class="text-sm text-gray-600 dark:text-gray-400">Run this command as root on your Docker host to start monitoring.'),hf=i('<details class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-700 dark:border-gray-700 dark:bg-gray-900/40 dark:text-gray-300"><summary class="flex cursor-pointer items-center justify-between font-semibold text-gray-800 dark:text-gray-100"><span>What exactly gets installed?</span><svg class="h-4 w-4 text-gray-500 transition-transform group-open:-rotate-180"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7"></path></svg></summary><div class="mt-3 space-y-2"><ul class="list-disc space-y-1 pl-5 leading-snug"><li>A single self-contained Go binary (<code class="font-mono text-[11px]">pulse-docker-agent</code>, ~7 MB)</li><li>A systemd unit on Linux or Unraid startup script so the agent restarts after reboots</li><li>No extra dependencies: it talks directly to <code class="font-mono text-[11px]">/var/run/docker.sock</code> and sends metrics over HTTPS</li><li>Every report includes a control handshake so Pulse can issue constrained commands (e.g. stop) without running arbitrary shell</li></ul><p class="text-xs text-gray-500 dark:text-gray-400">Removing a host tears down the service and autostart hook automatically; keeping the binary for quick reinstalls is optional and called out in the dialog.'),ff=i('<div class="rounded-lg border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-200">Loading API tokens…'),mf=i('<span class="text-xs text-red-700 dark:text-red-300">Still failing? Check network connectivity and server logs.'),xf=i('<div class="space-y-2 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-800 dark:bg-red-900/30 dark:text-red-200"><p></p><div class="flex flex-wrap items-center gap-3"><button type=button class="inline-flex items-center rounded bg-red-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60 disabled:cursor-not-allowed">Retry'),bf=i('<code class="px-1.5 py-0.5 bg-gray-100 dark:bg-gray-800 rounded font-mono text-[11px] text-gray-600 dark:text-gray-400">'),pf=i('<div class="pl-6 text-xs text-gray-700 dark:text-gray-300"><span class=font-medium>'),yf=i('<div class="mt-2 space-y-1.5"><div class="flex items-center gap-2 text-xs text-green-700 dark:text-green-300"><svg class="w-4 h-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span>Saved token detected'),vf=i('<p class="mt-2 text-xs text-gray-500 dark:text-gray-500">No saved token found on this device.'),kf=i('<p class="mt-2 text-xs text-amber-600 dark:text-amber-400">Sign in with an administrator account to create tokens in the browser.'),wf=i('<div class="rounded-lg border border-dashed border-blue-200 bg-blue-50/60 px-4 py-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-900/30 dark:text-blue-200">Pick an option above to unlock the install command.'),$f=i('<div class="rounded-lg border border-yellow-200 bg-yellow-50 px-4 py-3 text-xs text-yellow-800 dark:border-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-200">Need a reusable token? Generate one here or visit <a href=/settings/security class="underline hover:no-underline font-medium">Security Settings</a> to manage tokens across users.'),_f=i('<div class=space-y-4><div class=space-y-1><p class="text-sm font-semibold text-gray-900 dark:text-gray-100">Step 1 · Choose an API token</p><p class="text-sm text-gray-600 dark:text-gray-400">Use the token saved in this browser or create a new credential just for this Docker host. The choice will populate the install command automatically.</p></div><div class="grid gap-3 sm:grid-cols-2"><button type=button><div class="flex items-start justify-between gap-3"><div><p class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Option 1</p><h4 class="text-base font-semibold text-gray-900 dark:text-gray-100">Use saved token</h4></div><svg class="w-5 h-5 text-gray-400 dark:text-gray-500 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M5 13l4 4L19 7"></path></svg></div><p class="text-sm text-gray-600 dark:text-gray-400">Fill the install command with the API token already stored in this browser.</p></button><button type=button><div class="flex items-start justify-between gap-3"><div><p class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Option 2</p><h4 class="text-base font-semibold text-gray-900 dark:text-gray-100">Generate new token</h4></div><span class="inline-flex items-center px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300">Recommended</span></div><p class="text-sm text-gray-600 dark:text-gray-400">Create a fresh API token for this host and insert it into the install command automatically.</p></button></div><div class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-700 dark:bg-gray-800/50"><div class="flex items-start gap-3"><svg class="w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="flex-1 text-sm text-gray-700 dark:text-gray-300"><strong class="text-gray-900 dark:text-gray-100">Best practice:</strong> Give each Docker host its own API token. You can audit or revoke tokens anytime from <a href=/settings/security class="text-blue-600 dark:text-blue-400 underline hover:no-underline font-medium">Security Settings</a>.'),Cf=i('<div class=space-y-2><div class="flex items-center justify-between"><label class="text-sm font-medium text-gray-700 dark:text-gray-300">Step 2 · Install command</label><button type=button class="px-3 py-1.5 text-xs font-medium rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed bg-blue-600 text-white hover:bg-blue-700">Copy</button></div><div class="relative rounded-lg border-2 border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 p-3 overflow-x-auto"><code class="text-sm text-gray-900 dark:text-gray-100 font-mono break-all"></code></div><p class="text-xs text-gray-500 dark:text-gray-400">The installer downloads the agent, creates a systemd service, and starts reporting automatically.'),Sf=i('<details class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-700 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300"><summary class="cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100">Advanced options (uninstall & manual install)</summary><div class="mt-3 space-y-4"><div><p class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">Uninstall</p><div class="mt-2 flex items-center gap-2"><code class="flex-1 break-all rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-400 dark:bg-gray-950"></code><button type=button class="rounded bg-red-50 px-3 py-1 text-xs font-medium text-red-700 transition-colors hover:bg-red-100 dark:bg-red-900/30 dark:text-red-300 dark:hover:bg-red-900/50">Copy</button></div><p class="mt-2 text-xs text-gray-500 dark:text-gray-400">Stops the agent, removes the binary, the systemd unit, and related files.</p></div><div><p class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">Manual installation</p><div class="mt-2 space-y-3 rounded-lg border border-gray-200 bg-white p-3 text-xs dark:border-gray-700 dark:bg-gray-900"><p class="font-medium text-gray-900 dark:text-gray-100">1. Build the binary</p><div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950"><code>cd /opt/pulse<br>GOOS=linux GOARCH=amd64 go build -o pulse-docker-agent ./cmd/pulse-docker-agent</code></div><p class="font-medium text-gray-900 dark:text-gray-100">2. Copy to host</p><div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950"><code>scp pulse-docker-agent user@docker-host:/usr/local/bin/<br>ssh user@docker-host chmod +x /usr/local/bin/pulse-docker-agent</code></div><p class="font-medium text-gray-900 dark:text-gray-100">3. Systemd template</p><div class=relative><button type=button class="absolute right-2 top-2 rounded bg-gray-700 px-3 py-1 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600">Copy</button><div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950"><pre></pre></div></div><p class="font-medium text-gray-900 dark:text-gray-100">4. Enable & start</p><div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950"><code>systemctl daemon-reload<br>systemctl enable --now pulse-docker-agent'),Tf=i('<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-md rounded-lg bg-white p-6 shadow-xl dark:bg-gray-800"><div class=space-y-2><h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Generate a new Docker API token</h3><p class="text-sm text-gray-600 dark:text-gray-400">Pulse will create a scoped token and insert it into the install command. You can manage or revoke tokens anytime from Security Settings.</p></div><div class="mt-4 space-y-2"><label class="text-sm font-medium text-gray-700 dark:text-gray-300"for=docker-new-token-name>Token name</label><input id=docker-new-token-name type=text class="w-full rounded border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:focus:border-blue-400 dark:focus:ring-blue-900/60"placeholder="Docker host token"><p class="text-xs text-gray-500 dark:text-gray-400">Friendly names make it easier to audit tokens later (e.g. <code class="font-mono text-xs">docker-prod-01</code>).</p></div><div class="mt-6 flex justify-end gap-3"><button type=button class="rounded px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700">Cancel</button><button type=button class="rounded bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-500 dark:hover:bg-blue-400">'),Af=i('<p class="mt-2 leading-snug">'),Df=i('<p class="mt-2 font-medium text-red-600 dark:text-red-300">'),Mf=i('<div class="rounded border border-blue-200 bg-white px-3 py-2 text-xs text-blue-800 dark:border-blue-700 dark:bg-blue-800/20 dark:text-blue-200"><div class="flex items-center justify-between gap-3"><span class="font-semibold uppercase tracking-wide text-[11px] text-blue-600 dark:text-blue-300">Command status</span><span class="rounded-full bg-blue-100 px-2 py-0.5 text-[11px] font-medium uppercase text-blue-700 dark:bg-blue-900/40 dark:text-blue-300">'),Pf=i('<p class="text-xs text-blue-700 dark:text-blue-300">Hang tight—Pulse is waiting for the agent to acknowledge the stop command.'),Ef=i('<div class="rounded border border-emerald-200 bg-white p-3 text-xs text-emerald-800 dark:border-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-100"><p class=font-medium>Agent confirmed the stop. Pulse has already cleaned up everything it controls:</p><ul class="mt-2 space-y-1 leading-snug"><li>• Terminated the running <code class="font-mono text-[11px]">pulse-docker-agent</code> process</li><li>• Disabled future auto-start (stops the systemd unit or removes the Unraid autostart script if one exists)</li><li>• Cleared the host from the dashboard so new reports won’t appear unexpectedly</li></ul><p class=mt-2>The binary remains at <code class="font-mono text-[11px]">/usr/local/bin/pulse-docker-agent</code> for quick reinstalls. Use the uninstall command below if you prefer to remove it too.'),Nf=i('<p class="text-xs text-red-600 dark:text-red-300">'),Of=i(`<details class="rounded border border-blue-200 bg-white p-3 text-xs text-gray-700 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-200"><summary class="flex cursor-pointer items-center justify-between gap-2"><span class="font-semibold uppercase tracking-wide text-[11px] text-blue-700 dark:text-blue-300">Behind the scenes</span><code class="rounded bg-blue-100 px-2 py-0.5 font-mono text-[11px] text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"></code></summary><div class="mt-2 space-y-2"><ul class=space-y-1></ul><p class=leading-snug>Pulse responds to the agent's <code class="font-mono text-[11px]">/api/agents/docker/report</code> call with a stop command. The agent disables its service, removes<code class="font-mono text-[11px]">/boot/config/go.d/pulse-docker-agent.sh</code>, and posts back to<code class="font-mono text-[11px]">/api/agents/docker/commands/<id>/ack</code> so Pulse knows it can remove the row.`),Lf=i('<div class="rounded-lg border border-emerald-200 bg-emerald-50 p-4 dark:border-emerald-800 dark:bg-emerald-900/20"><div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between"><div><h4 class="text-sm font-semibold text-emerald-900 dark:text-emerald-100">Host is offline</h4><p class="text-sm text-emerald-800 dark:text-emerald-200">Tower stopped reporting. Remove it now to finish the cleanup.</p></div><button type=button class="self-start rounded bg-emerald-600 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-emerald-500 dark:hover:bg-emerald-400">'),Rf=i('<p class="text-[11px] font-medium text-gray-600 dark:text-gray-300">Command copied to clipboard.'),If=i('<p class="mt-1 text-xs text-blue-700 dark:text-blue-300">Already hidden.'),Hf=i('<div class="mt-3 space-y-3 text-sm"><div class="flex flex-col gap-2 rounded border border-gray-200 p-3 dark:border-gray-700"><div><p class="font-semibold text-gray-900 dark:text-gray-100">Manual uninstall command</p><p class="text-xs text-gray-600 dark:text-gray-400">Prefer to remove everything manually? Run this full uninstall on <code class="font-mono text-[11px]"></code>. It removes the service, startup script, log, and binary.</p></div><div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3"><code class="flex-1 rounded bg-gray-900 px-3 py-2 font-mono text-xs text-gray-100 dark:bg-gray-950 overflow-x-auto"></code><button type=button class="self-start rounded bg-gray-800 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-gray-700">Copy command</button></div><p class="text-[11px] text-gray-500 dark:text-gray-400">This command stops the agent, removes the systemd service (or Unraid autostart hook), deletes <code class="font-mono text-[11px]">/var/log/pulse-docker-agent.log</code>, and uninstalls the binary. Pulse will notice the host is gone after the next heartbeat (≈2 minutes) and clean up the row automatically.</p></div><div class="flex flex-col gap-2 rounded border border-gray-200 p-3 dark:border-gray-700"><div><p class="font-semibold text-gray-900 dark:text-gray-100">Force remove immediately</p><p class="text-xs text-gray-600 dark:text-gray-400">Skips the stop command and removes the entry right away. Any new report from this host will be rejected until you reinstall.</p></div><button type=button class="self-start rounded bg-red-600 px-3 py-1.5 text-xs font-semibold text-white transition-colors hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-red-500 dark:hover:bg-red-400"></button></div><div class="flex flex-col gap-2 rounded border border-gray-200 p-3 dark:border-gray-700"><div><p class="font-semibold text-gray-900 dark:text-gray-100">Hide the host instead</p><p class="text-xs text-gray-600 dark:text-gray-400">Remove it from the default view without uninstalling the agent. It will reappear if the agent reports again.</p></div><button type=button class="self-start rounded bg-gray-200 px-3 py-1.5 text-xs font-medium text-gray-800 transition-colors hover:bg-gray-300 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600">'),Uf=i('<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-2xl rounded-lg bg-white p-6 shadow-xl dark:bg-gray-800"><div class=space-y-2><h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Remove Docker host "<!>"</h3><p class="text-sm text-gray-600 dark:text-gray-400">Pulse guides you through uninstalling the agent and safely cleaning up the host entry.</p></div><div class="mt-4 space-y-4"><div class="rounded-lg border border-blue-200 bg-blue-50 p-4 space-y-3 dark:border-blue-800 dark:bg-blue-900/20"><div class="flex items-start gap-3"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="flex-1 space-y-2"><h4 class="text-sm font-semibold text-blue-900 dark:text-blue-100">Step 1 · Pulse stops the agent</h4><p class="text-sm text-blue-800 dark:text-blue-200">Pulse will queue a stop command with this host. The agent shuts down its system service (or Unraid autostart hook if present), confirms back to Pulse, and the row disappears as soon as that acknowledgement arrives—or after the next missed heartbeat.</p><button type=button></button></div></div></div><div class="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-900"><button type=button class="flex w-full items-center justify-between text-sm font-semibold text-gray-900 transition-colors hover:text-blue-600 dark:text-gray-100 dark:hover:text-blue-300"><span>Need something else?</span><svg fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7"></path></svg></button></div></div><div class="mt-6 flex justify-end"><button type=button class="rounded px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700">Close'),Bf=i('<div class="rounded-lg border border-yellow-200 bg-yellow-50 px-4 py-3 dark:border-yellow-700 dark:bg-yellow-900/30"><div class="flex items-start gap-3"><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class=flex-1><h4 class="text-sm font-semibold text-yellow-900 dark:text-yellow-100">Stopping <!> host</h4><p class="mt-1 text-sm text-yellow-800 dark:text-yellow-200">Pulse has sent the stop command. Once an agent acknowledges (or goes offline), the entry will disappear automatically.'),jf=i('<button type=button class="px-3 py-1.5 text-xs font-medium rounded transition-colors bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"> hidden (<!>)'),Ff=i('<div class=overflow-x-auto><table class="w-full text-sm"><thead><tr class="border-b border-gray-200 dark:border-gray-700"><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Host</th><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Status</th><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Containers</th><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Docker Version</th><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Agent Version</th><th class="text-left py-3 px-4 font-medium text-gray-600 dark:text-gray-400">Last Seen</th><th class="py-3 px-4"></th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),Vf=i('<div class=space-y-4><div class="flex items-center justify-between"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-100">Reporting Docker hosts (<!>)'),Gf=i('<div class="flex items-start gap-3"><div class=flex-shrink-0><svg class="w-5 h-5 text-blue-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div><div class="flex-1 min-w-0"><h4 class="text-sm font-medium text-gray-900 dark:text-gray-100">Agent-based monitoring</h4><p class="text-xs text-gray-600 dark:text-gray-400 mt-1">Docker hosts run the Pulse agent and push metrics to this server. No inbound firewall rules required.'),zf=i('<div class="flex items-start gap-3"><div class=flex-shrink-0><svg class="w-5 h-5 text-amber-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg></div><div class="flex-1 min-w-0"><h4 class="text-sm font-medium text-gray-900 dark:text-gray-100">Agent requirements</h4><p class="text-xs text-gray-600 dark:text-gray-400 mt-1">The agent needs access to the Docker socket (/var/run/docker.sock) and network connectivity to this Pulse instance.'),Wf=i('<div class=space-y-6><div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"><button type=button class="px-4 py-2 text-sm font-medium text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/30 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors"> deployment instructions</button></div><div class="grid gap-4 sm:grid-cols-2">'),qf=i("<li><span>"),Kf=i('<div class="text-center py-8"><div class="text-gray-400 dark:text-gray-500 mb-2"><svg class="w-12 h-12 mx-auto"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg></div><p class="text-sm text-gray-600 dark:text-gray-400">No Docker agents are currently reporting.</p><p class="text-xs text-gray-500 dark:text-gray-500 mt-1">Click "Show deployment instructions" above to get started.'),Jf=i("<span class=mx-1>•"),Qf=i('<div class="text-xs text-gray-400 dark:text-gray-500 mt-1">'),Yf=i('<span class="inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300"><svg class="w-3 h-3"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>Stopping'),Xf=i('<span class="inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"><svg class="w-3 h-3"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M18.364 5.636l-12.728 12.728M5.636 5.636l12.728 12.728"></path></svg>Failed'),Zf=i('<span class="inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300"><svg class="w-3 h-3"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M5 13l4 4L19 7"></path></svg>Stopped'),ei=i('<button type=button class="text-xs font-semibold text-blue-600 hover:text-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">'),em=i('<tr><td class="py-3 px-4"><div class="font-medium text-gray-900 dark:text-gray-100"></div><div class="text-xs text-gray-500 dark:text-gray-400"></div></td><td class="py-3 px-4"><div class="flex items-center gap-2"><span></span></div></td><td class="py-3 px-4"><div class="text-gray-900 dark:text-gray-100"> / </div><div class="text-xs text-gray-500 dark:text-gray-400">running</div></td><td class="py-3 px-4"><div class="text-gray-900 dark:text-gray-100"></div></td><td class="py-3 px-4"><div class="text-gray-900 dark:text-gray-100"></div><div class="text-xs text-gray-500 dark:text-gray-400">every <!>s</div></td><td class="py-3 px-4"><div class="text-gray-900 dark:text-gray-100"></div><div class="text-xs text-gray-500 dark:text-gray-400"></div></td><td class="py-3 px-4 text-right">'),tm=i('<button type=button class="text-xs font-semibold text-blue-600 disabled:opacity-50 disabled:cursor-not-allowed"disabled>'),ti=i('<button type=button class="text-xs font-semibold text-red-600 hover:text-red-700 disabled:opacity-50 disabled:cursor-not-allowed">');const rm=()=>{const{state:e}=qr(),[r,s]=Z(!0);let l=!1,o=!1,a=!1,d=!1,c=null;const[g,b]=Z(!1),p=()=>{const Ae=e.dockerHosts||[];return g()?Ae:Ae.filter(Fe=>!Fe.hidden)},m=()=>(e.dockerHosts||[]).filter(Ae=>Ae.hidden).length,S=()=>p().filter(Ae=>{const Fe=Ae.command?.status;return Fe==="queued"||Fe==="dispatched"||Fe==="acknowledged"?!0:!!Ae.pendingUninstall}),[z,ie]=Z(null),[ne,W]=Z(!1),[X,I]=Z(null),[L,H]=Z(!1),[se,le]=Z(null),[ee,U]=Z(!1),[Y,oe]=Z(null),[_,B]=Z(null),[$,D]=Z([]),[f,j]=Z(!1),[K,C]=Z(!1),[ge,J]=Z(!1),[N,F]=Z(!1),[P,E]=Z(!1),[u,v]=Z(null),[V,A]=Z(!1),[k,w]=Z(""),de=()=>{if(typeof window<"u"){const Ae=window.location.protocol,Fe=window.location.hostname,Qe=window.location.port;return`${Ae}//${Fe}${Qe?`:${Qe}`:""}`}return"http://localhost:7655"},fe="<api-token>",x=pe(()=>{const Ae=X();return Ae?(e.dockerHosts||[]).find(Fe=>Fe.id===Ae)??null:null}),R=Ae=>Ae.displayName||Ae.hostname||Ae.id,Q=()=>{const Ae=x();return Ae?R(Ae):""},G=()=>{const Ae=x();return Ae?.hostname||Ae?.id||""},T=()=>x()?.status||"unknown",te=()=>T().toLowerCase()==="online",ae=()=>!!x()?.hidden,M=pe(()=>x()?.command??null),ce=pe(()=>M()?.status??null),ue=pe(()=>{const Ae=ce();return Ae==="queued"||Ae==="dispatched"||Ae==="acknowledged"}),re=pe(()=>ce()==="failed"),O=pe(()=>ce()==="completed"),xe=pe(()=>{const Ae=M();if(!Ae)return[];const Fe={queued:0,dispatched:1,acknowledged:2,completed:3,failed:4,expired:5},Qe=Fe[Ae.status]??0;return[{key:"queued",label:"Stop command queued"},{key:"dispatched",label:"Instruction delivered to the agent"},{key:"acknowledged",label:"Agent acknowledged the stop request"},{key:"completed",label:"Agent disabled the service and removed autostart"}].map(Vt=>{const Et=Fe[Vt.key]??0;return{label:Vt.label,done:Qe>Et,active:Qe===Et}})});ft(()=>{if(!ne())return;const Ae=X(),Fe=x();Ae&&!Fe&<()}),vr(()=>{if(typeof window>"u")return;const Fe=window.localStorage.getItem("apiToken");Fe&&oe(Fe);const Qe=Vt=>{Vt.key==="apiToken"&&oe(Vt.newValue)};window.addEventListener("storage",Qe),Ar(()=>window.removeEventListener("storage",Qe)),(async()=>{try{const Vt=await fetch("/api/security/status",{credentials:"include"});if(Vt.ok){const Et=await Vt.json();B(Et)}}catch(Vt){l||(l=!0,console.error("Failed to load security status",Vt))}})()});const he=async()=>{if(!f()){j(!0),J(!1);try{const Fe=[...await Es.listTokens()].sort((Qe,xt)=>new Date(xt.createdAt).getTime()-new Date(Qe.createdAt).getTime());D(Fe),E(!1),d=!1,a=!1,C(!0)}catch(Ae){J(!0),Ae instanceof Error&&/authentication required/i.test(Ae.message)?(E(!0),o||(o=!0,console.debug("API token listing requires authentication.")),d||(d=!0,Yt.error("Authentication required to list API tokens",6e3))):a||(a=!0,console.error("Failed to load API tokens",Ae),Yt.error("Failed to load API tokens",6e3))}finally{j(!1)}}},me=()=>{f()||(Yt.info("Retrying API token load…",4e3),C(!1),he())};ft(Wn(()=>r(),Ae=>{Ae&&!K()&&!f()&&he()}));const _e=()=>!!Y(),Ce=()=>!P(),Oe=()=>!Ke()||!!Y()&&u()!==null,tt=()=>{const Ae=_()?.apiTokenHint;return Ae?$().find(Fe=>`${Fe.prefix}...${Fe.suffix}`===Ae):null};ft(Wn(()=>[Ke(),Y(),u()],([Ae,Fe,Qe])=>{if(!Ae){v("existing");return}!Fe&&Qe==="existing"&&v(null)}));const Ze=async Ae=>{try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(Ae),!0;if(typeof document>"u")return!1;const Fe=document.createElement("textarea");Fe.value=Ae,Fe.style.position="fixed",Fe.style.left="-999999px",Fe.style.top="-999999px",document.body.appendChild(Fe),Fe.focus(),Fe.select();try{return document.execCommand("copy")}finally{document.body.removeChild(Fe)}}catch(Fe){return console.error("Failed to copy to clipboard",Fe),!1}},bt=()=>{if(!_e()){typeof window<"u"&&window.showToast&&window.showToast("warning","No saved token found in this browser. Generate a new token instead.");return}v("existing"),typeof window<"u"&&window.showToast&&window.showToast("success","Install command updated with your saved token.")},ct=()=>{if(!Ce()){typeof window<"u"&&window.showToast&&window.showToast("error","Sign in with an administrator account to generate tokens here.");return}const Fe=`Docker host ${$().length+1}`;c=u(),v("generate"),w(Fe),A(!0)},qe=async()=>{if(!N()){if(!Ce()){Yt.error("You need administrator access to create API tokens from here.",6e3);return}F(!0);try{const Ae=$(),Fe=`Docker host ${Ae.length+1}`,Qe=k().trim()||Fe,{token:xt,record:Vt}=await Es.createToken(Qe),Et=Ae.filter(Jt=>Jt.id!==Vt.id);if(D([Vt,...Et]),oe(xt),v("generate"),c="generate",A(!1),w(""),pa({token:xt,record:Vt,source:"docker",note:"Copy this token into the install command for your Docker agent or other automation."}),typeof window<"u")try{window.localStorage.setItem("apiToken",xt),window.dispatchEvent(new StorageEvent("storage",{key:"apiToken",newValue:xt}))}catch(Jt){console.warn("Unable to persist API token in localStorage",Jt)}Yt.success("New API token generated and added to the install command.",6e3)}catch(Ae){console.error("Failed to generate API token",Ae),Yt.error("Failed to generate API token",6e3)}finally{F(!1)}}},Ke=()=>{const Ae=_();return Ae?Ae.requiresAuth||Ae.apiTokenConfigured:!0},Xe=()=>{const Ae=de();return Ke()?`curl -fsSL ${Ae}/install-docker-agent.sh | bash -s -- --url ${Ae} --token ${fe}`:`curl -fsSL ${Ae}/install-docker-agent.sh | bash -s -- --url ${Ae} --token disabled`},_t=()=>`curl -fsSL ${de()}/install-docker-agent.sh | bash -s -- --uninstall`,Lt=()=>{const Ae=Ke()?fe:"disabled";return`[Unit]
|
||
Description=Pulse Docker Agent
|
||
After=network-online.target docker.service
|
||
Wants=network-online.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
ExecStart=/usr/local/bin/pulse-docker-agent --url ${de()} --token ${Ae} --interval 30s
|
||
Restart=always
|
||
RestartSec=5s
|
||
User=root
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target`},vt=Ae=>z()===Ae,Ve=Ae=>{I(Ae.id),H(!1),le(null),U(!1),W(!0)},lt=()=>{W(!1),I(null),H(!1),le(null),U(!1)},Re=async()=>{const Ae=x();if(!Ae||se())return;const Fe=R(Ae);ie(Ae.id),le("queue");try{await _s.deleteDockerHost(Ae.id),Yt.success(`Stop command sent to ${Fe}`,3500)}catch(Qe){console.error("Failed to queue Docker host stop command",Qe);const xt=Qe instanceof Error?Qe.message:"Failed to send stop command";Yt.error(xt,8e3)}finally{ie(null),le(null)}},gt=async()=>{const Ae=x();if(!Ae||se())return;const Fe=R(Ae);ie(Ae.id),le("hide");try{await _s.deleteDockerHost(Ae.id,{hide:!0}),Yt.success(`Hidden Docker host ${Fe}`,3500),lt()}catch(Qe){console.error("Failed to hide Docker host",Qe);const xt=Qe instanceof Error?Qe.message:"Failed to hide Docker host";Yt.error(xt,8e3)}finally{ie(null),le(null)}},mt=async()=>{const Ae=x();if(!Ae||se())return;const Fe=R(Ae);ie(Ae.id),le("force");try{await _s.deleteDockerHost(Ae.id,{force:!0}),Yt.success(`Removed Docker host ${Fe}`,3500),lt()}catch(Qe){console.error("Failed to remove Docker host",Qe);const xt=Qe instanceof Error?Qe.message:"Failed to remove Docker host";Yt.error(xt,8e3)}finally{ie(null),le(null)}},Rt=async(Ae,Fe)=>{if(!vt(Ae)){ie(Ae);try{await _s.deleteDockerHost(Ae,{force:!0}),Yt.success(`Removed Docker host ${Fe}`,3500),X()===Ae&<()}catch(Qe){console.error("Failed to remove Docker host",Qe);const xt=Qe instanceof Error?Qe.message:"Failed to remove Docker host";Yt.error(xt,8e3)}finally{ie(null)}}},It=async(Ae,Fe)=>{if(!vt(Ae)){ie(Ae);try{await _s.unhideDockerHost(Ae),Yt.success(`Unhidden Docker host ${Fe}`,3500)}catch(Qe){console.error("Failed to unhide Docker host",Qe);const xt=Qe instanceof Error?Qe.message:"Failed to unhide Docker host";Yt.error(xt,8e3)}finally{ie(null)}}};return(()=>{var Ae=Wf(),Fe=Ae.firstChild,Qe=Fe.firstChild,xt=Qe.firstChild,Vt=Fe.nextSibling;return t(Fe,n(rr,{title:"Docker agent monitoring",size:"md",class:"flex-1"}),Qe),Qe.$$click=()=>s(!r()),t(Qe,()=>r()?"Hide":"Show",xt),t(Ae,n(h,{get when(){return r()},get children(){return n(it,{class:"space-y-5",get children(){return[gf(),hf(),n(h,{get when(){return Ke()},get children(){var Et=_f(),Jt=Et.firstChild,er=Jt.nextSibling,Ut=er.firstChild,lr=Ut.firstChild;lr.nextSibling;var Bt=Ut.nextSibling,et=Bt.firstChild;return et.nextSibling,er.nextSibling,t(Et,n(h,{get when(){return f()},get children(){return ff()}}),er),t(Et,n(h,{get when(){return ge()},get children(){var we=xf(),Je=we.firstChild,Ge=Je.nextSibling,pt=Ge.firstChild;return t(Je,()=>P()?"Authentication required to list API tokens. Sign in with an administrator account, then try again.":"Failed to load API tokens. Please try again."),pt.$$click=me,t(Ge,n(h,{get when(){return!P()},get children(){return mf()}}),null),q(()=>pt.disabled=f()),we}}),er),Ut.$$click=bt,t(Ut,n(h,{get when(){return _e()},get children(){var we=yf();return we.firstChild,t(we,n(h,{get when(){return tt()},get children(){var Je=pf(),Ge=Je.firstChild;return t(Ge,()=>tt()?.name),t(Je,n(h,{get when(){return _()?.apiTokenHint},get children(){return[" ","·"," ",(()=>{var pt=bf();return t(pt,()=>_()?.apiTokenHint),pt})()]}}),null),Je}}),null),we}}),null),t(Ut,n(h,{get when(){return!_e()},get children(){return vf()}}),null),Bt.$$click=ct,t(Bt,n(h,{get when(){return!Ce()},get children(){return kf()}}),null),t(Et,n(h,{get when(){return!Oe()},get children(){return wf()}}),null),t(Et,n(h,{get when(){return!_e()},get children(){return $f()}}),null),q(we=>{var Je=!_e(),Ge=`relative flex flex-col gap-2 p-4 text-left rounded-lg border transition shadow-sm ${u()==="existing"?"border-blue-500 ring-2 ring-blue-200 dark:ring-blue-400/40 bg-blue-50/40 dark:bg-blue-900/10":"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 hover:border-blue-300 dark:hover:border-blue-500 hover:bg-blue-50/20 dark:hover:bg-blue-900/10"} disabled:opacity-60 disabled:cursor-not-allowed`,pt=!Ce(),dt=`relative flex flex-col gap-2 p-4 text-left rounded-lg border transition shadow-sm ${u()==="generate"?"border-blue-500 ring-2 ring-blue-200 dark:ring-blue-400/40 bg-blue-50/40 dark:bg-blue-900/10":"border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 hover:border-blue-300 dark:hover:border-blue-500 hover:bg-blue-50/20 dark:hover:bg-blue-900/10"} disabled:opacity-60 disabled:cursor-not-allowed`;return Je!==we.e&&(Ut.disabled=we.e=Je),Ge!==we.t&&y(Ut,we.t=Ge),pt!==we.a&&(Bt.disabled=we.a=pt),dt!==we.o&&y(Bt,we.o=dt),we},{e:void 0,t:void 0,a:void 0,o:void 0}),Et}}),n(h,{get when(){return Oe()},get children(){var Et=Cf(),Jt=Et.firstChild,er=Jt.firstChild,Ut=er.nextSibling,lr=Jt.nextSibling,Bt=lr.firstChild;return Ut.$$click=async()=>{const et=Xe().replace(fe,Y()||fe),we=await Ze(et);typeof window<"u"&&window.showToast&&window.showToast(we?"success":"error",we?"Copied!":"Failed to copy")},t(Bt,()=>Xe().replace(fe,Y()||fe)),q(()=>Ut.disabled=Ke()&&!Y()),Et}}),(()=>{var Et=Sf(),Jt=Et.firstChild,er=Jt.nextSibling,Ut=er.firstChild,lr=Ut.firstChild,Bt=lr.nextSibling,et=Bt.firstChild,we=et.nextSibling,Je=Ut.nextSibling,Ge=Je.firstChild,pt=Ge.nextSibling,dt=pt.firstChild,ht=dt.nextSibling,We=ht.nextSibling,st=We.nextSibling,nr=st.nextSibling,xr=nr.nextSibling,cr=xr.firstChild,sr=cr.nextSibling,wr=sr.firstChild;return t(et,_t),we.$$click=async()=>{const Gt=await Ze(_t());typeof window<"u"&&window.showToast&&window.showToast(Gt?"success":"error",Gt?"Copied to clipboard":"Failed to copy to clipboard")},cr.$$click=async()=>{const Gt=await Ze(Lt());typeof window<"u"&&window.showToast&&window.showToast(Gt?"success":"error",Gt?"Copied to clipboard":"Failed to copy to clipboard")},t(wr,Lt),Et})()]}})}}),Vt),t(Ae,n(h,{get when(){return V()},get children(){var Et=Tf(),Jt=Et.firstChild,er=Jt.firstChild,Ut=er.nextSibling,lr=Ut.firstChild,Bt=lr.nextSibling,et=Ut.nextSibling,we=et.firstChild,Je=we.nextSibling;return Bt.$$input=Ge=>w(Ge.currentTarget.value),we.$$click=()=>{A(!1),w(""),v(c),c=null},Je.$$click=qe,t(Je,()=>N()?"Generating…":"Generate token"),q(()=>Je.disabled=N()),q(()=>Bt.value=k()),Et}}),Vt),t(Ae,n(h,{get when(){return ne()},get children(){var Et=Uf(),Jt=Et.firstChild,er=Jt.firstChild,Ut=er.firstChild,lr=Ut.firstChild,Bt=lr.nextSibling;Bt.nextSibling;var et=er.nextSibling,we=et.firstChild,Je=we.firstChild,Ge=Je.firstChild,pt=Ge.nextSibling,dt=pt.firstChild,ht=dt.nextSibling,We=ht.nextSibling,st=we.nextSibling,nr=st.firstChild,xr=nr.firstChild,cr=xr.nextSibling,sr=et.nextSibling,wr=sr.firstChild;return t(Ut,Q,Bt),t(pt,n(h,{get when(){return M()},get children(){var Gt=Mf(),br=Gt.firstChild,pr=br.firstChild,yr=pr.nextSibling;return t(yr,ce),t(Gt,n(h,{get when(){return M()?.message},get children(){var Er=Af();return t(Er,()=>M()?.message),Er}}),null),t(Gt,n(h,{get when(){return re()},get children(){var Er=Df();return t(Er,()=>M()?.failureReason||"Pulse could not stop the agent automatically."),Er}}),null),Gt}}),We),We.$$click=Re,t(We,()=>se()==="queue"?"Sending…":ue()?"Waiting for agent…":ce()==="completed"?"Agent stopped":re()?"Retry stop command":"Stop agent now"),t(pt,n(h,{get when(){return ue()},get children(){return Pf()}}),null),t(pt,n(h,{get when(){return O()},get children(){return Ef()}}),null),t(pt,n(h,{get when(){return $e(()=>!!re())()&&M()?.failureReason},get children(){var Gt=Nf();return t(Gt,()=>M()?.failureReason),Gt}}),null),t(pt,n(h,{get when(){return M()},get children(){var Gt=Of(),br=Gt.firstChild,pr=br.firstChild,yr=pr.nextSibling,Er=br.nextSibling,Nr=Er.firstChild;return t(yr,()=>M()?.id),t(Nr,n(ze,{get each(){return xe()},children:Or=>(()=>{var Zr=qf(),gn=Zr.firstChild;return t(Zr,()=>Or.label,null),q(en=>{var sn=`${Or.done||Or.active?"text-blue-700 dark:text-blue-200":"text-gray-500 dark:text-gray-400"} flex items-center gap-2`,hn=`h-2 w-2 rounded-full ${Or.done?"bg-blue-500":Or.active?"bg-blue-400 animate-pulse":"bg-gray-300 dark:bg-gray-600"}`;return sn!==en.e&&y(Zr,en.e=sn),hn!==en.t&&y(gn,en.t=hn),en},{e:void 0,t:void 0}),Zr})()})),Gt}}),null),t(et,n(h,{get when(){return!te()},get children(){var Gt=Lf(),br=Gt.firstChild,pr=br.firstChild,yr=pr.nextSibling;return yr.$$click=mt,t(yr,()=>se()==="force"?"Removing…":"Remove host"),q(()=>yr.disabled=se()!==null),Gt}}),st),nr.$$click=()=>U(Gt=>!Gt),t(st,n(h,{get when(){return ee()},get children(){var Gt=Hf(),br=Gt.firstChild,pr=br.firstChild,yr=pr.firstChild,Er=yr.nextSibling,Nr=Er.firstChild,Or=Nr.nextSibling,Zr=pr.nextSibling,gn=Zr.firstChild,en=gn.nextSibling,sn=Zr.nextSibling,hn=br.nextSibling,xn=hn.firstChild,bn=xn.nextSibling,Dn=hn.nextSibling,an=Dn.firstChild,Hn=an.firstChild;Hn.nextSibling;var kn=an.nextSibling;return t(Or,G),t(gn,_t),en.$$click=async()=>{const Br=await Ze(_t());Br&&H(!0),typeof window<"u"&&window.showToast&&window.showToast(Br?"success":"error",Br?"Copied!":"Failed to copy")},t(br,n(h,{get when(){return L()},get children(){return Rf()}}),sn),bn.$$click=mt,t(bn,()=>se()==="force"?"Removing…":"Force remove now"),t(an,n(h,{get when(){return ae()},get children(){return If()}}),null),kn.$$click=gt,t(kn,(()=>{var Br=$e(()=>se()==="hide");return()=>Br()?"Hiding...":ae()?"Already hidden":"Hide host"})()),q(Br=>{var ke=se()!==null,Me=se()!==null||ae();return ke!==Br.e&&(bn.disabled=Br.e=ke),Me!==Br.t&&(kn.disabled=Br.t=Me),Br},{e:void 0,t:void 0}),Gt}}),null),wr.$$click=lt,q(Gt=>{var br=se()!==null||ue()||ce()==="completed",pr=`inline-flex items-center justify-center rounded px-4 py-2 text-sm font-medium text-white transition-colors ${ce()==="completed"?"bg-emerald-600 dark:bg-emerald-500":"bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400"} disabled:cursor-not-allowed disabled:opacity-60`,yr=`h-4 w-4 transition-transform ${ee()?"rotate-180":""}`;return br!==Gt.e&&(We.disabled=Gt.e=br),pr!==Gt.t&&y(We,Gt.t=pr),yr!==Gt.a&&Te(cr,"class",Gt.a=yr),Gt},{e:void 0,t:void 0,a:void 0}),Et}}),Vt),t(Ae,n(it,{get children(){var Et=Vf(),Jt=Et.firstChild,er=Jt.firstChild,Ut=er.firstChild,lr=Ut.nextSibling;return lr.nextSibling,t(Et,n(h,{get when(){return S().length>0},get children(){var Bt=Bf(),et=Bt.firstChild,we=et.firstChild,Je=we.nextSibling,Ge=Je.firstChild,pt=Ge.firstChild,dt=pt.nextSibling;return dt.nextSibling,t(Ge,()=>S().length,dt),t(Ge,()=>S().length!==1?"s":"",null),Bt}}),Jt),t(er,()=>p().length,lr),t(Jt,n(h,{get when(){return m()>0},get children(){var Bt=jf(),et=Bt.firstChild,we=et.nextSibling;return we.nextSibling,Bt.$$click=()=>b(!g()),t(Bt,()=>g()?"Hide":"Show",et),t(Bt,m,we),Bt}}),null),t(Et,n(h,{get when(){return p().length>0},get fallback(){return Kf()},get children(){var Bt=Ff(),et=Bt.firstChild,we=et.firstChild,Je=we.nextSibling;return t(Je,n(ze,{get each(){return p()},children:Ge=>{const pt=Ge.status?.toLowerCase()==="online",dt=Ge.containers?.filter(sr=>sr.state?.toLowerCase()==="running").length||0,ht=R(Ge),We=Ge.command?.status??null,st=We==="queued"||We==="dispatched"||We==="acknowledged",nr=We==="failed",xr=We==="completed",cr=nr?"Force remove host":Ge.pendingUninstall?"Clean up pending host":"Remove offline host";return(()=>{var sr=em(),wr=sr.firstChild,Gt=wr.firstChild,br=Gt.nextSibling,pr=wr.nextSibling,yr=pr.firstChild,Er=yr.firstChild,Nr=pr.nextSibling,Or=Nr.firstChild,Zr=Or.firstChild,gn=Nr.nextSibling,en=gn.firstChild,sn=gn.nextSibling,hn=sn.firstChild,xn=hn.nextSibling,bn=xn.firstChild,Dn=bn.nextSibling;Dn.nextSibling;var an=sn.nextSibling,Hn=an.firstChild,kn=Hn.nextSibling,Br=an.nextSibling;return y(sr,`${pt?"bg-white dark:bg-gray-900":"bg-gray-50 dark:bg-gray-800/50 opacity-60"}`),t(Gt,()=>Ge.displayName),t(br,()=>Ge.hostname),t(wr,n(h,{get when(){return Ge.os||Ge.architecture},get children(){var ke=Qf();return t(ke,()=>Ge.os,null),t(ke,n(h,{get when(){return Ge.os&&Ge.architecture},get children(){return Jf()}}),null),t(ke,()=>Ge.architecture,null),ke}}),null),y(Er,`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${pt?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"}`),t(Er,()=>Ge.status||"unknown"),t(yr,n(h,{when:st,get children(){return Yf()}}),null),t(yr,n(h,{when:nr,get children(){return Xf()}}),null),t(yr,n(h,{when:xr,get children(){return Zf()}}),null),t(Or,dt,Zr),t(Or,()=>Ge.containers?.length||0,null),t(en,()=>Ge.dockerVersion||"—"),t(hn,()=>Ge.agentVersion||"—"),t(xn,()=>Ge.intervalSeconds||0,Dn),t(Hn,(()=>{var ke=$e(()=>!!Ge.lastSeen);return()=>ke()?An(Ge.lastSeen):"—"})()),t(kn,(()=>{var ke=$e(()=>!!Ge.lastSeen);return()=>ke()?ao(Ge.lastSeen):"—"})()),t(Br,n(h,{get when(){return Ge.hidden},get fallback(){return[n(h,{when:st||xr,get children(){var ke=tm();return t(ke,xr?"Cleaning up…":"Stopping…"),ke}}),n(h,{when:nr,get fallback(){return n(h,{when:!pt,get fallback(){return(()=>{var ke=ti();return ke.$$click=()=>Ve(Ge),t(ke,()=>vt(Ge.id)?"Working…":"Remove"),q(()=>ke.disabled=vt(Ge.id)),ke})()},get children(){var ke=ei();return ke.$$click=()=>Rt(Ge.id,ht),t(ke,()=>vt(Ge.id)?"Cleaning up…":cr),q(()=>ke.disabled=vt(Ge.id)),ke}})},get children(){var ke=ti();return ke.$$click=()=>Rt(Ge.id,ht),t(ke,()=>vt(Ge.id)?"Removing…":"Force remove"),q(()=>ke.disabled=vt(Ge.id)),ke}})]},get children(){var ke=ei();return ke.$$click=()=>It(Ge.id,ht),t(ke,()=>vt(Ge.id)?"Unhiding…":"Unhide"),q(()=>ke.disabled=vt(Ge.id)),ke}})),sr})()}})),Bt}}),null),Et}}),Vt),t(Vt,n(it,{tone:"info",padding:"sm",get children(){return Gf()}}),null),t(Vt,n(it,{tone:"warning",padding:"sm",get children(){return zf()}}),null),Ae})()};Xt(["click","input"]);var nm=i("<button type=button><span>"),sm=i("<label>"),am=i('<span class="flex flex-col text-sm text-gray-700 dark:text-gray-300">'),lm=i('<span class="text-xs text-gray-500 dark:text-gray-400">');const im={xs:{track:"h-4 w-7",knob:"h-3 w-3",translate:"12px"},sm:{track:"h-5 w-9",knob:"h-4 w-4",translate:"16px"},md:{track:"h-6 w-11",knob:"h-5 w-5",translate:"20px"}};function sa(e){const r=e.size??"sm",s=im[r],l=()=>!!e.disabled,o="bg-blue-500 dark:bg-blue-500",a="bg-gray-300 dark:bg-gray-600",d="bg-gray-200 dark:bg-gray-700 cursor-not-allowed opacity-60",c="bg-white shadow-md",g=()=>{if(l())return;const b=!e.checked;e.onToggle?.(),e.onChange?.({currentTarget:{checked:b}})};return(()=>{var b=nm(),p=b.firstChild;return b.$$click=g,q(m=>{var S=`relative inline-flex ${s.track} shrink-0 items-center rounded-full p-0.5 transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-900 ${l()?d:e.checked?o:a} ${e.class??""}`.trim(),z=e.disabled,ie=e.title,ne=e.checked?"true":"false",W=e.ariaLabel,X=`inline-block ${s.knob} rounded-full transition-transform duration-200 ease-in-out ${c} ${l()?"opacity-60":""}`,I=e.checked?`translateX(${s.translate})`:"translateX(0)";return S!==m.e&&y(b,m.e=S),z!==m.t&&(b.disabled=m.t=z),ie!==m.a&&Te(b,"title",m.a=ie),ne!==m.o&&Te(b,"aria-pressed",m.o=ne),W!==m.i&&Te(b,"aria-label",m.i=W),X!==m.n&&y(p,m.n=X),I!==m.s&&((m.s=I)!=null?p.style.setProperty("transform",I):p.style.removeProperty("transform")),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),b})()}function Tn(e){const r=e.size??"md";return(()=>{var s=sm();return t(s,n(sa,kr(e,{size:r})),null),t(s,(()=>{var l=$e(()=>!!(e.label||e.description));return()=>l()&&(()=>{var o=am();return t(o,()=>e.label,null),t(o,(()=>{var a=$e(()=>!!e.description);return()=>a()&&(()=>{var d=lm();return t(d,()=>e.description),d})()})(),null),o})()})(),null),q(()=>y(s,`flex items-center gap-3 ${e.containerClass??""}`.trim())),s})()}Xt(["click"]);var om=i('<div class="bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center gap-3"><div class="p-2 bg-blue-100 dark:bg-blue-900/40 rounded-lg"><svg class="w-5 h-5 text-blue-600 dark:text-blue-300"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=1.8 d="M21 12c0 4.97-4.03 9-9 9m9-9c0-4.97-4.03-9-9-9m9 9H3m9 9c-4.97 0-9-4.03-9-9m9 9c-1.5-1.35-3-4.5-3-9s1.5-7.65 3-9m0 18c1.5-1.35 3-4.5 3-9s-1.5-7.65-3-9">'),dm=i('<div class="flex items-center gap-3 text-sm text-gray-600 dark:text-gray-300"><span class="h-4 w-4 border-2 border-current border-t-transparent rounded-full animate-spin"></span>Loading OIDC settings...'),cm=i('<div class="bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded p-3 text-xs text-amber-800 dark:text-amber-200"><strong>Managed by environment variables:</strong> OIDC settings are currently defined through environment variables. Edit the deployment configuration to make changes.'),um=i('<button type=button class="text-xs text-blue-600 hover:underline dark:text-blue-300">Clear stored secret'),gm=i(`<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label>Issuer URL</label><input type=url placeholder=https://login.example.com/realms/pulse required><p>Base issuer URL from your OIDC provider configuration.</p></div><div><label>Client ID</label><input type=text placeholder=pulse-client required></div><div><div class="flex items-center justify-between"><label>Client secret</label></div><input type=password><p>Optional - Leave blank if your provider supports PKCE (Zitadel, Authentik, etc). Otherwise, enter your client secret.</p></div><div><label>Redirect URL</label><input type=url><p></p></div><div><label>Logout URL</label><input type=url placeholder=https://auth.example.com/application/o/pulse/end-session/><p>Optional - OIDC end-session URL for proper logout (e.g., Authentik's end-session endpoint). Leave blank to use local logout only.`),hm=i('<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><label>Scopes</label><input type=text placeholder="openid profile email"><p>Space-separated list of scopes requested during login.</p></div><div><label>Username claim</label><input type=text><p>Claim used to populate the Pulse username (default: preferred_username).</p></div><div><label>Email claim</label><input type=text></div><div><label>Groups claim</label><input type=text><p>Optional claim that lists group memberships. Used for group restrictions.</p></div><div><label>Allowed groups</label><textarea rows=2 placeholder="admin, sso-admins"></textarea><p>Comma or space separated values. Leave empty to allow any group.</p></div><div><label>Allowed domains</label><textarea rows=2 placeholder="example.com, partner.io"></textarea><p>Restrict access to email domains (without @). Leave empty to allow all.</p></div><div><label>Allowed email addresses</label><textarea rows=2 placeholder=admin@example.com></textarea><p>Optional allowlist of specific emails.'),fm=i('<div class=space-y-4><button type=button class="text-xs font-semibold text-blue-600 hover:underline dark:text-blue-300">'),mm=i('<div class="text-xs text-gray-500 dark:text-gray-400">Redirect URL registered with your IdP must match Pulse: '),xm=i('<div class="flex flex-wrap items-center justify-between gap-3 pt-4"><div class="flex gap-3"><button type=button class="px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">Reset</button><button type=submit class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">'),bm=i('<form class="p-6 space-y-5"><div class="bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-800 rounded-lg p-3 text-xs text-blue-800 dark:text-blue-200"><ol class="space-y-1 list-decimal pl-4"><li>Set PUBLIC_URL environment variable</li><li>Register client with your IdP using redirect URL below</li><li>Enter issuer and client ID (client secret optional for PKCE)</li><li>Save and test with SSO button on login page'),pm=i('<span class="text-xs font-medium text-gray-600 dark:text-gray-300">');const ja=e=>e&&e.length>0?e.join(", "):"",Ys=e=>e.split(/[,\s]+/).map(r=>r.trim()).filter(Boolean),ym=e=>{const[r,s]=Z(null),[l,o]=Z(!1),[a,d]=Z(!1),[c,g]=Z(!1),[b,p]=Ps({enabled:!1,issuerUrl:"",clientId:"",redirectUrl:"",logoutUrl:"",scopes:"",usernameClaim:"preferred_username",emailClaim:"email",groupsClaim:"",allowedGroups:"",allowedDomains:"",allowedEmails:"",clientSecret:"",clearSecret:!1}),m=()=>{const ne=r()?.envOverrides;return ne?Object.keys(ne).length>0:!1},S=ne=>{if(!ne){p({enabled:!1,issuerUrl:"",clientId:"",redirectUrl:"",logoutUrl:"",scopes:"",usernameClaim:"preferred_username",emailClaim:"email",groupsClaim:"",allowedGroups:"",allowedDomains:"",allowedEmails:"",clientSecret:"",clearSecret:!1});return}p({enabled:ne.enabled,issuerUrl:ne.issuerUrl??"",clientId:ne.clientId??"",redirectUrl:ne.redirectUrl||ne.defaultRedirect||"",logoutUrl:ne.logoutUrl??"",scopes:ne.scopes?.join(" ")??"openid profile email",usernameClaim:ne.usernameClaim||"preferred_username",emailClaim:ne.emailClaim||"email",groupsClaim:ne.groupsClaim??"",allowedGroups:ja(ne.allowedGroups),allowedDomains:ja(ne.allowedDomains),allowedEmails:ja(ne.allowedEmails),clientSecret:"",clearSecret:!1})},z=async()=>{o(!0);try{const{apiFetch:ne}=await Ln(async()=>{const{apiFetch:I}=await Promise.resolve().then(()=>zn);return{apiFetch:I}},void 0),W=await ne("/api/security/oidc");if(!W.ok)throw new Error(`Failed to load OIDC settings (${W.status})`);const X=await W.json();s(X),S(X),e.onConfigUpdated?.(X)}catch(ne){console.error("[OIDCPanel] Failed to load config:",ne),Yt.error("Failed to load OIDC settings"),s(null),S(null)}finally{o(!1)}};vr(()=>{z()});const ie=async ne=>{if(ne?.preventDefault(),!m()){d(!0);try{const W={enabled:b.enabled,issuerUrl:b.issuerUrl.trim(),clientId:b.clientId.trim(),redirectUrl:b.redirectUrl.trim(),logoutUrl:b.logoutUrl.trim(),scopes:Ys(b.scopes),usernameClaim:b.usernameClaim.trim(),emailClaim:b.emailClaim.trim(),groupsClaim:b.groupsClaim.trim(),allowedGroups:Ys(b.allowedGroups),allowedDomains:Ys(b.allowedDomains),allowedEmails:Ys(b.allowedEmails)};b.clientSecret.trim()!==""?W.clientSecret=b.clientSecret.trim():b.clearSecret&&(W.clearClientSecret=!0);const{apiFetch:X}=await Ln(async()=>{const{apiFetch:H}=await Promise.resolve().then(()=>zn);return{apiFetch:H}},void 0),I=await X("/api/security/oidc",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)});if(!I.ok){const H=await I.text();throw new Error(H||`Failed to save OIDC settings (${I.status})`)}const L=await I.json();s(L),S(L),Yt.success("OIDC settings updated"),e.onConfigUpdated?.(L)}catch(W){console.error("[OIDCPanel] Failed to save config:",W),Yt.error("Failed to save OIDC settings")}finally{d(!1)}}};return n(it,{padding:"none",class:"overflow-hidden border border-gray-200 dark:border-gray-700",border:!1,get children(){return[(()=>{var ne=om(),W=ne.firstChild;return W.firstChild,t(W,n(rr,{title:"Single sign-on (OIDC)",description:"Connect Pulse to your identity provider",size:"sm",class:"flex-1"}),null),t(W,n(Tn,{get checked(){return b.enabled},onChange:X=>{p("enabled",X.currentTarget.checked)},get disabled(){return m()||l()||a()},containerClass:"items-center gap-2",get label(){return(()=>{var X=pm();return t(X,()=>b.enabled?"Enabled":"Disabled"),X})()}}),null),ne})(),(()=>{var ne=bm();return ne.firstChild,ne.addEventListener("submit",ie),t(ne,n(h,{get when(){return l()},get children(){return dm()}}),null),t(ne,n(h,{get when(){return!l()},get children(){return[n(h,{get when(){return m()},get children(){return cm()}}),(()=>{var W=gm(),X=W.firstChild,I=X.firstChild,L=I.nextSibling,H=L.nextSibling,se=X.nextSibling,le=se.firstChild,ee=le.nextSibling,U=se.nextSibling,Y=U.firstChild,oe=Y.firstChild,_=Y.nextSibling,B=_.nextSibling,$=U.nextSibling,D=$.firstChild,f=D.nextSibling,j=f.nextSibling,K=$.nextSibling,C=K.firstChild,ge=C.nextSibling,J=ge.nextSibling;return y(X,Ht),L.$$input=N=>p("issuerUrl",N.currentTarget.value),y(H,hr),y(se,Ht),ee.$$input=N=>p("clientId",N.currentTarget.value),y(U,Ht),t(Y,n(h,{get when(){return r()?.clientSecretSet},get children(){var N=um();return N.$$click=()=>{!m()&&!a()&&(p("clientSecret",""),p("clearSecret",!0),Yt.info("Client secret will be cleared on save",2500))},q(()=>N.disabled=m()||a()),N}}),null),_.$$input=N=>{p("clientSecret",N.currentTarget.value),N.currentTarget.value.trim()!==""&&p("clearSecret",!1)},y(B,hr),y($,Ht),f.$$input=N=>p("redirectUrl",N.currentTarget.value),y(j,hr),t(j,(()=>{var N=$e(()=>!!(r()?.defaultRedirect&&r()?.defaultRedirect.trim()!==""));return()=>N()?`Optional - Leave blank to auto-detect from request headers (supports reverse proxies). Detected URL: ${r()?.defaultRedirect}`:"Optional - Leave blank to auto-detect from request headers. For best results, set PUBLIC_URL environment variable."})()),y(K,Ht),ge.$$input=N=>p("logoutUrl",N.currentTarget.value),y(J,hr),q(N=>{var F=yt(),P=Dt(),E=m()||a(),u=yt(),v=Dt(),V=m()||a(),A=yt("mb-0"),k=r()?.clientSecretSet?"•••••••• (leave blank to keep existing)":"Enter client secret",w=Dt(),de=m()||a(),fe=yt(),x=r()?.defaultRedirect||"",R=Dt(),Q=m()||a(),G=yt(),T=Dt(),te=m()||a();return F!==N.e&&y(I,N.e=F),P!==N.t&&y(L,N.t=P),E!==N.a&&(L.disabled=N.a=E),u!==N.o&&y(le,N.o=u),v!==N.i&&y(ee,N.i=v),V!==N.n&&(ee.disabled=N.n=V),A!==N.s&&y(oe,N.s=A),k!==N.h&&Te(_,"placeholder",N.h=k),w!==N.r&&y(_,N.r=w),de!==N.d&&(_.disabled=N.d=de),fe!==N.l&&y(D,N.l=fe),x!==N.u&&Te(f,"placeholder",N.u=x),R!==N.c&&y(f,N.c=R),Q!==N.w&&(f.disabled=N.w=Q),G!==N.m&&y(C,N.m=G),T!==N.f&&y(ge,N.f=T),te!==N.y&&(ge.disabled=N.y=te),N},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0}),q(()=>L.value=b.issuerUrl),q(()=>ee.value=b.clientId),q(()=>_.value=b.clientSecret),q(()=>f.value=b.redirectUrl),q(()=>ge.value=b.logoutUrl),W})(),(()=>{var W=fm(),X=W.firstChild;return X.$$click=()=>g(!c()),t(X,()=>c()?"Hide advanced OIDC options":"Show advanced OIDC options"),t(W,n(h,{get when(){return c()},get children(){var I=hm(),L=I.firstChild,H=L.firstChild,se=H.nextSibling,le=se.nextSibling,ee=L.nextSibling,U=ee.firstChild,Y=U.nextSibling,oe=Y.nextSibling,_=ee.nextSibling,B=_.firstChild,$=B.nextSibling,D=_.nextSibling,f=D.firstChild,j=f.nextSibling,K=j.nextSibling,C=D.nextSibling,ge=C.firstChild,J=ge.nextSibling,N=J.nextSibling,F=C.nextSibling,P=F.firstChild,E=P.nextSibling,u=E.nextSibling,v=F.nextSibling,V=v.firstChild,A=V.nextSibling,k=A.nextSibling;return y(L,Ht),se.$$input=w=>p("scopes",w.currentTarget.value),y(le,hr),y(ee,Ht),Y.$$input=w=>p("usernameClaim",w.currentTarget.value),y(oe,hr),y(_,Ht),$.$$input=w=>p("emailClaim",w.currentTarget.value),y(D,Ht),j.$$input=w=>p("groupsClaim",w.currentTarget.value),y(K,hr),y(C,Ht),J.$$input=w=>p("allowedGroups",w.currentTarget.value),y(N,hr),y(F,Ht),E.$$input=w=>p("allowedDomains",w.currentTarget.value),y(u,hr),y(v,Ht),A.$$input=w=>p("allowedEmails",w.currentTarget.value),y(k,hr),q(w=>{var de=yt(),fe=Dt(),x=m()||a(),R=yt(),Q=Dt(),G=m()||a(),T=yt(),te=Dt(),ae=m()||a(),M=yt(),ce=Dt(),ue=m()||a(),re=yt(),O=Dt("min-h-[70px]"),xe=m()||a(),he=yt(),me=Dt("min-h-[70px]"),_e=m()||a(),Ce=yt(),Oe=Dt("min-h-[70px]"),tt=m()||a();return de!==w.e&&y(H,w.e=de),fe!==w.t&&y(se,w.t=fe),x!==w.a&&(se.disabled=w.a=x),R!==w.o&&y(U,w.o=R),Q!==w.i&&y(Y,w.i=Q),G!==w.n&&(Y.disabled=w.n=G),T!==w.s&&y(B,w.s=T),te!==w.h&&y($,w.h=te),ae!==w.r&&($.disabled=w.r=ae),M!==w.d&&y(f,w.d=M),ce!==w.l&&y(j,w.l=ce),ue!==w.u&&(j.disabled=w.u=ue),re!==w.c&&y(ge,w.c=re),O!==w.w&&y(J,w.w=O),xe!==w.m&&(J.disabled=w.m=xe),he!==w.f&&y(P,w.f=he),me!==w.y&&y(E,w.y=me),_e!==w.g&&(E.disabled=w.g=_e),Ce!==w.p&&y(V,w.p=Ce),Oe!==w.b&&y(A,w.b=Oe),tt!==w.T&&(A.disabled=w.T=tt),w},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0,b:void 0,T:void 0}),q(()=>se.value=b.scopes),q(()=>Y.value=b.usernameClaim),q(()=>$.value=b.emailClaim),q(()=>j.value=b.groupsClaim),q(()=>J.value=b.allowedGroups),q(()=>E.value=b.allowedDomains),q(()=>A.value=b.allowedEmails),I}}),null),W})(),(()=>{var W=xm(),X=W.firstChild,I=X.firstChild,L=I.nextSibling;return t(W,n(h,{get when(){return r()?.defaultRedirect},get children(){var H=mm();return H.firstChild,t(H,()=>r()?.defaultRedirect,null),H}}),X),I.$$click=()=>S(r()),t(L,()=>a()?"Saving…":"Save changes"),q(H=>{var se=a()||l(),le=a()||l()||m();return se!==H.e&&(I.disabled=H.e=se),le!==H.t&&(L.disabled=H.t=le),H},{e:void 0,t:void 0}),W})()]}}),null),ne})()]}})};Xt(["input","click"]);var vm=i('<div class=space-y-2><div><label>Username</label><input type=text placeholder=admin></div><div><label>Password (min 8 characters)</label><input type=password placeholder="Enter password"></div><div><label>Confirm password</label><input type=password placeholder="Confirm password">'),km=i("<p>A secure 16-character password will be generated for you"),wm=i("<p class=mt-1>Existing sessions will be logged out once Pulse restarts with the new credentials."),$m=i('<div class=space-y-4><div class="flex items-start space-x-3"><div class=flex-shrink-0><svg class="h-6 w-6 text-blue-600 dark:text-blue-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 10V3L4 14h7v7l9-11h-7z"></path></svg></div><div class=flex-1><ul class="mt-2 space-y-1 text-xs text-gray-600 dark:text-gray-400"><li class="flex items-center"><span class="text-green-500 mr-2">✓</span></li><li class="flex items-center"><span class="text-green-500 mr-2">✓</span></li><li class="flex items-center"><span class="text-green-500 mr-2">✓</span></li><li class="flex items-center"><span class="text-green-500 mr-2">✓</span>Enable audit logging</li></ul></div></div><div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-3 space-y-3"><div class="flex items-center justify-between"><label>Password Setup</label><div class="flex items-center space-x-2"><button type=button>Auto-Generate</button><button type=button>Custom</button></div></div></div><div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3"><div class=flex><svg class="h-5 w-5 text-yellow-600 dark:text-yellow-400 mr-2 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-xs text-yellow-700 dark:text-yellow-300"><p class=font-semibold>Important:</p><p></p></div></div></div><button type=button class="w-full px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors">'),_m=i(`<div class=space-y-4><div class="flex items-center justify-between"><button type=button class="px-3 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 transition-colors">Download credentials</button></div><div class="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3"><p class="text-sm font-semibold text-green-800 dark:text-green-200 mb-2">Save these credentials now - they won't be shown again!</p></div><div class=space-y-3><div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-3"><label>Username</label><div class="mt-1 flex items-center gap-2"><code class="flex-1 font-mono text-sm bg-white dark:bg-gray-800 px-3 py-2 rounded border border-gray-200 dark:border-gray-700"></code><button type=button class="px-3 py-2 text-xs bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors"></button></div></div><div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-3"><label>Password</label><div class="mt-1 flex items-center gap-2"><code class="flex-1 font-mono text-sm bg-white dark:bg-gray-800 px-3 py-2 rounded border border-gray-200 dark:border-gray-700 break-all"></code><button type=button class="px-3 py-2 text-xs bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors"></button></div></div><div class="bg-gray-50 dark:bg-gray-900 rounded-lg p-3"><label>API token</label><div class="mt-1 flex items-center gap-2"><code class="flex-1 font-mono text-sm bg-white dark:bg-gray-800 px-3 py-2 rounded border border-gray-200 dark:border-gray-700 break-all"></code><button type=button class="px-3 py-2 text-xs bg-gray-600 text-white rounded hover:bg-gray-700 transition-colors"></button></div><p>Use this token with the X-API-Token header for automation.</p><p class="mt-1 text-xs font-semibold text-red-600 dark:text-red-400">This token is only shown once. Save it now.</p></div></div><div class="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3"><p class="text-sm font-semibold text-green-800 dark:text-green-200 mb-2">Credentials saved</p><p class="text-xs text-green-700 dark:text-green-300">The service needs to be restarted for security settings to take effect.</p><p class="text-xs text-green-600 dark:text-green-400 mt-2 italic">Save your credentials above - they won't be shown again.</p></div><div class="flex justify-end"><button type=button class="px-4 py-2 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 transition-colors">Done - I've Saved My Credentials`),Cm=i('<div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6">'),Sm=i('<span class="flex items-center justify-center"><svg class="animate-spin -ml-1 mr-2 h-4 w-4 text-white"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">');const ri=e=>{const s=(e.mode??"initial")==="rotate",[l,o]=Z(!1),[a,d]=Z(null),[c,g]=Z(!1),[b,p]=Z(null),[m,S]=Z(!1),[z,ie]=Z(e.defaultUsername??"admin"),[ne,W]=Z(""),[X,I]=Z(""),L=(U=16)=>{const Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-";let oe="";const _=new Uint8Array(U);crypto.getRandomValues(_);for(let B=0;B<U;B++)oe+=Y[_[B]%Y.length];return oe},H=()=>{const U=new Uint8Array(24);return crypto.getRandomValues(U),Array.from(U,Y=>Y.toString(16).padStart(2,"0")).join("")},se=async(U,Y)=>{await on(U)?(p(Y),setTimeout(()=>p(null),2e3)):$t("Failed to copy to clipboard")},le=async()=>{if(m()){if(ne().length<8){$t("Password must be at least 8 characters");return}if(ne()!==X()){$t("Passwords do not match");return}}o(!0);try{const U={username:z(),password:m()?ne():L(),apiToken:H()},Y=await fetch("/api/security/quick-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...U,force:s}),credentials:"include"});if(!Y.ok){const _=await Y.text();throw new Error(_||"Failed to setup security")}const oe=await Y.json();if(oe.skipped){$t(oe.message||"Security is already configured. Please remove existing security first if you want to reconfigure."),e.onConfigured&&e.onConfigured();return}d(U),g(!0),Wt(s?"Admin credentials generated. Save them before continuing.":"Security configured. Save your credentials before continuing.")}catch(U){$t(`Failed to setup security: ${U}`)}finally{o(!1)}},ee=()=>{if(!a())return;const U=`Pulse Admin Credentials ${s?"(Rotated)":""}
|
||
Generated: ${new Date().toISOString()}
|
||
|
||
Basic Authentication:
|
||
Username: ${a().username}
|
||
Password: ${a().password}
|
||
|
||
API Token: ${a().apiToken}
|
||
|
||
Important:
|
||
- Save these credentials securely
|
||
- They will not be shown again
|
||
- Use the API token for export/import operations
|
||
- Basic auth is required to access the web interface
|
||
`,Y=new Blob([U],{type:"text/plain"}),oe=URL.createObjectURL(Y),_=document.createElement("a");_.href=oe,_.download=`pulse-credentials-${Date.now()}.txt`,_.click(),URL.revokeObjectURL(oe)};return(()=>{var U=Cm();return t(U,n(h,{get when(){return!c()},get children(){var Y=$m(),oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=B.firstChild,D=$.firstChild;D.firstChild;var f=D.nextSibling;f.firstChild;var j=f.nextSibling;j.firstChild;var K=oe.nextSibling,C=K.firstChild,ge=C.firstChild,J=ge.nextSibling,N=J.firstChild,F=N.nextSibling,P=K.nextSibling,E=P.firstChild,u=E.firstChild,v=u.nextSibling,V=v.firstChild,A=V.nextSibling,k=P.nextSibling;return t(B,n(rr,{title:s?"Generate new admin credentials":"Quick security setup",description:s?"Create a fresh password and API token. This will:":"Enable authentication with one click. This will:",size:"sm",titleClass:"text-gray-900 dark:text-gray-100",descriptionClass:"!text-xs text-gray-600 dark:text-gray-400"}),$),t(D,s?"Generate a new secure password":"Generate secure random password",null),t(f,s?"Replace the stored admin password":"Enable basic authentication",null),t(j,s?"Create a new API token for automation":"Create API token for automation",null),N.$$click=()=>S(!1),F.$$click=()=>S(!0),t(K,n(h,{get when(){return m()},get children(){var w=vm(),de=w.firstChild,fe=de.firstChild,x=fe.nextSibling,R=de.nextSibling,Q=R.firstChild,G=Q.nextSibling,T=R.nextSibling,te=T.firstChild,ae=te.nextSibling;return y(de,Ht),x.$$input=M=>ie(M.currentTarget.value),y(R,Ht),G.$$input=M=>W(M.currentTarget.value),y(T,Ht),ae.$$input=M=>I(M.currentTarget.value),q(M=>{var ce=yt(),ue=Dt(),re=yt(),O=Dt(),xe=yt(),he=Dt();return ce!==M.e&&y(fe,M.e=ce),ue!==M.t&&y(x,M.t=ue),re!==M.a&&y(Q,M.a=re),O!==M.o&&y(G,M.o=O),xe!==M.i&&y(te,M.i=xe),he!==M.n&&y(ae,M.n=he),M},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),q(()=>x.value=z()),q(()=>G.value=ne()),q(()=>ae.value=X()),w}}),null),t(K,n(h,{get when(){return!m()},get children(){var w=km();return y(w,hr),w}}),null),t(A,()=>m()?"Your password will be hashed before storage":"Credentials will be shown only once. Save them immediately!"),t(v,n(h,{when:s,get children(){return wm()}}),null),k.$$click=le,t(k,(()=>{var w=$e(()=>!!l());return()=>w()?(()=>{var de=Sm();return de.firstChild,t(de,s?"Rotating credentials...":"Setting up security...",null),de})():s?"Rotate credentials":"Enable Security Now"})()),q(w=>{var de=yt(),fe=`px-3 py-1 text-xs rounded-lg transition-colors ${m()?"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600":"bg-blue-600 text-white"}`,x=`px-3 py-1 text-xs rounded-lg transition-colors ${m()?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,R=l();return de!==w.e&&y(ge,w.e=de),fe!==w.t&&y(N,w.t=fe),x!==w.a&&y(F,w.a=x),R!==w.o&&(k.disabled=w.o=R),w},{e:void 0,t:void 0,a:void 0,o:void 0}),Y}}),null),t(U,n(h,{get when(){return $e(()=>!!c())()&&a()},get children(){var Y=_m(),oe=Y.firstChild,_=oe.firstChild,B=oe.nextSibling,$=B.nextSibling,D=$.firstChild,f=D.firstChild,j=f.nextSibling,K=j.firstChild,C=K.nextSibling,ge=D.nextSibling,J=ge.firstChild,N=J.nextSibling,F=N.firstChild,P=F.nextSibling,E=ge.nextSibling,u=E.firstChild,v=u.nextSibling,V=v.firstChild,A=V.nextSibling,k=v.nextSibling,w=$.nextSibling,de=w.nextSibling,fe=de.firstChild;return t(oe,n(rr,{title:s?"Admin credentials generated":"Security enabled successfully",size:"md",class:"flex-1",titleClass:"text-gray-900 dark:text-gray-100"}),_),_.$$click=ee,t(K,()=>a().username),C.$$click=()=>se(a().username,"username"),t(C,()=>b()==="username"?"Copied!":"Copy"),t(F,()=>a().password),P.$$click=()=>se(a().password,"password"),t(P,()=>b()==="password"?"Copied!":"Copy"),t(V,()=>a().apiToken),A.$$click=()=>se(a().apiToken,"token"),t(A,()=>b()==="token"?"Copied!":"Copy"),y(k,hr+" mt-2"),fe.$$click=()=>{g(!1),e.onConfigured&&e.onConfigured(),window.location.reload()},q(x=>{var R=yt("text-xs"),Q=yt("text-xs"),G=yt("text-xs");return R!==x.e&&y(f,x.e=R),Q!==x.t&&y(J,x.t=Q),G!==x.a&&y(u,x.a=G),x},{e:void 0,t:void 0,a:void 0}),Y}}),null),U})()};Xt(["click","input"]);var Tm=i('<span class="hidden md:inline-flex items-center px-3 py-1 text-xs font-medium rounded-full bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300">IP: '),Am=i('<div class="flex flex-col gap-4"><div class="flex flex-col md:flex-row md:items-start md:justify-between gap-3"><div class="flex items-center gap-2"><span></span></div></div><div class="grid gap-3 md:grid-cols-2 xl:grid-cols-3">'),Dm=i('<div class="rounded-lg border border-gray-200 dark:border-gray-700 p-3 bg-white dark:bg-gray-800"><div class="flex items-center justify-between mb-2"><span class="text-sm font-semibold text-gray-900 dark:text-gray-100"></span><span><svg class="w-3.5 h-3.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2></path></svg></span></div><p class="text-xs text-gray-600 dark:text-gray-400 leading-relaxed">');const Mm=e=>{const r=()=>[{key:"password",label:"Password login",enabled:e.status.hasAuthentication,description:e.status.hasAuthentication?"Active":"Not configured"},{key:"oidc",label:"Single sign-on",enabled:!!e.status.oidcEnabled,description:e.status.oidcEnabled?"OIDC configured":"Not configured"},{key:"proxy",label:"Proxy auth",enabled:!!e.status.hasProxyAuth,description:e.status.hasProxyAuth?"Active":"Not configured"},{key:"token",label:"API token",enabled:e.status.apiTokenConfigured,description:e.status.apiTokenConfigured?"Active":"Not configured"},{key:"export",label:"Export protection",enabled:e.status.exportProtected&&!e.status.unprotectedExportAllowed,description:e.status.unprotectedExportAllowed?"Unprotected":"Token + passphrase required"},{key:"https",label:"HTTPS",enabled:!!e.status.hasHTTPS,description:e.status.hasHTTPS?"Encrypted":"HTTP only"},{key:"audit",label:"Audit log",enabled:e.status.hasAuditLogging,description:e.status.hasAuditLogging?"Active":"Not enabled"}],s=l=>l?"inline-flex items-center gap-1 px-2.5 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"inline-flex items-center gap-1 px-2.5 py-1 text-xs font-semibold rounded-full bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-200";return n(it,{padding:"md",class:"border border-gray-200 dark:border-gray-700",get children(){var l=Am(),o=l.firstChild,a=o.firstChild,d=a.firstChild,c=o.nextSibling;return t(o,n(rr,{title:"Security posture",size:"sm",class:"flex-1"}),a),t(d,()=>e.status.publicAccess&&!e.status.isPrivateNetwork?"Public network access":"Private network access"),t(a,n(h,{get when(){return e.status.clientIP},get children(){var g=Tm();return g.firstChild,t(g,()=>e.status.clientIP,null),g}}),null),t(c,n(ze,{get each(){return r()},children:g=>(()=>{var b=Dm(),p=b.firstChild,m=p.firstChild,S=m.nextSibling,z=S.firstChild,ie=z.firstChild,ne=p.nextSibling;return t(m,()=>g.label),t(S,()=>g.enabled?"On":"Off",null),t(ne,()=>g.description),q(W=>{var X=s(g.enabled),I=g.enabled?"M5 13l4 4L19 7":"M6 18L18 6M6 6l12 12";return X!==W.e&&y(S,W.e=X),I!==W.t&&Te(ie,"d",W.t=I),W},{e:void 0,t:void 0}),b})()})),q(()=>y(d,`${e.status.publicAccess&&!e.status.isPrivateNetwork?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200"} px-3 py-1 text-xs font-semibold rounded-full`)),l}})};class Sn{static baseUrl="/api";static async getSettings(){return Ft(`${this.baseUrl}/settings`)}static async updateSettings(r){return Ft(`${this.baseUrl}/settings/update`,{method:"POST",body:JSON.stringify(r)})}static async updateSystemSettings(r){return Ft(`${this.baseUrl}/system/settings/update`,{method:"POST",body:JSON.stringify(r)})}static async getSystemSettings(){return Ft(`${this.baseUrl}/system/settings`)}static async validateSettings(r){return Ft(`${this.baseUrl}/settings/validate`,{method:"POST",body:JSON.stringify(r)})}}class yn{static async checkForUpdates(r){const s=r?`/api/updates/check?channel=${r}`:"/api/updates/check";return Ft(s)}static async applyUpdate(r){return Ft("/api/updates/apply",{method:"POST",body:JSON.stringify({downloadUrl:r})})}static async getUpdateStatus(){return Ft("/api/updates/status")}static async getVersion(){return Ft("/api/version")}static async getUpdatePlan(r,s){const l=s?`/api/updates/plan?version=${r}&channel=${s}`:`/api/updates/plan?version=${r}`;return Ft(l)}static async getUpdateHistory(r,s){const l=new URLSearchParams;r&&l.append("limit",r.toString()),s&&l.append("status",s);const o=`/api/updates/history${l.toString()?`?${l.toString()}`:""}`;return Ft(o)}static async getUpdateHistoryEntry(r){return Ft(`/api/updates/history/entry?id=${r}`)}}/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ls={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ni=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,s,l)=>l?l.toUpperCase():s.toLowerCase()),Em=e=>{const r=Pm(e);return r.charAt(0).toUpperCase()+r.slice(1)},Nm=(...e)=>e.filter((r,s,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===s).join(" ").trim();/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var Om=i("<svg>");const nn=e=>{const[r,s]=rs(e,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var l=Om();return bs(l,kr(ls,{get width(){return r.size??ls.width},get height(){return r.size??ls.height},get stroke(){return r.color??ls.stroke},get"stroke-width"(){return $e(()=>!!r.absoluteStrokeWidth)()?Number(r.strokeWidth??ls["stroke-width"])*24/Number(r.size):Number(r.strokeWidth??ls["stroke-width"])},get class(){return Nm("lucide","lucide-icon",...r.name!=null?[`lucide-${ni(Em(r.name))}`,`lucide-${ni(r.name)}`]:[],r.class!=null?r.class:"")}},s),!0,!0),t(l,n(ze,{get each(){return r.iconNode},children:([o,a])=>n(yd,kr({component:o},a))})),l})()};/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Lm=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Rm=e=>n(nn,kr(e,{iconNode:Lm,name:"server"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Im=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],Hm=e=>n(nn,kr(e,{iconNode:Im,name:"hard-drive"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Um=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Bm=e=>n(nn,kr(e,{iconNode:Um,name:"mail"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jm=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Fm=e=>n(nn,kr(e,{iconNode:jm,name:"link"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Vm=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],Gm=e=>n(nn,kr(e,{iconNode:Vm,name:"container"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zm=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yo=e=>n(nn,kr(e,{iconNode:zm,name:"settings"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wm=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],qm=e=>n(nn,kr(e,{iconNode:Wm,name:"shield"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Km=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Jm=e=>n(nn,kr(e,{iconNode:Km,name:"activity"})),vo="pulse-updates",Qm=1440*60*1e3,$l=()=>{try{const e=localStorage.getItem(vo);if(e)return JSON.parse(e)}catch(e){console.error("Failed to load update state:",e)}return{lastCheck:0}},Ns=e=>{try{localStorage.setItem(vo,JSON.stringify(e))}catch(r){console.error("Failed to save update state:",r)}},[ko,is]=Z(!1),[wo,aa]=Z(null),[si,Ym]=Z(null),[$o,ai]=Z(!1),[_o,cs]=Z(!1),[Xm,li]=Z(null),Zm=async(e=!1)=>{if($o())return;const r=$l(),s=Date.now();if(!e&&r.lastCheck&&s-r.lastCheck<Qm)if(r.updateInfo)try{const l=await yn.getVersion();if(r.updateInfo.currentVersion!==l.version)r.updateInfo=void 0,r.dismissedVersion=void 0,r.lastCheck=0,Ns(r);else{aa(r.updateInfo),is(r.updateInfo.available),r.dismissedVersion===r.updateInfo.latestVersion&&cs(!0);return}}catch(l){console.error("Failed to verify version for cache:",l)}else return;ai(!0),li(null);try{const l=await yn.getVersion();if(Ym(l),r.updateInfo&&r.updateInfo.currentVersion!==l.version&&(r.updateInfo=void 0,r.dismissedVersion=void 0,Ns(r)),l.isDocker||l.isDevelopment){is(!1),aa(null);return}if((l.version.includes("-dirty")||/v\d+\.\d+\.\d+.*-g[0-9a-f]+/.test(l.version))&&!e){is(!1);return}const a=await yn.checkForUpdates();aa(a),is(a.available),r.dismissedVersion===a.latestVersion?cs(!0):cs(!1),Ns({...r,lastCheck:s,updateInfo:a})}catch(l){console.error("Failed to check for updates:",l),li(l instanceof Error?l.message:"Failed to check for updates"),is(!1)}finally{ai(!1)}},ex=()=>{const e=wo();if(!e)return;const r=$l();Ns({...r,dismissedVersion:e.latestVersion}),cs(!0)},tx=()=>{const e=$l();delete e.dismissedVersion,Ns(e),cs(!1)},rx=()=>ko()&&!_o(),Tr={updateAvailable:ko,updateInfo:wo,versionInfo:si,isChecking:$o,isDismissed:_o,lastError:Xm,isUpdateVisible:rx,checkForUpdates:Zm,dismissUpdate:ex,clearDismissed:tx,simulateUpdate:(e="v5.0.0")=>{aa({available:!0,currentVersion:si()?.version||"v4.9.0",latestVersion:e,releaseNotes:"Test update notification",releaseDate:new Date().toISOString(),downloadUrl:"#",isPrerelease:!1}),is(!0),cs(!1)}};(window.location.hostname==="localhost"||window.location.hostname.startsWith("192.168"))&&(window.updateStore=Tr);var nx=i('<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3 sm:p-4"><div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3"><div class="flex items-center gap-2 text-yellow-800 dark:text-yellow-200"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10></circle><line x1=12 y1=8 x2=12 y2=12></line><line x1=12 y1=16 x2=12.01 y2=16></line></svg><span class="text-sm font-medium">You have unsaved changes</span></div><div class="flex gap-2 w-full sm:w-auto"><button type=button class="flex-1 sm:flex-initial px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">Save Changes</button><button type=button class="flex-1 sm:flex-initial px-4 py-2 text-sm border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">Discard'),sx=i('<div aria-label="Settings navigation"><div><div id=settings-sidebar-menu class=space-y-6>'),ax=i('<div class="lg:hidden border-b border-gray-200 dark:border-gray-700"><div class=p-1><div class="flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5 w-full overflow-x-auto scrollbar-hide"style=-webkit-overflow-scrolling:touch;>'),Fa=i('<div class="flex items-center justify-center py-8"><span class=text-gray-500>Loading configuration...'),ii=i('<button type=button class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-1"title="Refresh discovered servers"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"></path></svg><span class="hidden sm:inline">Refresh'),lx=i('<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4 gap-3"><div class="flex flex-wrap gap-2 items-center justify-end"><div class="flex items-center gap-2 sm:gap-3"title="Enable automatic discovery of Proxmox servers on your network"><span class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Discovery</span></div><button type=button class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-1"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=12 y1=5 x2=12 y2=19></line><line x1=5 y1=12 x2=19 y2=12></line></svg><span class=sm:hidden>Add</span><span class="hidden sm:inline">Add PVE Node'),ix=i('<span class="flex items-center gap-2"><svg class="h-4 w-4 animate-spin"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10 stroke-opacity=0.25></circle><path d="M22 12a10 10 0 00-10-10"stroke-linecap=round></path></svg><span>Scanning your network for Proxmox VE servers…'),Va=i("<span>Last scan "),Ga=i('<div class="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-2"><span class=font-medium>Discovery issues:</span><ul class="list-disc ml-4 mt-1 space-y-0.5">'),oi=i('<div class="flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"><svg class="h-4 w-4 animate-spin"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10 stroke-opacity=0.25></circle><path d="M22 12a10 10 0 00-10-10"stroke-linecap=round></path></svg><span>Waiting for responses… this can take up to a minute depending on your network size.'),za=i('<div class=space-y-3><div class="flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400">'),Wa=i('<div class="grid gap-4">'),Xs=i("<div class=space-y-4>"),ox=i('<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4 gap-3"><div class="flex flex-wrap gap-2 items-center justify-end"><div class="flex items-center gap-2 sm:gap-3"title="Enable automatic discovery of PBS servers on your network"><span class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Discovery</span></div><button type=button class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-1"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=12 y1=5 x2=12 y2=19></line><line x1=5 y1=12 x2=19 y2=12></line></svg><span class=sm:hidden>Add</span><span class="hidden sm:inline">Add PBS Node'),dx=i('<span class="flex items-center gap-2"><svg class="h-4 w-4 animate-spin"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10 stroke-opacity=0.25></circle><path d="M22 12a10 10 0 00-10-10"stroke-linecap=round></path></svg><span>Scanning your network for Proxmox Backup Servers…'),cx=i('<button type=button class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-1"title="Refresh discovered servers"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path></svg><span class="hidden sm:inline">Refresh'),ux=i('<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4 gap-3"><div class="flex flex-wrap gap-2 items-center justify-end"><div class="flex items-center gap-2 sm:gap-3"title="Enable automatic discovery of PMG servers on your network"><span class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Discovery</span></div><button type=button class="px-2 sm:px-4 py-1.5 sm:py-2 text-xs sm:text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-1"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=12 y1=5 x2=12 y2=19></line><line x1=5 y1=12 x2=19 y2=12></line></svg><span class=sm:hidden>Add</span><span class="hidden sm:inline">Add PMG Node'),gx=i('<span class="flex items-center gap-2"><svg class="h-4 w-4 animate-spin"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path><path d="M12 3v6m0 6v6m6-9h-6m-6 0H3"></path></svg>Scanning network...'),hx=i('<div class="text-center py-6 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600"><svg class="h-8 w-8 mx-auto mb-2 animate-pulse text-purple-500"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=11 cy=11 r=8></circle><path d="m21 21-4.35-4.35"></path></svg><p class=text-sm>Scanning for PMG servers...'),fx=i('<div class="flex items-start gap-3"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400 mt-0.5 flex-shrink-0"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="text-sm text-blue-800 dark:text-blue-200"><p class="font-medium mb-1">Configuration Priority</p><ul class=space-y-1><li>• Some env vars override settings (API_TOKENS, legacy API_TOKEN, PORTS, AUTH)</li><li>• Changes made here are saved to system.json immediately</li><li>• Settings persist unless overridden by env vars'),mx=i('<div class="flex items-center justify-between gap-3"><div class="text-sm text-gray-600 dark:text-gray-400"><p class="font-medium text-gray-900 dark:text-gray-100">Dark mode</p><p class="text-xs text-gray-500 dark:text-gray-400">Toggle to match your environment. Pulse remembers this preference on each browser.'),xx=i('<section class=space-y-3><h4 class="flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10></circle><path d="M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"></path></svg>Network Settings</h4><div class=space-y-2><label class="text-sm font-medium text-gray-900 dark:text-gray-100">CORS Allowed Origins</label><p class="text-xs text-gray-600 dark:text-gray-400">For reverse proxy setups (* = allow all, empty = same-origin only)</p><div class=relative><input type=text placeholder="* or https://example.com">'),bx=i('<div class=space-y-2><label class="text-xs font-medium text-gray-700 dark:text-gray-300">Allowed Embed Origins (optional)</label><p class="text-xs text-gray-600 dark:text-gray-400">Comma-separated list of origins that can embed Pulse (leave empty for same-origin only)</p><input type=text placeholder="https://my.domain, https://dashboard.example.com"class="w-full px-3 py-1.5 text-sm border rounded-lg border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800"><p class="text-xs text-gray-500 dark:text-gray-400">Example: If Pulse is at <code>pulse.my.domain</code> and your dashboard is at <code>my.domain</code>, add <code>https://my.domain</code> here.'),px=i('<section class=space-y-3><h4 class="flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><rect x=3 y=4 width=18 height=14 rx=2></rect><path d="M7 20h10"></path></svg>Embedding</h4><p class="text-xs text-gray-600 dark:text-gray-400">Allow Pulse to be embedded in iframes (e.g., Homepage dashboard)</p><div class=space-y-3><div class="flex items-center gap-2"><input type=checkbox id=allowEmbedding class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"><label for=allowEmbedding class="text-sm text-gray-700 dark:text-gray-300">Allow iframe embedding'),yx=i('<p class="text-xs text-amber-800 dark:text-amber-200 mb-2"><strong>Port Configuration:</strong> Use <code class="font-mono bg-amber-100 dark:bg-amber-800 px-1 rounded">systemctl edit pulse'),vx=i('<p class="text-xs text-amber-700 dark:text-amber-300 font-mono">[Service]<br>Environment="FRONTEND_PORT=8080"<br><span class="text-xs text-amber-600 dark:text-amber-400">Then restart: sudo systemctl restart pulse'),kx=i('<div class="p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg"><p class="text-xs text-blue-800 dark:text-blue-200"><strong>Docker Installation:</strong> Updates are managed through Docker. Pull the latest image to update.'),wx=i('<div class="p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg"><p class="text-xs text-amber-800 dark:text-amber-200">'),$x=i('<p class="text-xs text-green-700 dark:text-green-300">Type <code class="px-1 py-0.5 bg-green-200 dark:bg-green-800 rounded">update</code> in the LXC console'),_x=i('<div class="text-xs text-green-700 dark:text-green-300 space-y-1"><p>Run these commands:</p><code class="block p-1 bg-green-200 dark:bg-green-800 rounded text-xs">docker pull rcourtman/pulse:latest<br>docker restart pulse'),Cx=i('<div class="text-xs text-green-700 dark:text-green-300 space-y-1"><p>Run the install script:</p><code class="block p-1 bg-green-200 dark:bg-green-800 rounded text-xs">curl -fsSL https://raw.githubusercontent.com/rcourtman/Pulse/main/install.sh | bash'),Sx=i('<p class="text-xs text-green-700 dark:text-green-300">Pull latest changes and rebuild'),Tx=i('<p class="text-xs text-green-700 dark:text-green-300">Pull the latest Pulse Docker image and recreate your container.'),Ax=i('<details class=mt-1><summary class="text-xs text-green-700 dark:text-green-300 cursor-pointer">Release Notes</summary><pre class="mt-2 text-xs text-green-600 dark:text-green-400 whitespace-pre-wrap font-mono bg-green-100 dark:bg-green-900/30 p-2 rounded">'),Dx=i('<div class="p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg space-y-3"><div><p class="text-sm font-medium text-green-800 dark:text-green-200">Update Available: </p><p class="text-xs text-green-700 dark:text-green-300 mt-1">Released: </p></div><div class="p-2 bg-green-100 dark:bg-green-900/40 rounded space-y-2"><p class="text-xs font-medium text-green-800 dark:text-green-200">How to update:'),Mx=i('<div class="space-y-4 rounded-md border border-gray-200 dark:border-gray-600 p-3"><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><label class="text-sm font-medium text-gray-900 dark:text-gray-100">Check Interval</label><p class="text-xs text-gray-600 dark:text-gray-400">How often to check for updates</p></div><select class="px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800"><option value=6>Every 6 hours</option><option value=12>Every 12 hours</option><option value=24>Daily</option><option value=168>Weekly</option></select></div><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><label class="text-sm font-medium text-gray-900 dark:text-gray-100">Check Time</label><p class="text-xs text-gray-600 dark:text-gray-400">Preferred time to check for updates</p></div><input type=time class="px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800">'),Px=i(`<section class=space-y-4><h4 class="flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="23 4 23 10 17 10"></polyline><polyline points="1 20 1 14 7 14"></polyline><path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"></path></svg>Updates</h4><div class=space-y-4><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><label class="text-sm font-medium text-gray-900 dark:text-gray-100">Current Version</label><p class="text-xs text-gray-600 dark:text-gray-400"></p></div><button type=button></button></div><div class="border-t border-gray-200 dark:border-gray-600 pt-4 space-y-4"><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><label class="text-sm font-medium text-gray-900 dark:text-gray-100">Update Channel</label><p class="text-xs text-gray-600 dark:text-gray-400">Choose between stable and release candidate versions</p></div><select class="px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 disabled:opacity-50"><option value=stable>Stable</option><option value=rc>Release Candidate</option></select></div><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><label class="text-sm font-medium text-gray-900 dark:text-gray-100">Update Checks</label><p class="text-xs text-gray-600 dark:text-gray-400">Automatically check for updates (installation is manual)</p></div><label class="relative inline-flex items-center cursor-pointer"><input type=checkbox class="sr-only peer"><div class="w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 peer-disabled:opacity-50">`),Ex=i('<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4"><div class="flex items-start gap-3"><div class="flex-shrink-0 w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"></path></svg></div><div class=flex-1><h4 class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-1">Export Configuration</h4><p class="text-xs text-gray-600 dark:text-gray-400 mb-3">Download an encrypted backup of all nodes and settings</p><button type=button class="px-3 py-1.5 bg-blue-600 text-white text-sm rounded-md hover:bg-blue-700 transition-colors inline-flex items-center gap-2"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>Export Backup</button></div></div></div><div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4"><div class="flex items-start gap-3"><div class="flex-shrink-0 w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-lg flex items-center justify-center"><svg class="w-5 h-5 text-gray-600 dark:text-gray-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path></svg></div><div class=flex-1><h4 class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-1">Restore Configuration</h4><p class="text-xs text-gray-600 dark:text-gray-400 mb-3">Upload a backup file to restore nodes and settings</p><button type=button class="px-3 py-1.5 bg-gray-600 text-white text-sm rounded-md hover:bg-gray-700 transition-colors inline-flex items-center gap-2"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg>Restore Backup'),Nx=i('<div class="mt-4 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800"><div class="flex gap-2"><svg class="w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-xs text-amber-700 dark:text-amber-300"><p class="font-medium mb-1">Important Notes</p><ul class="space-y-0.5 text-amber-600 dark:text-amber-400"><li>• Backups contain encrypted credentials and sensitive data</li><li>• Use a strong passphrase to protect your backup</li><li>• Store backup files securely and never share the passphrase'),Ox=i('<div class=space-y-6><div class="grid gap-4 lg:grid-cols-5">'),Lx=i('<a class="underline font-medium">Proxy logout'),Rx=i('<div class="flex flex-col gap-2 text-xs text-blue-800 dark:text-blue-200"><div class="flex items-center gap-2"><svg class="w-4 h-4 flex-shrink-0"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class="font-semibold text-blue-900 dark:text-blue-100">Proxy authentication detected</span></div><p>Requests are validated by an upstream proxy. The current proxied user is<!>.</p><p>Need configuration tips? Review the proxy auth guide in the docs. <a class="underline font-medium"href=https://github.com/rcourtman/Pulse/blob/main/docs/PROXY_AUTH.md target=_blank rel=noreferrer>Read proxy auth guide →'),Ix=i('<div class="mt-3 pt-3 border-t border-amber-200 dark:border-amber-700">'),Hx=i(`<div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4"><div class="flex items-start justify-between gap-3"><div class="flex items-start gap-3 flex-1"><svg class="h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="flex-1 min-w-0"><h4 class="text-sm font-semibold text-amber-900 dark:text-amber-100">Authentication disabled</h4><p class="text-xs text-amber-700 dark:text-amber-300 mt-1">DISABLE_AUTH is set, or auth isn't configured yet.</p></div></div><button type=button class="px-3 py-1.5 text-xs font-medium rounded-lg border border-amber-300 text-amber-800 bg-amber-100/50 hover:bg-amber-100 transition-colors dark:border-amber-700 dark:text-amber-200 dark:bg-amber-900/30 dark:hover:bg-amber-900/40 whitespace-nowrap">Setup`),Ux=i('<div class="bg-gradient-to-r from-gray-50 to-gray-50 dark:from-gray-900/20 dark:to-gray-900/20 px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center gap-3"><div class="p-2 bg-gray-100 dark:bg-gray-900/50 rounded-lg"><svg class="w-5 h-5 text-gray-600 dark:text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z">'),Bx=i('<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">'),jx=i('<div class=p-6><div class="flex flex-wrap items-center gap-3"><button type=button class="px-4 py-2 text-sm font-medium bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">Change password</button><button type=button class="px-4 py-2 text-sm font-medium border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors">Rotate credentials</button><div class=flex-1></div><div class="text-xs text-gray-600 dark:text-gray-400"><span class="font-medium text-gray-800 dark:text-gray-200">User:</span> '),Fx=i('<div class=space-y-2><p class="text-xs text-gray-700 dark:text-gray-300">Type <code class="px-1 py-0.5 bg-gray-100 dark:bg-gray-700 rounded">update</code> in your ProxmoxVE console</p><p class="text-xs text-gray-600 dark:text-gray-400 italic">Or restart manually with: <code class=text-xs>systemctl restart pulse'),Vx=i('<div class=space-y-1><p class="text-xs text-gray-700 dark:text-gray-300">Restart your Docker container:</p><code class="block text-xs bg-gray-100 dark:bg-gray-700 p-2 rounded mt-1">docker restart pulse'),Gx=i('<div class=space-y-1><p class="text-xs text-gray-700 dark:text-gray-300">Restart the service:</p><code class="block text-xs bg-gray-100 dark:bg-gray-700 p-2 rounded mt-1">sudo systemctl restart pulse'),zx=i('<div class=space-y-1><p class="text-xs text-gray-700 dark:text-gray-300">Restart the development server:</p><code class="block text-xs bg-gray-100 dark:bg-gray-700 p-2 rounded mt-1">sudo systemctl restart pulse-hot-dev'),Wx=i('<div class=space-y-1><p class="text-xs text-gray-700 dark:text-gray-300">Restart Pulse using your deployment method'),qx=i(`<div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4"><div class="flex items-start space-x-3"><div class=flex-shrink-0><svg class="h-6 w-6 text-amber-600 dark:text-amber-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg></div><div class=flex-1><h4 class="text-sm font-semibold text-amber-900 dark:text-amber-100">Security Configured - Restart Required</h4><p class="text-xs text-amber-700 dark:text-amber-300 mt-1">Security settings have been configured but the service needs to be restarted to activate them.</p><p class="text-xs text-amber-600 dark:text-amber-400 mt-2">After restarting, you'll need to log in with your saved credentials.</p><div class="mt-4 bg-white dark:bg-gray-800 rounded-lg p-3 border border-amber-200 dark:border-amber-700"><p class="text-xs font-semibold text-gray-900 dark:text-gray-100 mb-2">How to restart Pulse:</p></div><div class="mt-3 p-2 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded"><p class="text-xs text-green-700 dark:text-green-300">💡 <strong>Tip:</strong> Make sure you've saved your credentials before restarting!`),Kx=i('<div class="bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center gap-3"><div class="p-2 bg-blue-100 dark:bg-blue-900/50 rounded-lg"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z">'),Jx=i("<div class=p-6>"),Qx=i("<div class=space-y-6>"),Yx=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">System'),Xx=i('<div class="text-xs space-y-1 text-gray-600 dark:text-gray-400"><div>Version: </div><div>Runtime: </div><div>Uptime: </div><div>OS / Arch: </div><div>Go runtime: </div><div>CPU cores: </div><div>Goroutines: </div><div>Memory: <!> MB'),Zx=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">PVE Nodes'),eb=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">PBS Instances'),tb=i('<div class="mt-4 space-y-3">'),rb=i('<div class=space-y-6><div><div class=space-y-4><div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4"><h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-4">Connection Diagnostics</h4><p class="text-xs text-gray-600 dark:text-gray-400 mb-4">Test all configured node connections and view detailed status</p><button type=button class="px-4 py-2 text-sm bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"></button></div><div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4"><h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-4">System Information</h4><div class="space-y-2 text-sm"><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Version:</span><span class=font-medium>2.0.0</span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Backend:</span><span class=font-medium>Go 1.21</span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Frontend:</span><span class=font-medium>SolidJS + TypeScript</span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">WebSocket Status:</span><span></span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Server Port:</span><span class=font-medium></span></div></div></div><div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4"><h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-4">Connection Status</h4><div class="space-y-2 text-sm"><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">PVE Nodes:</span><span class=font-medium></span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">PBS Nodes:</span><span class=font-medium></span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Total VMs:</span><span class=font-medium></span></div><div class="flex justify-between"><span class="text-gray-600 dark:text-gray-400">Total Containers:</span><span class=font-medium></span></div></div></div><div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4"><h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-4">Export Diagnostics</h4><p class="text-xs text-gray-600 dark:text-gray-400 mb-4">Export system diagnostics data for troubleshooting</p><p class="text-xs text-gray-500 dark:text-gray-400 mt-3"><strong>Export Full:</strong> Complete data for private troubleshooting<br><strong>Export for GitHub:</strong> Sanitized data safe for public sharing'),nb=i('<div class=flex-1><div class="p-3 sm:p-6">'),sb=i("<li>Backup user tokens on the PBS are removed, so jobs referencing them will no longer authenticate until the node is re-added."),ab=i("<li>Mail gateway tokens are removed as part of the cleanup; re-enroll to restore outbound telemetry."),lb=i('<div class="space-y-3 text-sm text-gray-600 dark:text-gray-300"><p>Removing this <!> also scrubs the Pulse footprint on the host — the proxy service, SSH key, API token, and bind mount are all cleaned up automatically.</p><div class="rounded-lg border border-blue-200 bg-blue-50 p-3 text-sm leading-relaxed dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-100"><p class="font-medium text-blue-900 dark:text-blue-100">What happens next</p><ul class="mt-2 list-disc space-y-1 pl-4 text-blue-800 dark:text-blue-200 text-sm"><li>Pulse removes the node entry and clears related alerts.</li><li></li><li>If the host comes back later, rerunning the setup script reinstalls everything with a fresh key.'),ib=i('<div class="flex items-center justify-end gap-3 pt-2"><button type=button class="rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700">Keep node</button><button type=button class="rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-red-500 dark:hover:bg-red-400">'),ob=i('<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4">'),db=i('<div class="bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700"><div class=space-y-3><label class="flex items-start gap-3 cursor-pointer"><input type=radio class="mt-1 text-blue-600 focus:ring-blue-500"><div class=flex-1><div class="text-sm font-medium text-gray-700 dark:text-gray-300">Use your login password</div><div class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">Use the same password you use to log into Pulse (recommended)</div></div></label><label class="flex items-start gap-3 cursor-pointer"><input type=radio class="mt-1 text-blue-600 focus:ring-blue-500"><div class=flex-1><div class="text-sm font-medium text-gray-700 dark:text-gray-300">Use a custom passphrase</div><div class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">Create a different passphrase for this backup'),cb=i("<p>You'll need this passphrase to restore the backup."),ub=i("<p>You'll use this same password when restoring the backup"),gb=i('<div class=space-y-4><div><label></label><input type=password></div><div class="bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3"><div class="flex gap-2"><svg class="w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-xs text-amber-700 dark:text-amber-300"><strong>Important:</strong> The backup contains node credentials but NOT authentication settings. Each Pulse instance should configure its own login credentials for security. Remember your <!> for restoring.</div></div></div><div class="flex justify-end space-x-3"><button type=button class="px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">Cancel</button><button type=button class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">Export'),qa=i('<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">'),hb=i('<div class=space-y-4><p class="text-sm text-gray-600 dark:text-gray-400">This Pulse instance requires an API token for export/import operations. Please enter the API token configured on the server.</p><div><label>API Token</label><input type=password placeholder="Enter API token"></div><div class="text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 rounded p-2"><p class="font-semibold mb-1">The API token is set as an environment variable:</p><code class=block>API_TOKENS=token-for-export,token-for-automation'),fb=i('<div class="flex justify-end space-x-2 mt-6"><button type=button class="px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">Cancel</button><button type=button class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">Authenticate'),mb=i('<div class=space-y-4><div><label>Configuration File</label><input type=file accept=.json></div><div><label>Backup Password</label><input type=password placeholder="Enter the password used when creating this backup"><p>This is usually your Pulse login password, unless you used a custom passphrase</p></div><div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded p-3"><p class="text-xs text-yellow-700 dark:text-yellow-300"><strong>Warning:</strong> Importing will replace all current configuration. This action cannot be undone.</p></div><div class="flex justify-end space-x-3"><button type=button class="px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">Cancel</button><button type=button class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed">Import'),xb=i('<p class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">'),bb=i("<div class=space-y-2><div class=space-y-1.5>"),pb=i("<span class=truncate>"),di=i("<button type=button>"),Ka=i('<span class="text-xs font-medium text-gray-600 dark:text-gray-400">'),yb=i('<div class="mt-3 p-3 bg-gray-100 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700"><div class="flex items-center gap-2 mb-2"><svg width=16 height=16 viewBox="0 0 24 24"fill=none class="text-gray-600 dark:text-gray-400"><circle cx=12 cy=12 r=3 stroke=currentColor stroke-width=2 fill=none></circle><circle cx=4 cy=12 r=2 stroke=currentColor stroke-width=2 fill=none></circle><circle cx=20 cy=12 r=2 stroke=currentColor stroke-width=2 fill=none></circle><line x1=7 y1=12 x2=9 y2=12 stroke=currentColor stroke-width=2></line><line x1=15 y1=12 x2=17 y2=12 stroke=currentColor stroke-width=2></line></svg><span class="font-semibold text-gray-700 dark:text-gray-300"> Cluster</span><span class="text-xs bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-2 py-0.5 rounded-full ml-auto"> nodes</span></div><div class="grid grid-cols-1 sm:grid-cols-2 gap-2"></div><p class="mt-2 text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M5 12h14M12 5l7 7-7 7"></path></svg>Automatic failover enabled between cluster nodes'),ci=i('<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600"><div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2"><div class="flex-1 min-w-0"><div class="flex items-start gap-3"><div></div><div class="flex-1 min-w-0"><h4 class="font-medium text-gray-900 dark:text-gray-100 truncate"></h4><p class="text-sm text-gray-600 dark:text-gray-400 mt-1 break-all"></p><div class="flex flex-wrap gap-1 sm:gap-2 mt-2"><span class="text-xs px-2 py-1 bg-gray-200 dark:bg-gray-600 rounded"></span></div></div></div></div><div class="flex items-center gap-1 sm:gap-2 flex-shrink-0"><button type=button class="p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"title="Test connection"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg></button><button type=button class="p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg></button><button type=button class="p-2 text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2">'),vb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">VMs'),kb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Containers'),wb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Storage'),$b=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Backups'),_b=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Physical Disks'),ui=i('<span class="text-xs px-2 py-1 bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300 rounded">Temperature'),Cb=i('<div class="flex items-center gap-2 text-xs bg-white dark:bg-gray-900 px-2 py-1.5 rounded border border-gray-200 dark:border-gray-700"><div></div><span class="font-medium text-gray-700 dark:text-gray-300"></span><span class="text-gray-500 dark:text-gray-500 ml-auto">'),Sb=i('<div class="text-center py-8 text-gray-500 dark:text-gray-400"><p>No PVE nodes configured</p><p class="text-sm mt-1">Add a node to start monitoring'),Fn=i("<li>"),gi=i('<div class="bg-gray-50/50 dark:bg-gray-700/30 rounded-lg p-4 border border-gray-200/50 dark:border-gray-600/50 opacity-75 hover:opacity-100 transition-opacity cursor-pointer"><div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2"><div class="flex-1 min-w-0"><div class="flex items-start gap-3"><div class="flex-shrink-0 w-3 h-3 mt-1.5 rounded-full bg-gray-400 animate-pulse"></div><div class="flex-1 min-w-0"><h4 class="font-medium text-gray-700 dark:text-gray-300"></h4><p class="text-sm text-gray-500 dark:text-gray-500 mt-1">:</p><div class="flex items-center gap-2 mt-2"><span class="text-xs px-2 py-1 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded">Discovered</span><span class="text-xs text-gray-500 dark:text-gray-400">Click to configure</span></div></div></div></div><svg width=20 height=20 viewBox="0 0 24 24"fill=none class="text-gray-400 mt-1"><path d="M12 5v14m-7-7h14"stroke=currentColor stroke-width=2 stroke-linecap=round>'),Tb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Datastores'),Ab=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Sync Jobs'),Db=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Verify Jobs'),Mb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Prune Jobs'),Pb=i('<div class="text-center py-8 text-gray-500 dark:text-gray-400"><p>No PBS nodes configured</p><p class="text-sm mt-1">Add a node to start monitoring'),Eb=i('<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600"><div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2"><div class="flex-1 min-w-0"><div class="flex items-start gap-3"><div></div><div class="flex-1 min-w-0"><h4 class="font-medium text-gray-900 dark:text-gray-100 truncate"></h4><p class="text-sm text-gray-600 dark:text-gray-400 mt-1 break-all"></p><div class="flex flex-wrap gap-1 sm:gap-2 mt-2"><span class="text-xs px-2 py-1 bg-gray-200 dark:bg-gray-600 rounded"></span></div></div></div></div><div class="flex items-center gap-1 sm:gap-2 flex-shrink-0"><button type=button class="p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"title="Test connection"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg></button><button type=button class="p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"title="Edit node"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg></button><button type=button class="p-2 text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300"title="Delete node"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2">'),Nb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Mail stats'),Ob=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Queues'),Lb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Quarantine'),Rb=i('<span class="text-xs px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded">Domain stats'),Ib=i('<div class="text-center py-8 text-gray-500 dark:text-gray-400"><p>No PMG nodes configured</p><p class="text-sm mt-1">Add a node to start monitoring mail flow'),Hb=i('<div class="bg-gradient-to-r from-purple-50 to-transparent dark:from-purple-900/20 dark:to-transparent border-l-4 border-purple-500 rounded-lg p-4 cursor-pointer hover:shadow-md transition-all"><div class="flex items-start justify-between"><div class="flex items-start gap-3 flex-1 min-w-0"><svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class="text-purple-500 flex-shrink-0 mt-0.5"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg><div class="flex-1 min-w-0"><h4 class="font-medium text-gray-900 dark:text-gray-100 truncate"></h4><p class="text-sm text-gray-500 dark:text-gray-500 mt-1">:</p><div class="flex items-center gap-2 mt-2"><span class="text-xs px-2 py-1 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded">Discovered</span><span class="text-xs text-gray-500 dark:text-gray-400">Click to configure</span></div></div></div><svg width=20 height=20 viewBox="0 0 24 24"fill=none class="text-gray-400 mt-1"><path d="M12 5v14m-7-7h14"stroke=currentColor stroke-width=2 stroke-linecap=round>'),Ub=i('<div class="mt-2 p-2 bg-amber-100 dark:bg-amber-900/30 border border-amber-300 dark:border-amber-700 rounded text-xs text-amber-800 dark:text-amber-200"><div class="flex items-center gap-1"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><span>Overridden by ALLOWED_ORIGINS environment variable</span></div><div class="mt-1 text-amber-700 dark:text-amber-300">Remove the env var and restart to enable UI configuration'),Bb=i('<div class="animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full">'),jb=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">Temperature proxy'),Fb=i("<div>Socket path: "),Vb=i("<div>Permissions: "),Gb=i("<div>Owner: "),zb=i("<div>Proxy version: "),Wb=i("<div>SSH directory: "),qb=i("<div>Key fingerprint: "),Kb=i("<div>Legacy SSH keys: "),Jb=i("<div class=text-red-500>Legacy SSH temperature collection detected"),Qb=i('<div class="text-xs space-y-1 text-gray-600 dark:text-gray-400"><div class="flex items-center justify-between"><span>Proxy socket</span><span></span></div><div class="flex items-center justify-between"><span>Daemon</span><span>'),Yb=i('<div class="mt-3 flex flex-wrap gap-2"><button type=button class="px-3 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">'),Xb=i('<div class="mt-3 text-xs text-gray-600 dark:text-gray-400 space-y-1"><div>Proxy node connectivity:</div><ul class="list-disc pl-4 space-y-0.5">'),Zs=i('<ul class="mt-3 text-xs text-gray-600 dark:text-gray-400 list-disc pl-4 space-y-1">'),hi=i('<span class="ml-1 text-gray-500 dark:text-gray-400">(<!>)'),Zb=i("<li><span>: "),ep=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">API tokens'),tp=i('<span class="px-2 py-0.5 rounded text-xs bg-orange-100 text-orange-700 dark:bg-orange-700/40 dark:text-orange-100">Env override detected'),rp=i('<span class="px-2 py-0.5 rounded text-xs bg-red-100 text-red-700 dark:bg-red-700/40 dark:text-red-100">Legacy token present'),np=i('<div class="text-xs space-y-2 text-gray-600 dark:text-gray-400"><div class="flex flex-wrap gap-2"><span></span></div><div class="grid grid-cols-2 gap-2"><div>Configured tokens: </div><div>Rotation needed: </div><div>Docker hosts on shared token: </div><div>Unused tokens: '),sp=i('<div class="mt-3 border border-gray-200 dark:border-gray-700 rounded-md divide-y divide-gray-200 dark:divide-gray-700">'),ap=i('<div class="mt-3 text-xs text-gray-600 dark:text-gray-400 space-y-1"><div class="font-semibold text-gray-700 dark:text-gray-200">Token usage</div><ul class="list-disc pl-4 space-y-1">'),lp=i('<span class="ml-2 uppercase tracking-wide">(<!>)'),ip=i('<div class="p-2 text-xs text-gray-600 dark:text-gray-400 flex flex-wrap justify-between gap-2"><div class="flex-1 min-w-[140px]"><div class="font-medium text-gray-700 dark:text-gray-200"></div><div class="text-2xs text-gray-500 dark:text-gray-400"></div></div><div class="text-right min-w-[160px]"><div>Created: </div><div>Last used: '),op=i("<li>: <!> "),dp=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">Docker agents'),cp=i('<div class="text-xs text-gray-600 dark:text-gray-400 grid grid-cols-2 gap-2"><div>Total hosts: </div><div>Online: </div><div>With dedicated tokens: </div><div>Attention required: </div><div>Missing version: </div><div>Outdated agents: </div><div>Stale commands: </div><div>Pending uninstall: '),up=i('<div class="mt-2 text-xs text-gray-500 dark:text-gray-400">Recommended agent version: '),gp=i('<div class="mt-3 text-xs text-gray-600 dark:text-gray-400 divide-y divide-gray-200 dark:divide-gray-700 border border-gray-200 dark:border-gray-700 rounded-md">'),hp=i("<span>Agent "),fp=i("<span>Token "),mp=i("<span>Seen "),xp=i('<div class="mt-3 w-full space-y-2 bg-gray-100 dark:bg-gray-800/60 border border-gray-200 dark:border-gray-700 rounded p-3 text-xs text-gray-700 dark:text-gray-200">'),bp=i('<div class="p-2 space-y-1"><div class="flex items-center justify-between"><span class="font-medium text-gray-700 dark:text-gray-200"></span><span></span></div><div class="text-2xs text-gray-500 dark:text-gray-400 space-x-2"></div><ul class="list-disc pl-4 space-y-1 text-gray-600 dark:text-gray-400"></ul><div class="mt-2 flex flex-wrap gap-2"><button type=button class="px-3 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">'),pp=i('<div class="font-semibold text-gray-800 dark:text-gray-100">Install command'),fi=i('<pre class="whitespace-pre-wrap break-all bg-gray-900/80 text-gray-100 rounded p-2 text-[11px]">'),yp=i('<button type=button class="px-2 py-1 text-xs bg-slate-700 text-white rounded hover:bg-slate-800 transition-colors">Copy install command'),vp=i('<div class="font-semibold text-gray-800 dark:text-gray-100 mt-2">Systemd snippet'),kp=i('<button type=button class="px-2 py-1 text-xs bg-slate-700 text-white rounded hover:bg-slate-800 transition-colors">Copy service snippet'),wp=i('<div class="text-gray-600 dark:text-gray-400">Target URL: '),$p=i('<h5 class="text-sm font-semibold mb-2 text-gray-700 dark:text-gray-300">Alerts configuration'),_p=i("<div>Legacy sources: "),Cp=i("<div>Legacy schedule settings: "),Sp=i('<div class="text-xs text-gray-600 dark:text-gray-400 space-y-2"><div class="flex flex-wrap gap-2"><span>Legacy thresholds </span><span>Cooldown </span><span>Grouping window '),Tp=i('<div class="text-red-500 mt-1 break-words">'),Ap=i('<div class="text-xs border-t dark:border-gray-700 pt-2 mt-2 first:border-0 first:pt-0 first:mt-0"><div class="flex justify-between items-center mb-1"><span class="font-medium text-gray-700 dark:text-gray-300"></span><span></span></div><div class="text-gray-600 dark:text-gray-400"><div>Host: </div><div>Auth: '),Dp=i('<div class="text-red-500 break-words">'),Mp=i('<div class="text-xs border-t dark:border-gray-700 pt-2 mt-2 first:border-0 first:pt-0 first:mt-0"><div class="flex justify-between items-center mb-1"><span class="font-medium text-gray-700 dark:text-gray-300"></span><span>'),Pp=i('<div class="text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 rounded p-2">💡 Run diagnostics first for more comprehensive export data'),Ep=i('<div class=space-y-3><div class="flex gap-2"><button type=button class="px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors">Export Full</button><button type=button class="px-4 py-2 text-sm bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors">Export for GitHub'),Np=i("<span class=font-semibold>");const Op={pve:{title:"Proxmox VE",description:"Connect clusters, manage nodes, and control discovery for Proxmox VE."},pbs:{title:"Proxmox Backup Server",description:"Add and maintain Proxmox Backup Server endpoints used for snapshot and archive monitoring."},pmg:{title:"Proxmox Mail Gateway",description:"Monitor mail flow, spam trends, and quarantine health from your PMG nodes."},docker:{title:"Docker Agents",description:"Configure Docker hosts, agent tokens, and polling behaviour for container insights."},system:{title:"System Settings",description:"Adjust Pulse core behaviour, discovery preferences, and software update cadence."},urls:{title:"Guest URLs",description:"Define per-guest deep links to console, dashboards, or third-party tooling."},security:{title:"Security & Access",description:"Manage authentication, API tokens, exports, and other security posture tooling."},diagnostics:{title:"Diagnostics",description:"Inspect discovery scans, connection health, and runtime metrics for troubleshooting."},updates:{title:"Update History",description:"Review past software updates, rollback events, and upgrade audit logs."}},Lp=e=>{const{state:r,connected:s}=qr(),l=In(),o=Bs(),a=ke=>ke.includes("/settings/pbs")?"pbs":ke.includes("/settings/pmg")?"pmg":ke.includes("/settings/docker")?"docker":ke.includes("/settings/system")?"system":ke.includes("/settings/security")?"security":ke.includes("/settings/diagnostics")?"diagnostics":ke.includes("/settings/urls")?"urls":ke.includes("/settings/updates")?"updates":"pve",[d,c]=Z(a(o.pathname)),g=()=>d(),b=ke=>{d()!==ke&&c(ke);const Me=`/settings/${ke}`;o.pathname!==Me&&l(Me)},p=()=>Op[g()]??{title:"Settings",description:"Manage Pulse configuration."};ft(Wn(()=>o.pathname,ke=>{if(ke==="/settings"||ke==="/settings/"){d()!=="pve"&&c("pve"),l("/settings/pve",{replace:!0});return}const Me=a(ke);Me!==d()&&c(Me)}));const[m,S]=Z(!1),[z,ie]=Z(!0),[ne,W]=Z([]),[X,I]=Z([]),[L,H]=Z(!1),[se,le]=Z(null),[ee,U]=Z("pve"),[Y,oe]=Z(0),[_,B]=Z(!1),[$,D]=Z(!1),[f,j]=Z(null),[K,C]=Z(!1),[ge,J]=Z(!1),[N,F]=Z({scanning:!1}),[P,E]=Z("*"),[u,v]=Z(!0),[V,A]=Z("auto"),[k,w]=Z({}),[de,fe]=Z(!1),[x,R]=Z(""),[Q,G]=Z(null),[T,te]=Z(null),[ae,M]=Z(!1),[ce,ue]=Z("stable"),[re,O]=Z(!1),[xe,he]=Z(24),[me,_e]=Z("03:00"),[Ce,Oe]=Z(null),[tt,Ze]=Z(!1),[bt,ct]=Z(null),[qe,Ke]=Z(null),[Xe,_t]=Z(null),[Lt,vt]=Z({}),[Ve,lt]=Z(null),[Re,gt]=Z(!0),[mt,Rt]=Z(""),[It,Ae]=Z(!1),[Fe,Qe]=Z(""),[xt,Vt]=Z(null),[Et,Jt]=Z(!1),[er,Ut]=Z(!1),[lr,Bt]=Z(!1),[et,we]=Z(""),[Je,Ge]=Z(null),[pt,dt]=Z(!1),[ht,We]=Z(!1),st=ke=>{if(!ke)return"";const Me=Date.now()-ke;if(Me<0)return"just now";const Ee=Math.round(Me/1e3);if(Ee<60)return`${Ee}s ago`;const Se=Math.round(Ee/60);if(Se<60)return`${Se}m ago`;const De=Math.round(Se/60);return De<24?`${De}h ago`:new Date(ke).toLocaleString()},nr=ke=>{if(!ke||ke<=0)return"Unknown";const Me=Math.floor(ke/86400),Ee=Math.floor(ke%86400/3600),Se=Math.floor(ke%3600/60);return Me>0?`${Me}d ${Ee}h`:Ee>0?`${Ee}h ${Se}m`:Se>0?`${Se}m`:`${Math.floor(ke)}s`},xr=async()=>{Ze(!0);try{const Me=await(await fetch("/api/diagnostics")).json();Oe(Me)}catch(ke){console.error("Failed to fetch diagnostics:",ke),$t("Failed to run diagnostics")}finally{Ze(!1)}},cr=async()=>{if(!bt()){ct("register-nodes");try{const ke=await fetch("/api/diagnostics/temperature-proxy/register-nodes",{method:"POST"}),Me=await ke.json().catch(()=>null);if(!ke.ok||!Me||Me.success!==!0){const Se=Me&&typeof Me.message=="string"?Me.message:"Failed to query proxy nodes";$t(Se);return}const Ee=Array.isArray(Me.nodes)?Me.nodes.map(Se=>({name:typeof Se.name=="string"?Se.name:"unknown",sshReady:!!Se.ssh_ready,error:typeof Se.error=="string"?Se.error:void 0})):[];Ke(Ee),Wt("Queried proxy node registration state"),await xr()}catch(ke){console.error("Failed to query proxy node registration state:",ke),$t("Failed to query proxy nodes")}finally{ct(null)}}},sr=async ke=>{if(!Xe()){_t(ke);try{const Me=await fetch("/api/diagnostics/docker/prepare-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hostId:ke})}),Ee=await Me.json().catch(()=>null);if(!Me.ok||!Ee||Ee.success!==!0){const ye=Ee&&typeof Ee.message=="string"?Ee.message:"Failed to prepare Docker token";$t(ye);return}const Se=Ee.record;if(!Se||typeof Se.id!="string"){$t("Server did not return a valid token record");return}const De={id:Se.id,name:Se.name,prefix:Se.prefix,suffix:Se.suffix,createdAt:Se.createdAt,lastUsedAt:Se.lastUsedAt},be={token:Ee.token,installCommand:Ee.installCommand,systemdServiceSnippet:Ee.systemdServiceSnippet,pulseURL:Ee.pulseURL,record:De};vt(ye=>({...ye,[ke]:be})),pa({token:be.token,record:De,source:"docker",note:"Copy this token into the install command shown in Diagnostics."});const ve=Ee.host&&typeof Ee.host.name=="string"?Ee.host.name:ke;Wt(`Generated dedicated token for ${ve}`),await xr()}catch(Me){console.error("Failed to prepare Docker token",Me),$t("Failed to prepare Docker token")}finally{_t(null)}}},wr=async(ke,Me)=>{await on(ke)?Wt(Me):$t("Failed to copy to clipboard")},Gt=[{id:"proxmox",label:"Proxmox",items:[{id:"pve",label:"Proxmox VE nodes",icon:n(Rm,{class:"w-4 h-4",strokeWidth:2})},{id:"pbs",label:"Proxmox Backup Server",icon:n(Hm,{class:"w-4 h-4",strokeWidth:2})},{id:"pmg",label:"Proxmox Mail Gateway",icon:n(Bm,{class:"w-4 h-4",strokeWidth:2})},{id:"urls",label:"Guest URLs",icon:n(Fm,{class:"w-4 h-4",strokeWidth:2})}]},{id:"docker",label:"Docker",items:[{id:"docker",label:"Docker hosts",icon:n(Gm,{class:"w-4 h-4",strokeWidth:2})}]},{id:"administration",label:"Administration",items:[{id:"system",label:"System",icon:n(yo,{class:"w-4 h-4",strokeWidth:2})},{id:"security",label:"Security",icon:n(qm,{class:"w-4 h-4",strokeWidth:2})},{id:"diagnostics",label:"Diagnostics",icon:n(Jm,{class:"w-4 h-4",strokeWidth:2})}]}],br=Gt.flatMap(ke=>ke.items),pr=async()=>{try{const ke=await rn.getNodes(),Me=r.nodes,Ee=ke.map(Se=>{const De=Me?.find(ve=>{if(ve.id===Se.id||ve.name===Se.name)return!0;const ye=Se.name.replace(/\.lan$/,""),Ie=ve.name.replace(/\.lan$/,"");return!!(ye===Ie||ve.id.includes(Se.name)||Se.name.includes(ve.name))});return{...Se,hasPassword:Se.hasPassword??!!Se.password,hasToken:Se.hasToken??!!Se.tokenValue,status:Se.status||"pending",temperature:De?.temperature||Se.temperature}});W(Ee)}catch(ke){console.error("Failed to load nodes:",ke),ke instanceof Error&&(ke.message.includes("429")||ke.message.includes("fetch"))&&(console.log("Retrying node load after delay..."),setTimeout(()=>pr(),3e3))}},yr=async()=>{gt(!0);try{const{apiFetch:ke}=await Ln(async()=>{const{apiFetch:Ee}=await Promise.resolve().then(()=>zn);return{apiFetch:Ee}},void 0),Me=await ke("/api/security/status");if(Me.ok){const Ee=await Me.json();console.log("Security status loaded:",Ee),lt(Ee)}else console.error("Failed to fetch security status:",Me.status)}catch(ke){console.error("Failed to fetch security status:",ke)}finally{gt(!1)}},Er=(ke,Me={})=>{const{merge:Ee=!1}=Me;if(!ke||ke.length===0){Ee||I([]);return}const Se=new Set,De=new Set;ne().forEach(Le=>{const rt=Le.host.replace(/^https?:\/\//,"").replace(/:\d+$/,"");Se.add(rt.toLowerCase()),Le.type==="pve"&&"isCluster"in Le&&Le.isCluster&&"clusterEndpoints"in Le&&Le.clusterEndpoints&&Le.clusterEndpoints.forEach(je=>{je.IP&&De.add(je.IP.toLowerCase()),je.Host&&De.add(je.Host.toLowerCase())})});const be=["pve","pbs","pmg"],ve=Le=>be.includes(Le),Ie=ke.map(Le=>{const rt=(Le.ip||"").trim();let je=(Le.type||"").toLowerCase();const jt=(Le.hostname||Le.name||"").trim(),Ct=(Le.version||"").trim(),Mt=(Le.release||"").trim();if(!ve(je)){const Kt=`${jt} ${Ct} ${Mt}`.toLowerCase();Kt.includes("pmg")||Kt.includes("mail gateway")?je="pmg":Kt.includes("pbs")||Kt.includes("backup server")?je="pbs":(Kt.includes("pve")||Kt.includes("virtual environment"))&&(je="pve")}if(!rt||!ve(je))return null;const Pt=typeof Le.port=="number"?Le.port:je==="pbs"?8007:8006;return{ip:rt,port:Pt,type:je,version:Ct||"Unknown",hostname:jt||void 0,release:Mt||void 0}}).filter(Le=>Le!==null).filter(Le=>{const rt=Le.ip.toLowerCase(),je=Le.hostname?.toLowerCase();return!(Se.has(rt)||je&&Se.has(je)||De.has(rt)||je&&De.has(je))});I(Ee?Le=>{const rt=new Map(Le.map(je=>[`${je.ip}:${je.port}`,je]));return Ie.forEach(je=>{rt.set(`${je.ip}:${je.port}`,je)}),Array.from(rt.values())}:Ie),F(Le=>({...Le,lastResultAt:Date.now()}))},Nr=async()=>{try{const{apiFetch:ke}=await Ln(async()=>{const{apiFetch:Ee}=await Promise.resolve().then(()=>zn);return{apiFetch:Ee}},void 0),Me=await ke("/api/discover");if(Me.ok){const Ee=await Me.json();Array.isArray(Ee.servers)?(Er(Ee.servers),F(Se=>({...Se,lastResultAt:typeof Ee.timestamp=="number"?Ee.timestamp:Date.now(),errors:Array.isArray(Ee.errors)&&Ee.errors.length>0?Ee.errors:void 0}))):(Er([]),F(Se=>({...Se,lastResultAt:typeof Ee?.timestamp=="number"?Ee.timestamp:Se.lastResultAt,errors:Array.isArray(Ee?.errors)&&Ee.errors.length>0?Ee.errors:void 0})))}}catch(ke){console.error("Failed to load discovered nodes:",ke)}},Or=async(ke={})=>{const{quiet:Me=!1}=ke;F(Ee=>({...Ee,scanning:!0,subnet:V()||Ee.subnet,lastScanStartedAt:Date.now(),errors:void 0}));try{const{apiFetch:Ee}=await Ln(async()=>{const{apiFetch:De}=await Promise.resolve().then(()=>zn);return{apiFetch:De}},void 0),Se=await Ee("/api/discover",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subnet:V()||"auto"})});if(!Se.ok){const De=await Se.text();throw new Error(De||"Discovery request failed")}Me||Yt.info("Discovery scan started",2e3)}catch(Ee){console.error("Failed to start discovery scan:",Ee),Yt.error("Failed to start discovery scan"),F(Se=>({...Se,scanning:!1}))}};vr(async()=>{const ke=dn.on("node_auto_registered",()=>{H(!1),le(null),pr(),Nr()}),Me=dn.on("refresh_nodes",()=>{pr()}),Ee=dn.on("discovery_updated",ve=>{if(!ve){Er([]),F(ye=>({...ye,scanning:!1}));return}Array.isArray(ve.servers)?(Er(ve.servers,{merge:!!ve.immediate}),F(ye=>({...ye,scanning:ve.scanning??ye.scanning,lastResultAt:ve.timestamp??Date.now(),errors:Array.isArray(ve.errors)&&ve.errors.length>0?ve.errors:void 0}))):ve.immediate?F(ye=>({...ye,scanning:ve.scanning??ye.scanning,errors:Array.isArray(ve.errors)&&ve.errors.length>0?ve.errors:void 0})):(Er([]),F(ye=>({...ye,scanning:ve.scanning??ye.scanning,lastResultAt:ve.timestamp??ye.lastResultAt,errors:Array.isArray(ve.errors)&&ve.errors.length>0?ve.errors:void 0})))}),Se=dn.on("discovery_status",ve=>{if(!ve){F(ye=>({...ye,scanning:!1}));return}F(ye=>({...ye,scanning:!!ve.scanning,subnet:ve.subnet||ye.subnet,lastScanStartedAt:ve.scanning?ve.timestamp??Date.now():ye.lastScanStartedAt,lastResultAt:!ve.scanning&&ve.timestamp?ve.timestamp:ye.lastResultAt}))});let De;ft(()=>{De&&(clearInterval(De),De=void 0),L()&&(De=setInterval(()=>{pr(),Nr()},3e3))});const be=setInterval(()=>{Nr()},3e4);Ar(()=>{ke(),Me(),Ee(),Se(),De&&clearInterval(De),clearInterval(be)});try{await yr(),await new Promise(ve=>setTimeout(ve,50)),await pr(),await new Promise(ve=>setTimeout(ve,50)),await Nr();try{const ve=await fetch("/api/config/system");if(ve.ok){const ye=await ve.json();E(ye.allowedOrigins||"*"),v(ye.discoveryEnabled??!0),A(ye.discoverySubnet||"auto"),fe(ye.allowEmbedding??!1),R(ye.allowedEmbedOrigins||""),O(ye.autoUpdateEnabled||!1),he(ye.autoUpdateCheckInterval||24),_e(ye.autoUpdateTime||"03:00"),ye.updateChannel&&ue(ye.updateChannel),ye.envOverrides&&w(ye.envOverrides)}else await Sn.getSettings()}catch(ve){console.error("Failed to load settings:",ve)}try{const ve=await yn.getVersion();G(ve),Tr.checkForUpdates(),ve.channel&&ue(ve.channel)}catch(ve){console.error("Failed to load version:",ve)}}catch(ve){console.error("Failed to load configuration:",ve)}finally{J(!0)}}),ft(Wn(()=>r.nodes,ke=>{const Me=ne();if(ke&&ke.length>0&&Me.length>0){const Ee=Me.map(Se=>{const De=ke.find(be=>{if(be.id===Se.id||be.name===Se.name)return!0;const ve=Se.name.replace(/\.lan$/,""),ye=be.name.replace(/\.lan$/,"");return!!(ve===ye||be.id.includes(Se.name)||Se.name.includes(be.name))});return De?.temperature?{...Se,temperature:De.temperature}:Se});W(Ee)}}));const Zr=async()=>{try{g()==="system"&&await Sn.updateSystemSettings({allowedOrigins:P(),updateChannel:ce(),autoUpdateEnabled:re(),autoUpdateCheckInterval:xe(),autoUpdateTime:me(),allowEmbedding:de(),allowedEmbedOrigins:x()}),Wt("Settings saved successfully. Service restart may be required for port changes."),S(!1),setTimeout(()=>{window.location.reload()},3e3)}catch(ke){$t(ke instanceof Error?ke.message:"Failed to save settings")}},gn=()=>{const ke=f();return ke?ke.displayName||ke.name||ke.host||ke.id:""},en=()=>f()?.host||"",sn=()=>f()?.type||"",hn=()=>{switch(sn()){case"pve":return"Proxmox VE node";case"pbs":return"Proxmox Backup Server";case"pmg":return"Proxmox Mail Gateway";default:return"Pulse node"}},xn=ke=>{j(ke),D(!0)},bn=()=>{K()||(D(!1),j(null))},Dn=async()=>{const ke=f();if(ke){C(!0);try{await rn.deleteNode(ke.id),W(ne().filter(Ee=>Ee.id!==ke.id));const Me=ke.displayName||ke.name||ke.host||ke.id;Wt(`${Me} removed successfully`)}catch(Me){$t(Me instanceof Error?Me.message:"Failed to delete node")}finally{C(!1),D(!1),j(null)}}},an=async ke=>{try{if(!ne().find(Se=>Se.id===ke))throw new Error("Node not found");const Ee=await rn.testExistingNode(ke);if(Ee.status==="success")Wt(Ee.message||"Connection successful");else throw new Error(Ee.message||"Connection failed")}catch(Me){$t(Me instanceof Error?Me.message:"Connection test failed")}},Hn=async()=>{M(!0);try{await Tr.checkForUpdates(!0);const ke=Tr.updateInfo();te(ke),ke?.available&&Tr.isDismissed()&&Tr.clearDismissed(),ke?.available||Wt("You are running the latest version")}catch(ke){$t("Failed to check for updates"),console.error("Update check error:",ke)}finally{M(!1)}},kn=async()=>{if(!mt()){const Ee=Ve()?.hasAuthentication;$t(Ee?It()?"Please enter a passphrase":"Please enter your password":"Please enter a passphrase");return}if((!Ve()?.hasAuthentication||It())&&!mt()){$t("Please enter a passphrase");return}if(!Ve()?.hasAuthentication&&Ve()?.apiTokenConfigured&&!localStorage.getItem("apiToken")){Ge("export"),Bt(!0);return}try{const Ee=document.cookie.split("; ").find(rt=>rt.startsWith("pulse_csrf="))?.split("=")[1],Se={"Content-Type":"application/json"};Ee&&(Se["X-CSRF-Token"]=Ee);const De=localStorage.getItem("apiToken");De&&(Se["X-API-Token"]=De);const be=await fetch("/api/config/export",{method:"POST",headers:Se,credentials:"include",body:JSON.stringify({passphrase:mt()})});if(!be.ok){const rt=await be.text();if(be.status===401||be.status===403){if(!Ve()?.hasAuthentication){if(localStorage.getItem("apiToken")){localStorage.removeItem("apiToken"),$t("Invalid or expired API token. Please re-enter."),Ge("export"),Bt(!0);return}if(rt.includes("API_TOKEN")||rt.includes("API_TOKENS")){Ge("export"),Bt(!0);return}}throw new Error("Export requires authentication")}throw new Error(rt||"Export failed")}const ve=await be.json(),ye=new Blob([JSON.stringify(ve,null,2)],{type:"application/json"}),Ie=URL.createObjectURL(ye),Le=document.createElement("a");Le.href=Ie,Le.download=`pulse-config-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),URL.revokeObjectURL(Ie),Wt("Configuration exported successfully"),Jt(!1),Rt("")}catch(Ee){const Se=Ee instanceof Error?Ee.message:"Failed to export configuration";$t(Se),console.error("Export error:",Ee)}},Br=async()=>{if(!Fe()){$t("Please enter the password");return}if(!xt()){$t("Please select a file to import");return}if(!Ve()?.hasAuthentication&&Ve()?.apiTokenConfigured&&!localStorage.getItem("apiToken")){Ge("import"),Bt(!0);return}try{const Me=await xt().text();let Ee;try{Ee=JSON.parse(Me)}catch(ye){$t("Invalid JSON file format"),console.error("JSON parse error:",ye);return}const Se=document.cookie.split("; ").find(ye=>ye.startsWith("pulse_csrf="))?.split("=")[1],De={"Content-Type":"application/json"};Se&&(De["X-CSRF-Token"]=Se);const be=localStorage.getItem("apiToken");be&&(De["X-API-Token"]=be);const ve=await fetch("/api/config/import",{method:"POST",headers:De,credentials:"include",body:JSON.stringify({passphrase:Fe(),data:Ee.data})});if(!ve.ok){const ye=await ve.text();if(ve.status===401||ve.status===403){if(!Ve()?.hasAuthentication){if(localStorage.getItem("apiToken")){localStorage.removeItem("apiToken"),$t("Invalid or expired API token. Please re-enter."),Ge("import"),Bt(!0);return}if(ye.includes("API_TOKEN")||ye.includes("API_TOKENS")){Ge("import"),Bt(!0);return}}throw new Error("Import requires authentication")}throw new Error(ye||"Import failed")}Wt("Configuration imported successfully. Reloading..."),Ut(!1),Qe(""),Vt(null),setTimeout(()=>window.location.reload(),2e3)}catch(Me){$t("Failed to import configuration"),console.error("Import error:",Me)}};return[(()=>{var ke=Xs();return t(ke,n(it,{padding:"md",get children(){return n(rr,{get title(){return p().title},get description(){return p().description},size:"lg"})}}),null),t(ke,n(h,{get when(){return $e(()=>!!m())()&&(g()==="pve"||g()==="pbs"||g()==="system")},get children(){var Me=nx(),Ee=Me.firstChild,Se=Ee.firstChild,De=Se.nextSibling,be=De.firstChild,ve=be.nextSibling;return be.$$click=Zr,ve.$$click=()=>{window.location.reload()},Me}}),null),t(ke,n(it,{padding:"none",class:"relative lg:flex",get children(){return[(()=>{var Me=sx(),Ee=Me.firstChild,Se=Ee.firstChild;return Me.addEventListener("mouseleave",()=>ie(!0)),Me.addEventListener("mouseenter",()=>ie(!1)),t(Se,n(ze,{each:Gt,children:De=>(()=>{var be=bb(),ve=be.firstChild;return t(be,n(h,{get when(){return!z()},get children(){var ye=xb();return t(ye,()=>De.label),ye}}),ve),t(ve,n(ze,{get each(){return De.items},children:ye=>(()=>{var Ie=di();return Ie.$$click=()=>b(ye.id),t(Ie,()=>ye.icon,null),t(Ie,n(h,{get when(){return!z()},get children(){var Le=pb();return t(Le,()=>ye.label),Le}}),null),q(Le=>{var rt=g()===ye.id?"page":void 0,je=`flex w-full items-center ${z()?"justify-center":"gap-2.5"} rounded-md ${z()?"px-2 py-2.5":"px-3 py-2"} text-sm font-medium transition-colors ${g()===ye.id?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-200":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700/60 dark:hover:text-gray-100"}`,jt=z()?ye.label:void 0;return rt!==Le.e&&Te(Ie,"aria-current",Le.e=rt),je!==Le.t&&y(Ie,Le.t=je),jt!==Le.a&&Te(Ie,"title",Le.a=jt),Le},{e:void 0,t:void 0,a:void 0}),Ie})()})),be})()})),q(De=>{var be=`hidden lg:flex lg:flex-col ${z()?"w-16":"w-72"} ${z()?"lg:min-w-[4rem] lg:max-w-[4rem] lg:basis-[4rem]":"lg:min-w-[18rem] lg:max-w-[18rem] lg:basis-[18rem]"} relative border-b border-gray-200 dark:border-gray-700 lg:border-b-0 lg:border-r lg:border-gray-200 dark:lg:border-gray-700 lg:align-top flex-shrink-0 transition-all duration-300`,ve=!z(),ye=`sticky top-24 ${z()?"px-2":"px-5"} py-6 space-y-6 transition-all duration-300`;return be!==De.e&&y(Me,De.e=be),ve!==De.t&&Te(Me,"aria-expanded",De.t=ve),ye!==De.a&&y(Ee,De.a=ye),De},{e:void 0,t:void 0,a:void 0}),Me})(),(()=>{var Me=nb(),Ee=Me.firstChild;return t(Me,n(h,{get when(){return br.length>0},get children(){var Se=ax(),De=Se.firstChild,be=De.firstChild;return t(be,n(ze,{each:br,children:ve=>(()=>{var ye=di();return ye.$$click=()=>b(ve.id),t(ye,()=>ve.label),q(()=>y(ye,`flex-1 px-3 py-2 text-xs font-medium rounded-md transition-all whitespace-nowrap ${g()===ve.id?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`)),ye})()})),Se}}),Ee),t(Ee,n(h,{get when(){return g()==="pve"},get children(){var Se=Xs();return t(Se,n(h,{get when(){return!ge()},get children(){return Fa()}}),null),t(Se,n(h,{get when(){return ge()},get children(){return[(()=>{var De=lx(),be=De.firstChild,ve=be.firstChild;ve.firstChild;var ye=ve.nextSibling;return t(De,n(rr,{title:"Proxmox VE nodes",size:"md",class:"flex-1"}),be),t(ve,n(Tn,{get checked(){return u()},onChange:async Ie=>{if(k().discoveryEnabled)return;const Le=Ie.currentTarget.checked;v(Le);try{await Sn.updateSystemSettings({discoveryEnabled:Le,discoverySubnet:V()}),Le?(await Or({quiet:!0}),Yt.success("Discovery enabled — scanning network...",2e3)):(Yt.info("Discovery disabled",2e3),F(rt=>({...rt,scanning:!1})))}catch(rt){console.error("Failed to update discovery setting:",rt),Yt.error("Failed to update discovery setting"),v(!Le)}finally{await Nr()}},get disabled(){return k().discoveryEnabled},containerClass:"gap-2",get label(){return(()=>{var Ie=Ka();return t(Ie,()=>u()?"On":"Off"),Ie})()}}),null),t(be,n(h,{get when(){return u()},get children(){var Ie=ii();return Ie.$$click=async()=>{Yt.info("Refreshing discovery...",2e3);try{await Or({quiet:!0})}finally{await Nr()}},Ie}}),ye),ye.$$click=()=>{le(null),U("pve"),oe(Ie=>Ie+1),H(!0)},De})(),(()=>{var De=Wa();return t(De,n(ze,{get each(){return ne().filter(be=>be.type==="pve")},children:be=>(()=>{var ve=ci(),ye=ve.firstChild,Ie=ye.firstChild,Le=Ie.firstChild,rt=Le.firstChild,je=rt.nextSibling,jt=je.firstChild,Ct=jt.nextSibling,Mt=Ct.nextSibling,Pt=Mt.firstChild,Kt=Ie.nextSibling,ur=Kt.firstChild,$r=ur.nextSibling,Ir=$r.nextSibling;return t(jt,()=>be.name),t(Ct,()=>be.host),t(Pt,()=>be.user?`User: ${be.user}`:`Token: ${be.tokenName}`),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&"monitorVMs"in be&&be.monitorVMs));return()=>St()&&vb()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&"monitorContainers"in be&&be.monitorContainers));return()=>St()&&kb()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&"monitorStorage"in be&&be.monitorStorage));return()=>St()&&wb()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&"monitorBackups"in be&&be.monitorBackups));return()=>St()&&$b()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&"monitorPhysicalDisks"in be&&be.monitorPhysicalDisks));return()=>St()&&_b()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pve"&&be.temperature?.available));return()=>St()&&ui()})(),null),t(je,n(h,{get when(){return be.type==="pve"&&"isCluster"in be&&be.isCluster},get children(){var St=yb(),tr=St.firstChild,Lr=tr.firstChild,gr=Lr.nextSibling,Kr=gr.firstChild,Rr=gr.nextSibling,ln=Rr.firstChild,wn=tr.nextSibling;return t(gr,()=>"clusterName"in be?be.clusterName:"Unknown",Kr),t(Rr,()=>"clusterEndpoints"in be&&be.clusterEndpoints?be.clusterEndpoints.length:0,ln),t(wn,n(ze,{get each(){return"clusterEndpoints"in be?be.clusterEndpoints:[]},children:Jr=>(()=>{var Un=Cb(),Kn=Un.firstChild,Bn=Kn.nextSibling,ss=Bn.nextSibling;return t(Bn,()=>Jr.NodeName),t(ss,()=>Jr.IP),q(()=>y(Kn,`w-2 h-2 rounded-full flex-shrink-0 ${Jr.Online?"bg-green-500":"bg-gray-400"}`)),Un})()})),St}}),null),ur.$$click=()=>an(be.id),$r.$$click=()=>{le(be),U(be.type),H(!0)},Ir.$$click=()=>xn(be),q(()=>y(rt,`flex-shrink-0 w-3 h-3 mt-1.5 rounded-full ${(()=>{const St=r.nodes.find(tr=>tr.instance===be.name);return St?.connectionHealth==="unhealthy"||St?.connectionHealth==="error"||St?.status==="offline"?"bg-red-500":St?.connectionHealth==="degraded"?"bg-yellow-500":St&&(St.status==="online"||St.connectionHealth==="healthy")||be.status==="connected"?"bg-green-500":be.status==="error"?"bg-red-500":be.status==="pending"||be.status==="disconnected"?"bg-amber-500 animate-pulse":"bg-gray-400"})()}`)),ve})()}),null),t(De,(()=>{var be=$e(()=>ne().filter(ve=>ve.type==="pve").length===0&&X().filter(ve=>ve.type==="pve").length===0);return()=>be()&&Sb()})(),null),t(De,n(h,{get when(){return u()},get children(){var be=za(),ve=be.firstChild;return t(ve,n(h,{get when(){return N().scanning},get children(){return ix()}}),null),t(ve,n(h,{get when(){return $e(()=>!N().scanning)()&&(N().lastResultAt||N().lastScanStartedAt)},get children(){var ye=Va();return ye.firstChild,t(ye,()=>st(N().lastResultAt??N().lastScanStartedAt),null),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().errors)()&&N().errors.length},get children(){var ye=Ga(),Ie=ye.firstChild,Le=Ie.nextSibling;return t(Le,n(ze,{get each(){return N().errors||[]},children:rt=>(()=>{var je=Fn();return t(je,rt),je})()})),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().scanning)()&&X().filter(ye=>ye.type==="pve").length===0},get children(){return oi()}}),null),t(be,n(ze,{get each(){return X().filter(ye=>ye.type==="pve")},children:ye=>(()=>{var Ie=gi(),Le=Ie.firstChild,rt=Le.firstChild,je=rt.firstChild,jt=je.firstChild,Ct=jt.nextSibling,Mt=Ct.firstChild,Pt=Mt.nextSibling,Kt=Pt.firstChild;return Ie.$$click=()=>{le({id:"",type:"pve",name:ye.hostname||`pve-${ye.ip}`,host:`https://${ye.ip}:${ye.port}`,user:"",tokenName:"",tokenValue:"",verifySSL:!1,monitorVMs:!0,monitorContainers:!0,monitorStorage:!0,monitorBackups:!0,monitorPhysicalDisks:!1,status:"pending"}),U("pve"),H(!0)},t(Mt,()=>ye.hostname||`Proxmox VE at ${ye.ip}`),t(Pt,()=>ye.ip,Kt),t(Pt,()=>ye.port,null),Ie})()}),null),be}}),null),De})()]}}),null),Se}}),null),t(Ee,n(h,{get when(){return g()==="pbs"},get children(){var Se=Xs();return t(Se,n(h,{get when(){return!ge()},get children(){return Fa()}}),null),t(Se,n(h,{get when(){return ge()},get children(){return[(()=>{var De=ox(),be=De.firstChild,ve=be.firstChild;ve.firstChild;var ye=ve.nextSibling;return t(De,n(rr,{title:"Proxmox Backup Server nodes",size:"md",class:"flex-1"}),be),t(ve,n(Tn,{get checked(){return u()},onChange:async Ie=>{if(k().discoveryEnabled)return;const Le=Ie.currentTarget.checked;v(Le);try{await Sn.updateSystemSettings({discoveryEnabled:Le,discoverySubnet:V()}),Le?(await Or({quiet:!0}),Yt.success("Discovery enabled — scanning network...",2e3)):(Yt.info("Discovery disabled",2e3),F(rt=>({...rt,scanning:!1})))}catch(rt){console.error("Failed to update discovery setting:",rt),Yt.error("Failed to update discovery setting"),v(!Le)}finally{await Nr()}},get disabled(){return k().discoveryEnabled},containerClass:"gap-2",get label(){return(()=>{var Ie=Ka();return t(Ie,()=>u()?"On":"Off"),Ie})()}}),null),t(be,n(h,{get when(){return u()},get children(){var Ie=ii();return Ie.$$click=async()=>{Yt.info("Refreshing discovery...",2e3);try{await Or({quiet:!0})}finally{await Nr()}},Ie}}),ye),ye.$$click=()=>{le(null),U("pbs"),oe(Ie=>Ie+1),H(!0)},De})(),(()=>{var De=Wa();return t(De,n(ze,{get each(){return ne().filter(be=>be.type==="pbs")},children:be=>(()=>{var ve=ci(),ye=ve.firstChild,Ie=ye.firstChild,Le=Ie.firstChild,rt=Le.firstChild,je=rt.nextSibling,jt=je.firstChild,Ct=jt.nextSibling,Mt=Ct.nextSibling,Pt=Mt.firstChild,Kt=Ie.nextSibling,ur=Kt.firstChild,$r=ur.nextSibling,Ir=$r.nextSibling;return t(jt,()=>be.name),t(Ct,()=>be.host),t(Pt,()=>be.user?`User: ${be.user}`:`Token: ${be.tokenName}`),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pbs"&&"monitorDatastores"in be&&be.monitorDatastores));return()=>St()&&Tb()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pbs"&&"monitorSyncJobs"in be&&be.monitorSyncJobs));return()=>St()&&Ab()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pbs"&&"monitorVerifyJobs"in be&&be.monitorVerifyJobs));return()=>St()&&Db()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pbs"&&"monitorPruneJobs"in be&&be.monitorPruneJobs));return()=>St()&&Mb()})(),null),t(Mt,(()=>{var St=$e(()=>!!(be.type==="pbs"&&be.temperature?.available));return()=>St()&&ui()})(),null),ur.$$click=()=>an(be.id),$r.$$click=()=>{le(be),U(be.type),H(!0)},Ir.$$click=()=>xn(be),q(()=>y(rt,`flex-shrink-0 w-3 h-3 mt-1.5 rounded-full ${(()=>{const St=r.pbs.find(tr=>tr.name===be.name);return St?.connectionHealth==="unhealthy"||St?.connectionHealth==="error"||St?.status==="offline"?"bg-red-500":St?.connectionHealth==="degraded"?"bg-yellow-500":St&&(St.status==="online"||St.connectionHealth==="healthy")||be.status==="connected"?"bg-green-500":be.status==="error"?"bg-red-500":be.status==="pending"||be.status==="disconnected"?"bg-amber-500 animate-pulse":"bg-gray-400"})()}`)),ve})()}),null),t(De,(()=>{var be=$e(()=>ne().filter(ve=>ve.type==="pbs").length===0&&X().filter(ve=>ve.type==="pbs").length===0);return()=>be()&&Pb()})(),null),t(De,n(h,{get when(){return u()},get children(){var be=za(),ve=be.firstChild;return t(ve,n(h,{get when(){return N().scanning},get children(){return dx()}}),null),t(ve,n(h,{get when(){return $e(()=>!N().scanning)()&&(N().lastResultAt||N().lastScanStartedAt)},get children(){var ye=Va();return ye.firstChild,t(ye,()=>st(N().lastResultAt??N().lastScanStartedAt),null),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().errors)()&&N().errors.length},get children(){var ye=Ga(),Ie=ye.firstChild,Le=Ie.nextSibling;return t(Le,n(ze,{get each(){return N().errors||[]},children:rt=>(()=>{var je=Fn();return t(je,rt),je})()})),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().scanning)()&&X().filter(ye=>ye.type==="pbs").length===0},get children(){return oi()}}),null),t(be,n(ze,{get each(){return X().filter(ye=>ye.type==="pbs")},children:ye=>(()=>{var Ie=gi(),Le=Ie.firstChild,rt=Le.firstChild,je=rt.firstChild,jt=je.firstChild,Ct=jt.nextSibling,Mt=Ct.firstChild,Pt=Mt.nextSibling,Kt=Pt.firstChild;return Ie.$$click=()=>{le({id:"",type:"pbs",name:ye.hostname||`pbs-${ye.ip}`,host:`https://${ye.ip}:${ye.port}`,user:"",tokenName:"",tokenValue:"",verifySSL:!1,monitorDatastores:!0,monitorSyncJobs:!0,monitorVerifyJobs:!0,monitorPruneJobs:!0,monitorGarbageJobs:!0,status:"pending"}),U("pbs"),H(!0)},t(Mt,()=>ye.hostname||`Backup Server at ${ye.ip}`),t(Pt,()=>ye.ip,Kt),t(Pt,()=>ye.port,null),Ie})()}),null),be}}),null),De})()]}}),null),Se}}),null),t(Ee,n(h,{get when(){return g()==="pmg"},get children(){var Se=Xs();return t(Se,n(h,{get when(){return!ge()},get children(){return Fa()}}),null),t(Se,n(h,{get when(){return ge()},get children(){return[(()=>{var De=ux(),be=De.firstChild,ve=be.firstChild;ve.firstChild;var ye=ve.nextSibling;return t(De,n(rr,{title:"Proxmox Mail Gateway nodes",size:"md",class:"flex-1"}),be),t(ve,n(Tn,{get checked(){return u()},onChange:async Ie=>{if(k().discoveryEnabled)return;const Le=Ie.currentTarget.checked;v(Le);try{await Sn.updateSystemSettings({discoveryEnabled:Le,discoverySubnet:V()}),Le?(await Or({quiet:!0}),Yt.success("Discovery enabled — scanning network...",2e3)):(Yt.info("Discovery disabled",2e3),F(rt=>({...rt,scanning:!1})))}catch(rt){console.error("Failed to update discovery setting:",rt),Yt.error("Failed to update discovery setting"),v(!Le)}finally{await Nr()}},get disabled(){return k().discoveryEnabled},containerClass:"gap-2",get label(){return(()=>{var Ie=Ka();return t(Ie,()=>u()?"On":"Off"),Ie})()}}),null),t(be,n(h,{get when(){return u()},get children(){var Ie=cx();return Ie.$$click=async()=>{Yt.info("Refreshing discovery...",2e3);try{await Or({quiet:!0})}finally{await Nr()}},Ie}}),ye),ye.$$click=()=>{le(null),U("pmg"),oe(Ie=>Ie+1),H(!0)},De})(),(()=>{var De=Wa();return t(De,n(ze,{get each(){return ne().filter(be=>be.type==="pmg")},children:be=>{const ve=be,ye=r.pmg.find(Le=>Le.name===ve.name),Ie=ye?.connectionHealth==="unhealthy"||ye?.connectionHealth==="error"||ye?.status==="offline"?"bg-red-500":ye?.connectionHealth==="degraded"?"bg-yellow-500":ye&&(ye.status==="online"||ye.connectionHealth==="healthy")||ve.status==="connected"?"bg-green-500":ve.status==="error"?"bg-red-500":ve.status==="pending"||ve.status==="disconnected"?"bg-amber-500 animate-pulse":"bg-gray-400";return(()=>{var Le=Eb(),rt=Le.firstChild,je=rt.firstChild,jt=je.firstChild,Ct=jt.firstChild,Mt=Ct.nextSibling,Pt=Mt.firstChild,Kt=Pt.nextSibling,ur=Kt.nextSibling,$r=ur.firstChild,Ir=je.nextSibling,St=Ir.firstChild,tr=St.nextSibling,Lr=tr.nextSibling;return y(Ct,`flex-shrink-0 w-3 h-3 mt-1.5 rounded-full ${Ie}`),t(Pt,()=>ve.name),t(Kt,()=>ve.host),t($r,()=>ve.user?`User: ${ve.user}`:`Token: ${ve.tokenName}`),t(ur,(()=>{var gr=$e(()=>!!ve.monitorMailStats);return()=>gr()&&Nb()})(),null),t(ur,(()=>{var gr=$e(()=>!!ve.monitorQueues);return()=>gr()&&Ob()})(),null),t(ur,(()=>{var gr=$e(()=>!!ve.monitorQuarantine);return()=>gr()&&Lb()})(),null),t(ur,(()=>{var gr=$e(()=>!!ve.monitorDomainStats);return()=>gr()&&Rb()})(),null),St.$$click=()=>an(ve.id),tr.$$click=()=>{le(ne().find(gr=>gr.id===ve.id)??null),U("pmg"),oe(gr=>gr+1),H(!0)},Lr.$$click=()=>xn(ve),Le})()}}),null),t(De,(()=>{var be=$e(()=>ne().filter(ve=>ve.type==="pmg").length===0);return()=>be()&&Ib()})(),null),t(De,n(h,{get when(){return u()},get children(){var be=za(),ve=be.firstChild;return t(ve,n(h,{get when(){return N().scanning},get children(){return gx()}}),null),t(ve,n(h,{get when(){return $e(()=>!N().scanning)()&&(N().lastResultAt||N().lastScanStartedAt)},get children(){var ye=Va();return ye.firstChild,t(ye,()=>st(N().lastResultAt??N().lastScanStartedAt),null),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().errors)()&&N().errors.length},get children(){var ye=Ga(),Ie=ye.firstChild,Le=Ie.nextSibling;return t(Le,n(ze,{get each(){return N().errors||[]},children:rt=>(()=>{var je=Fn();return t(je,rt),je})()})),ye}}),null),t(be,n(h,{get when(){return $e(()=>!!N().scanning)()&&X().filter(ye=>ye.type==="pmg").length===0},get children(){return hx()}}),null),t(be,n(ze,{get each(){return X().filter(ye=>ye.type==="pmg")},children:ye=>(()=>{var Ie=Hb(),Le=Ie.firstChild,rt=Le.firstChild,je=rt.firstChild,jt=je.nextSibling,Ct=jt.firstChild,Mt=Ct.nextSibling,Pt=Mt.firstChild;return Ie.$$click=()=>{le(null),U("pmg"),oe(Kt=>Kt+1),H(!0),setTimeout(()=>{const Kt=document.querySelector('input[placeholder*="192.168"]');Kt&&(Kt.value=ye.ip,Kt.dispatchEvent(new Event("input",{bubbles:!0})))},50)},t(Ct,()=>ye.hostname||`PMG at ${ye.ip}`),t(Mt,()=>ye.ip,Pt),t(Mt,()=>ye.port,null),Ie})()}),null),be}}),null),De})()]}}),null),Se}}),null),t(Ee,n(h,{get when(){return g()==="docker"},get children(){return n(rm,{})}}),null),t(Ee,n(h,{get when(){return g()==="system"},get children(){var Se=Ox(),De=Se.firstChild;return t(Se,n(rr,{title:"System configuration",size:"md",class:"mb-2"}),De),t(Se,n(it,{tone:"info",padding:"md",border:!1,class:"border border-blue-200 dark:border-blue-800",get children(){return fx()}}),De),t(Se,n(it,{padding:"lg",class:"space-y-3",get children(){return[n(rr,{title:"Appearance",description:"Switch between light and dark themes. Stored per device and synced to the server when authenticated.",size:"sm",align:"left"}),(()=>{var be=mx();return be.firstChild,t(be,n(Tn,{get checked(){return e.darkMode()},onChange:ve=>{ve.currentTarget.checked!==e.darkMode()&&e.toggleDarkMode()}}),null),be})()]}}),De),t(De,n(it,{padding:"lg",class:"space-y-6 lg:col-span-3",get children(){return[(()=>{var be=xx(),ve=be.firstChild,ye=ve.nextSibling,Ie=ye.firstChild,Le=Ie.nextSibling,rt=Le.nextSibling,je=rt.firstChild;return je.addEventListener("change",jt=>{k().allowedOrigins||(E(jt.currentTarget.value),S(!0))}),t(rt,(()=>{var jt=$e(()=>!!k().allowedOrigins);return()=>jt()&&Ub()})(),null),q(jt=>{var Ct=k().allowedOrigins,Mt=`w-full px-3 py-1.5 text-sm border rounded-lg ${k().allowedOrigins?"border-amber-300 dark:border-amber-600 bg-amber-50 dark:bg-amber-900/20 cursor-not-allowed opacity-75":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800"}`;return Ct!==jt.e&&(je.disabled=jt.e=Ct),Mt!==jt.t&&y(je,jt.t=Mt),jt},{e:void 0,t:void 0}),q(()=>je.value=P()),be})(),(()=>{var be=px(),ve=be.firstChild,ye=ve.nextSibling,Ie=ye.nextSibling,Le=Ie.firstChild,rt=Le.firstChild;return rt.addEventListener("change",je=>{fe(je.currentTarget.checked),S(!0)}),t(Ie,n(h,{get when(){return de()},get children(){var je=bx(),jt=je.firstChild,Ct=jt.nextSibling,Mt=Ct.nextSibling;return Mt.addEventListener("change",Pt=>{R(Pt.currentTarget.value),S(!0)}),q(()=>Mt.value=x()),je}}),null),q(()=>rt.checked=de()),be})(),n(it,{tone:"warning",padding:"sm",border:!1,class:"border border-amber-200 dark:border-amber-800",get children(){return[yx(),vx()]}})]}}),null),t(De,n(it,{padding:"lg",class:"space-y-6 lg:col-span-2",get children(){var be=Px(),ve=be.firstChild,ye=ve.nextSibling,Ie=ye.firstChild,Le=Ie.firstChild,rt=Le.firstChild,je=rt.nextSibling,jt=Le.nextSibling,Ct=Ie.nextSibling,Mt=Ct.firstChild,Pt=Mt.firstChild,Kt=Pt.nextSibling,ur=Mt.nextSibling,$r=ur.firstChild,Ir=$r.nextSibling,St=Ir.firstChild;return t(je,()=>Q()?.version||"Loading...",null),t(je,()=>Q()?.isDevelopment&&" (Development)",null),t(je,()=>Q()?.isDocker&&" - Docker",null),jt.$$click=Hn,t(jt,(()=>{var tr=$e(()=>!!ae());return()=>tr()?[Bb(),"Checking..."]:"Check for Updates"})()),t(ye,n(h,{get when(){return $e(()=>!!Q()?.isDocker)()&&!T()?.available},get children(){return kx()}}),Ct),t(ye,n(h,{get when(){return!!T()?.warning},get children(){var tr=wx(),Lr=tr.firstChild;return t(Lr,()=>T()?.warning),tr}}),Ct),t(ye,n(h,{get when(){return T()?.available},get children(){var tr=Dx(),Lr=tr.firstChild,gr=Lr.firstChild;gr.firstChild;var Kr=gr.nextSibling;Kr.firstChild;var Rr=Lr.nextSibling;return Rr.firstChild,t(gr,()=>T()?.latestVersion,null),t(Kr,(()=>{var ln=$e(()=>!!T()?.releaseDate);return()=>ln()?new Date(T().releaseDate).toLocaleDateString():"Unknown"})(),null),t(Rr,n(h,{get when(){return Q()?.deploymentType==="proxmoxve"},get children(){return $x()}}),null),t(Rr,n(h,{get when(){return Q()?.deploymentType==="docker"},get children(){return _x()}}),null),t(Rr,n(h,{get when(){return Q()?.deploymentType==="systemd"||Q()?.deploymentType==="manual"},get children(){return Cx()}}),null),t(Rr,n(h,{get when(){return Q()?.deploymentType==="development"},get children(){return Sx()}}),null),t(Rr,n(h,{get when(){return $e(()=>!Q()?.deploymentType)()&&Q()?.isDocker},get children(){return Tx()}}),null),t(tr,n(h,{get when(){return T()?.releaseNotes},get children(){var ln=Ax(),wn=ln.firstChild,Jr=wn.nextSibling;return t(Jr,()=>T()?.releaseNotes),ln}}),null),tr}}),Ct),Kt.addEventListener("change",tr=>{ue(tr.currentTarget.value),S(!0)}),St.addEventListener("change",tr=>{O(tr.currentTarget.checked),S(!0)}),t(Ct,n(h,{get when(){return re()},get children(){var tr=Mx(),Lr=tr.firstChild,gr=Lr.firstChild,Kr=gr.nextSibling,Rr=Lr.nextSibling,ln=Rr.firstChild,wn=ln.nextSibling;return Kr.addEventListener("change",Jr=>{he(parseInt(Jr.currentTarget.value)),S(!0)}),wn.addEventListener("change",Jr=>{_e(Jr.currentTarget.value),S(!0)}),q(()=>Kr.value=xe()),q(()=>wn.value=me()),tr}}),null),q(tr=>{var Lr=ae()||Q()?.isDocker,gr=`px-4 py-2 text-sm rounded-lg transition-colors flex items-center gap-2 ${Q()?.isDocker?"bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":"bg-blue-600 text-white hover:bg-blue-700"}`,Kr=Q()?.isDocker,Rr=Q()?.isDocker;return Lr!==tr.e&&(jt.disabled=tr.e=Lr),gr!==tr.t&&y(jt,tr.t=gr),Kr!==tr.a&&(Kt.disabled=tr.a=Kr),Rr!==tr.o&&(St.disabled=tr.o=Rr),tr},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>Kt.value=ce()),q(()=>St.checked=re()),be}}),null),t(Se,n(it,{padding:"lg",border:!1,class:"border border-gray-200 dark:border-gray-700",get children(){return[n(rr,{title:"Backup & restore",description:"Backup your node configurations and credentials or restore from a previous backup.",size:"md",class:"mb-4"}),(()=>{var be=Ex(),ve=be.firstChild,ye=ve.firstChild,Ie=ye.firstChild,Le=Ie.nextSibling,rt=Le.firstChild,je=rt.nextSibling,jt=je.nextSibling,Ct=ve.nextSibling,Mt=Ct.firstChild,Pt=Mt.firstChild,Kt=Pt.nextSibling,ur=Kt.firstChild,$r=ur.nextSibling,Ir=$r.nextSibling;return jt.$$click=()=>{Ae(!Ve()?.hasAuthentication),Jt(!0)},Ir.$$click=()=>Ut(!0),be})(),Nx()]}}),null),Se}}),null),t(Ee,n(h,{get when(){return g()==="security"},get children(){var Se=Qx();return t(Se,n(h,{get when(){return $e(()=>!Re())()&&Ve()},get children(){return n(Mm,{get status(){return Ve()}})}}),null),t(Se,n(h,{get when(){return $e(()=>!Re())()&&Ve()?.hasProxyAuth},get children(){return n(it,{padding:"sm",class:"border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20",get children(){var De=Rx(),be=De.firstChild,ve=be.nextSibling,ye=ve.firstChild,Ie=ye.nextSibling;return Ie.nextSibling,t(ve,(()=>{var Le=$e(()=>!!Ve()?.proxyAuthUsername);return()=>Le()?` ${Ve()?.proxyAuthUsername}`:" available once a request is received"})(),Ie),t(ve,()=>Ve()?.proxyAuthIsAdmin?" Admin privileges confirmed.":"",null),t(ve,n(h,{get when(){return Ve()?.proxyAuthLogoutURL},get children(){return[" ",(()=>{var Le=Lx();return q(()=>Te(Le,"href",Ve()?.proxyAuthLogoutURL)),Le})()]}}),null),De}})}}),null),t(Se,n(h,{get when(){return!Ve()?.hasAuthentication},get children(){var De=Hx(),be=De.firstChild,ve=be.firstChild,ye=ve.nextSibling;return ye.$$click=()=>dt(!pt()),t(De,n(h,{get when(){return pt()},get children(){var Ie=Ix();return t(Ie,n(ri,{onConfigured:()=>{dt(!1),yr()}})),Ie}}),null),De}}),null),t(Se,n(h,{get when(){return $e(()=>!Re())()&&(Ve()?.hasAuthentication||Ve()?.apiTokenConfigured)},get children(){return n(it,{padding:"none",class:"overflow-hidden border border-gray-200 dark:border-gray-700",border:!1,get children(){return[(()=>{var De=Ux(),be=De.firstChild;return be.firstChild,t(be,n(rr,{title:"Authentication",size:"sm",class:"flex-1"}),null),De})(),(()=>{var De=jx(),be=De.firstChild,ve=be.firstChild,ye=ve.nextSibling,Ie=ye.nextSibling,Le=Ie.nextSibling,rt=Le.firstChild;return rt.nextSibling,ve.$$click=je=>{je.preventDefault(),je.stopPropagation(),B(!0)},ye.$$click=()=>We(!ht()),t(Le,()=>Ve()?.authUsername||"Not configured",null),t(De,n(h,{get when(){return ht()},get children(){var je=Bx();return t(je,n(ri,{mode:"rotate",get defaultUsername(){return Ve()?.authUsername||"admin"},onConfigured:()=>{We(!1),yr()}})),je}}),null),De})()]}})}}),null),t(Se,n(h,{get when(){return Ve()?.configuredButPendingRestart},get children(){var De=qx(),be=De.firstChild,ve=be.firstChild,ye=ve.nextSibling,Ie=ye.firstChild,Le=Ie.nextSibling,rt=Le.nextSibling,je=rt.nextSibling;return je.firstChild,t(je,n(h,{get when(){return Q()?.deploymentType==="proxmoxve"},get children(){return Fx()}}),null),t(je,n(h,{get when(){return Q()?.deploymentType==="docker"},get children(){return Vx()}}),null),t(je,n(h,{get when(){return Q()?.deploymentType==="systemd"||Q()?.deploymentType==="manual"},get children(){return Gx()}}),null),t(je,n(h,{get when(){return Q()?.deploymentType==="development"},get children(){return zx()}}),null),t(je,n(h,{get when(){return!Q()?.deploymentType},get children(){return Wx()}}),null),De}}),null),t(Se,n(ym,{onConfigUpdated:yr}),null),t(Se,n(it,{padding:"none",class:"overflow-hidden border border-gray-200 dark:border-gray-700",border:!1,get children(){return[(()=>{var De=Kx(),be=De.firstChild;return be.firstChild,t(be,n(rr,{title:"API token",description:"For automation and integrations",size:"sm",class:"flex-1"}),null),De})(),(()=>{var De=Jx();return t(De,n(Xh,{get currentTokenHint(){return Ve()?.apiTokenHint},onTokensChanged:()=>{yr()},get refreshing(){return Re()}})),De})()]}}),null),Se}}),null),t(Ee,n(h,{get when(){return g()==="diagnostics"},get children(){var Se=rb(),De=Se.firstChild,be=De.firstChild,ve=be.firstChild,ye=ve.firstChild,Ie=ye.nextSibling,Le=Ie.nextSibling,rt=ve.nextSibling,je=rt.firstChild,jt=je.nextSibling,Ct=jt.firstChild,Mt=Ct.nextSibling,Pt=Mt.nextSibling,Kt=Pt.nextSibling,ur=Kt.firstChild,$r=ur.nextSibling,Ir=Kt.nextSibling,St=Ir.firstChild,tr=St.nextSibling,Lr=rt.nextSibling,gr=Lr.firstChild,Kr=gr.nextSibling,Rr=Kr.firstChild,ln=Rr.firstChild,wn=ln.nextSibling,Jr=Rr.nextSibling,Un=Jr.firstChild,Kn=Un.nextSibling,Bn=Jr.nextSibling,ss=Bn.firstChild,Ta=ss.nextSibling,Gs=Bn.nextSibling,ys=Gs.firstChild,zs=ys.nextSibling,vs=Lr.nextSibling,Aa=vs.firstChild,Da=Aa.nextSibling,ks=Da.nextSibling;return t(De,n(rr,{title:"System diagnostics",size:"md",class:"mb-4"}),be),Le.$$click=()=>{xr()},t(Le,()=>tt()?"Running...":"Run Diagnostics"),t(ve,n(h,{get when(){return Ce()},get children(){var Mr=tb();return t(Mr,n(it,{padding:"sm",get children(){return[Yx(),(()=>{var He=Xx(),nt=He.firstChild;nt.firstChild;var Ne=nt.nextSibling;Ne.firstChild;var ut=Ne.nextSibling;ut.firstChild;var kt=ut.nextSibling;kt.firstChild;var Tt=kt.nextSibling;Tt.firstChild;var At=Tt.nextSibling;At.firstChild;var Ue=At.nextSibling;Ue.firstChild;var Be=Ue.nextSibling,at=Be.firstChild,zt=at.nextSibling;return zt.nextSibling,t(nt,()=>Ce()?.version||"Unknown",null),t(Ne,()=>Ce()?.runtime||"Unknown",null),t(ut,()=>nr(Ce()?.uptime||0),null),t(kt,(()=>{var wt=$e(()=>!!Ce()?.system?.os);return()=>wt()?`${Ce()?.system?.os} / ${Ce()?.system?.arch||"Unknown"}`:"Unknown"})(),null),t(Tt,()=>Ce()?.system?.goVersion||"Unknown",null),t(At,()=>Ce()?.system?.numCPU??"Unknown",null),t(Ue,()=>Ce()?.system?.numGoroutine??"Unknown",null),t(Be,()=>Ce()?.system?.memoryMB??0,zt),He})()]}}),null),t(Mr,n(h,{get when(){return Ce()?.temperatureProxy},children:He=>n(it,{padding:"sm",get children(){return[jb(),(()=>{var nt=Qb(),Ne=nt.firstChild,ut=Ne.firstChild,kt=ut.nextSibling,Tt=Ne.nextSibling,At=Tt.firstChild,Ue=At.nextSibling;return t(kt,()=>He().socketFound?"Detected":"Missing"),t(Ue,()=>He().proxyReachable?"Responding":"No response"),t(nt,n(h,{get when(){return He().socketPath},get children(){var Be=Fb();return Be.firstChild,t(Be,()=>He().socketPath,null),Be}}),null),t(nt,n(h,{get when(){return He().socketPermissions},get children(){var Be=Vb();return Be.firstChild,t(Be,()=>He().socketPermissions,null),Be}}),null),t(nt,n(h,{get when(){return He().socketOwner||He().socketGroup},get children(){var Be=Gb();return Be.firstChild,t(Be,()=>[He().socketOwner,He().socketGroup].filter(Boolean).join(" / ")||"Unknown",null),Be}}),null),t(nt,n(h,{get when(){return He().proxyVersion},get children(){var Be=zb();return Be.firstChild,t(Be,()=>He().proxyVersion,null),Be}}),null),t(nt,n(h,{get when(){return He().proxySshDirectory},get children(){var Be=Wb();return Be.firstChild,t(Be,()=>He().proxySshDirectory,null),Be}}),null),t(nt,n(h,{get when(){return He().proxyPublicKeySha256},get children(){var Be=qb();return Be.firstChild,t(Be,()=>He().proxyPublicKeySha256,null),Be}}),null),t(nt,n(h,{get when(){return typeof He().legacySshKeyCount=="number"},get children(){var Be=Kb();return Be.firstChild,t(Be,()=>He().legacySshKeyCount??0,null),Be}}),null),t(nt,n(h,{get when(){return He().legacySSHDetected},get children(){return Jb()}}),null),q(Be=>{var at=`px-2 py-0.5 rounded text-white text-xs ${He().socketFound?"bg-green-500":"bg-red-500"}`,zt=`px-2 py-0.5 rounded text-white text-xs ${He().proxyReachable?"bg-green-500":"bg-yellow-500"}`;return at!==Be.e&&y(kt,Be.e=at),zt!==Be.t&&y(Ue,Be.t=zt),Be},{e:void 0,t:void 0}),nt})(),(()=>{var nt=Yb(),Ne=nt.firstChild;return Ne.$$click=()=>{bt()||cr()},t(Ne,()=>bt()==="register-nodes"?"Checking nodes...":"Check proxy nodes"),q(()=>Ne.disabled=bt()!==null),nt})(),n(h,{get when(){return $e(()=>!!qe())()&&qe().length>0},get children(){var nt=Xb(),Ne=nt.firstChild,ut=Ne.nextSibling;return t(ut,n(ze,{get each(){return qe()||[]},children:kt=>(()=>{var Tt=Zb(),At=Tt.firstChild,Ue=At.firstChild;return t(At,()=>kt.name,Ue),t(At,()=>kt.sshReady?"reachable":"unreachable",null),t(Tt,n(h,{get when(){return kt.error},get children(){var Be=hi(),at=Be.firstChild,zt=at.nextSibling;return zt.nextSibling,t(Be,()=>kt.error,zt),Be}}),null),q(()=>y(At,kt.sshReady?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")),Tt})()})),nt}}),n(h,{get when(){return $e(()=>!!He().notes)()&&He().notes.length>0},get children(){var nt=Zs();return t(nt,n(ze,{get each(){return He().notes||[]},children:Ne=>(()=>{var ut=Fn();return t(ut,Ne),ut})()})),nt}})]}})}),null),t(Mr,n(h,{get when(){return Ce()?.apiTokens},children:He=>n(it,{padding:"sm",get children(){return[ep(),(()=>{var nt=np(),Ne=nt.firstChild,ut=Ne.firstChild,kt=Ne.nextSibling,Tt=kt.firstChild;Tt.firstChild;var At=Tt.nextSibling;At.firstChild;var Ue=At.nextSibling;Ue.firstChild;var Be=Ue.nextSibling;return Be.firstChild,t(ut,()=>He().enabled?"Token auth enabled":"Token auth disabled"),t(Ne,n(h,{get when(){return He().hasEnvTokens},get children(){return tp()}}),null),t(Ne,n(h,{get when(){return He().hasLegacyToken},get children(){return rp()}}),null),t(Tt,()=>He().tokenCount,null),t(At,()=>He().recommendTokenRotation?"Yes":"No",null),t(Ue,()=>He().legacyDockerHostCount??0,null),t(Be,()=>He().unusedTokenCount??0,null),q(()=>y(ut,`px-2 py-0.5 rounded text-xs ${He().enabled?"bg-green-100 text-green-700 dark:bg-green-700/40 dark:text-green-100":"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/40 dark:text-yellow-100"}`)),nt})(),n(h,{get when(){return $e(()=>!!He().tokens)()&&He().tokens.length>0},get children(){var nt=sp();return t(nt,n(ze,{get each(){return He().tokens||[]},children:Ne=>(()=>{var ut=ip(),kt=ut.firstChild,Tt=kt.firstChild,At=Tt.nextSibling,Ue=kt.nextSibling,Be=Ue.firstChild;Be.firstChild;var at=Be.nextSibling;return at.firstChild,t(Tt,()=>Ne.name||"Unnamed token"),t(At,()=>Ne.hint||"No hint available",null),t(At,n(h,{get when(){return Ne.source},get children(){var zt=lp(),wt=zt.firstChild,or=wt.nextSibling;return or.nextSibling,t(zt,()=>Ne.source,or),zt}}),null),t(Be,(()=>{var zt=$e(()=>!!Ne.createdAt);return()=>zt()?new Date(Ne.createdAt).toLocaleString():"Unknown"})(),null),t(at,(()=>{var zt=$e(()=>!!Ne.lastUsedAt);return()=>zt()?st(new Date(Ne.lastUsedAt).getTime()):"Never"})(),null),ut})()})),nt}}),n(h,{get when(){return $e(()=>!!He().usage)()&&He().usage.length>0},get children(){var nt=ap(),Ne=nt.firstChild,ut=Ne.nextSibling;return t(ut,n(ze,{get each(){return He().usage||[]},children:kt=>(()=>{var Tt=op(),At=Tt.firstChild,Ue=At.nextSibling;return Ue.nextSibling,t(Tt,()=>kt.tokenId,At),t(Tt,()=>kt.hostCount,Ue),t(Tt,()=>kt.hostCount===1?"host":"hosts",null),t(Tt,n(h,{get when(){return kt.hosts&&kt.hosts.length>0},get children(){var Be=hi(),at=Be.firstChild,zt=at.nextSibling;return zt.nextSibling,t(Be,()=>kt.hosts.join(", "),zt),Be}}),null),Tt})()})),nt}}),n(h,{get when(){return $e(()=>!!He().notes)()&&He().notes.length>0},get children(){var nt=Zs();return t(nt,n(ze,{get each(){return He().notes||[]},children:Ne=>(()=>{var ut=Fn();return t(ut,Ne),ut})()})),nt}})]}})}),null),t(Mr,n(h,{get when(){return Ce()?.dockerAgents},children:He=>n(it,{padding:"sm",get children(){return[dp(),n(h,{get when(){return He().hostsTotal>0},get children(){return[(()=>{var nt=cp(),Ne=nt.firstChild;Ne.firstChild;var ut=Ne.nextSibling;ut.firstChild;var kt=ut.nextSibling;kt.firstChild;var Tt=kt.nextSibling;Tt.firstChild;var At=Tt.nextSibling;At.firstChild;var Ue=At.nextSibling;Ue.firstChild;var Be=Ue.nextSibling;Be.firstChild;var at=Be.nextSibling;return at.firstChild,t(Ne,()=>He().hostsTotal,null),t(ut,()=>He().hostsOnline,null),t(kt,()=>He().hostsWithTokenBinding,null),t(Tt,()=>He().hostsNeedingAttention,null),t(At,()=>He().hostsWithoutVersion??0,null),t(Ue,()=>He().hostsOutdatedVersion??0,null),t(Be,()=>He().hostsWithStaleCommand??0,null),t(at,()=>He().hostsPendingUninstall??0,null),nt})(),n(h,{get when(){return He().recommendedAgentVersion},get children(){var nt=up();return nt.firstChild,t(nt,()=>He().recommendedAgentVersion,null),nt}})]}}),n(h,{get when(){return $e(()=>!!He().attention)()&&He().attention.length>0},get children(){var nt=gp();return t(nt,n(ze,{get each(){return He().attention||[]},children:Ne=>(()=>{var ut=bp(),kt=ut.firstChild,Tt=kt.firstChild,At=Tt.nextSibling,Ue=kt.nextSibling,Be=Ue.nextSibling,at=Be.nextSibling,zt=at.firstChild;return t(Tt,()=>Ne.name),t(At,()=>Ne.status||"unknown"),t(Ue,n(h,{get when(){return Ne.agentVersion},get children(){var wt=hp();return wt.firstChild,t(wt,()=>Ne.agentVersion,null),wt}}),null),t(Ue,n(h,{get when(){return Ne.tokenHint},get children(){var wt=fp();return wt.firstChild,t(wt,()=>Ne.tokenHint,null),wt}}),null),t(Ue,n(h,{get when(){return Ne.lastSeen},get children(){var wt=mp();return wt.firstChild,t(wt,()=>st(new Date(Ne.lastSeen).getTime()),null),wt}}),null),t(Be,n(ze,{get each(){return Ne.issues},children:wt=>(()=>{var or=Fn();return t(or,wt),or})()})),zt.$$click=()=>{Xe()!==Ne.hostId&&sr(Ne.hostId)},t(zt,()=>Xe()===Ne.hostId?"Preparing token...":"Generate dedicated token"),t(ut,n(h,{get when(){return Lt()[Ne.hostId]},get children(){var wt=xp();return t(wt,()=>{const or=Lt()[Ne.hostId];return[pp(),(()=>{var Cr=fi();return t(Cr,()=>or.installCommand),Cr})(),(()=>{var Cr=yp();return Cr.$$click=()=>void wr(or.installCommand,"Install command copied"),Cr})(),vp(),(()=>{var Cr=fi();return t(Cr,()=>or.systemdServiceSnippet),Cr})(),(()=>{var Cr=kp();return Cr.$$click=()=>void wr(or.systemdServiceSnippet,"Service snippet copied"),Cr})(),(()=>{var Cr=wp();return Cr.firstChild,t(Cr,()=>or.pulseURL,null),Cr})()]}),wt}}),null),q(wt=>{var or=`px-2 py-0.5 rounded text-xs ${Ne.status==="online"?"bg-green-100 text-green-700 dark:bg-green-700/40 dark:text-green-100":"bg-red-100 text-red-700 dark:bg-red-700/40 dark:text-red-100"}`,Cr=Xe()===Ne.hostId;return or!==wt.e&&y(At,wt.e=or),Cr!==wt.t&&(zt.disabled=wt.t=Cr),wt},{e:void 0,t:void 0}),ut})()})),nt}}),n(h,{get when(){return $e(()=>!!He().notes)()&&He().notes.length>0},get children(){var nt=Zs();return t(nt,n(ze,{get each(){return He().notes||[]},children:Ne=>(()=>{var ut=Fn();return t(ut,Ne),ut})()})),nt}})]}})}),null),t(Mr,n(h,{get when(){return Ce()?.alerts},children:He=>n(it,{padding:"sm",get children(){return[$p(),(()=>{var nt=Sp(),Ne=nt.firstChild,ut=Ne.firstChild;ut.firstChild;var kt=ut.nextSibling;kt.firstChild;var Tt=kt.nextSibling;return Tt.firstChild,t(ut,()=>He().legacyThresholdsDetected?"detected":"migrated",null),t(kt,()=>He().missingCooldown?"missing":"configured",null),t(Tt,()=>He().missingGroupingWindow?"disabled":"enabled",null),t(nt,n(h,{get when(){return $e(()=>!!He().legacyThresholdSources)()&&He().legacyThresholdSources.length>0},get children(){var At=_p();return At.firstChild,t(At,()=>He().legacyThresholdSources.join(", "),null),At}}),null),t(nt,n(h,{get when(){return $e(()=>!!He().legacyScheduleSettings)()&&He().legacyScheduleSettings.length>0},get children(){var At=Cp();return At.firstChild,t(At,()=>He().legacyScheduleSettings.join(", "),null),At}}),null),q(At=>{var Ue=`px-2 py-0.5 rounded text-xs ${He().legacyThresholdsDetected?"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/40 dark:text-yellow-100":"bg-green-100 text-green-700 dark:bg-green-700/40 dark:text-green-100"}`,Be=`px-2 py-0.5 rounded text-xs ${He().missingCooldown?"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/40 dark:text-yellow-100":"bg-green-100 text-green-700 dark:bg-green-700/40 dark:text-green-100"}`,at=`px-2 py-0.5 rounded text-xs ${He().missingGroupingWindow?"bg-yellow-100 text-yellow-700 dark:bg-yellow-700/40 dark:text-yellow-100":"bg-green-100 text-green-700 dark:bg-green-700/40 dark:text-green-100"}`;return Ue!==At.e&&y(ut,At.e=Ue),Be!==At.t&&y(kt,At.t=Be),at!==At.a&&y(Tt,At.a=at),At},{e:void 0,t:void 0,a:void 0}),nt})(),n(h,{get when(){return $e(()=>!!He().notes)()&&He().notes.length>0},get children(){var nt=Zs();return t(nt,n(ze,{get each(){return He().notes||[]},children:Ne=>(()=>{var ut=Fn();return t(ut,Ne),ut})()})),nt}})]}})}),null),t(Mr,n(h,{get when(){return $e(()=>!!Ce()?.nodes)()&&Ce().nodes.length>0},get children(){return n(it,{padding:"sm",get children(){return[Zx(),n(ze,{get each(){return Ce()?.nodes||[]},children:He=>(()=>{var nt=Ap(),Ne=nt.firstChild,ut=Ne.firstChild,kt=ut.nextSibling,Tt=Ne.nextSibling,At=Tt.firstChild;At.firstChild;var Ue=At.nextSibling;return Ue.firstChild,t(ut,()=>He.name),t(kt,()=>He.connected?"Connected":"Failed"),t(At,()=>He.host,null),t(Ue,()=>He.authMethod?.replace("_"," "),null),t(Tt,n(h,{get when(){return He.error},get children(){var Be=Tp();return t(Be,()=>He.error),Be}}),null),q(()=>y(kt,`px-2 py-0.5 rounded text-white text-xs ${He.connected?"bg-green-500":"bg-red-500"}`)),nt})()})]}})}}),null),t(Mr,n(h,{get when(){return $e(()=>!!Ce()?.pbs)()&&Ce().pbs.length>0},get children(){return n(it,{padding:"sm",get children(){return[eb(),n(ze,{get each(){return Ce()?.pbs||[]},children:He=>(()=>{var nt=Mp(),Ne=nt.firstChild,ut=Ne.firstChild,kt=ut.nextSibling;return t(ut,()=>He.name),t(kt,()=>He.connected?"Connected":"Failed"),t(nt,n(h,{get when(){return He.error},get children(){var Tt=Dp();return t(Tt,()=>He.error),Tt}}),null),q(()=>y(kt,`px-2 py-0.5 rounded text-white text-xs ${He.connected?"bg-green-500":"bg-red-500"}`)),nt})()})]}})}}),null),Mr}}),null),t($r,()=>s()?"Connected":"Disconnected"),t(tr,()=>window.location.port||(window.location.protocol==="https:"?"443":"80")),t(wn,()=>ne().filter(Mr=>Mr.type==="pve").length),t(Kn,()=>ne().filter(Mr=>Mr.type==="pbs").length),t(Ta,()=>r.vms?.length||0),t(zs,()=>r.containers?.length||0),t(vs,()=>{const Mr=nt=>{const Ne=JSON.parse(JSON.stringify(nt)),ut=new Map,kt=new Map,Tt=Pe=>{if(!Pe)return Pe;if(kt.has(Pe))return kt.get(Pe);const Nt=Pe.match(/\.(lan|local|home|internal)$/),Ye=`instance-REDACTED${Nt?Nt[0]:""}`;return kt.set(Pe,Ye),Ye},At=Pe=>{if(!Pe)return Pe;const Nt=Pe.split(".");return Nt.length===4?`${Nt[0]}.xxx.xxx.xxx`:"xxx.xxx.xxx.xxx"},Ue=Pe=>{if(!Pe)return Pe;const Nt=Pe.match(/\.(lan|local|home|internal)$/);return`node-REDACTED${Nt?Nt[0]:""}`},Be=Pe=>Pe&&Pe.replace(/https?:\/\/[^"'\s]+/g,"https://REDACTED").replace(/\b\d{1,3}(?:\.\d{1,3}){3}\b/g,"xxx.xxx.xxx.xxx"),at=Pe=>Array.isArray(Pe)?Pe.map(Nt=>typeof Nt!="string"?Nt:Be(Nt)??Nt):Pe,zt=Pe=>Pe.map((Nt,Qt)=>{const Ye={...Nt},ar=typeof Ye.node=="string"?Ye.node:"";ar&&(Ye.node=ut.get(ar)||Ue(ar));const Pr=typeof Ye.instance=="string"?Ye.instance:"";return Pr&&(Ye.instance=Tt(Pr)),typeof Ye.id=="string"&&Ye.id&&(Ye.id=`node-snapshot-${Qt}`),Ye}),wt=Pe=>Pe.map((Nt,Qt)=>{const Ye={...Nt},ar=typeof Ye.node=="string"?Ye.node:"";ar&&(Ye.node=ut.get(ar)||Ue(ar));const Pr=typeof Ye.instance=="string"?Ye.instance:"";return Pr&&(Ye.instance=Tt(Pr)),typeof Ye.name=="string"&&(Ye.name="vm-REDACTED"),typeof Ye.vmid=="number"?Ye.vmid=Qt+1:typeof Ye.vmid=="string"&&(Ye.vmid=`vm-${Qt+1}`),Array.isArray(Ye.notes)&&(Ye.notes=at(Ye.notes)),Ye});if(Ne.nodes&&(Ne.nodes=Ne.nodes.map((Pe,Nt)=>{const Qt=typeof Pe.type=="string"?Pe.type:"node",Ye=typeof Pe.name=="string"?Pe.name:"",ar=typeof Pe.host=="string"?Pe.host:"",Pr=typeof Pe.tokenName=="string"?Pe.tokenName:void 0,_r=typeof Pe.clusterName=="string"?Pe.clusterName:void 0,Vr=Array.isArray(Pe.clusterEndpoints)?Pe.clusterEndpoints.map((Dr,ws)=>({...Dr,NodeName:`node-${ws+1}`,Host:`node-${ws+1}`,IP:At(typeof Dr.IP=="string"?Dr.IP:"")})):Pe.clusterEndpoints,mr=`${Qt}-${Nt}`;ut.set(Ye,mr);const $n=Pe.physicalDisks;$n&&Array.isArray($n.nodeResults)&&($n.nodeResults=$n.nodeResults.map(Dr=>({...Dr,nodeName:Ue(typeof Dr.nodeName=="string"?Dr.nodeName:""),apiResponse:Be(typeof Dr.apiResponse=="string"?Dr.apiResponse:void 0)??Dr.apiResponse,error:Be(typeof Dr.error=="string"?Dr.error:void 0)??Dr.error})));const Qr=Pe.vmDiskCheck;return Qr&&(typeof Qr.testVMName=="string"&&(Qr.testVMName="vm-REDACTED"),typeof Qr.testResult=="string"&&(Qr.testResult=Be(Qr.testResult)),Array.isArray(Qr.problematicVMs)&&(Qr.problematicVMs=Qr.problematicVMs.map(Dr=>({...Dr,name:"vm-REDACTED",issue:Be(typeof Dr.issue=="string"?Dr.issue:void 0)??Dr.issue}))),Array.isArray(Qr.recommendations)&&(Qr.recommendations=Qr.recommendations.map(Dr=>Be(Dr)??Dr))),{...Pe,id:mr,name:Ue(Ye),host:ar&&ar.replace(/https?:\/\/[^:\/]+/,"https://REDACTED"),tokenName:Pr&&"token-REDACTED",clusterName:_r&&"cluster-REDACTED",clusterEndpoints:Vr,physicalDisks:$n,vmDiskCheck:Qr}})),Array.isArray(Ne.nodeSnapshots)&&(Ne.nodeSnapshots=zt(Ne.nodeSnapshots)),Array.isArray(Ne.guestSnapshots)&&(Ne.guestSnapshots=wt(Ne.guestSnapshots)),Ne.temperatureProxy&&typeof Ne.temperatureProxy=="object"){const Pe=Ne.temperatureProxy;typeof Pe.socketPath=="string"&&(Pe.socketPath=Pe.socketPath.includes("pulse-sensor-proxy")?"/mnt/pulse-proxy/pulse-sensor-proxy.sock":"proxy-socket"),Array.isArray(Pe.notes)&&(Pe.notes=at(Pe.notes))}if(Ne.apiTokens&&typeof Ne.apiTokens=="object"){const Pe=Ne.apiTokens,Nt=new Map;Array.isArray(Pe.tokens)&&(Pe.tokens=Pe.tokens.map((Qt,Ye)=>{const ar={...Qt},Pr=typeof Qt.id=="string"?Qt.id:"",_r=`token-${Ye+1}`;return Pr&&Nt.set(Pr,_r),ar.id=_r,ar.name=_r,typeof ar.hint=="string"&&(ar.hint="token-REDACTED"),ar})),Array.isArray(Pe.usage)&&(Pe.usage=Pe.usage.map((Qt,Ye)=>{const ar={...Qt},Pr=typeof Qt.tokenId=="string"?Qt.tokenId:"",_r=Nt.get(Pr)??`token-${Ye+1}`;return ar.tokenId=_r,Array.isArray(ar.hosts)&&(ar.hosts=ar.hosts.map((Vr,mr)=>Ue(typeof Vr=="string"?Vr:`host-${mr+1}`))),ar})),Array.isArray(Pe.notes)&&(Pe.notes=at(Pe.notes))}if(Ne.dockerAgents&&typeof Ne.dockerAgents=="object"){const Pe=Ne.dockerAgents;Array.isArray(Pe.attention)&&(Pe.attention=Pe.attention.map((Nt,Qt)=>{const Ye={...Nt};return Ye.hostId=`docker-host-${Qt+1}`,Ye.name=`docker-host-${Qt+1}`,typeof Ye.tokenHint=="string"&&(Ye.tokenHint="token-REDACTED"),Array.isArray(Ye.issues)&&(Ye.issues=at(Ye.issues)),Ye})),Array.isArray(Pe.notes)&&(Pe.notes=at(Pe.notes))}if(Ne.alerts&&typeof Ne.alerts=="object"){const Pe=Ne.alerts;Array.isArray(Pe.legacyThresholdSources)&&(Pe.legacyThresholdSources=Pe.legacyThresholdSources.map(Nt=>Be(Nt)??Nt)),Array.isArray(Pe.legacyScheduleSettings)&&(Pe.legacyScheduleSettings=Pe.legacyScheduleSettings.map(Nt=>Be(Nt)??Nt)),Array.isArray(Pe.notes)&&(Pe.notes=at(Pe.notes))}if(Ne.backendDiagnostics&&typeof Ne.backendDiagnostics=="object"){const Pe=Ne.backendDiagnostics;Array.isArray(Pe.nodeSnapshots)&&(Pe.nodeSnapshots=zt(Pe.nodeSnapshots)),Array.isArray(Pe.guestSnapshots)&&(Pe.guestSnapshots=wt(Pe.guestSnapshots)),Array.isArray(Pe.nodes)&&(Pe.nodes=Pe.nodes.map((Nt,Qt)=>{const Ye=Nt,ar=typeof Ye.name=="string"?Ye.name:"",Pr=`diagnostic-node-${Qt}`;ut.set(ar,Pr);const _r=Ye.vmDiskCheck,Vr=Ye.physicalDisks;if(_r){if(typeof _r.testVMName=="string"&&(_r.testVMName="vm-REDACTED"),typeof _r.testResult=="string"){const mr=Be(_r.testResult);_r.testResult=mr??_r.testResult}Array.isArray(_r.problematicVMs)&&(_r.problematicVMs=_r.problematicVMs.map(mr=>{const $n=Be(typeof mr.issue=="string"?mr.issue:void 0);return{...mr,name:"vm-REDACTED",issue:$n??mr.issue}})),Array.isArray(_r.recommendations)&&(_r.recommendations=_r.recommendations.map(mr=>Be(mr)??mr))}if(Vr){if(typeof Vr.testResult=="string"){const mr=Be(Vr.testResult);Vr.testResult=mr??Vr.testResult}Array.isArray(Vr.nodeResults)&&(Vr.nodeResults=Vr.nodeResults.map(mr=>({...mr,nodeName:Ue(typeof mr.nodeName=="string"?mr.nodeName:""),apiResponse:Be(typeof mr.apiResponse=="string"?mr.apiResponse:void 0)??mr.apiResponse,error:Be(typeof mr.error=="string"?mr.error:void 0)??mr.error})))}return{...Ye,id:Pr,name:Ue(ar),host:typeof Ye.host=="string"?Ye.host.replace(/https?:\/\/[^:\/]+/,"https://REDACTED"):Ye.host,error:Be(typeof Ye.error=="string"?Ye.error:void 0)??Ye.error,vmDiskCheck:_r,physicalDisks:Vr}})),Array.isArray(Pe.pbs)&&(Pe.pbs=Pe.pbs.map((Nt,Qt)=>{const Ye=Nt,ar=typeof Ye.name=="string"?Ye.name:"",Pr=`diagnostic-pbs-${Qt}`;return ut.set(ar,Pr),{...Ye,id:Pr,name:Ue(ar),host:typeof Ye.host=="string"?Ye.host.replace(/https?:\/\/[^:\/]+/,"https://REDACTED"):Ye.host,error:Be(typeof Ye.error=="string"?Ye.error:void 0)??Ye.error}}))}Ne.storage&&(Ne.storage=Ne.storage.map((Pe,Nt)=>{const Qt=typeof Pe.node=="string"?Pe.node:"";return{...Pe,id:`storage-${Nt}`,node:Ue(Qt),name:`storage-${Nt}`}}));const or=Ne.backups;or&&(Array.isArray(or.pveBackupTasks)&&(or.pveBackupTasks=or.pveBackupTasks.map((Pe,Nt)=>{const Qt=typeof Pe.node=="string"?Pe.node:"",Ye=typeof Pe.vmid=="number"?Pe.vmid:void 0;return{...Pe,node:Ue(Qt),storage:`storage-${Nt}`,vmid:Ye!==void 0?`vm-${Ye}`:Ye}})),Array.isArray(or.pveStorageBackups)&&(or.pveStorageBackups=or.pveStorageBackups.map((Pe,Nt)=>{const Qt=typeof Pe.node=="string"?Pe.node:"",Ye=typeof Pe.vmid=="number"?Pe.vmid:void 0,ar=typeof Pe.volid=="string"?Pe.volid:void 0;return{...Pe,node:Ue(Qt),storage:`storage-${Nt}`,vmid:Ye!==void 0?`vm-${Ye}`:Ye,volid:ar&&"vol-REDACTED"}})),Array.isArray(or.pbsBackups)&&(or.pbsBackups=or.pbsBackups.map((Pe,Nt)=>{const Qt=typeof Pe.backupId=="string"?Pe.backupId:void 0,Ye=typeof Pe.vmName=="string"?Pe.vmName:void 0;return{...Pe,datastore:`datastore-${Nt}`,backupId:Qt&&`backup-${Nt}`,vmName:Ye&&"vm-REDACTED"}})));const Cr=Ne.activeAlerts;Cr&&(Ne.activeAlerts=Cr.map(Pe=>{const Nt=typeof Pe.node=="string"?Pe.node:"",Qt=typeof Pe.details=="string"?Pe.details:void 0;return{...Pe,node:Ue(Nt),details:Qt&&Qt.replace(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/g,"xxx.xxx.xxx.xxx")}}));const jn=Ne.websocket;if(jn&&typeof jn.url=="string"&&(jn.url=jn.url.replace(/\/\/[^\/]+/,"//REDACTED")),Ne.connectionHealth&&typeof Ne.connectionHealth=="object"){const Pe={};let Nt=1;Object.entries(Ne.connectionHealth).forEach(([Qt,Ye])=>{const ar=ut.get(Qt)||`resource-${Nt}`;Pe[ar]=Ye,Nt+=1}),Ne.connectionHealth=Pe}return Ne._notice="This diagnostic data has been sanitized for sharing on GitHub. IP addresses, hostnames, and tokens have been redacted.",Ne},He=nt=>{let Ne={timestamp:new Date().toISOString(),version:"2.1.0",pulseVersion:r.stats?.version||"unknown",environment:{userAgent:navigator.userAgent,platform:navigator.platform,language:navigator.language,screenResolution:`${window.screen.width}x${window.screen.height}`,windowSize:`${window.innerWidth}x${window.innerHeight}`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone},websocket:{connected:s(),url:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`},backendDiagnostics:Ce()||null,nodes:ne()?.map(Ue=>({...Ue,status:r.nodes?.find(Be=>Be.id===Ue.id)?.status||"unknown",online:r.nodes?.find(Be=>Be.id===Ue.id)?.status==="online"}))||[],state:{nodesCount:r.nodes?.length||0,nodesOnline:r.nodes?.filter(Ue=>Ue.status==="online").length||0,nodesOffline:r.nodes?.filter(Ue=>Ue.status!=="online").length||0,vmsCount:r.vms?.length||0,containersCount:r.containers?.length||0,storageCount:r.storage?.length||0,physicalDisksCount:r.physicalDisks?.length||0,pbsCount:r.pbs?.length||0,pbsBackupsCount:r.pbsBackups?.length||0,pveBackups:{backupTasksCount:r.pveBackups?.backupTasks?.length||0,storageBackupsCount:r.pveBackups?.storageBackups?.length||0,guestSnapshotsCount:r.pveBackups?.guestSnapshots?.length||0}},nodeStatus:r.nodes?.map(Ue=>({id:Ue.id,name:Ue.name,status:Ue.status,online:Ue.status==="online",cpu:Ue.cpu,memory:Ue.memory,uptime:Ue.uptime,version:Ue.pveVersion??Ue.kernelVersion}))||[],storage:r.storage?.map(Ue=>({id:Ue.id,node:Ue.node,name:Ue.name,type:Ue.type,status:Ue.status,enabled:Ue.enabled,content:Ue.content,shared:Ue.shared,used:Ue.used,total:Ue.total,zfsPool:Ue.zfsPool?{state:Ue.zfsPool.state,readErrors:Ue.zfsPool.readErrors,writeErrors:Ue.zfsPool.writeErrors,checksumErrors:Ue.zfsPool.checksumErrors,deviceCount:Ue.zfsPool.devices?.length||0}:void 0,hasBackups:(r.pveBackups?.storageBackups?.filter(Be=>Be.storage===Ue.name).length||0)>0}))||[],physicalDisks:r.physicalDisks?.map(Ue=>({node:Ue.node,device:Ue.device||Ue.devPath,model:Ue.model,size:Ue.size,type:Ue.type,health:Ue.health,wearout:Ue.wearout,rpm:Ue.rpm,smart:Ue.smart??null}))||[],backups:{pveBackupTasks:r.pveBackups?.backupTasks?.slice(0,10)||[],pveStorageBackups:r.pveBackups?.storageBackups?.slice(0,10)||[],pbsBackups:r.pbsBackups?.slice(0,10)||[]},connectionHealth:r.connectionHealth||{},performance:{lastPollDuration:r.performance?.lastPollDuration||0,totalApiCalls:r.performance?.totalApiCalls||0,failedApiCalls:r.performance?.failedApiCalls||0,apiCallDuration:r.performance?.apiCallDuration||{}},activeAlerts:r.activeAlerts?.slice(0,20)||[],settings:{}};if(nt){if(Ne=Mr(Ne),Array.isArray(Ne.nodes)&&Array.isArray(Ne.nodeStatus)){const Ue=Ne.nodes,Be=Ne.nodeStatus;Ne.nodeStatus=Ue.map((at,zt)=>{const wt=Be[zt];return{id:at.id,name:at.name,status:wt?.status||"unknown",online:wt?.online||!1,cpu:wt?.cpu,memory:wt?.memory,uptime:wt?.uptime,version:wt?.version}})}Array.isArray(Ne.storage)&&(Ne.storage=Ne.storage.map((Ue,Be)=>{const at={...Ue};if(typeof at.storage=="string"&&at.storage&&(at.storage=`storage-${Be}`),Array.isArray(at.nodes)&&(at.nodes=at.nodes.map(()=>"node-REDACTED")),Array.isArray(at.nodeIds)&&(at.nodeIds=at.nodeIds.map(()=>"node-REDACTED")),typeof at.instance=="string"&&at.instance){const zt=at.instance.match(/\.(lan|local|home|internal)$/),wt=zt?zt[0]:"";at.instance=`instance-REDACTED${wt}`}return at})),Array.isArray(Ne.activeAlerts)&&(Ne.activeAlerts=Ne.activeAlerts.map((Ue,Be)=>{const at={...Ue};if(typeof at.resourceName=="string"&&at.resourceName){const zt=at.resourceName.match(/\.(lan|local|home|internal)$/),wt=zt?zt[0]:"";at.resourceName=`resource-REDACTED${wt}`}if(typeof at.node=="string"&&at.node&&(at.node="node-REDACTED"),typeof at.instance=="string"&&at.instance){const zt=at.instance.match(/\.(lan|local|home|internal)$/),wt=zt?zt[0]:"";at.instance=`instance-REDACTED${wt}`}if(typeof at.resourceId=="string"&&at.resourceId&&(at.resourceId=`alert-resource-${Be}`),typeof at.id=="string"&&at.id){const zt=at.id.split("-"),wt=zt[zt.length-1];at.id=`alert-${Be}-${wt}`}return at}))}const ut=new Blob([JSON.stringify(Ne,null,2)],{type:"application/json"}),kt=URL.createObjectURL(ut),Tt=document.createElement("a");Tt.href=kt;const At=nt?"sanitized":"full";Tt.download=`pulse-diagnostics-${At}-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(Tt),Tt.click(),document.body.removeChild(Tt),URL.revokeObjectURL(kt)};return(()=>{var nt=Ep(),Ne=nt.firstChild,ut=Ne.firstChild,kt=ut.nextSibling;return t(nt,n(h,{get when(){return!Ce()},get children(){return Pp()}}),Ne),ut.$$click=()=>He(!1),kt.$$click=()=>He(!0),nt})()},ks),q(Mr=>{var He=tt(),nt=`font-medium ${s()?"text-green-600":"text-red-600"}`;return He!==Mr.e&&(Le.disabled=Mr.e=He),nt!==Mr.t&&y($r,Mr.t=nt),Mr},{e:void 0,t:void 0}),Se}}),null),t(Ee,n(h,{get when(){return g()==="urls"},get children(){return n(uf,{hasUnsavedChanges:m,setHasUnsavedChanges:S})}}),null),Me})()]}}),null),ke})(),n(h,{get when(){return $()},get children(){var ke=ob();return t(ke,n(it,{padding:"lg",class:"w-full max-w-lg space-y-5",get children(){return[n(rr,{get title(){return`Remove ${gn()}`},size:"md",class:"mb-1"}),(()=>{var Me=lb(),Ee=Me.firstChild,Se=Ee.firstChild,De=Se.nextSibling;De.nextSibling;var be=Ee.nextSibling,ve=be.firstChild,ye=ve.nextSibling,Ie=ye.firstChild,Le=Ie.nextSibling;return Le.nextSibling,t(Ee,()=>hn().toLowerCase(),De),t(Le,(()=>{var rt=$e(()=>!!en());return()=>rt()?["The host"," ",(()=>{var je=Np();return t(je,en),je})()," loses the proxy service, SSH key, and API token."]:"The host loses the proxy service, SSH key, and API token."})()),t(ye,n(h,{get when(){return sn()==="pbs"},get children(){return sb()}}),null),t(ye,n(h,{get when(){return sn()==="pmg"},get children(){return ab()}}),null),Me})(),(()=>{var Me=ib(),Ee=Me.firstChild,Se=Ee.nextSibling;return Ee.$$click=bn,Se.$$click=Dn,t(Se,()=>K()?"Removing…":"Remove node"),q(De=>{var be=K(),ve=K();return be!==De.e&&(Ee.disabled=De.e=be),ve!==De.t&&(Se.disabled=De.t=ve),De},{e:void 0,t:void 0}),Me})()]}})),ke}}),n(h,{get when(){return $e(()=>!!L())()&&ee()==="pve"},get children(){return n(Ba,{isOpen:!0,get resetKey(){return Y()},onClose:()=>{H(!1),le(null),oe(ke=>ke+1)},nodeType:"pve",get editingNode(){return $e(()=>se()?.type==="pve")()?se()??void 0:void 0},get securityStatus(){return Ve()??void 0},onSave:async ke=>{try{if(se()&&se().id)await rn.updateNode(se().id,ke),W(ne().map(Me=>Me.id===se().id?{...Me,...ke,hasPassword:ke.password?!0:Me.hasPassword,hasToken:ke.tokenValue?!0:Me.hasToken,status:"pending"}:Me)),Wt("Node updated successfully");else{await rn.addNode(ke);const Ee=(await rn.getNodes()).map(Se=>({...Se,hasPassword:Se.hasPassword??!!Se.password,hasToken:Se.hasToken??!!Se.tokenValue,status:Se.status||"pending"}));W(Ee),Wt("Node added successfully")}H(!1),le(null)}catch(Me){$t(Me instanceof Error?Me.message:"Operation failed")}}})}}),n(h,{get when(){return $e(()=>!!L())()&&ee()==="pbs"},get children(){return n(Ba,{isOpen:!0,get resetKey(){return Y()},onClose:()=>{H(!1),le(null),oe(ke=>ke+1)},nodeType:"pbs",get editingNode(){return $e(()=>se()?.type==="pbs")()?se()??void 0:void 0},get securityStatus(){return Ve()??void 0},onSave:async ke=>{try{if(se()&&se().id)await rn.updateNode(se().id,ke),W(ne().map(Me=>Me.id===se().id?{...Me,...ke,hasPassword:ke.password?!0:Me.hasPassword,hasToken:ke.tokenValue?!0:Me.hasToken,status:"pending"}:Me)),Wt("Node updated successfully");else{await rn.addNode(ke);const Ee=(await rn.getNodes()).map(Se=>({...Se,hasPassword:Se.hasPassword??!!Se.password,hasToken:Se.hasToken??!!Se.tokenValue,status:Se.status||"pending"}));W(Ee),Wt("Node added successfully")}H(!1),le(null)}catch(Me){$t(Me instanceof Error?Me.message:"Operation failed")}}})}}),n(h,{get when(){return $e(()=>!!L())()&&ee()==="pmg"},get children(){return n(Ba,{isOpen:!0,get resetKey(){return Y()},onClose:()=>{H(!1),le(null),oe(ke=>ke+1)},nodeType:"pmg",get editingNode(){return $e(()=>se()?.type==="pmg")()?se()??void 0:void 0},get securityStatus(){return Ve()??void 0},onSave:async ke=>{try{if(se()&&se().id)await rn.updateNode(se().id,ke),W(ne().map(Me=>Me.id===se().id?{...Me,...ke,hasPassword:ke.password?!0:Me.hasPassword,hasToken:ke.tokenValue?!0:Me.hasToken,status:"pending"}:Me)),Wt("Node updated successfully");else{await rn.addNode(ke);const Ee=(await rn.getNodes()).map(Se=>({...Se,hasPassword:Se.hasPassword??!!Se.password,hasToken:Se.hasToken??!!Se.tokenValue,status:Se.status||"pending"}));W(Ee),Wt("Node added successfully")}H(!1),le(null)}catch(Me){$t(Me instanceof Error?Me.message:"Operation failed")}}})}}),n(h,{get when(){return Et()},get children(){var ke=qa();return t(ke,n(it,{padding:"lg",class:"max-w-md w-full",get children(){return[n(rr,{title:"Export configuration",size:"md",class:"mb-4"}),(()=>{var Me=gb(),Ee=Me.firstChild,Se=Ee.firstChild,De=Se.nextSibling,be=Ee.nextSibling,ve=be.firstChild,ye=ve.firstChild,Ie=ye.nextSibling,Le=Ie.firstChild,rt=Le.nextSibling,je=rt.nextSibling;je.nextSibling;var jt=be.nextSibling,Ct=jt.firstChild,Mt=Ct.nextSibling;return t(Me,n(h,{get when(){return Ve()?.hasAuthentication},get children(){var Pt=db(),Kt=Pt.firstChild,ur=Kt.firstChild,$r=ur.firstChild,Ir=ur.nextSibling,St=Ir.firstChild;return $r.addEventListener("change",()=>{Ae(!1),Rt("")}),St.addEventListener("change",()=>Ae(!0)),q(()=>$r.checked=!It()),q(()=>St.checked=It()),Pt}}),Ee),y(Ee,Ht),t(Se,(()=>{var Pt=$e(()=>!!Ve()?.hasAuthentication);return()=>Pt()?It()?"Custom Passphrase":"Enter Your Login Password":"Encryption Passphrase"})()),De.$$input=Pt=>Rt(Pt.currentTarget.value),t(Ee,n(h,{get when(){return!Ve()?.hasAuthentication||It()},get children(){var Pt=cb();return y(Pt,`${hr} mt-1`),Pt}}),null),t(Ee,n(h,{get when(){return $e(()=>!!Ve()?.hasAuthentication)()&&!It()},get children(){var Pt=ub();return y(Pt,`${hr} mt-1`),Pt}}),null),t(Ie,()=>It()||!Ve()?.hasAuthentication?"passphrase":"password",je),Ct.$$click=()=>{Jt(!1),Rt(""),Ae(!1)},Mt.$$click=kn,q(Pt=>{var Kt=yt(),ur=Ve()?.hasAuthentication?It()?"Enter a strong passphrase":"Enter your Pulse login password":"Enter a strong passphrase for encryption",$r=Dt(),Ir=!mt()||It()&&mt().length<12;return Kt!==Pt.e&&y(Se,Pt.e=Kt),ur!==Pt.t&&Te(De,"placeholder",Pt.t=ur),$r!==Pt.a&&y(De,Pt.a=$r),Ir!==Pt.o&&(Mt.disabled=Pt.o=Ir),Pt},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>De.value=mt()),Me})()]}})),ke}}),n(h,{get when(){return lr()},get children(){var ke=qa();return t(ke,n(it,{padding:"lg",class:"max-w-md w-full",get children(){return[n(rr,{title:"API token required",size:"md",class:"mb-4"}),(()=>{var Me=hb(),Ee=Me.firstChild,Se=Ee.nextSibling,De=Se.firstChild,be=De.nextSibling;return y(Se,Ht),be.$$input=ve=>we(ve.currentTarget.value),q(ve=>{var ye=yt(),Ie=Dt();return ye!==ve.e&&y(De,ve.e=ye),Ie!==ve.t&&y(be,ve.t=Ie),ve},{e:void 0,t:void 0}),q(()=>be.value=et()),Me})(),(()=>{var Me=fb(),Ee=Me.firstChild,Se=Ee.nextSibling;return Ee.$$click=()=>{Bt(!1),we("")},Se.$$click=()=>{if(et()){localStorage.setItem("apiToken",et());const De=Je();Bt(!1),we(""),Ge(null),De==="export"?kn():De==="import"&&Br()}else $t("Please enter the API token")},q(()=>Se.disabled=!et()),Me})()]}})),ke}}),n(h,{get when(){return er()},get children(){var ke=qa();return t(ke,n(it,{padding:"lg",class:"max-w-md w-full",get children(){return[n(rr,{title:"Import configuration",size:"md",class:"mb-4"}),(()=>{var Me=mb(),Ee=Me.firstChild,Se=Ee.firstChild,De=Se.nextSibling,be=Ee.nextSibling,ve=be.firstChild,ye=ve.nextSibling,Ie=ye.nextSibling,Le=be.nextSibling,rt=Le.nextSibling,je=rt.firstChild,jt=je.nextSibling;return y(Ee,Ht),De.addEventListener("change",Ct=>{const Mt=Ct.currentTarget.files?.[0];Mt&&Vt(Mt)}),y(be,Ht),ye.$$input=Ct=>Qe(Ct.currentTarget.value),y(Ie,`${hr} mt-1`),je.$$click=()=>{Ut(!1),Qe(""),Vt(null)},jt.$$click=Br,q(Ct=>{var Mt=yt(),Pt=Dt("cursor-pointer"),Kt=yt(),ur=Dt(),$r=!Fe()||!xt();return Mt!==Ct.e&&y(Se,Ct.e=Mt),Pt!==Ct.t&&y(De,Ct.t=Pt),Kt!==Ct.a&&y(ve,Ct.a=Kt),ur!==Ct.o&&y(ye,Ct.o=ur),$r!==Ct.i&&(jt.disabled=Ct.i=$r),Ct},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),q(()=>ye.value=Fe()),Me})()]}})),ke}}),n(tf,{get isOpen(){return _()},onClose:()=>{B(!1),yr()}})]};Xt(["click","input"]);class fn{static baseUrl="/api/notifications";static async getEmailConfig(){const r=await Ft(`${this.baseUrl}/email`);return{enabled:r.enabled||!1,provider:r.provider||"",server:r.server||"",port:r.port||587,username:r.username||"",password:r.password||"",from:r.from||"",to:r.to||[],tls:r.tls||!1,startTLS:r.startTLS||!1}}static async updateEmailConfig(r){const s={enabled:r.enabled,server:r.server,port:r.port,username:r.username,password:r.password,from:r.from,to:r.to,tls:r.tls||!1,startTLS:r.startTLS||!1,provider:r.provider||""};return Ft(`${this.baseUrl}/email`,{method:"PUT",body:JSON.stringify(s)})}static async getWebhooks(){const r=await Ft(`${this.baseUrl}/webhooks`);return Array.isArray(r)?r:[]}static async createWebhook(r){return Ft(`${this.baseUrl}/webhooks`,{method:"POST",body:JSON.stringify(r)})}static async updateWebhook(r,s){return Ft(`${this.baseUrl}/webhooks/${r}`,{method:"PUT",body:JSON.stringify(s)})}static async deleteWebhook(r){return Ft(`${this.baseUrl}/webhooks/${r}`,{method:"DELETE"})}static async getEmailProviders(){return Ft(`${this.baseUrl}/email-providers`)}static async getWebhookTemplates(){return Ft(`${this.baseUrl}/webhook-templates`)}static async testNotification(r){const s={method:r.type};return r.config&&(s.config=r.config),r.webhookId&&(s.webhookId=r.webhookId),Ft(`${this.baseUrl}/test`,{method:"POST",body:JSON.stringify(s)})}static async testWebhook(r){return Ft(`${this.baseUrl}/webhooks/test`,{method:"POST",body:JSON.stringify(r)})}}var Rp=i('<button type=button class="text-xs font-medium text-blue-600 hover:underline dark:text-blue-400">Reapply defaults'),Ip=i('<div class="mt-2 rounded border border-blue-200 bg-blue-50 px-3 py-2 text-xs leading-relaxed text-blue-900 dark:border-blue-700 dark:bg-blue-900/20 dark:text-blue-200">'),Hp=i('<div class="sm:hidden w-full"><button type=button class="text-xs font-medium text-blue-600 hover:underline dark:text-blue-300">'),Up=i('<div class="hidden w-full sm:block"><div class="mt-2 rounded border border-blue-200 bg-blue-50 px-3 py-2 text-xs leading-relaxed text-blue-900 dark:border-blue-700 dark:bg-blue-900/20 dark:text-blue-200">'),Bp=i('<div class="mt-3 space-y-3 text-xs text-gray-700 dark:text-gray-300"><div class="grid gap-3 sm:grid-cols-3"><label class="flex items-center gap-2"><input type=checkbox><span>Use TLS</span></label><label class="flex items-center gap-2"><input type=checkbox><span>Use STARTTLS</span></label><div class="flex w-full flex-wrap items-center gap-2 sm:flex-nowrap"><label>Rate limit</label><input type=number><span>/min</span></div></div><div class="grid w-full gap-3 sm:grid-cols-2"><div><label>Max retries</label><input type=number min=0 max=5></div><div><label>Retry delay (seconds)</label><input type=number min=1 max=60>'),jp=i('<div class="space-y-4 text-sm overflow-hidden"><div><label>Email provider</label><div class="flex w-full flex-wrap items-center gap-2 sm:flex-nowrap"><select><option value>Manual configuration</option></select></div></div><div class="grid w-full gap-3 sm:grid-cols-2"><div><label>SMTP server</label><input type=text placeholder=smtp.example.com></div><div><label>SMTP port</label><input type=number placeholder=587></div><div><label>From address</label><input type=email placeholder=noreply@example.com></div><div><label>Reply-to address</label><input type=email placeholder=admin@example.com></div><div><label>Username</label><input type=text></div><div><label>Password / API key</label><input type=password placeholder=••••••••></div></div><div><label>Recipients (one per line)</label><textarea rows=3></textarea></div><div class="border-t border-gray-200 pt-3 dark:border-gray-700"><button type=button class="text-xs font-semibold uppercase tracking-wide text-gray-600 transition-colors hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"></button></div><div class="flex justify-end pt-2"><button type=button class="rounded border border-blue-500 px-3 py-1.5 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-blue-400 dark:text-blue-300 dark:hover:bg-blue-900/30">'),Fp=i("<option> (<!>:<!>)");function Vp(e){const[r,s]=Z([]),[l,o]=Z(!1),[a,d]=Z(!1);ft(async()=>{try{const p=await fn.getEmailProviders();s(p)}catch(p){console.error("Failed to load email providers:",p)}});const c=p=>{if(!p){e.onChange({...e.config,provider:""}),d(!1);return}e.onChange({...e.config,provider:p.name,server:p.smtpHost,port:p.smtpPort,tls:p.tls,startTLS:p.startTLS,username:p.name==="SendGrid"?"apikey":e.config.username}),d(!0)},g=p=>{if(!p){c(void 0);return}const m=r().find(S=>S.name===p);c(m)},b=()=>r().find(p=>p.name===e.config.provider);return(()=>{var p=jp(),m=p.firstChild,S=m.firstChild,z=S.nextSibling,ie=z.firstChild;ie.firstChild;var ne=m.nextSibling,W=ne.firstChild,X=W.firstChild,I=X.nextSibling,L=W.nextSibling,H=L.firstChild,se=H.nextSibling,le=L.nextSibling,ee=le.firstChild,U=ee.nextSibling,Y=le.nextSibling,oe=Y.firstChild,_=oe.nextSibling,B=Y.nextSibling,$=B.firstChild,D=$.nextSibling,f=B.nextSibling,j=f.firstChild,K=j.nextSibling,C=ne.nextSibling,ge=C.firstChild,J=ge.nextSibling,N=C.nextSibling,F=N.firstChild,P=N.nextSibling,E=P.firstChild;return y(m,Ht),ie.addEventListener("change",u=>g(u.currentTarget.value)),t(ie,n(ze,{get each(){return r()},children:u=>(()=>{var v=Fp(),V=v.firstChild,A=V.nextSibling,k=A.nextSibling,w=k.nextSibling;return w.nextSibling,t(v,()=>u.name,V),t(v,()=>u.smtpHost,A),t(v,()=>u.smtpPort,w),q(()=>v.value=u.name),v})()}),null),t(z,n(h,{get when(){return e.config.provider},get children(){var u=Rp();return u.$$click=()=>{const v=b();v&&c(v)},u}}),null),t(p,n(h,{get when(){return b()},get children(){return[(()=>{var u=Hp(),v=u.firstChild;return v.$$click=()=>d(!a()),t(v,()=>a()?"Hide setup instructions":"Show setup instructions"),t(u,n(h,{get when(){return a()},get children(){var V=Ip();return t(V,()=>b().instructions),V}}),null),u})(),(()=>{var u=Up(),v=u.firstChild;return t(v,()=>b().instructions),u})()]}}),ne),y(W,Ht),I.$$input=u=>e.onChange({...e.config,server:u.currentTarget.value}),y(L,Ht),se.$$input=u=>e.onChange({...e.config,port:parseInt(u.currentTarget.value)||587}),y(le,Ht),U.$$input=u=>e.onChange({...e.config,from:u.currentTarget.value}),y(Y,Ht),_.$$input=u=>e.onChange({...e.config,replyTo:u.currentTarget.value}),y(B,Ht),D.$$input=u=>e.onChange({...e.config,username:u.currentTarget.value}),y(f,Ht),K.$$input=u=>e.onChange({...e.config,password:u.currentTarget.value}),y(C,Ht),J.$$keydown=u=>{u.key==="Enter"&&u.stopPropagation()},J.$$input=u=>{const v=u.currentTarget.value.split(`
|
||
`).map(V=>V.trim()).filter(V=>V.length>0);e.onChange({...e.config,to:v})},F.$$click=()=>o(!l()),t(F,()=>l()?"Hide advanced options":"Show advanced options"),t(N,n(h,{get when(){return l()},get children(){var u=Bp(),v=u.firstChild,V=v.firstChild,A=V.firstChild,k=V.nextSibling,w=k.firstChild,de=k.nextSibling,fe=de.firstChild,x=fe.nextSibling,R=x.nextSibling,Q=v.nextSibling,G=Q.firstChild,T=G.firstChild,te=T.nextSibling,ae=G.nextSibling,M=ae.firstChild,ce=M.nextSibling;return A.addEventListener("change",ue=>e.onChange({...e.config,tls:ue.currentTarget.checked})),y(A,`${Pn} h-4 w-4`),w.addEventListener("change",ue=>e.onChange({...e.config,startTLS:ue.currentTarget.checked})),y(w,`${Pn} h-4 w-4`),x.$$input=ue=>e.onChange({...e.config,rateLimit:parseInt(ue.currentTarget.value)}),y(R,hr),y(G,Ht),te.$$input=ue=>e.onChange({...e.config,maxRetries:parseInt(ue.currentTarget.value)}),y(ae,Ht),ce.$$input=ue=>e.onChange({...e.config,retryDelay:parseInt(ue.currentTarget.value)}),q(ue=>{var re=yt("text-xs uppercase tracking-[0.08em]"),O=`${Dt("px-2 py-1 text-sm")} w-20`,xe=yt("text-xs uppercase tracking-[0.08em]"),he=Dt("px-2 py-1 text-sm"),me=yt("text-xs uppercase tracking-[0.08em]"),_e=Dt("px-2 py-1 text-sm");return re!==ue.e&&y(fe,ue.e=re),O!==ue.t&&y(x,ue.t=O),xe!==ue.a&&y(T,ue.a=xe),he!==ue.o&&y(te,ue.o=he),me!==ue.i&&y(M,ue.i=me),_e!==ue.n&&y(ce,ue.n=_e),ue},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),q(()=>A.checked=e.config.tls),q(()=>w.checked=e.config.startTLS),q(()=>x.value=e.config.rateLimit||60),q(()=>te.value=e.config.maxRetries||3),q(()=>ce.value=e.config.retryDelay||5),u}}),null),Gr(E,"click",e.onTest,!0),t(E,()=>e.testing?"Sending test email…":"Send test email"),q(u=>{var v=yt(),V=`${Dt("px-2 py-1.5")} sm:w-auto sm:min-w-[180px]`,A=yt(),k=Dt("px-2 py-1.5"),w=yt(),de=Dt("px-2 py-1.5"),fe=yt(),x=Dt("px-2 py-1.5"),R=yt(),Q=Dt("px-2 py-1.5"),G=yt(),T=e.config.provider==="SendGrid"?"apikey":"username@example.com",te=Dt("px-2 py-1.5"),ae=yt(),M=Dt("px-2 py-1.5"),ce=yt(),ue=Dt("px-2 py-1.5 font-mono leading-snug"),re=`Leave empty to use ${e.config.from||"the from address"}
|
||
Or add one recipient per line`,O=e.testing||!e.config.enabled;return v!==u.e&&y(S,u.e=v),V!==u.t&&y(ie,u.t=V),A!==u.a&&y(X,u.a=A),k!==u.o&&y(I,u.o=k),w!==u.i&&y(H,u.i=w),de!==u.n&&y(se,u.n=de),fe!==u.s&&y(ee,u.s=fe),x!==u.h&&y(U,u.h=x),R!==u.r&&y(oe,u.r=R),Q!==u.d&&y(_,u.d=Q),G!==u.l&&y($,u.l=G),T!==u.u&&Te(D,"placeholder",u.u=T),te!==u.c&&y(D,u.c=te),ae!==u.w&&y(j,u.w=ae),M!==u.m&&y(K,u.m=M),ce!==u.f&&y(ge,u.f=ce),ue!==u.y&&y(J,u.y=ue),re!==u.g&&Te(J,"placeholder",u.g=re),O!==u.p&&(E.disabled=u.p=O),u},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0}),q(()=>ie.value=e.config.provider),q(()=>I.value=e.config.server),q(()=>se.value=e.config.port),q(()=>U.value=e.config.from),q(()=>_.value=e.config.replyTo||""),q(()=>D.value=e.config.username),q(()=>K.value=e.config.password),q(()=>J.value=e.config.to.join(`
|
||
`)),p})()}Xt(["click","input","keydown"]);var Gp=i('<div class="space-y-3 w-full"><div class="flex flex-col gap-2 rounded border border-gray-200 px-3 py-3 text-xs dark:border-gray-700 sm:flex-row sm:items-center sm:justify-between"><div class="text-gray-600 dark:text-gray-400 sm:text-sm"> of <!> webhooks enabled</div><div class="flex flex-wrap gap-2 sm:flex-nowrap"><button class="w-full rounded border border-gray-300 px-3 py-1 text-xs text-gray-700 transition-colors hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 sm:w-auto">Disable All</button><button class="w-full rounded border border-green-500 px-3 py-1 text-xs text-green-700 transition-colors hover:bg-green-50 dark:border-green-600 dark:text-green-400 dark:hover:bg-green-900/20 sm:w-auto">Enable All'),zp=i('<div class="grid grid-cols-1 md:grid-cols-2 gap-2 border border-gray-200 dark:border-gray-700 px-3 py-2 mb-3 text-xs">'),Wp=i('<div class="mb-3 border-l-2 border-blue-300 pl-3 text-xs leading-relaxed text-blue-800 dark:border-blue-700 dark:text-blue-200"><h4 class="text-sm font-medium text-blue-900 dark:text-blue-100 mb-2">Setup Instructions'),qp=i(`<div><label>Custom payload template (JSON)<span class="text-xs text-gray-500 dark:text-gray-400">Optional — leave empty to use default</span></label><textarea placeholder="{
|
||
"text": "Alert: {{.Level}} - {{.Message}}",
|
||
"resource": "{{.ResourceName}}",
|
||
"value": {{.Value}},
|
||
"threshold": {{.Threshold}}
|
||
}"rows=8></textarea><p>Available variables: {{.ID}}, {{.Level}}, {{.Type}}, {{.ResourceName}}, {{.Node}}, {{.Message}}, {{.Value}}, {{.Threshold}}, {{.Duration}}, {{.Timestamp}}`),Kp=i('<div><label>Custom fields<span class="text-xs text-gray-500 dark:text-gray-400">Available as <code class="font-mono text-[11px] text-gray-600 dark:text-gray-300">{{.CustomFields.<name>}}</code> in templates</span></label><div class="space-y-2 text-xs"><button type=button class="w-full border border-dashed border-gray-300 px-2 py-1 text-xs text-gray-600 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-800">+ Add custom field</button></div><p class="mt-2 text-xs text-gray-500 dark:text-gray-400">Need Pushover? Provide your Application Token and User Key here.'),Jp=i('<button class="px-3 py-1.5 border border-gray-300 rounded text-xs hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200">'),Qp=i('<div class="space-y-4 text-sm"><div><div class="flex items-center justify-between mb-4"><label class="text-sm font-medium text-gray-700 dark:text-gray-300">Service Type</label><button type=button class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400"> →</button></div></div><div class="grid w-full grid-cols-1 gap-3 md:grid-cols-2"><div><label>Name</label><input type=text></div><div><label>HTTP method</label><select><option value=POST>POST</option><option value=PUT>PUT</option><option value=PATCH>PATCH</option></select></div></div><div><label>Webhook URL</label><input type=url><p>Supports template variables like <code class="font-mono text-[11px] text-gray-600 dark:text-gray-300">{{.Message}}</code>. Use <code class="font-mono text-[11px] text-gray-600 dark:text-gray-300">{{urlpath ...}}</code> or <code class="font-mono text-[11px] text-gray-600 dark:text-gray-300">{{urlquery ...}}</code> to keep dynamic values URL-safe.</p></div><div><label>Custom headers<span class="text-xs text-gray-500 dark:text-gray-400">Add authentication tokens or custom headers</span></label><div class="space-y-2 text-xs"><button type=button class="w-full border border-dashed border-gray-300 px-2 py-1 text-xs text-gray-600 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-800">+ Add header</button></div><p class="mt-2 text-xs text-gray-500 dark:text-gray-400">Common headers: Authorization (Bearer token), X-API-Key, X-Auth-Token</p></div><div><label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300"><input type=checkbox><span>Enable this webhook</span></label></div><div class="flex justify-end gap-2 text-xs"><button class="px-3 py-1.5 border border-gray-300 rounded text-xs hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200">Cancel</button><button class="px-3 py-1.5 bg-blue-600 text-white text-xs rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"> Webhook'),Yp=i('<button class="w-full border border-dashed border-gray-300 px-2 py-1 text-xs text-gray-600 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-800">+ Add Webhook'),Xp=i('<div class="space-y-6 min-w-0 w-full">'),Zp=i('<div class="w-full px-3 py-3 border border-gray-200 text-xs dark:border-gray-700 sm:text-sm"><div class="flex flex-wrap items-center justify-between gap-2"><span class="font-medium text-gray-800 dark:text-gray-200"></span><button></button></div><div class="mt-2 flex flex-wrap gap-2 text-[11px] text-gray-600 dark:text-gray-400 sm:text-xs"><span class="rounded bg-gray-200 px-2 py-0.5 text-gray-700 dark:bg-gray-600 dark:text-gray-200"></span><span class="rounded bg-gray-200 px-2 py-0.5 text-gray-700 dark:bg-gray-600 dark:text-gray-200"></span><span class="rounded bg-gray-200 px-2 py-0.5 text-gray-700 dark:bg-gray-600 dark:text-gray-200">ID: </span></div><p class="mt-2 break-all text-[11px] font-mono text-gray-500 dark:text-gray-400 sm:text-xs"></p><div class="mt-3 flex flex-wrap gap-2 border-t border-gray-100 pt-2 dark:border-gray-700 sm:justify-end w-full"><button class="rounded border border-gray-300 px-3 py-1 text-xs text-gray-700 transition-colors hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 disabled:opacity-50"></button><button class="rounded border border-blue-300 px-3 py-1 text-xs text-blue-600 transition-colors hover:bg-blue-50 dark:border-blue-500 dark:text-blue-300 dark:hover:bg-blue-900/20">Edit</button><button class="rounded border border-red-300 px-3 py-1 text-xs text-red-600 transition-colors hover:bg-red-50 dark:border-red-500 dark:text-red-300 dark:hover:bg-red-900/20">Delete'),ey=i('<button type=button><div class="font-medium text-xs text-gray-800 dark:text-gray-200"></div><div class="text-[11px] text-gray-600 dark:text-gray-400 mt-1">'),ty=i('<span class="text-[11px] text-gray-500 dark:text-gray-400">'),ry=i('<button type=button class="px-2 py-1 text-xs text-red-600 hover:underline dark:text-red-400">Remove'),ny=i('<div class="flex gap-2 text-xs"><div class="flex flex-1 flex-col gap-1"><input type=text placeholder="Field name"></div><input type=text>'),sy=i('<div class="flex gap-2 text-xs"><input type=text placeholder="Header name"><input type=text placeholder="Header value"><button type=button class="px-2 py-1 text-xs text-red-600 hover:underline dark:text-red-400">Remove');const hl={pushover:[{key:"app_token",label:"Application Token",placeholder:"Your Pushover application token",required:!0},{key:"user_token",label:"User Key",placeholder:"Primary user key or group key",required:!0}]},ea=e=>{const r={};return e.forEach(({key:s,value:l})=>{s&&(r[s]=l)}),r},mi=(e,r={})=>{const s=hl[e],l=Date.now();if(!s)return Object.entries(r).map(([a,d],c)=>({id:`custom-${a}-${l}-${c}`,key:a,value:d}));const o=s.map((a,d)=>({id:`custom-${a.key}-${l}-${d}`,key:a.key,value:r[a.key]??"",label:a.label,placeholder:a.placeholder,required:a.required}));return Object.entries(r).filter(([a])=>!s.some(d=>d.key===a)).forEach(([a,d],c)=>{o.push({id:`custom-${a}-${l}-${s.length+c}`,key:a,value:d})}),o};function ay(e){const[r,s]=Z(!1),[l,o]=Z(null),[a,d]=Z({name:"",url:"",method:"POST",service:"generic",headers:{"Content-Type":"application/json"},enabled:!0,payloadTemplate:"",customFields:{}}),[c,g]=Z([]),[b,p]=Z(!1),[m,S]=Z([]),[z,ie]=Z([]),ne=_=>{ie(_),d(B=>({...B,customFields:ea(_)}))},W=_=>{ie(B=>{const $=_(B);return d(D=>({...D,customFields:ea($)})),$})},X=_=>{if(!hl[_])return;const B=a().customFields||{},$=mi(_,B);ne($)};ft(async()=>{try{const _=await fn.getWebhookTemplates();g(_)}catch(_){console.error("Failed to load webhook templates:",_)}});const I=()=>{const _=a();if(!_.name||!_.url)return;const B={};m().forEach(D=>{D.key&&(B[D.key]=D.value)});const $=ea(z());if(l())e.onUpdate({..._,id:l(),headers:B,service:_.service,template:_.payloadTemplate,customFields:$}),o(null),s(!1),S([]),ne([]);else{const D={name:_.name,url:_.url,method:_.method,headers:B,enabled:_.enabled,service:_.service,template:_.payloadTemplate,customFields:$};e.onAdd(D),d({name:"",url:"",method:"POST",service:"generic",headers:{"Content-Type":"application/json"},enabled:!0,payloadTemplate:"",customFields:{}}),S([]),ne([]),s(!1)}},L=()=>{s(!1),o(null),d({name:"",url:"",method:"POST",service:"generic",headers:{"Content-Type":"application/json"},enabled:!0,payloadTemplate:"",customFields:{}}),S([]),ne([])},H=_=>{_.id&&o(_.id),d({..._,service:_.service||"generic",payloadTemplate:_.template||"",customFields:_.customFields||{}});const B=_.headers||{};S(Object.entries(B).map(([f,j],K)=>({id:`header-${Date.now()}-${K}`,key:f,value:j})));const $=_.service||"generic",D=_.customFields||{};hl[$]||Object.keys(D).length>0?ne(mi($,D)):ne([]),s(!0)},se=_=>{const B=c().find($=>$.service===_);if(B){d({...a(),service:B.service,method:B.method,headers:{...B.headers},name:a().name||B.name,payloadTemplate:_==="generic"?a().payloadTemplate:""});const $=B.headers||{};S(Object.entries($).map(([D,f],j)=>({id:`header-${Date.now()}-${j}`,key:D,value:f})))}else d({...a(),service:_});X(_),p(!1)},le=()=>c().find(_=>_.service===a().service),ee=_=>({generic:"Generic",discord:"Discord",slack:"Slack",telegram:"Telegram",teams:"Microsoft Teams","teams-adaptive":"Teams (Adaptive)",pagerduty:"PagerDuty",pushover:"Pushover",gotify:"Gotify",ntfy:"ntfy"})[_]||_,U=_=>{e.webhooks.forEach(B=>{e.onUpdate({...B,enabled:_})})},Y=()=>e.webhooks.every(_=>_.enabled),oe=()=>e.webhooks.some(_=>_.enabled);return(()=>{var _=Xp();return t(_,n(h,{get when(){return e.webhooks.length>0},get children(){var B=Gp(),$=B.firstChild,D=$.firstChild,f=D.firstChild,j=f.nextSibling;j.nextSibling;var K=D.nextSibling,C=K.firstChild,ge=C.nextSibling;return t(D,()=>e.webhooks.filter(J=>J.enabled).length,f),t(D,()=>e.webhooks.length,j),C.$$click=()=>U(!1),ge.$$click=()=>U(!0),t(B,n(ze,{get each(){return e.webhooks},children:J=>(()=>{var N=Zp(),F=N.firstChild,P=F.firstChild,E=P.nextSibling,u=F.nextSibling,v=u.firstChild,V=v.nextSibling,A=V.nextSibling;A.firstChild;var k=u.nextSibling,w=k.nextSibling,de=w.firstChild,fe=de.nextSibling,x=fe.nextSibling;return t(P,()=>J.name),E.$$click=()=>e.onUpdate({...J,enabled:!J.enabled}),t(E,()=>J.enabled?"Enabled":"Disabled"),t(v,()=>ee(J.service||"generic")),t(V,()=>J.method),t(A,()=>J.id||"—",null),t(k,()=>J.url),de.$$click=()=>J.id&&e.onTest(J.id),t(de,()=>e.testing===J.id?"Testing…":"Test"),fe.$$click=()=>H(J),x.$$click=()=>J.id&&e.onDelete(J.id),q(R=>{var Q=`rounded border px-3 py-1 text-xs font-medium transition-colors ${J.enabled?"border-green-500 text-green-700 hover:bg-green-50 dark:border-green-600 dark:text-green-400 dark:hover:bg-green-900/20":"border-gray-300 text-gray-600 hover:bg-gray-100 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-700"}`,G=e.testing===J.id||!J.enabled;return Q!==R.e&&y(E,R.e=Q),G!==R.t&&(de.disabled=R.t=G),R},{e:void 0,t:void 0}),N})()}),null),q(J=>{var N=!oe(),F=Y();return N!==J.e&&(C.disabled=J.e=N),F!==J.t&&(ge.disabled=J.t=F),J},{e:void 0,t:void 0}),B}}),null),t(_,n(h,{get when(){return r()},get children(){var B=Qp(),$=B.firstChild,D=$.firstChild,f=D.firstChild,j=f.nextSibling,K=j.firstChild,C=$.nextSibling,ge=C.firstChild,J=ge.firstChild,N=J.nextSibling,F=ge.nextSibling,P=F.firstChild,E=P.nextSibling,u=C.nextSibling,v=u.firstChild,V=v.nextSibling,A=V.nextSibling,k=u.nextSibling,w=k.firstChild,de=w.nextSibling,fe=de.firstChild,x=k.nextSibling,R=x.firstChild,Q=R.firstChild,G=x.nextSibling,T=G.firstChild,te=T.nextSibling,ae=te.firstChild;return j.$$click=()=>p(!b()),t(j,()=>ee(a().service),K),t($,n(h,{get when(){return b()},get children(){var M=zp();return t(M,n(ze,{each:["generic","discord","slack","telegram","teams","teams-adaptive","pagerduty","pushover","gotify","ntfy"],children:ce=>(()=>{var ue=ey(),re=ue.firstChild,O=re.nextSibling;return ue.$$click=()=>se(ce),t(re,()=>ee(ce)),t(O,ce==="generic"?"Custom webhook endpoint":ce==="discord"?"Discord server webhook":ce==="slack"?"Slack incoming webhook":ce==="telegram"?"Telegram bot notifications":ce==="teams"?"Microsoft Teams webhook":ce==="teams-adaptive"?"Teams with Adaptive Cards":ce==="pushover"?"Mobile push notifications":ce==="gotify"?"Self-hosted push notifications":ce==="ntfy"?"Push notifications via ntfy.sh":"PagerDuty Events API v2"),q(()=>y(ue,`px-2 py-1.5 text-left border transition-colors text-xs ${a().service===ce?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700/30"}`)),ue})()})),M}}),null),t($,n(h,{get when(){return le()?.instructions},get children(){var M=Wp();return M.firstChild,t(M,()=>le().instructions,null),M}}),null),y(ge,Ht),N.$$input=M=>d({...a(),name:M.currentTarget.value}),y(F,Ht),E.addEventListener("change",M=>d({...a(),method:M.currentTarget.value})),y(u,Ht),V.$$input=M=>d({...a(),url:M.currentTarget.value}),y(A,hr+" mt-1"),t(B,n(h,{get when(){return a().service==="generic"},get children(){var M=qp(),ce=M.firstChild,ue=ce.nextSibling,re=ue.nextSibling;return y(M,Ht),ue.$$input=O=>d({...a(),payloadTemplate:O.currentTarget.value}),y(re,hr+" mt-1"),q(O=>{var xe=yt("flex items-center gap-2"),he=Dt("px-2 py-1.5 text-xs font-mono min-h-[160px]");return xe!==O.e&&y(ce,O.e=xe),he!==O.t&&y(ue,O.t=he),O},{e:void 0,t:void 0}),q(()=>ue.value=a().payloadTemplate||""),M}}),k),t(B,n(h,{get when(){return z().length>0||a().service==="pushover"},get children(){var M=Kp(),ce=M.firstChild,ue=ce.nextSibling,re=ue.firstChild;return y(M,Ht),t(ue,n(Nl,{get each(){return z()},children:(O,xe)=>(()=>{var he=ny(),me=he.firstChild,_e=me.firstChild,Ce=me.nextSibling;return t(me,n(h,{get when(){return O().label},get children(){var Oe=ty();return t(Oe,()=>O().label),Oe}}),_e),_e.$$input=Oe=>{const tt=Oe.currentTarget.value;W(Ze=>{const bt=[...Ze];return bt[xe]={...bt[xe],key:tt},bt})},Ce.$$input=Oe=>{const tt=Oe.currentTarget.value;W(Ze=>{const bt=[...Ze];return bt[xe]={...bt[xe],value:tt},bt})},t(he,n(h,{get when(){return!O().required},get children(){var Oe=ry();return Oe.$$click=()=>{W(tt=>tt.filter((Ze,bt)=>bt!==xe))},Oe}}),null),q(Oe=>{var tt=O().required,Ze=Dt("flex-1 px-2 py-1.5 text-xs font-mono"),bt=O().placeholder||"Value",ct=Dt("flex-1 px-2 py-1.5 text-xs font-mono");return tt!==Oe.e&&(_e.disabled=Oe.e=tt),Ze!==Oe.t&&y(_e,Oe.t=Ze),bt!==Oe.a&&Te(Ce,"placeholder",Oe.a=bt),ct!==Oe.o&&y(Ce,Oe.o=ct),Oe},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>_e.value=O().key),q(()=>Ce.value=O().value),he})()}),re),re.$$click=()=>{const O=`custom-${Date.now()}-${Math.random()}`;W(xe=>[...xe,{id:O,key:"",value:""}])},q(()=>y(ce,yt("flex items-center gap-2"))),M}}),k),y(k,Ht),t(de,n(Nl,{get each(){return m()},children:(M,ce)=>(()=>{var ue=sy(),re=ue.firstChild,O=re.nextSibling,xe=O.nextSibling;return re.$$input=he=>{const me=he.currentTarget.value;S(_e=>{const Ce=[..._e];return Ce[ce]={...Ce[ce],key:me},Ce})},O.$$input=he=>{const me=he.currentTarget.value;S(_e=>{const Ce=[..._e];return Ce[ce]={...Ce[ce],value:me},Ce})},xe.$$click=()=>{S(he=>he.filter((me,_e)=>_e!==ce))},q(he=>{var me=Dt("flex-1 px-2 py-1.5 text-xs font-mono"),_e=Dt("flex-1 px-2 py-1.5 text-xs font-mono");return me!==he.e&&y(re,he.e=me),_e!==he.t&&y(O,he.t=_e),he},{e:void 0,t:void 0}),q(()=>re.value=M().key),q(()=>O.value=M().value),ue})()}),fe),fe.$$click=()=>{const M=`header-${Date.now()}-${Math.random()}`;S([...m(),{id:M,key:"",value:""}])},Q.addEventListener("change",M=>d({...a(),enabled:M.currentTarget.checked})),y(Q,Pn),T.$$click=L,t(G,n(h,{get when(){return $e(()=>!!a().url)()&&a().name},get children(){var M=Jp();return M.$$click=()=>{const ce={};m().forEach(me=>{me.key&&(ce[me.key]=me.value)});const ue=ea(z()),{payloadTemplate:re,...O}=a(),xe={...O,headers:ce,customFields:ue,template:re??O.template??""},he=l()||"temp-new-webhook";e.onTest(he,xe)},t(M,()=>e.testing===(l()||"temp-new-webhook")?"Testing...":"Test"),q(()=>M.disabled=e.testing===(l()||"temp-new-webhook")),M}}),te),te.$$click=I,t(te,()=>l()?"Update":"Add",ae),q(M=>{var ce=yt(),ue=le()?.name||"My Webhook",re=Dt("px-2 py-1.5"),O=yt(),xe=Dt("px-2 py-1.5 pr-8 appearance-none"),he=yt(),me=le()?.urlPattern||"https://example.com/webhook",_e=Dt("px-2 py-1.5 font-mono"),Ce=yt("flex items-center gap-2"),Oe=!a().name||!a().url;return ce!==M.e&&y(J,M.e=ce),ue!==M.t&&Te(N,"placeholder",M.t=ue),re!==M.a&&y(N,M.a=re),O!==M.o&&y(P,M.o=O),xe!==M.i&&y(E,M.i=xe),he!==M.n&&y(v,M.n=he),me!==M.s&&Te(V,"placeholder",M.s=me),_e!==M.h&&y(V,M.h=_e),Ce!==M.r&&y(w,M.r=Ce),Oe!==M.d&&(te.disabled=M.d=Oe),M},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),q(()=>N.value=a().name),q(()=>E.value=a().method),q(()=>V.value=a().url),q(()=>Q.checked=a().enabled),B}}),null),t(_,n(h,{get when(){return!r()},get children(){var B=Yp();return B.$$click=()=>{s(!0),S([{id:`header-${Date.now()}-0`,key:"Content-Type",value:"application/json"}]),ne([])},B}}),null),_})()}Xt(["click","input"]);var ly=i("<button type=button>");function xi(e){const{isEnabled:r,disabled:s=!1,size:l="sm",onToggle:o,labelEnabled:a="Enabled",labelDisabled:d="Disabled",titleEnabled:c,titleDisabled:g,titleWhenDisabled:b}=e,m=`inline-flex items-center justify-center ${l==="md"?"px-2.5 py-1":"px-2 py-0.5"} text-xs font-medium rounded-md transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-blue-400`,S=r?"bg-blue-50 text-blue-700 hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-300 dark:hover:bg-blue-500/30":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600",z=s?"opacity-60 cursor-not-allowed hover:bg-transparent dark:hover:bg-transparent":"",ie=s?b??g??c??"":r?c??"":g??"";return(()=>{var ne=ly();return ne.$$click=()=>{s||o?.()},ne.disabled=s,Te(ne,"aria-pressed",r),Te(ne,"title",ie),t(ne,r?a:d),q(()=>y(ne,`${m} ${S} ${z}`.trim())),ne})()}Xt(["click"]);var iy=i('<span class="text-xs font-medium text-gray-600 dark:text-gray-400">'),Ja=i('<span class="rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300">'),Qa=i('<div class="flex flex-wrap items-center gap-3">'),oy=i('<span class="text-sm font-medium text-gray-900 dark:text-gray-100">'),dy=i('<a target=_blank rel="noopener noreferrer"class="text-sm font-medium text-gray-900 dark:text-gray-100 transition-colors duration-150 hover:text-sky-600 dark:hover:text-sky-400">'),cy=i('<div class="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"title="Active alert">'),uy=i("<div><span>"),gy=i("<button type=button>"),hy=i('<div class="px-4 py-3 border-b border-gray-200 dark:border-gray-700">'),fy=i('<th class="px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider"title="Toggle default behavior for powered-off or connectivity alerts for this resource type.">Offline Alerts'),Ya=i('<div class="flex items-center justify-center">'),Cs=i('<span class="text-xs px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded">Custom'),Ss=i('<td class="p-1 px-2 text-center align-middle">'),my=i('<button type=button class="p-1 text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 transition-colors"><svg fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 9l-7 7-7-7">'),xy=i('<button type=button class="p-1 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 transition-colors"title="Reset to factory defaults"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16">'),ta=i('<span class="text-sm text-gray-400">-'),by=i('<tr><td class="p-1 px-2 text-center align-middle"></td><td class="p-1 px-2"><div class="flex items-center gap-2"><span class="text-sm font-semibold text-gray-700 dark:text-gray-300">Global Defaults</span></div></td><td class="p-1 px-2 text-center align-middle"><div class="flex items-center justify-center gap-1">'),py=i('<td class="p-1 px-2 text-center align-middle"><span class="text-sm text-gray-400">-'),yy=i('<tr><td class="p-1 px-2 text-center align-middle"><span class="text-sm text-gray-400">-</span></td><td class="p-1 px-2 align-middle"><span class="text-xs font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Alert Delay (s)</span></td><td class="p-1 px-2 text-center align-middle"><span class="text-sm text-gray-400">-'),vy=i('<tr><td class="px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400">No <!> found'),ky=i('<tr><td class="px-4 py-6 text-sm text-center text-gray-500 dark:text-gray-400">'),wy=i('<div class=overflow-x-auto><table class=w-full><thead><tr class="bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700"><th class="px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider w-16">Alerts</th><th class="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Resource</th><th class="px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Actions</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),$y=i('<th class="px-3 py-2 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">'),_y=i('<button type=button class="absolute inset-0 w-full rounded cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400"title="Click to enable this metric"><span class=sr-only>Enable <!> default'),Cy=i('<td class="p-1 px-2 text-center align-middle"><div class="relative flex justify-center w-full"><input type=number>'),Sy=i('<td class="p-1 px-2 text-center align-middle"><div class="relative flex justify-center w-full"><input type=number min=0 class="w-16 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-2 py-0.5 text-sm text-center text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500">'),Ty=i('<tr class="bg-gray-50 dark:bg-gray-700/50"><td class="p-1 px-2 text-xs font-medium text-gray-600 dark:text-gray-400">'),bi=i('<button type=button class="p-1 text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"title="Edit thresholds"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z">'),pi=i('<button type=button class="p-1 text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"title="Remove override"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16">'),yi=i('<tr><td class="p-1 px-2 text-center align-middle"></td><td class="p-1 px-2"></td><td class="p-1 px-2"><div class="flex items-center justify-center gap-1">'),vi=i('<div class="flex items-center gap-2"><span>'),ki=i("<span>"),wi=i('<a target=_blank rel="noopener noreferrer">'),Ay=i('<div class="flex items-center justify-center"><input type=number title="Set to -1 to disable alerts for this metric">'),$i=i('<span class="text-sm text-gray-400 dark:text-gray-500">-'),_i=i('<div class="cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 rounded px-1 py-0.5 transition-colors"title="Click to edit this metric">'),Ci=i('<button type=button class="p-1 text-gray-600 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"title="Cancel editing"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Dy=i('<div class="flex items-center justify-center"><input type=number min=-1 title="Set to -1 to disable alerts for this metric">');const Si={"cpu %":"Percent CPU utilization allowed before an alert fires.","memory %":"Percent memory usage threshold for triggering alerts.","disk %":"Percent disk usage threshold for this resource.","disk r mb/s":"Maximum sustained disk read throughput before alerting.","disk w mb/s":"Maximum sustained disk write throughput before alerting.","net in mb/s":"Inbound network throughput threshold for alerts.","net out mb/s":"Outbound network throughput threshold for alerts.","usage %":"Storage capacity usage percentage that triggers an alert.","temp °c":"CPU temperature limit for node alerts.","temperature °c":"CPU temperature limit for node alerts.",temperature:"CPU temperature limit for node alerts.","restart count":"Maximum container restarts within the evaluation window.","restart window":"Time window used to evaluate the restart count threshold.","restart window (s)":"Time window used to evaluate the restart count threshold.","memory warn %":"Warning threshold for container memory usage.","memory critical %":"Critical threshold for container memory usage.","queue warn":"Early warning when total mail queue exceeds this message count.","queue crit":"Critical alert requiring urgent action when queue reaches this size.","deferred warn":"Early warning for messages stuck in deferred queue (waiting to retry delivery).","deferred crit":"Critical threshold for deferred messages indicating serious delivery problems.","hold warn":"Early warning when administratively held messages exceed this count.","hold crit":"Critical alert for held messages requiring immediate moderation attention.","oldest warn (min)":"Early warning when oldest queued message exceeds this age in minutes.","oldest crit (min)":"Critical alert when message queue age indicates delivery has stalled.","spam warn":"Early warning for spam messages accumulating in quarantine.","spam crit":"Critical spam quarantine level requiring urgent intervention.","virus warn":"Early warning for virus-positive messages in quarantine.","virus crit":"Critical virus quarantine threshold indicating potential outbreak.","growth warn %":"Early warning when quarantine growth rate exceeds this percentage.","growth warn min":"Minimum new messages required before growth percentage triggers warning.","growth crit %":"Critical quarantine growth rate requiring immediate investigation.","growth crit min":"Minimum new messages required before growth percentage triggers critical alert."};function Jn(e){const r=()=>e.groupedResources?Object.values(e.groupedResources).flat():e.resources??[],s=()=>r().length>0,[l,o]=Z(null),[a,d]=Z(!1);ft(()=>{console.log("[ResourceTable] createEffect triggered - props changed:",{title:e.title,globalDefaults:e.globalDefaults,factoryDefaults:e.factoryDefaults,onResetDefaults:!!e.onResetDefaults})});const c=()=>{if(console.log("[ResourceTable] hasCustomGlobalDefaults check:",{globalDefaults:e.globalDefaults,factoryDefaults:e.factoryDefaults,title:e.title}),!e.globalDefaults||!e.factoryDefaults)return console.log("[ResourceTable] Missing props, returning false"),!1;const ee=Object.keys(e.factoryDefaults).some(U=>{const Y=e.globalDefaults?.[U],oe=e.factoryDefaults?.[U],_=Y!==void 0&&Y!==oe;return _&&console.log(`[ResourceTable] Difference found: ${U} current=${Y} factory=${oe}`),_});return console.log(`[ResourceTable] hasCustomGlobalDefaults result: ${ee}`),ee},g=ee=>{const U=ee.trim().toLowerCase(),Y=new Map([["cpu %","cpu"],["memory %","memory"],["disk %","disk"],["disk r mb/s","diskRead"],["disk w mb/s","diskWrite"],["net in mb/s","networkIn"],["net out mb/s","networkOut"],["usage %","usage"],["temp °c","temperature"],["temperature °c","temperature"],["temperature","temperature"],["restart count","restartCount"],["restart window","restartWindow"],["restart window (s)","restartWindow"],["memory warn %","memoryWarnPct"],["memory critical %","memoryCriticalPct"]]).get(U);return Y||U.replace(" %","").replace(" °c","").replace(" mb/s","").replace("disk r","diskRead").replace("disk w","diskWrite").replace("net in","networkIn").replace("net out","networkOut")},b=ee=>ee==="temperature"?{min:-1,max:150}:["diskRead","diskWrite","networkIn","networkOut"].includes(ee)?{min:-1,max:1e4}:["cpu","memory","disk","usage","memoryWarnPct","memoryCriticalPct"].includes(ee)?{min:-1,max:100}:ee==="restartCount"?{min:-1,max:50}:ee==="restartWindow"?{min:-1,max:86400}:{min:-1,max:1e4},p=ee=>["diskRead","diskWrite","networkIn","networkOut"].includes(ee)?"any":1,m=ee=>["diskRead","diskWrite","networkIn","networkOut"].includes(ee)?100:ee==="temperature"?80:ee==="restartCount"?3:ee==="restartWindow"?300:ee==="memoryWarnPct"?90:ee==="memoryCriticalPct"?95:80,S=ee=>{const U=ee.trim().toLowerCase(),Y=e.metricDelaySeconds?.[U]??e.metricDelaySeconds?.[ee];if(!(typeof Y!="number"||!Number.isFinite(Y)))return Y},z=()=>e.columns.length+3+(e.showOfflineAlertsColumn?1:0),ie=ee=>{const U=ee.trim().toLowerCase();return Si[ee]??Si[U]},ne=(ee,U)=>ee?ee==="node"&&["diskRead","diskWrite","networkIn","networkOut"].includes(U)?!1:ee==="pbs"?["cpu","memory"].includes(U):ee==="storage"?U==="usage":ee==="dockerContainer"?["cpu","memory","restartCount","restartWindow","memoryWarnPct","memoryCriticalPct"].includes(U):!0:!0,W=(ee,U)=>!U||U.type!=="node"?(()=>{var Y=iy();return t(Y,ee),Y})():(()=>{var Y=Qa();return t(Y,n(h,{get when(){return U.host},get fallback(){return(()=>{var oe=oy();return t(oe,()=>U.displayName||ee),oe})()},children:oe=>(()=>{var _=dy();return _.$$click=B=>B.stopPropagation(),t(_,()=>U.displayName||ee),q(B=>{var $=oe(),D=`Open ${U.displayName||ee} web interface`;return $!==B.e&&Te(_,"href",B.e=$),D!==B.t&&Te(_,"title",B.t=D),B},{e:void 0,t:void 0}),_})()}),null),t(Y,n(h,{get when(){return U.clusterName},get children(){var oe=Ja();return t(oe,()=>U.clusterName),oe}}),null),Y})(),X=ee=>{const U=ee.value<=0,Y=U?"Off":e.formatMetricValue(ee.metric,ee.value);return(()=>{var oe=uy(),_=oe.firstChild;return Te(oe,"title",U?"Disabled (no alerts for this metric)":""),t(_,Y),t(oe,n(h,{get when(){return e.hasActiveAlert(ee.resourceId,ee.metric)},get children(){return cy()}}),null),q(B=>{var $=`flex items-center justify-center gap-1 ${U?"opacity-60":""}`.trim(),D=`text-sm ${U?"text-gray-400 dark:text-gray-500 italic":ee.isOverridden?"text-gray-900 dark:text-gray-100 font-bold":"text-gray-900 dark:text-gray-100"}`;return $!==B.e&&y(oe,B.e=$),D!==B.t&&y(_,B.t=D),B},{e:void 0,t:void 0}),oe})()},I=ee=>n(xi,ee),L=["off","warning","critical"],H={off:{label:"Off",className:"bg-gray-200 text-gray-600 hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600",title:"Offline alerts disabled for this resource."},warning:{label:"Warn",className:"bg-blue-50 text-blue-700 hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-200 dark:hover:bg-blue-500/30",title:"Offline alerts will raise warning-level notifications."},critical:{label:"Crit",className:"bg-red-50 text-red-700 hover:bg-red-100 dark:bg-red-500/20 dark:text-red-200 dark:hover:bg-red-500/30",title:"Offline alerts will raise critical-level notifications."}},se=ee=>{const U=L.indexOf(ee);return L[(U+1)%L.length]},le=(ee,U,Y)=>{const oe=H[ee];return(()=>{var _=gy();return _.$$click=()=>{U||Y()},_.disabled=U,t(_,()=>oe.label),q(B=>{var $=`inline-flex items-center justify-center px-2 py-0.5 text-xs font-medium rounded transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-1 ${oe.className} ${U?"opacity-60 cursor-not-allowed pointer-events-none":""}`.trim(),D=oe.title;return $!==B.e&&y(_,B.e=$),D!==B.t&&Te(_,"title",B.t=D),B},{e:void 0,t:void 0}),_})()};return n(it,{padding:"none",class:"overflow-hidden border border-gray-200 dark:border-gray-700",border:!1,get children(){return[(()=>{var ee=hy();return t(ee,n(rr,{get title(){return e.title},size:"sm"})),ee})(),(()=>{var ee=wy(),U=ee.firstChild,Y=U.firstChild,oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=B.nextSibling,D=Y.nextSibling;return t(oe,n(ze,{get each(){return e.columns},children:f=>(()=>{var j=$y();return t(j,f),q(()=>Te(j,"title",ie(f))),j})()}),$),t(oe,n(h,{get when(){return e.showOfflineAlertsColumn},get children(){return fy()}}),$),t(D,n(h,{get when(){return e.globalDefaults&&e.setGlobalDefaults&&e.setHasUnsavedChanges},get children(){var f=by(),j=f.firstChild,K=j.nextSibling,C=K.firstChild;C.firstChild;var ge=K.nextSibling,J=ge.firstChild;return t(j,n(h,{get when(){return e.onToggleGlobalDisable},get fallback(){return ta()},get children(){var N=Ya();return t(N,n(sa,{size:"sm",get checked(){return!e.globalDisableFlag?.()},onToggle:()=>{e.onToggleGlobalDisable?.(),e.setHasUnsavedChanges?.(!0)},class:"my-[1px]",title:"Global alerts toggle - disable all alerts for this resource type",ariaLabel:"Global alerts toggle"})),N}})),t(C,n(h,{get when(){return c()},get children(){return Cs()}}),null),t(f,n(ze,{get each(){return e.columns},children:N=>{const F=g(N),P=b(F),E=()=>e.globalDefaults?.[F]??0,u=()=>E()===-1;return(()=>{var v=Cy(),V=v.firstChild,A=V.firstChild;return A.$$input=k=>{const w=parseFloat(k.currentTarget.value);e.setGlobalDefaults&&e.setGlobalDefaults(de=>({...de,[F]:Number.isNaN(w)?0:w})),e.setHasUnsavedChanges&&e.setHasUnsavedChanges(!0)},t(V,n(h,{get when(){return u()},get children(){var k=_y(),w=k.firstChild,de=w.firstChild,fe=de.nextSibling;return fe.nextSibling,k.$$click=()=>{e.setGlobalDefaults&&(e.setGlobalDefaults(x=>({...x,[F]:m(F)})),e.setHasUnsavedChanges?.(!0))},t(w,N,fe),k}}),null),q(k=>{var w=P.min,de=P.max,fe=p(F),x=u()?"Off":"",R=u(),Q=`w-16 px-2 py-0.5 text-sm text-center border rounded ${u()?"border-gray-300 dark:border-gray-600 bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-500 italic placeholder:text-gray-400 dark:placeholder:text-gray-500 placeholder:opacity-60 pointer-events-none":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}`,G=u()?"Click to enable this metric":"Set to -1 to disable alerts for this metric";return w!==k.e&&Te(A,"min",k.e=w),de!==k.t&&Te(A,"max",k.t=de),fe!==k.a&&Te(A,"step",k.a=fe),x!==k.o&&Te(A,"placeholder",k.o=x),R!==k.i&&(A.disabled=k.i=R),Q!==k.n&&y(A,k.n=Q),G!==k.s&&Te(A,"title",k.s=G),k},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),q(()=>A.value=u()?"":E()),v})()}}),ge),t(f,n(h,{get when(){return e.showOfflineAlertsColumn},get children(){var N=Ss();return t(N,n(h,{get when(){return e.onSetGlobalOfflineState},get fallback(){return n(h,{get when(){return e.onToggleGlobalDisableOffline},get fallback(){return ta()},get children(){return(()=>{const F=e.globalDisableOfflineFlag?.()??!1;return I({isEnabled:!F,size:"md",onToggle:()=>{e.onToggleGlobalDisableOffline?.(),e.setHasUnsavedChanges?.(!0)},labelEnabled:"On",labelDisabled:"Off",titleEnabled:"Offline alerts currently enabled by default. Click to disable.",titleDisabled:"Offline alerts currently disabled by default. Click to enable."})})()}})},get children(){return(()=>{const F=e.globalDisableFlag?.()??!1,P=e.globalDisableOfflineFlag?.()??!1,E=e.globalOfflineSeverity??"warning",u=P?"off":E==="critical"?"critical":"warning";return le(u,F,()=>{if(F)return;const v=se(u);e.onSetGlobalOfflineState?.(v)})})()}})),N}}),ge),t(J,n(h,{get when(){return e.showDelayColumn&&typeof e.onMetricDelayChange=="function"},get children(){var N=my(),F=N.firstChild;return N.$$click=()=>d(!a()),q(P=>{var E=a()?"Hide alert delay settings":"Show alert delay settings",u=`w-4 h-4 transition-transform ${a()?"rotate-180":""}`;return E!==P.e&&Te(N,"title",P.e=E),u!==P.t&&Te(F,"class",P.t=u),P},{e:void 0,t:void 0}),N}}),null),t(J,n(h,{get when(){return c()&&e.onResetDefaults},get children(){var N=xy();return N.$$click=()=>e.onResetDefaults?.(),N}}),null),t(J,n(h,{get when(){return $e(()=>!e.showDelayColumn)()&&!c()},get children(){return ta()}}),null),q(()=>y(f,`bg-gray-50 dark:bg-gray-800/50 border-b border-gray-300 dark:border-gray-600 ${e.globalDisableFlag?.()?"opacity-40":""}`)),f}}),null),t(D,n(h,{get when(){return a()&&e.showDelayColumn&&typeof e.onMetricDelayChange=="function"},get children(){var f=yy(),j=f.firstChild,K=j.nextSibling,C=K.nextSibling;return t(f,n(ze,{get each(){return e.columns},children:ge=>{const J=g(ge),N=e.globalDelaySeconds??5,F=S(J);return(()=>{var P=Sy(),E=P.firstChild,u=E.firstChild;return u.$$input=v=>{const V=v.currentTarget.value;if(V==="")e.onMetricDelayChange?.(J,null),e.setHasUnsavedChanges?.(!0);else{const A=parseInt(V,10);if(Number.isNaN(A))return;const k=Math.max(0,A);k===N?e.onMetricDelayChange?.(J,null):e.onMetricDelayChange?.(J,k),e.setHasUnsavedChanges?.(!0)}},q(()=>Te(u,"placeholder",String(N))),q(()=>u.value=F!==void 0?F:""),P})()}}),C),t(f,n(h,{get when(){return e.showOfflineAlertsColumn},get children(){return py()}}),C),q(()=>y(f,`bg-gray-50 dark:bg-gray-800/50 border-b border-gray-300 dark:border-gray-600 ${e.globalDisableFlag?.()?"opacity-40":""}`)),f}}),null),t(D,n(h,{get when(){return e.groupedResources},get children(){return n(ze,{get each(){return Object.entries(e.groupedResources||{}).sort(([f],[j])=>f.localeCompare(j))},children:([f,j])=>{const K=e.groupHeaderMeta?.[f];return[(()=>{var C=Ty(),ge=C.firstChild;return t(ge,()=>W(f,K)),q(()=>Te(ge,"colspan",z())),C})(),n(ze,{each:j,children:C=>{const ge=()=>e.editingId()===C.id,J=()=>ge()?e.editingThresholds():C.thresholds??{},N=P=>{const E=k=>{if(k==null)return;if(typeof k=="number")return k;const w=Number(k);return Number.isFinite(w)?w:void 0},u=k=>E(k?.[P]),v=C.defaults;if(ge()){const k=u(J());if(k!==void 0)return k;const w=u(v);return w!==void 0?w:0}const V=u(C.thresholds);if(V!==void 0)return V;const A=u(v);return A!==void 0?A:0},F=P=>C.thresholds?.[P]!==void 0&&C.thresholds?.[P]!==null;return(()=>{var P=yi(),E=P.firstChild,u=E.nextSibling,v=u.nextSibling,V=v.firstChild;return t(E,n(h,{get when(){return e.onToggleDisabled},get children(){return(()=>{const A=e.globalDisableFlag?.()??!1,k=!A&&!C.disabled;return(()=>{var w=Ya();return t(w,n(sa,{size:"sm",checked:k,disabled:A,onToggle:()=>!A&&e.onToggleDisabled?.(C.id),class:"my-[1px]",get title(){return A?"Alerts disabled globally":C.disabled?"Click to enable alerts":"Click to disable alerts"},ariaLabel:k?"Alerts enabled for this resource":"Alerts disabled for this resource"})),w})()})()}})),t(u,n(h,{get when(){return C.type==="node"},get fallback(){return(()=>{var A=vi(),k=A.firstChild;return t(k,()=>C.name),t(A,n(h,{get when(){return C.hasOverride||C.disableConnectivity},get children(){return Cs()}}),null),q(()=>y(k,`text-sm font-medium ${C.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100"}`)),A})()},get children(){var A=Qa();return t(A,n(h,{get when(){return C.host},get fallback(){return(()=>{var k=ki();return t(k,()=>C.type==="node"?C.name:C.displayName||C.name),q(()=>y(k,`text-sm font-medium ${C.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100"}`)),k})()},children:k=>(()=>{var w=wi();return w.$$click=de=>de.stopPropagation(),t(w,()=>C.type==="node"?C.name:C.displayName||C.name),q(de=>{var fe=k(),x=`text-sm font-medium transition-colors duration-150 ${C.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100 hover:text-sky-600 dark:hover:text-sky-400"}`,R=`Open ${C.displayName||C.name} web interface`;return fe!==de.e&&Te(w,"href",de.e=fe),x!==de.t&&y(w,de.t=x),R!==de.a&&Te(w,"title",de.a=R),de},{e:void 0,t:void 0,a:void 0}),w})()}),null),t(A,n(h,{get when(){return C.clusterName},get children(){var k=Ja();return t(k,()=>C.clusterName),k}}),null),t(A,n(h,{get when(){return C.hasOverride||C.disableConnectivity},get children(){return Cs()}}),null),q(()=>Te(A,"title",C.status||void 0)),A}})),t(P,n(ze,{get each(){return e.columns},children:A=>{const k=g(A),w=()=>ne(C.type,k),de=b(k),fe=()=>J()?.[k]===-1,x=R=>{R.stopPropagation(),o({resourceId:C.id,metric:k}),e.onEdit(C.id,C.thresholds?{...C.thresholds}:{},C.defaults?{...C.defaults}:{})};return(()=>{var R=Ss();return t(R,n(h,{get when(){return w()},get fallback(){return $i()},get children(){return n(h,{get when(){return ge()},get fallback(){return(()=>{var Q=_i();return Q.$$click=G=>{x(G)},t(Q,n(X,{get resourceId(){return C.id},metric:k,get value(){return N(k)},get isOverridden(){return F(k)}})),Q})()},get children(){var Q=Ay(),G=Q.firstChild;return G.addEventListener("blur",()=>{e.editingId()===C.id&&e.onSaveEdit(C.id),o(null)}),G.$$input=T=>{const te=T.currentTarget.value;if(te===""){e.setEditingThresholds({...e.editingThresholds(),[k]:void 0});return}const ae=parseFloat(te);Number.isNaN(ae)||e.setEditingThresholds({...e.editingThresholds(),[k]:ae})},fr(T=>{ge()&&l()?.resourceId===C.id&&l()?.metric===k&&queueMicrotask(()=>{T.focus(),T.select()})},G),q(T=>{var te=de.min,ae=de.max,M=p(k),ce=fe()?"Off":"",ue=`w-16 px-2 py-0.5 text-sm text-center border rounded ${fe()?"bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-600 border-gray-300 dark:border-gray-600":"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 border-gray-300 dark:border-gray-600"}`;return te!==T.e&&Te(G,"min",T.e=te),ae!==T.t&&Te(G,"max",T.t=ae),M!==T.a&&Te(G,"step",T.a=M),ce!==T.o&&Te(G,"placeholder",T.o=ce),ue!==T.i&&y(G,T.i=ue),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),q(()=>G.value=J()?.[k]??""),Q}})}})),R})()}}),v),t(P,n(h,{get when(){return e.showOfflineAlertsColumn},get children(){var A=Ss();return t(A,()=>{const k=e.globalDisableFlag?.()??!1;if(typeof e.onSetOfflineState=="function"&&(C.type==="guest"||C.type==="dockerContainer")){const fe=e.globalDisableOfflineFlag?.()??!1,x=e.globalOfflineSeverity??"warning";let R;return C.disableConnectivity?R="off":C.poweredOffSeverity?R=C.poweredOffSeverity:fe?R="off":R=x==="critical"?"critical":"warning",le(R,k,()=>{if(k)return;const Q=se(R);e.onSetOfflineState?.(C.id,Q)})}if(!e.onToggleNodeConnectivity)return ta();const de=e.globalDisableOfflineFlag?.()??!1;return I({isEnabled:!de&&!C.disableConnectivity,disabled:k,onToggle:()=>{k||e.onToggleNodeConnectivity?.(C.id)},titleEnabled:"Offline alerts enabled. Click to disable for this resource.",titleDisabled:"Offline alerts disabled. Click to enable for this resource.",titleWhenDisabled:"Offline alerts controlled globally"})}),A}}),v),t(V,n(h,{get when(){return!ge()},get fallback(){return(()=>{var A=Ci();return A.$$click=()=>{e.onCancelEdit(),o(null)},A})()},get children(){return[n(h,{get when(){return C.type!=="dockerHost"},get children(){var A=bi();return A.$$click=()=>e.onEdit(C.id,C.thresholds?{...C.thresholds}:{},C.defaults?{...C.defaults}:{}),A}}),n(h,{get when(){return C.hasOverride||(C.type==="node"||C.type==="dockerHost")&&C.disableConnectivity},get children(){var A=pi();return A.$$click=()=>e.onRemoveOverride(C.id),A}})]}})),q(()=>y(P,`hover:bg-gray-50 dark:hover:bg-gray-900/50 transition-colors ${C.disabled||e.globalDisableFlag?.()?"opacity-40":""}`)),P})()}})]}})}}),null),t(D,n(h,{get when(){return!e.groupedResources&&e.resources},get children(){return n(h,{get when(){return e.resources&&e.resources.length===0},get fallback(){return n(ze,{get each(){return e.resources},children:f=>{const j=()=>e.editingId()===f.id,K=()=>j()?e.editingThresholds():f.thresholds??{},C=J=>{const N=v=>{if(v==null)return;if(typeof v=="number")return v;const V=Number(v);return Number.isFinite(V)?V:void 0},F=v=>N(v?.[J]),P=f.defaults;if(j()){const v=F(K());if(v!==void 0)return v;const V=F(P);return V!==void 0?V:0}const E=F(f.thresholds);if(E!==void 0)return E;const u=F(P);return u!==void 0?u:0},ge=J=>f.thresholds?.[J]!==void 0&&f.thresholds?.[J]!==null;return(()=>{var J=yi(),N=J.firstChild,F=N.nextSibling,P=F.nextSibling,E=P.firstChild;return t(N,n(h,{get when(){return e.onToggleDisabled},get children(){return(()=>{const u=e.globalDisableFlag?.()??!1,v=!u&&!f.disabled;return(()=>{var V=Ya();return t(V,n(sa,{size:"sm",checked:v,disabled:u,onToggle:()=>!u&&e.onToggleDisabled?.(f.id),class:"my-[1px]",get title(){return u?"Alerts disabled globally":f.disabled?"Click to enable alerts":"Click to disable alerts"},ariaLabel:v?"Alerts enabled for this resource":"Alerts disabled for this resource"})),V})()})()}})),t(F,n(h,{get when(){return f.type==="node"},get fallback(){return(()=>{var u=vi(),v=u.firstChild;return t(v,()=>f.name),t(u,n(h,{get when(){return f.hasOverride||f.disableConnectivity},get children(){return Cs()}}),null),q(()=>y(v,`text-sm font-medium ${f.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100"}`)),u})()},get children(){var u=Qa();return t(u,n(h,{get when(){return f.host},get fallback(){return(()=>{var v=ki();return t(v,()=>f.type==="node"?f.name:f.displayName||f.name),q(()=>y(v,`text-sm font-medium ${f.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100"}`)),v})()},children:v=>(()=>{var V=wi();return V.$$click=A=>A.stopPropagation(),t(V,()=>f.type==="node"?f.name:f.displayName||f.name),q(A=>{var k=v(),w=`text-sm font-medium transition-colors duration-150 ${f.disabled?"text-gray-500 dark:text-gray-500":"text-gray-900 dark:text-gray-100 hover:text-sky-600 dark:hover:text-sky-400"}`,de=`Open ${f.displayName||f.name} web interface`;return k!==A.e&&Te(V,"href",A.e=k),w!==A.t&&y(V,A.t=w),de!==A.a&&Te(V,"title",A.a=de),A},{e:void 0,t:void 0,a:void 0}),V})()}),null),t(u,n(h,{get when(){return f.clusterName},get children(){var v=Ja();return t(v,()=>f.clusterName),v}}),null),t(u,n(h,{get when(){return f.hasOverride||f.disableConnectivity},get children(){return Cs()}}),null),q(()=>Te(u,"title",f.status||void 0)),u}})),t(J,n(ze,{get each(){return e.columns},children:u=>{const v=u.toLowerCase().replace(" %","").replace(" mb/s","").replace("disk r","diskRead").replace("disk w","diskWrite").replace("net in","networkIn").replace("net out","networkOut"),V=()=>f.type==="node"&&["diskRead","diskWrite","networkIn","networkOut"].includes(v)?!1:f.type==="pbs"?["cpu","memory"].includes(v):f.type==="storage"?v==="usage":!0,A=()=>K()?.[v]===-1,k=w=>{w.stopPropagation(),o({resourceId:f.id,metric:v}),e.onEdit(f.id,f.thresholds?{...f.thresholds}:{},f.defaults?{...f.defaults}:{})};return(()=>{var w=Ss();return t(w,n(h,{get when(){return V()},get fallback(){return $i()},get children(){return n(h,{get when(){return j()},get fallback(){return(()=>{var de=_i();return de.$$click=k,t(de,n(X,{get resourceId(){return f.id},metric:v,get value(){return C(v)},get isOverridden(){return ge(v)}})),de})()},get children(){var de=Dy(),fe=de.firstChild;return fe.addEventListener("blur",()=>{e.editingId()===f.id&&e.onSaveEdit(f.id),o(null)}),fe.$$input=x=>{const R=x.currentTarget.value;if(R===""){e.setEditingThresholds({...e.editingThresholds(),[v]:void 0});return}const Q=parseFloat(R);Number.isNaN(Q)||e.setEditingThresholds({...e.editingThresholds(),[v]:Q})},fr(x=>{j()&&l()?.resourceId===f.id&&l()?.metric===v&&queueMicrotask(()=>{x.focus(),x.select()})},fe),q(x=>{var R=v.includes("disk")||v.includes("memory")||v.includes("cpu")||v==="usage"?100:1e4,Q=p(v),G=A()?"Off":"",T=`w-16 px-2 py-0.5 text-sm text-center border rounded ${A()?"bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-600 border-gray-300 dark:border-gray-600":"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 border-gray-300 dark:border-gray-600"}`;return R!==x.e&&Te(fe,"max",x.e=R),Q!==x.t&&Te(fe,"step",x.t=Q),G!==x.a&&Te(fe,"placeholder",x.a=G),T!==x.o&&y(fe,x.o=T),x},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>fe.value=K()?.[v]??""),de}})}})),w})()}}),P),t(J,n(h,{get when(){return e.showOfflineAlertsColumn},get children(){var u=Ss();return t(u,n(h,{get when(){return e.onToggleNodeConnectivity},get children(){return(()=>{const v=e.globalDisableOfflineFlag?.()??!1,V=!(f.disableConnectivity||v),A=e.globalDisableFlag?.()??!1;return n(xi,{isEnabled:V,disabled:A,onToggle:()=>e.onToggleNodeConnectivity?.(f.id),titleEnabled:"Offline alerts enabled. Click to disable for this resource.",titleDisabled:"Offline alerts disabled. Click to enable for this resource.",titleWhenDisabled:"Offline alerts controlled globally"})})()}})),u}}),P),t(E,n(h,{get when(){return!j()},get fallback(){return(()=>{var u=Ci();return u.$$click=()=>{e.onCancelEdit(),o(null)},u})()},get children(){return[(()=>{var u=bi();return u.$$click=()=>e.onEdit(f.id,f.thresholds?{...f.thresholds}:{},f.defaults?{...f.defaults}:{}),u})(),n(h,{get when(){return f.hasOverride||f.type==="node"&&f.disableConnectivity},get children(){var u=pi();return u.$$click=()=>e.onRemoveOverride(f.id),u}})]}})),q(()=>y(J,`hover:bg-gray-50 dark:hover:bg-gray-900/50 transition-colors ${f.disabled||e.globalDisableFlag?.()?"opacity-40":""}`)),J})()}})},get children(){var f=vy(),j=f.firstChild,K=j.firstChild,C=K.nextSibling;return C.nextSibling,t(j,()=>e.title.toLowerCase(),C),q(()=>Te(j,"colspan",z())),f}})}}),null),t(D,n(h,{get when(){return!s()},get children(){var f=ky(),j=f.firstChild;return t(j,()=>e.emptyMessage||"No resources available."),q(()=>Te(j,"colspan",z())),f}}),null),ee})()]}})}Xt(["click","input"]);var My=i('<button type=button class="absolute right-3 top-2.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Qn=i("<div class=scroll-mt-24>"),Py=i('<button type=button class="inline-flex items-center justify-center rounded-md border border-transparent bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700 transition hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700">Reset'),Ey=i('<div class="mb-6 rounded-lg border border-gray-200 bg-white p-5 shadow-sm dark:border-gray-700 dark:bg-gray-900"><div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div><h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Ignored container prefixes</h3><p class="mt-1 text-xs text-gray-600 dark:text-gray-400">Containers whose name or ID starts with any prefix below are skipped for Docker alerts. Enter one prefix per line; matching is case-insensitive.</p></div></div><textarea placeholder=runner- rows=4 class="mt-4 w-full rounded-md border border-gray-300 bg-white p-3 text-sm text-gray-900 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-200 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:focus:border-sky-400 dark:focus:ring-sky-600/40">'),Ny=i('<div class=space-y-6><div class=relative><input type=text placeholder="Search resources..."class="w-full pl-10 pr-10 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><svg class="absolute left-3 top-2.5 w-5 h-5 text-gray-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg></div><div class="rounded-lg border border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/30 p-3"><div class="flex items-start gap-2"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="text-sm text-blue-900 dark:text-blue-100"><span class=font-medium>Quick tips:</span> Set any threshold to <code class="px-1 py-0.5 bg-blue-100 dark:bg-blue-900/50 rounded text-xs font-mono">0</code> to disable alerts for that metric. Click on disabled thresholds showing <span class=italic>Off</span> to re-enable them. Resources with custom settings show a <span class="inline-flex items-center px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded text-xs">Custom</span> badge.</div></div></div><div class="border-b border-gray-200 dark:border-gray-700"><nav class="-mb-px flex gap-6"aria-label=Tabs><button type=button>Proxmox / PBS</button><button type=button>Mail Gateway</button><button type=button>Docker</button></nav></div><div class=space-y-6>'),Oy=i('<div class="rounded-lg border border-gray-200 bg-white p-6 text-sm text-gray-600 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300">No mail gateways configured yet. Add a PMG instance in Settings to manage thresholds.');const Ly=e=>e.trim().toLowerCase().replace(" %","").replace(" °c","").replace(" mb/s","").replace("disk r","diskRead").replace("disk w","diskWrite").replace("net in","networkIn").replace("net out","networkOut"),zr=(e,r)=>({key:e,label:r,normalized:Ly(r)}),ya=[zr("queueTotalWarning","Queue Warn"),zr("queueTotalCritical","Queue Crit"),zr("deferredQueueWarn","Deferred Warn"),zr("deferredQueueCritical","Deferred Crit"),zr("holdQueueWarn","Hold Warn"),zr("holdQueueCritical","Hold Crit"),zr("oldestMessageWarnMins","Oldest Warn (min)"),zr("oldestMessageCritMins","Oldest Crit (min)"),zr("quarantineSpamWarn","Spam Warn"),zr("quarantineSpamCritical","Spam Crit"),zr("quarantineVirusWarn","Virus Warn"),zr("quarantineVirusCritical","Virus Crit"),zr("quarantineGrowthWarnPct","Growth Warn %"),zr("quarantineGrowthWarnMin","Growth Warn Min"),zr("quarantineGrowthCritPct","Growth Crit %"),zr("quarantineGrowthCritMin","Growth Crit Min")],Ry=new Map(ya.map(e=>[e.normalized,e.key])),Iy=new Map(ya.map(e=>[e.key,e.normalized])),Hy=e=>e.split(`
|
||
`).map(r=>r.trim()).filter(r=>r.length>0);function Uy(e){const r=In(),s=Bs(),[l,o]=Z(""),[a,d]=Z(null),[c,g]=Z({}),[b,p]=Z("proxmox");let m;const[S,z]=Z(e.dockerIgnoredPrefixes().join(`
|
||
`));ft(()=>{z(e.dockerIgnoredPrefixes().join(`
|
||
`))});const ie=()=>{const x=s.pathname;return x.includes("/thresholds/docker")?"docker":x.includes("/thresholds/mail-gateway")?"pmg":"proxmox"};ft(()=>{const x=ie();b()!==x&&p(x)}),ft(()=>{s.pathname==="/alerts/thresholds"&&r("/alerts/thresholds/proxmox",{replace:!0})});const ne=x=>{r({proxmox:"/alerts/thresholds/proxmox",pmg:"/alerts/thresholds/mail-gateway",docker:"/alerts/thresholds/docker"}[x])},W=x=>{z(x);const R=Hy(x);e.setDockerIgnoredPrefixes(R),e.setHasUnsavedChanges(!0)},X=()=>{e.resetDockerIgnoredPrefixes?e.resetDockerIgnoredPrefixes():e.setDockerIgnoredPrefixes([]),z(""),e.setHasUnsavedChanges(!0)};vr(()=>{const x=Q=>{if(!Q)return!1;const G=Q.tagName;return G==="INPUT"||G==="TEXTAREA"||G==="SELECT"||Q.contentEditable==="true"},R=Q=>{const G=Q.target,T=document.activeElement??null,te=x(G);if(Q.key==="Escape"){l()&&(Q.preventDefault(),o("")),m&&document.activeElement===m&&m.blur();return}Q.defaultPrevented||te||x(T)||a()||Q.key.length===1&&Q.key.match(/[a-z0-9]/i)&&(Q.preventDefault(),m&&(m.focus(),o(Q.key)))};document.addEventListener("keydown",R),Ar(()=>{document.removeEventListener("keydown",R)})});const I=(x,R)=>R==null?"0":R<=0?"Off":x==="cpu"||x==="memory"||x==="disk"||x==="usage"||x==="memoryWarnPct"||x==="memoryCriticalPct"?`${R}%`:x==="temperature"?`${R}°C`:x==="restartWindow"?`${R}s`:x==="restartCount"?String(R):x==="diskRead"||x==="diskWrite"||x==="networkIn"||x==="networkOut"?`${R} MB/s`:String(R),L=(x,R)=>e.activeAlerts?`${x}-${R}`in e.activeAlerts:!1,H=(x,R)=>{if(!x)return x;const Q=R?.toLowerCase().trim(),G=ce=>{if(!ce)return"";let ue=ce.replace(/\(.*?\)/g," ").replace(/\s+/g," ").trim();if(Q&&(ue=ue.split(" ").filter(xe=>xe.toLowerCase()!==Q).join(" ").trim()),!ue)return"";const re=ue.split(/\s+/)[0]||ue;return(re.includes(".")?re.split(".")[0]??re:re).trim()},te=x.match(/\(([^)]+)\)/)?.[1]?.trim();let ae=G(x);ae||(ae=x.trim());const M=G(te);return M&&M.toLowerCase()!==ae.toLowerCase()?M:ae},se=x=>{const R=x.displayName?.trim()||x.name,Q=H(R,x.clusterName),G=x.host?.trim();let T;G&&G!==""?T=G.startsWith("http")?G:`https://${G.includes(":")?G:`${G}:8006`}`:x.name&&(T=`https://${x.name.includes(":")?x.name:`${x.name}:8006`}`);const te={type:"node",displayName:Q,rawName:R,host:T,status:x.status,clusterName:x.isClusterMember?x.clusterName?.trim()||"Cluster":void 0,isClusterMember:x.isClusterMember??!1},ae=new Set;return[x.name,R,Q].forEach(M=>{M&&M.trim()&&ae.add(M.trim())}),{headerMeta:te,keys:ae}},le=pe((x=[])=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(T=>[T.id,T])),G=(e.nodes??[]).map(T=>{const te=Q.get(T.id),ae=te?.thresholds&&Object.keys(te.thresholds).some(he=>{const me=he;return te.thresholds[me]!==void 0&&te.thresholds[me]!==e.nodeDefaults[me]}),M=T.displayName?.trim()||T.name,ce=H(M,T.clusterName),ue=T.name,re=ce||M||ue.split(".")[0]||ue,O=T.host?.trim()||ue,xe=O.startsWith("http://")||O.startsWith("https://")?O:`https://${O.includes(":")?O:`${O}:8006`}`;return{id:T.id,name:re,displayName:re,rawName:M,host:xe,type:"node",resourceType:"Node",status:T.status,uptime:T.uptime,cpu:T.cpu,memory:T.memory?.usage,hasOverride:ae||!1,disabled:!1,disableConnectivity:te?.disableConnectivity||!1,thresholds:te?.thresholds||{},defaults:e.nodeDefaults,clusterName:T.isClusterMember?T.clusterName?.trim():void 0,isClusterMember:T.isClusterMember??!1,instance:T.instance}});return R?G.filter(T=>T.name.toLowerCase().includes(R)):G},[]),ee=pe((x=[])=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(te=>[te.id,te])),G=new Set,T=(e.dockerHosts??[]).map(te=>{const ae=te.displayName?.trim()||te.hostname||te.id,M=H(ae),ce=Q.get(te.id),ue=ce?.disableConnectivity||!1,re=te.status||(te.lastSeen?"online":"offline");return G.add(te.id),{id:te.id,name:M,displayName:M,rawName:ae,type:"dockerHost",resourceType:"Docker Host",node:te.hostname,instance:te.displayName,status:re,hasOverride:ue,disableConnectivity:ue,thresholds:ce?.thresholds||{},defaults:{}}});return(e.overrides()??[]).filter(te=>te.type==="dockerHost"&&!G.has(te.id)).forEach(te=>{const ae=te.name||te.id,M=H(ae);T.push({id:te.id,name:M,displayName:M,rawName:ae,type:"dockerHost",resourceType:"Docker Host",node:te.node||"",instance:te.instance||"",status:"unknown",hasOverride:!0,disableConnectivity:te.disableConnectivity||!1,thresholds:te.thresholds||{},defaults:{}})}),R?T.filter(te=>te.name.toLowerCase().includes(R)):T},[]),U=pe((x={})=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(M=>[M.id,M])),G={},T=new Set,te=M=>{const ce=M.name?.trim()||"";return ce.startsWith("/")?ce.replace(/^\/+/,"")||(M.id?.slice(0,12)??"container"):ce||(M.id?.slice(0,12)??"container")};if((e.dockerHosts??[]).forEach(M=>{const ce=M.displayName?.trim()||M.hostname||M.id,ue=H(ce),re=ce.toLowerCase(),O=ue.toLowerCase();(M.containers||[]).forEach(xe=>{const he=xe.id||te(xe),me=`docker:${M.id}/${he}`,_e=Q.get(me),Ce=_e?.poweredOffSeverity,Oe=e.dockerDefaults,Ze=_e?.thresholds&&Object.keys(_e.thresholds).some(vt=>{const Ve=vt;return _e.thresholds[Ve]!==void 0&&_e.thresholds[Ve]!==Oe?.[Ve]})||_e?.disabled||_e?.disableConnectivity||Ce!==void 0||!1,bt=te(xe),ct=bt.toLowerCase(),qe=xe.image?.toLowerCase()||"";if(!(!R||ct.includes(R)||re.includes(R)||O.includes(R)||qe.includes(R)))return;const Xe=xe.state||xe.status||"unknown",_t=ue||ce,Lt={id:me,name:bt,type:"dockerContainer",resourceType:"Docker Container",node:_t,instance:M.hostname,status:Xe,hasOverride:Ze,disabled:_e?.disabled||!1,disableConnectivity:_e?.disableConnectivity||!1,thresholds:_e?.thresholds||{},defaults:e.dockerDefaults,hostId:M.id,image:xe.image,poweredOffSeverity:Ce};G[_t]||(G[_t]=[]),G[_t].push(Lt),T.add(me)})}),(e.overrides()??[]).filter(M=>M.type==="dockerContainer"&&!T.has(M.id)).forEach(M=>{const ce=M.name||M.id.split("/").pop()||M.id,ue="Unassigned Docker Containers";G[ue]||(G[ue]=[]),G[ue].push({id:M.id,name:ce,type:"dockerContainer",resourceType:"Docker Container",status:"unknown",hasOverride:!0,disabled:M.disabled||!1,disableConnectivity:M.disableConnectivity||!1,thresholds:M.thresholds||{},defaults:e.dockerDefaults,poweredOffSeverity:M.poweredOffSeverity})}),Object.keys(G).forEach(M=>{G[M].sort((ce,ue)=>ce.name.localeCompare(ue.name))}),!R)return G;const ae={};return Object.entries(G).forEach(([M,ce])=>{ce.length>0&&(ae[M]=ce)}),ae},{}),Y=pe(()=>Object.values(U()??{}).flat()),oe=pe(()=>(e.dockerHosts??[]).reduce((x,R)=>x+(R.containers?.length??0),0)),_=pe(()=>{const x={};return(e.dockerHosts??[]).forEach(R=>{const Q=R.displayName?.trim()||R.hostname||R.id,G=H(Q),T={displayName:G,rawName:Q,status:R.status||(R.lastSeen?"online":"offline")};[G,Q,R.hostname,R.id].filter(te=>!!(te&&te.trim())).forEach(te=>{x[te.trim()]=T})}),x["Unassigned Docker Containers"]={displayName:"Unassigned Docker Containers",status:"unknown"},x}),B=x=>x?.filter(R=>R.hasOverride||R.disabled||R.disableConnectivity).length??0,$=x=>R=>{},D=pe((x={})=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(ae=>[ae.id,ae])),G=(e.allGuests()??[]).map(ae=>{const M=ae.id||`${ae.instance}-${ae.node}-${ae.vmid}`,ce=Q.get(M),ue=ce?.poweredOffSeverity,O=ce?.thresholds&&Object.keys(ce.thresholds).some(xe=>{const he=xe;return ce.thresholds[he]!==void 0&&ce.thresholds[he]!==e.guestDefaults[he]})||ce?.disabled||ce?.disableConnectivity||ue!==void 0||!1;return{id:M,name:ae.name,type:"guest",resourceType:ae.type==="qemu"?"VM":"CT",vmid:ae.vmid,node:ae.node,instance:ae.instance,status:ae.status,hasOverride:O,disabled:ce?.disabled||!1,disableConnectivity:ce?.disableConnectivity||!1,thresholds:ce?.thresholds||{},defaults:e.guestDefaults,poweredOffSeverity:ue}}),T=R?G.filter(ae=>ae.name.toLowerCase().includes(R)||ae.vmid?.toString().includes(R)||ae.node?.toLowerCase().includes(R)):G,te={};return T.forEach(ae=>{const M=ae.node||"Unknown";te[M]||(te[M]=[]),te[M].push(ae)}),Object.keys(te).forEach(ae=>{te[ae].sort((M,ce)=>M.vmid&&ce.vmid?M.vmid-ce.vmid:M.name.localeCompare(ce.name))}),te},{}),f=pe(()=>Object.values(D()??{}).flat()),j=pe(()=>{const x={};return(e.nodes??[]).forEach(R=>{const{headerMeta:Q,keys:G}=se(R);G.forEach(T=>{x[T]=Q})}),x}),K=pe((x=[])=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(te=>[te.id,te])),T=(e.pbsInstances||[]).filter(te=>(te.cpu||0)>0||(te.memory||0)>0).map(te=>{const ae=te.id,M=Q.get(ae),ce=M?.thresholds&&Object.keys(M.thresholds).some(ue=>{const re=ue;return M.thresholds[re]!==void 0&&M.thresholds[re]!==e.nodeDefaults[re]});return{id:ae,name:te.name,type:"pbs",resourceType:"PBS",host:te.host,status:te.status,cpu:te.cpu,memory:te.memory,memoryUsed:te.memoryUsed,memoryTotal:te.memoryTotal,uptime:te.uptime,hasOverride:ce||!1,disabled:!1,disableConnectivity:M?.disableConnectivity||!1,thresholds:M?.thresholds||{},defaults:{cpu:e.nodeDefaults.cpu,memory:e.nodeDefaults.memory}}});return R?T.filter(te=>te.name.toLowerCase().includes(R)||te.host?.toLowerCase().includes(R)):T},[]),C=pe(()=>{const x=e.pmgThresholds(),R={};return ya.forEach(({key:Q,normalized:G})=>{const T=x[Q];R[G]=typeof T=="number"&&Number.isFinite(T)?T:0}),R}),ge=x=>{const R=C(),Q=typeof x=="function"?x({...R}):{...R,...x};let G=!1;e.setPMGThresholds(T=>{const te={...T};return ya.forEach(({key:ae,normalized:M})=>{const ce=Q[M];if(typeof ce=="number"&&!Number.isNaN(ce)){const ue=Math.max(0,Math.round(ce));te[ae]!==ue&&(te[ae]=ue,G=!0)}}),te}),G&&e.setHasUnsavedChanges(!0)},J=pe((x=[])=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(ae=>[ae.id,ae])),G=e.pmgInstances||[],T=C(),te=G.map(ae=>{const M=ae.id,ce=Q.get(M),ue={},re=ce?.thresholds??{};Object.entries(re).forEach(([xe,he])=>{if(typeof he!="number"||Number.isNaN(he))return;const me=Iy.get(xe)||(Ry.has(xe)?xe:void 0);me&&(ue[me]=he)});const O=ce?.disableConnectivity||ce?.disabled||Object.keys(ue).length>0||!1;return{id:M,name:ae.name,type:"pmg",resourceType:"PMG",host:ae.host,status:ae.status,hasOverride:O,disabled:ce?.disabled||!1,disableConnectivity:ce?.disableConnectivity||!1,thresholds:ue,defaults:{...T}}});return R?te.filter(ae=>ae.name.toLowerCase().includes(R)||ae.host?.toLowerCase().includes(R)):te},[]),N=pe((x=[])=>{if(a())return x;const R=l().toLowerCase(),Q=new Map((e.overrides()??[]).map(T=>[T.id,T])),G=(e.storage??[]).map(T=>{const te=Q.get(T.id),M=te?.thresholds?.usage!==void 0&&te.thresholds.usage!==e.storageDefault()||te?.disabled||!1;return{id:T.id,name:T.name,type:"storage",resourceType:"Storage",node:T.node,instance:T.instance,status:T.status,hasOverride:M,disabled:te?.disabled||!1,thresholds:te?.thresholds||{},defaults:{usage:e.storageDefault()}}});return R?G.filter(T=>T.name.toLowerCase().includes(R)||T.node?.toLowerCase().includes(R)):G},[]),F=pe(()=>{const x={};return N().forEach(R=>{const Q=R.node?.trim()||"Unassigned";x[Q]||(x[Q]=[]),x[Q].push(R)}),Object.values(x).forEach(R=>{R.sort((Q,G)=>Q.name.localeCompare(G.name))}),x}),P=pe(()=>{try{return[{key:"nodes",label:"Nodes",total:e.nodes?.length??0,overrides:B(le()),tab:"proxmox"},{key:"dockerHosts",label:"Docker Hosts",total:e.dockerHosts?.length??0,overrides:B(ee()),tab:"docker"},{key:"storage",label:"Storage",total:e.storage?.length??0,overrides:B(N()),tab:"proxmox"},{key:"pbs",label:"PBS Servers",total:e.pbsInstances?.length??0,overrides:B(K()),tab:"proxmox"},{key:"pmg",label:"Mail Gateways",total:e.pmgInstances?.length??0,overrides:B(J()),tab:"pmg"},{key:"dockerContainers",label:"Docker Containers",total:oe()??0,overrides:B(Y()),tab:"docker"},{key:"guests",label:"VMs & Containers",total:e.allGuests?.()?.length??0,overrides:B(f()),tab:"proxmox"}].filter(Q=>Q.total>0||Q.overrides>0).filter(Q=>Q.tab===b())}catch(x){return console.error("Error in summaryItems memo:",x),[]}}),E=x=>P()?.some(R=>R.key===x)??!1,u=(x,R,Q)=>{d(x);const G={...Q,...R};g(G)},v=x=>{const R=f(),Q=Y(),T=[...le(),...ee(),...R,...Q,...N(),...K()].find(me=>me.id===x);if(!T)return;const te=c(),ae=T.defaults??{},M={};Object.keys(te).forEach(me=>{const _e=te[me],Ce=ae[me];_e!==void 0&&_e!==Ce&&(M[me]=_e)});const ce=!!(T.disabled||T.disableConnectivity||T.poweredOffSeverity!==void 0);if(Object.keys(M).length===0&&!ce){if(T.hasOverride){const me=e.overrides().filter(Ce=>Ce.id!==x);e.setOverrides(me);const _e={...e.rawOverridesConfig()};delete _e[x],e.setRawOverridesConfig(_e),e.setHasUnsavedChanges(!0)}V();return}const ue={id:x,name:T.name,type:T.type,resourceType:T.resourceType,vmid:"vmid"in T?T.vmid:void 0,node:"node"in T?T.node:void 0,instance:"instance"in T?T.instance:void 0,disabled:T.disabled,disableConnectivity:T.disableConnectivity,poweredOffSeverity:T.poweredOffSeverity,thresholds:M},re=e.overrides().findIndex(me=>me.id===x);if(re>=0){const me=[...e.overrides()];me[re]=ue,e.setOverrides(me)}else e.setOverrides([...e.overrides(),ue]);const O={...e.rawOverridesConfig()},xe=e.rawOverridesConfig()[x],he={};xe&&(xe.disabled!==void 0&&(he.disabled=xe.disabled),xe.disableConnectivity!==void 0&&(he.disableConnectivity=xe.disableConnectivity),xe.poweredOffSeverity&&(he.poweredOffSeverity=xe.poweredOffSeverity)),Object.entries(M).forEach(([me,_e])=>{_e!=null&&(he[me]={trigger:_e,clear:Math.max(0,_e-5)})}),T.disabled?he.disabled=!0:delete he.disabled,T.disableConnectivity?(he.disableConnectivity=!0,delete he.poweredOffSeverity):((T.type==="guest"||T.type==="dockerContainer")&&e.guestDisableConnectivity()?he.disableConnectivity=!1:delete he.disableConnectivity,T.poweredOffSeverity?he.poweredOffSeverity=T.poweredOffSeverity:delete he.poweredOffSeverity),O[x]=he,e.setRawOverridesConfig(O),e.setHasUnsavedChanges(!0),d(null),g({})},V=()=>{d(null),g({})},A=(x,R,Q)=>{const G=R.trim().toLowerCase();if(!G)return;let T=!1;e.setMetricTimeThresholds(te=>{const ae=te?{...te}:{},M=te?.[x],ce=M?{...M}:{};if(Q===null){if(ce[G]===void 0)return te;delete ce[G],T=!0}else{const ue=Math.max(0,Math.round(Q));if(ce[G]===ue)return te;ce[G]=ue,T=!0}return T?(Object.keys(ce).length===0?delete ae[x]:ae[x]=ce,ae):te}),T&&e.setHasUnsavedChanges(!0)},k=x=>{e.setOverrides(e.overrides().filter(Q=>Q.id!==x));const R={...e.rawOverridesConfig()};delete R[x],e.setRawOverridesConfig(R),e.setHasUnsavedChanges(!0)},w=(x,R)=>{const Q=f(),G=Y(),te=[...Q,...G,...N(),...K()].find(re=>re.id===x);if(!te||te.type!=="guest"&&te.type!=="storage"&&te.type!=="pbs"&&te.type!=="dockerContainer")return;const ae=e.overrides().find(re=>re.id===x),M=te.disabled,ce=R!==void 0?R:!M,ue={...ae?.thresholds||{}};if(delete ue.disabled,!ce&&(!ae||Object.keys(ue).length===0)){e.setOverrides(e.overrides().filter(O=>O.id!==x));const re={...e.rawOverridesConfig()};delete re[x],e.setRawOverridesConfig(re)}else{const re={id:x,name:te.name,type:te.type,resourceType:te.resourceType,vmid:"vmid"in te?te.vmid:void 0,node:"node"in te?te.node:void 0,instance:"instance"in te?te.instance:void 0,disabled:ce,thresholds:ue},O=e.overrides().findIndex(me=>me.id===x);if(O>=0){const me=[...e.overrides()];me[O]=re,e.setOverrides(me)}else e.setOverrides([...e.overrides(),re]);const xe={...e.rawOverridesConfig()},he={};Object.entries(re.thresholds).forEach(([me,_e])=>{typeof _e=="number"&&(he[me]={trigger:_e,clear:Math.max(0,_e-5)})}),ce?he.disabled=!0:delete he.disabled,Object.keys(he).length===0?delete xe[x]:xe[x]=he,e.setRawOverridesConfig(xe)}if(ce&&e.removeAlerts)if(te.type==="guest")e.removeAlerts(re=>re.resourceId===x&&re.type==="powered-off");else if(te.type==="pbs"){const re=`pbs-offline-${x}`;e.removeAlerts(O=>O.resourceId===x&&(O.id===re||O.type==="offline"))}else te.type==="dockerContainer"&&e.removeAlerts(re=>re.resourceId===x&&(re.type==="docker-container-state"||re.type==="docker-container-health"));e.setHasUnsavedChanges(!0)},de=(x,R)=>{const Q=le(),G=K(),T=f(),te=ee(),ae=[...Q,...G,...T,...te].find(O=>O.id===x);if(!ae||ae.type!=="node"&&ae.type!=="pbs"&&ae.type!=="guest"&&ae.type!=="dockerHost")return;const M=e.overrides().find(O=>O.id===x),ce=ae.disableConnectivity,ue=R!==void 0?R:!ce,re={...M?.thresholds||{}};if(delete re.disabled,delete re.disableConnectivity,!ue&&Object.keys(re).length===0){e.setOverrides(e.overrides().filter(xe=>xe.id!==x));const O={...e.rawOverridesConfig()};delete O[x],e.setRawOverridesConfig(O)}else{const O={id:x,name:ae.name,type:ae.type,resourceType:ae.resourceType,disableConnectivity:ue,thresholds:re},xe=e.overrides().findIndex(_e=>_e.id===x);if(xe>=0){const _e=[...e.overrides()];_e[xe]=O,e.setOverrides(_e)}else e.setOverrides([...e.overrides(),O]);const he={...e.rawOverridesConfig()},me={};Object.entries(re).forEach(([_e,Ce])=>{Ce!=null&&(me[_e]={trigger:Ce,clear:Math.max(0,Ce-5)})}),ue?me.disableConnectivity=!0:delete me.disableConnectivity,Object.keys(me).length===0?delete he[x]:he[x]=me,e.setRawOverridesConfig(he)}if(e.setHasUnsavedChanges(!0),e.removeAlerts&&ae.type==="dockerHost"){const O=`docker-host-offline-${x}`,xe=`docker:${x}`;e.removeAlerts(he=>he.id===O||he.resourceId===xe)}},fe=(x,R)=>{const Q=f(),G=Y(),T=[...Q,...G].find(tt=>tt.id===x);if(!T)return;const te=e.guestDisableConnectivity(),ae=e.guestPoweredOffSeverity(),M=e.overrides().find(tt=>tt.id===x),ce={...M?.thresholds||{}};delete ce.disabled,delete ce.disableConnectivity,delete ce.poweredOffSeverity;const ue=R==="off",re=R==="off"?void 0:R==="critical"?"critical":"warning",O=M?.disabled||!1,xe=Object.keys(ce).length>0;if(!(ue!==te||!ue&&re!==ae)&&!xe&&!O&&!M?.disableConnectivity){if(M){e.setOverrides(e.overrides().filter(Ze=>Ze.id!==x));const tt={...e.rawOverridesConfig()};delete tt[x],e.setRawOverridesConfig(tt),e.setHasUnsavedChanges(!0)}return}const me={id:x,name:T.name,type:T.type,resourceType:T.resourceType,vmid:"vmid"in T?T.vmid:void 0,node:"node"in T?T.node:void 0,instance:"instance"in T?T.instance:void 0,disabled:O,disableConnectivity:ue,poweredOffSeverity:ue?void 0:re,thresholds:ce},_e=e.overrides().findIndex(tt=>tt.id===x);if(_e>=0){const tt=[...e.overrides()];tt[_e]=me,e.setOverrides(tt)}else e.setOverrides([...e.overrides(),me]);const Ce={...e.rawOverridesConfig()},Oe={};Object.entries(ce).forEach(([tt,Ze])=>{Ze!=null&&(Oe[tt]={trigger:Ze,clear:Math.max(0,Ze-5)})}),O&&(Oe.disabled=!0),ue?Oe.disableConnectivity=!0:(te&&(Oe.disableConnectivity=!1),re&&(Oe.poweredOffSeverity=re)),Object.keys(Oe).length>0?Ce[x]=Oe:delete Ce[x],e.setRawOverridesConfig(Ce),e.setHasUnsavedChanges(!0),e.removeAlerts&&ue&&(T.type==="guest"?e.removeAlerts(tt=>tt.resourceId===x&&tt.type==="powered-off"):T.type==="dockerContainer"&&e.removeAlerts(tt=>tt.resourceId===x&&(tt.type==="docker-container-state"||tt.type==="docker-container-health")))};return(()=>{var x=Ny(),R=x.firstChild,Q=R.firstChild;Q.nextSibling;var G=R.nextSibling,T=G.nextSibling,te=T.firstChild,ae=te.firstChild,M=ae.nextSibling,ce=M.nextSibling,ue=T.nextSibling;Q.$$input=O=>o(O.currentTarget.value);var re=m;return typeof re=="function"?fr(re,Q):m=Q,t(R,n(h,{get when(){return l()},get children(){var O=My();return O.$$click=()=>o(""),O}}),null),ae.$$click=()=>ne("proxmox"),M.$$click=()=>ne("pmg"),ce.$$click=()=>ne("docker"),t(ue,n(h,{get when(){return b()==="proxmox"},get children(){return[n(h,{get when(){return E("nodes")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"Proxmox Nodes",get resources(){return le()},columns:["CPU %","Memory %","Disk %","Temp °C"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No nodes match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,onToggleNodeConnectivity:de,showOfflineAlertsColumn:!0,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return e.nodeDefaults},get setGlobalDefaults(){return e.setNodeDefaults},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllNodes},onToggleGlobalDisable:()=>e.setDisableAllNodes(!e.disableAllNodes()),get globalDisableOfflineFlag(){return e.disableAllNodesOffline},onToggleGlobalDisableOffline:()=>e.setDisableAllNodesOffline(!e.disableAllNodesOffline()),showDelayColumn:!0,get globalDelaySeconds(){return e.timeThresholds().node},get metricDelaySeconds(){return e.metricTimeThresholds().node??{}},onMetricDelayChange:(he,me)=>A("node",he,me),get factoryDefaults(){return e.factoryNodeDefaults},get onResetDefaults(){return e.resetNodeDefaults}})),O}}),n(h,{get when(){return E("pbs")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"PBS Servers",get resources(){return K()},columns:["CPU %","Memory %"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No PBS servers match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,onToggleNodeConnectivity:de,showOfflineAlertsColumn:!0,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return{cpu:e.nodeDefaults.cpu,memory:e.nodeDefaults.memory}},setGlobalDefaults:he=>{if(typeof he=="function"){const me=he({cpu:e.nodeDefaults.cpu,memory:e.nodeDefaults.memory});e.setNodeDefaults(_e=>({..._e,cpu:me.cpu??_e.cpu,memory:me.memory??_e.memory}))}else e.setNodeDefaults(me=>({...me,cpu:he.cpu??me.cpu,memory:he.memory??me.memory}))},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllPBS},onToggleGlobalDisable:()=>e.setDisableAllPBS(!e.disableAllPBS()),get globalDisableOfflineFlag(){return e.disableAllPBSOffline},onToggleGlobalDisableOffline:()=>e.setDisableAllPBSOffline(!e.disableAllPBSOffline()),showDelayColumn:!0,get globalDelaySeconds(){return e.timeThresholds().pbs},get metricDelaySeconds(){return e.metricTimeThresholds().pbs??{}},onMetricDelayChange:(he,me)=>A("pbs",he,me),get factoryDefaults(){return e.factoryNodeDefaults?{cpu:e.factoryNodeDefaults.cpu,memory:e.factoryNodeDefaults.memory}:void 0},get onResetDefaults(){return e.resetNodeDefaults}})),O}}),n(h,{get when(){return E("guests")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"VMs & Containers",get groupedResources(){return D()},get groupHeaderMeta(){return j()},columns:["CPU %","Memory %","Disk %","Disk R MB/s","Disk W MB/s","Net In MB/s","Net Out MB/s"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No VMs or containers match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,onToggleNodeConnectivity:de,showOfflineAlertsColumn:!0,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return e.guestDefaults},get setGlobalDefaults(){return e.setGuestDefaults},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllGuests},onToggleGlobalDisable:()=>e.setDisableAllGuests(!e.disableAllGuests()),globalDisableOfflineFlag:()=>e.guestDisableConnectivity(),onToggleGlobalDisableOffline:()=>e.setGuestDisableConnectivity(!e.guestDisableConnectivity()),get globalOfflineSeverity(){return e.guestPoweredOffSeverity()},onSetGlobalOfflineState:he=>{he==="off"?e.setGuestDisableConnectivity(!0):(e.setGuestDisableConnectivity(!1),e.setGuestPoweredOffSeverity(he==="critical"?"critical":"warning")),e.setHasUnsavedChanges(!0)},onSetOfflineState:fe,showDelayColumn:!0,get globalDelaySeconds(){return e.timeThresholds().guest},get metricDelaySeconds(){return e.metricTimeThresholds().guest??{}},onMetricDelayChange:(he,me)=>A("guest",he,me),get factoryDefaults(){return e.factoryGuestDefaults},get onResetDefaults(){return e.resetGuestDefaults}})),O}}),n(h,{get when(){return E("storage")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"Storage Devices",get groupedResources(){return F()},get groupHeaderMeta(){return j()},columns:["Usage %"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No storage devices match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,showOfflineAlertsColumn:!1,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return{usage:e.storageDefault()}},setGlobalDefaults:he=>{if(typeof he=="function"){const me=he({usage:e.storageDefault()});e.setStorageDefault(me.usage??85)}else e.setStorageDefault(he.usage??85)},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllStorage},onToggleGlobalDisable:()=>e.setDisableAllStorage(!e.disableAllStorage()),showDelayColumn:!0,get globalDelaySeconds(){return e.timeThresholds().storage},get metricDelaySeconds(){return e.metricTimeThresholds().storage??{}},onMetricDelayChange:(he,me)=>A("storage",he,me),get factoryDefaults(){return e.factoryStorageDefault!==void 0?{usage:e.factoryStorageDefault}:void 0},get onResetDefaults(){return e.resetStorageDefault}})),O}})]}}),null),t(ue,n(h,{get when(){return b()==="pmg"},get children(){return n(h,{get when(){return J().length>0},get fallback(){return Oy()},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"Mail Gateway Thresholds",get resources(){return J()},columns:["Queue Warn","Queue Crit","Deferred Warn","Deferred Crit","Hold Warn","Hold Crit","Oldest Warn (min)","Oldest Crit (min)","Spam Warn","Spam Crit","Virus Warn","Virus Crit","Growth Warn %","Growth Warn Min","Growth Crit %","Growth Crit Min"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No mail gateways match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,onToggleNodeConnectivity:de,showOfflineAlertsColumn:!0,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return C()},setGlobalDefaults:ge,get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllPMG},onToggleGlobalDisable:()=>e.setDisableAllPMG(!e.disableAllPMG()),get globalDisableOfflineFlag(){return e.disableAllPMGOffline},onToggleGlobalDisableOffline:()=>e.setDisableAllPMGOffline(!e.disableAllPMGOffline())})),O}})}}),null),t(ue,n(h,{get when(){return b()==="docker"},get children(){return[(()=>{var O=Ey(),xe=O.firstChild;xe.firstChild;var he=xe.nextSibling;return t(xe,n(h,{get when(){return(e.dockerIgnoredPrefixes().length??0)>0},get children(){var me=Py();return me.$$click=X,me}}),null),he.$$input=me=>W(me.currentTarget.value),q(()=>he.value=S()),O})(),n(h,{get when(){return E("dockerHosts")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"Docker Hosts",get resources(){return ee()},columns:[],get activeAlerts(){return e.activeAlerts},emptyMessage:"No Docker hosts match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,onToggleNodeConnectivity:de,showOfflineAlertsColumn:!0,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDisableFlag(){return e.disableAllDockerHosts},onToggleGlobalDisable:()=>e.setDisableAllDockerHosts(!e.disableAllDockerHosts()),get globalDisableOfflineFlag(){return e.disableAllDockerHostsOffline},onToggleGlobalDisableOffline:()=>e.setDisableAllDockerHostsOffline(!e.disableAllDockerHostsOffline())})),O}}),n(h,{get when(){return E("dockerContainers")},get children(){var O=Qn(),xe=$();return typeof xe=="function"&&fr(xe,O),t(O,n(Jn,{title:"Docker Containers",get groupedResources(){return U()},get groupHeaderMeta(){return _()},columns:["CPU %","Memory %","Restart Count","Restart Window (s)","Memory Warn %","Memory Critical %"],get activeAlerts(){return e.activeAlerts},emptyMessage:"No Docker containers match the current filters.",onEdit:u,onSaveEdit:v,onCancelEdit:V,onRemoveOverride:k,onToggleDisabled:w,showOfflineAlertsColumn:!1,editingId:a,editingThresholds:c,setEditingThresholds:g,formatMetricValue:I,hasActiveAlert:L,get globalDefaults(){return{cpu:e.dockerDefaults.cpu,memory:e.dockerDefaults.memory,restartCount:e.dockerDefaults.restartCount,restartWindow:e.dockerDefaults.restartWindow,memoryWarnPct:e.dockerDefaults.memoryWarnPct,memoryCriticalPct:e.dockerDefaults.memoryCriticalPct}},setGlobalDefaults:he=>{const me={cpu:e.dockerDefaults.cpu,memory:e.dockerDefaults.memory,restartCount:e.dockerDefaults.restartCount,restartWindow:e.dockerDefaults.restartWindow,memoryWarnPct:e.dockerDefaults.memoryWarnPct,memoryCriticalPct:e.dockerDefaults.memoryCriticalPct},_e=typeof he=="function"?he(me):{...me,...he};e.setDockerDefaults(Ce=>({...Ce,cpu:_e.cpu??Ce.cpu,memory:_e.memory??Ce.memory,restartCount:_e.restartCount??Ce.restartCount,restartWindow:_e.restartWindow??Ce.restartWindow,memoryWarnPct:_e.memoryWarnPct??Ce.memoryWarnPct,memoryCriticalPct:_e.memoryCriticalPct??Ce.memoryCriticalPct}))},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get globalDisableFlag(){return e.disableAllDockerContainers},onToggleGlobalDisable:()=>e.setDisableAllDockerContainers(!e.disableAllDockerContainers()),globalDisableOfflineFlag:()=>e.guestDisableConnectivity(),onToggleGlobalDisableOffline:()=>e.setGuestDisableConnectivity(!e.guestDisableConnectivity()),showDelayColumn:!0,get globalDelaySeconds(){return e.timeThresholds().guest},get metricDelaySeconds(){return e.metricTimeThresholds().guest??{}},onMetricDelayChange:(he,me)=>A("guest",he,me),get globalOfflineSeverity(){return e.guestPoweredOffSeverity()},onSetOfflineState:fe,get factoryDefaults(){return e.factoryDockerDefaults},get onResetDefaults(){return e.resetDockerDefaults}})),O}})]}}),null),q(O=>{var xe=`py-3 px-1 border-b-2 font-medium text-sm transition-colors cursor-pointer ${b()==="proxmox"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,he=`py-3 px-1 border-b-2 font-medium text-sm transition-colors cursor-pointer ${b()==="pmg"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,me=`py-3 px-1 border-b-2 font-medium text-sm transition-colors cursor-pointer ${b()==="docker"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`;return xe!==O.e&&y(ae,O.e=xe),he!==O.t&&y(M,O.t=he),me!==O.a&&y(ce,O.a=me),O},{e:void 0,t:void 0,a:void 0}),q(()=>Q.value=l()),x})()}Xt(["input","click"]);var By=i("<div class=md:ml-6>"),jy=i('<div class="flex flex-col gap-4 md:flex-row md:items-start md:justify-between">'),Fy=i("<div>");function Yn(e){const[r,s]=rs(e,["title","description","action","bodyClass","children","class","tone","padding"]);return n(it,kr({get padding(){return r.padding??"lg"},get tone(){return r.tone??"default"},get class(){return`space-y-6 ${r.class??""}`.trim()}},s,{get children(){return[(()=>{var l=jy();return t(l,n(rr,{get title(){return r.title},get description(){return r.description},size:"sm",class:"flex-1"}),null),t(l,n(h,{get when(){return r.action},get children(){var o=By();return t(o,()=>r.action),o}}),null),l})(),(()=>{var l=Fy();return t(l,()=>r.children),q(()=>y(l,r.bodyClass??"space-y-4")),l})()]}}))}class es{static baseUrl="/api/alerts";static async getActive(){return Ft(`${this.baseUrl}/active`)}static async getHistory(r){const s=new URLSearchParams;return r&&Object.entries(r).forEach(([l,o])=>{o!==void 0&&s.append(l,o.toString())}),Ft(`${this.baseUrl}/history?${s}`)}static async acknowledge(r,s){return Ft(`${this.baseUrl}/${encodeURIComponent(r)}/acknowledge`,{method:"POST",body:JSON.stringify({user:s})})}static async unacknowledge(r){return Ft(`${this.baseUrl}/${encodeURIComponent(r)}/unacknowledge`,{method:"POST"})}static async getConfig(){return Ft(`${this.baseUrl}/config`)}static async updateConfig(r){return Ft(`${this.baseUrl}/config`,{method:"PUT",body:JSON.stringify(r)})}static async clearAlert(r){return Ft(`${this.baseUrl}/${encodeURIComponent(r)}/clear`,{method:"POST"})}static async clearHistory(){return Ft(`${this.baseUrl}/history`,{method:"DELETE"})}static async bulkAcknowledge(r,s){return Ft(`${this.baseUrl}/bulk/acknowledge`,{method:"POST",body:JSON.stringify({alertIds:r,user:s})})}static async bulkClear(r){return Ft(`${this.baseUrl}/bulk/clear`,{method:"POST",body:JSON.stringify({alertIds:r})})}}/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Vy=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Gy=e=>n(nn,kr(e,{iconNode:Vy,name:"layout-dashboard"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zy=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Wy=e=>n(nn,kr(e,{iconNode:zy,name:"history"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qy=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Ky=e=>n(nn,kr(e,{iconNode:qy,name:"gauge"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Jy=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Qy=e=>n(nn,kr(e,{iconNode:Jy,name:"send"}));/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yy=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Xy=e=>n(nn,kr(e,{iconNode:Yy,name:"calendar"}));var Zy=i('<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"><div class="flex items-center gap-2 text-yellow-800 dark:text-yellow-200"><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10></circle><line x1=12 y1=8 x2=12 y2=12></line><line x1=12 y1=16 x2=12.01 y2=16></line></svg><span class="text-sm font-medium">You have unsaved changes</span></div><div class="flex w-full gap-2 sm:w-auto"><button class="flex-1 px-4 py-2 text-sm text-white transition-colors sm:flex-initial bg-blue-600 rounded-lg hover:bg-blue-700 disabled:opacity-60 disabled:cursor-not-allowed">Save Changes</button><button class="flex-1 px-4 py-2 text-sm transition-colors border border-gray-300 rounded-lg text-gray-700 dark:border-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 sm:flex-initial disabled:opacity-60 disabled:cursor-not-allowed">'),ev=i('<div aria-label="Alerts navigation"><div><div id=alerts-sidebar-menu class=space-y-6>'),tv=i('<div class="lg:hidden border-b border-gray-200 dark:border-gray-700"><div class=p-1><div class="flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5 w-full overflow-x-auto"style=-webkit-overflow-scrolling:touch;>'),rv=i('<div class="flex-1 min-w-0"><div class="p-3 sm:p-6">'),nv=i("<div class=space-y-4>"),sv=i('<p class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">'),av=i("<div class=space-y-2><div class=space-y-1.5>"),lv=i("<span class=truncate>"),fl=i("<button type=button>"),iv=i('<div class="flex items-center justify-between"><div><p class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Active Alerts</p><p class="text-xl sm:text-2xl font-semibold text-gray-600 dark:text-gray-300"></p></div><div class="w-8 h-8 sm:w-10 sm:h-10 bg-red-100 dark:bg-red-900/50 rounded-full flex items-center justify-center"><svg width=16 height=16 class="sm:w-5 sm:h-5 text-red-600 dark:text-red-400"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0">'),ov=i('<div class="flex items-center justify-between"><div><p class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Acknowledged</p><p class="text-xl sm:text-2xl font-semibold text-yellow-600 dark:text-yellow-400"></p></div><div class="w-8 h-8 sm:w-10 sm:h-10 bg-yellow-100 dark:bg-yellow-900/50 rounded-full flex items-center justify-center"><svg width=16 height=16 class="sm:w-5 sm:h-5 text-yellow-600 dark:text-yellow-400"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M9 11L12 14L22 4"></path><path d="M21 12V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3H16">'),dv=i('<div class="flex items-center justify-between"><div><p class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Last 24 Hours</p><p class="text-xl sm:text-2xl font-semibold text-gray-700 dark:text-gray-300"></p></div><div class="w-8 h-8 sm:w-10 sm:h-10 bg-gray-200 dark:bg-gray-600 rounded-full flex items-center justify-center"><svg width=16 height=16 class="sm:w-5 sm:h-5 text-gray-600 dark:text-gray-400"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=10></circle><polyline points="12 6 12 12 16 14">'),cv=i('<div class="flex items-center justify-between"><div><p class="text-xs sm:text-sm text-gray-600 dark:text-gray-400">Guest Overrides</p><p class="text-xl sm:text-2xl font-semibold text-blue-600 dark:text-blue-400"></p></div><div class="w-8 h-8 sm:w-10 sm:h-10 bg-blue-100 dark:bg-blue-900/50 rounded-full flex items-center justify-center"><svg width=16 height=16 class="sm:w-5 sm:h-5 text-blue-600 dark:text-blue-400"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z">'),uv=i('<button class="text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors"> acknowledged'),gv=i('<button type=button class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-lg border border-blue-200 dark:border-blue-700 bg-blue-50 dark:bg-blue-900/40 text-blue-700 dark:text-blue-200 transition-colors hover:bg-blue-100 dark:hover:bg-blue-900/60 disabled:opacity-60 disabled:cursor-not-allowed">'),hv=i('<div class="flex flex-wrap items-center justify-between gap-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-t-lg border border-gray-200 dark:border-gray-700">'),fv=i('<div class="text-center py-8 text-gray-500 dark:text-gray-400">'),mv=i("<div class=space-y-2>"),xv=i('<div class=space-y-6><div class="grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4"></div><div>'),bv=i('<div class="text-center py-8 text-gray-500 dark:text-gray-400"><div class="flex justify-center mb-3"><svg class="w-12 h-12 text-green-500 dark:text-green-400"fill=none stroke=currentColor viewBox="0 0 24 24"><circle cx=12 cy=12 r=10 stroke=currentColor stroke-width=2 fill=none></circle><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4"></path></svg></div><p class=text-sm>No active alerts</p><p class="text-xs mt-1">Alerts will appear here when thresholds are exceeded'),pv=i('<span class="text-xs text-gray-500 dark:text-gray-500">on '),yv=i('<span class="px-2 py-0.5 text-xs bg-yellow-200 dark:bg-yellow-800 text-yellow-800 dark:text-yellow-200 rounded">Acknowledged'),vv=i('<div><div class="flex flex-col sm:flex-row sm:items-start"><div class="flex items-start flex-1"><div></div><div class="flex-1 min-w-0"><div class="flex flex-wrap items-center gap-2"><span></span><span class="text-xs text-gray-600 dark:text-gray-400">(<!>)</span></div><p class="text-sm text-gray-700 dark:text-gray-300 mt-1 break-words"></p><p class="text-xs text-gray-600 dark:text-gray-400 mt-1">Started: </p></div></div><div class="flex gap-2 mt-3 sm:mt-0 sm:ml-4 self-end sm:self-start"><button>'),kv=i('<svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z">'),wv=i('<svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z">'),$v=i("<div>"),_v=i('<div class="flex w-full max-w-full flex-col gap-6 md:gap-8">'),As=i('<span class="text-xs font-medium text-gray-600 dark:text-gray-400">'),Cv=i('<span class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap"> configured'),Sv=i('<div class=space-y-4><div class="grid grid-cols-1 gap-4 sm:grid-cols-3"><div><label>Start time</label><input type=time></div><div><label>End time</label><input type=time></div><div><label>Timezone</label><select></select></div></div><div><span>Quiet days</span><div class="grid grid-cols-7 gap-1"></div><p class="mt-2 text-xs text-gray-500 dark:text-gray-400"></p></div><div class="space-y-3 border-t border-gray-200 pt-4 dark:border-gray-700"><span>Suppress categories</span><p class="text-xs text-gray-500 dark:text-gray-400">Critical alerts in selected categories will stay silent during quiet hours.</p><div class="flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:gap-3">'),Tv=i('<div class=space-y-4><div class="grid grid-cols-1 gap-4 sm:grid-cols-2"><div><label>Cooldown period</label><div class=relative><input type=number min=5 max=120><span class="pointer-events-none absolute inset-y-0 right-3 flex items-center text-sm text-gray-500 dark:text-gray-400">minutes</span></div><p>Minimum time between alerts for the same issue</p></div><div><label>Max alerts / hour</label><div class=relative><input type=number min=1 max=10><span class="pointer-events-none absolute inset-y-0 right-3 flex items-center text-sm text-gray-500 dark:text-gray-400">alerts</span></div><p>Per guest/metric combination'),Xa=i('<svg class="h-3 w-3 text-white"fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=3><path stroke-linecap=round stroke-linejoin=round d="M5 13l4 4L19 7">'),Av=i('<div class=space-y-4><div><label>Grouping window</label><div class="flex items-center gap-3"><input type=range min=1 max=30 class=flex-1><div class="w-16 rounded-md bg-gray-100 px-2 py-1 text-center text-sm text-gray-700 dark:bg-gray-700 dark:text-gray-200"> min</div></div><p>Alerts within this window are grouped together.</p></div><div><span>Grouping strategy</span><div class="grid grid-cols-2 gap-2"><label><input type=checkbox class=sr-only><div></div><span class="text-sm font-medium text-gray-700 dark:text-gray-300">By Node</span></label><label><input type=checkbox class=sr-only><div></div><span class="text-sm font-medium text-gray-700 dark:text-gray-300">By Guest'),Dv=i('<div class=space-y-3><p>Define escalation levels for unresolved alerts:</p><button type=button class="flex w-full items-center justify-center gap-2 rounded-lg border-2 border-dashed border-gray-300 py-2 text-sm text-gray-600 transition-all hover:border-gray-400 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-400 dark:hover:border-gray-500 dark:hover:bg-gray-700"><svg class="h-4 w-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path></svg>Add Escalation Level'),Mv=i("<p>• Quiet hours active from <!> to <!> (<!>)"),Pv=i("<p>• Suppressing <!> during quiet hours"),Ev=i("<p>• <!> minute cooldown between alerts, max <!> alerts per hour"),Nv=i("<p>• Grouping alerts within <!> minute windows"),Ov=i("<p>• <!> escalation level<!> configured"),Lv=i("<p>• All notification controls are disabled - alerts will be sent immediately"),Rv=i('<div class=space-y-6><div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between"><div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-100">Alert scheduling</h3><p class="mt-1 text-sm text-gray-500 dark:text-gray-400">Configure when and how alerts are delivered</p></div><button type=button class="inline-flex items-center gap-2 self-start rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"title="Restore quiet hours, cooldown, grouping, and escalation settings to their defaults"><svg class="h-4 w-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path stroke-linecap=round stroke-linejoin=round d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path></svg>Reset to defaults</button></div><div class="grid gap-6 xl:grid-cols-2">'),Iv=i("<option>"),Hv=i('<label><input type=checkbox class=sr-only><div></div><div><p class="text-sm font-medium text-gray-700 dark:text-gray-200"></p><p class="text-xs text-gray-500 dark:text-gray-400">'),Uv=i('<div class="flex items-center gap-3 rounded-lg border border-gray-200 bg-gray-50 p-3 dark:border-gray-600 dark:bg-gray-700/40"><div class="flex flex-1 flex-col gap-3 sm:grid sm:grid-cols-2 sm:items-center sm:gap-2"><div class="flex items-center gap-2"><span class="text-xs font-medium text-gray-600 dark:text-gray-400">After</span><input type=number min=5 max=180><span class="text-xs text-gray-600 dark:text-gray-400">min</span></div><div class="flex items-center gap-2"><span class="text-xs font-medium text-gray-600 dark:text-gray-400">Notify</span><select><option value=email>Email</option><option value=webhook>Webhooks</option><option value=all>All Channels</option></select></div></div><button type=button class="rounded-md p-1.5 text-red-600 transition-colors hover:bg-red-100 dark:hover:bg-red-900/30"title="Remove escalation level"><svg class="h-4 w-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16">'),Bv=i('<button type=button class="px-2 py-0.5 text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300 rounded hover:bg-blue-200 dark:hover:bg-blue-800/50 transition-colors">Clear filter'),jv=i('<div class="mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-3"><div class="flex flex-col items-start gap-2 sm:items-end"><div class="flex flex-col items-start gap-1 text-xs text-gray-500 dark:text-gray-400 sm:items-end"><div><span class="font-medium text-gray-600 dark:text-gray-300">Bar size:</span> </div></div><div class="flex flex-wrap items-center justify-end gap-2"><div class="flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"><span class="flex items-center gap-1"><div class="h-2 w-2 rounded-full bg-yellow-500"></div> warnings</span><span class="flex items-center gap-1"><div class="h-2 w-2 rounded-full bg-red-500"></div> critical'),Fv=i('<div class="mb-1 text-[10px] text-gray-400 dark:text-gray-500">Showing <!> time periods (<!> each) · Total: <!> alerts'),Vv=i('<div class="relative mt-3 h-10"><div class="absolute inset-x-0 top-0 h-px bg-gray-200 dark:bg-gray-700">'),Gv=i('<div class="text-center py-12 text-gray-500 dark:text-gray-400"><p class=text-sm>Loading alert history...'),zv=i('<div class="mt-8 pt-6 border-t border-gray-200 dark:border-gray-700"><div class="bg-gray-50 dark:bg-gray-800/50 rounded-lg p-4"><div class="flex items-start justify-between"><div><h4 class="text-sm font-medium text-gray-800 dark:text-gray-200 mb-1">Administrative Actions</h4><p class="text-xs text-gray-600 dark:text-gray-400">Permanently clear all alert history. Use with caution - this action cannot be undone.</p></div><button type=button class="px-3 py-2 text-xs border border-red-300 dark:border-red-600 text-red-600 dark:text-red-400 rounded-md hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors flex-shrink-0">Clear All History'),Wv=i('<div class=space-y-4><div class="flex flex-wrap gap-2 mb-4"><select class="px-3 py-2 text-sm border rounded-lg dark:bg-gray-700 dark:border-gray-600"><option value=24h>Last 24h</option><option value=7d>Last 7d</option><option value=30d>Last 30d</option><option value=all>All Time</option></select><select class="px-3 py-2 text-sm border rounded-lg dark:bg-gray-700 dark:border-gray-600"><option value=all>All Levels</option><option value=critical>Critical Only</option><option value=warning>Warning Only</option></select><div class="flex-1 max-w-xs"><input type=text placeholder="Search alerts..."class="w-full px-3 py-2 text-sm border rounded-lg dark:bg-gray-700 dark:border-gray-600 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500">'),qv=i('<span class="text-xs text-gray-500 dark:text-gray-400"> alerts'),Kv=i('<div class="inline-flex items-center gap-2 rounded-full border border-blue-200 dark:border-blue-700 bg-blue-50 dark:bg-blue-900/30 px-3 py-1 text-xs text-blue-700 dark:text-blue-200"><span class="font-medium uppercase tracking-wide text-[10px] text-blue-600 dark:text-blue-300">Filtered Range</span><span class="font-mono text-[11px]">'),Jv=i('<div class="flex items-center gap-1 whitespace-nowrap"><span class="font-medium text-gray-600 dark:text-gray-300">Range:</span><span></span><span class="text-gray-400 dark:text-gray-500">→</span><span>'),Qv=i('<div class="rounded bg-gray-100 p-1 dark:bg-gray-800"><div class="flex h-12 items-end gap-1">'),Yv=i('<div class="flex-1 relative flex items-end cursor-pointer"role=button tabindex=0><div class="absolute bottom-0 h-1 w-full rounded-full bg-gray-300 opacity-30 dark:bg-gray-600"></div><div class="relative w-full rounded-sm transition-all">'),Xv=i('<div class="pointer-events-none absolute top-0 flex h-full flex-col items-center"><div class="h-3 w-px bg-gray-300 dark:bg-gray-600"></div><div class="mt-1 whitespace-nowrap text-[10px] text-gray-500 dark:text-gray-400 transform">'),Zv=i('<div class="mb-2 border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class=overflow-x-auto><table class="w-full min-w-[900px] text-xs sm:text-sm"><thead><tr class="bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-b border-gray-300 dark:border-gray-600"><th class="p-1 px-2 text-left text-[10px] sm:text-xs font-medium uppercase tracking-wider">Timestamp</th><th class="p-1 px-2 text-left text-[10px] sm:text-xs font-medium uppercase tracking-wider">Resource</th><th class="p-1 px-2 text-left text-[10px] sm:text-xs font-medium uppercase tracking-wider">Type</th><th class="p-1 px-2 text-center text-[10px] sm:text-xs font-medium uppercase tracking-wider">Severity</th><th class="p-1 px-2 text-left text-[10px] sm:text-xs font-medium uppercase tracking-wider">Message</th><th class="p-1 px-2 text-center text-[10px] sm:text-xs font-medium uppercase tracking-wider">Duration</th><th class="p-1 px-2 text-center text-[10px] sm:text-xs font-medium uppercase tracking-wider">Status</th><th class="p-1 px-2 text-left text-[10px] sm:text-xs font-medium uppercase tracking-wider">Node</th></tr></thead><tbody>'),e1=i('<div class="text-center py-12 text-gray-500 dark:text-gray-400"><p class=text-sm>No alerts found</p><p class="text-xs mt-1">Try adjusting your filters or check back later'),t1=i('<tr class="bg-gray-50 dark:bg-gray-900/40"><td colspan=8 class="py-1.5 pr-3 pl-4 text-[12px] sm:text-sm font-semibold text-slate-700 dark:text-slate-100"><div class="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3"><span class=truncate></span><span class="text-[10px] font-medium text-slate-500 dark:text-slate-400"> '),r1=i('<tr><td class="p-1 px-2 text-gray-600 dark:text-gray-400 font-mono"></td><td class="p-1 px-2 font-medium text-gray-900 dark:text-gray-100 truncate max-w-[150px]"></td><td class="p-1 px-2"><span></span></td><td class="p-1 px-2 text-center"><span></span></td><td class="p-1 px-2 text-gray-700 dark:text-gray-300 truncate max-w-[300px]"></td><td class="p-1 px-2 text-center text-gray-600 dark:text-gray-400"></td><td class="p-1 px-2 text-center"><span></span></td><td class="p-1 px-2 text-gray-600 dark:text-gray-400 truncate">');const n1={overview:{title:"Alerts Overview",description:"Monitor active alerts, acknowledgements, and recent status changes across platforms."},thresholds:{title:"Alert Thresholds",description:"Tune resource thresholds and override rules for nodes, guests, and containers."},destinations:{title:"Notification Destinations",description:"Configure email, webhooks, and escalation paths for alert delivery."},schedule:{title:"Maintenance Schedule",description:"Set quiet hours and maintenance windows to suppress alerts when expected changes occur."},history:{title:"Alert History",description:"Review previously triggered alerts and their resolution timeline."}},Co={overview:"overview",thresholds:"thresholds",destinations:"destinations",schedule:"schedule",history:"history"},Ti=(e,r=Co)=>{const s=r[e];return s?`/alerts/${s}`:"/alerts"},Ai=(e,r=Co)=>{const l=(e.replace(/\/+$/,"")||"/alerts").split("/").filter(Boolean);if(l[0]!=="alerts")return"overview";const o=l[1]??"";if(!o)return"overview";const a=Object.entries(r).find(([,d])=>d===o);return a?a[0]:o==="custom-rules"?"thresholds":"overview"},s1=()=>Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",la=()=>({enabled:!1,start:"22:00",end:"08:00",timezone:s1(),days:{monday:!0,tuesday:!0,wednesday:!0,thursday:!0,friday:!0,saturday:!1,sunday:!1},suppress:{performance:!1,storage:!1,offline:!1}}),ml=()=>({enabled:!0,minutes:30,maxAlerts:3}),xl=()=>({enabled:!0,window:5,byNode:!0,byGuest:!1}),Di=e=>{if(!e)return{};const r={};return Object.entries(e).forEach(([s,l])=>{if(!l)return;const o=s.trim().toLowerCase();if(!o)return;const a={};Object.entries(l).forEach(([d,c])=>{if(typeof c!="number"||Number.isNaN(c)||c<0)return;const g=d.trim().toLowerCase();g&&(a[g]=Math.round(c))}),Object.keys(a).length>0&&(r[o]=a)}),r},bl=()=>({enabled:!1,levels:[]}),Xr=e=>typeof e=="number"?e:typeof e=="boolean"?0:e&&typeof e=="object"&&"trigger"in e?e.trigger:0,Vn=e=>{const r={};return Object.entries(e).forEach(([s,l])=>{s==="disabled"||s==="disableConnectivity"||s==="poweredOffSeverity"||typeof l!="string"&&(r[s]=Xr(l))}),r},Yr=5;function a1(){const{state:e,activeAlerts:r,updateAlert:s,removeAlerts:l}=qr(),o=In(),a=Bs(),[d,c]=Z(Ai(a.pathname)),g=()=>n1[d()]??{title:"Alerts",description:"Manage alerting configuration."};ft(()=>{const et=a.pathname,we=Ai(et);we!==d()&&c(we);const Je=Ti(we),Ge=we==="thresholds"&&et.startsWith("/alerts/thresholds/");et!==Je&&!Ge&&o(Je,{replace:!0})});const b=et=>{const we=Ti(et);a.pathname!==we&&o(we)},[p,m]=Z(!1),[S,z]=Z(!1),[ie,ne]=Z(!0),[W,X]=Z(localStorage.getItem("hideAlertsQuickTip")!=="true"),I=()=>{X(!1),localStorage.setItem("hideAlertsQuickTip","true")};let L={};const[H,se]=Z([]),[le,ee]=Z({}),[U,Y]=Z({enabled:!1,provider:"",server:"",port:587,username:"",password:"",from:"",to:[],tls:!0,startTLS:!1,replyTo:"",maxRetries:3,retryDelay:5,rateLimit:60}),[oe,_]=Z(la()),[B,$]=Z(ml()),[D,f]=Z(xl()),[j,K]=Z(bl());L.emailConfig=()=>{const et=U();return{enabled:et.enabled,provider:et.provider,server:et.server,port:et.port,username:et.username,password:et.password,from:et.from,to:et.to,tls:et.tls,startTLS:et.startTLS}},ft(()=>{if(p())return;const et=le();if(Object.keys(et).length>0&&e.nodes&&e.vms&&e.containers&&e.storage){const we=[],Je=e.dockerHosts||[],Ge=new Map,pt=new Map;Je.forEach(We=>{Ge.set(We.id,We),(We.containers||[]).forEach(st=>{const nr=`docker:${We.id}/${st.id}`;pt.set(nr,{host:We,container:st})})}),Object.entries(et).forEach(([We,st])=>{const nr=Ge.get(We);if(nr){we.push({id:We,name:nr.displayName?.trim()||nr.hostname||nr.id,type:"dockerHost",resourceType:"Docker Host",disableConnectivity:st.disableConnectivity||!1,thresholds:Vn(st)});return}const xr=pt.get(We);if(xr){const{host:cr,container:sr}=xr,wr=sr.name?.replace(/^\/+/,"")||sr.id;we.push({id:We,name:wr,type:"dockerContainer",resourceType:"Docker Container",node:cr.hostname,instance:cr.displayName,disabled:st.disabled||!1,disableConnectivity:st.disableConnectivity||!1,poweredOffSeverity:st.poweredOffSeverity==="critical"?"critical":st.poweredOffSeverity==="warning"?"warning":void 0,thresholds:Vn(st)});return}if(We.startsWith("docker:")){const[,cr]=We.split(":",2),[sr,wr]=(cr||"").split("/",2);if(wr){we.push({id:We,name:wr,type:"dockerContainer",resourceType:"Docker Container",node:sr,disabled:st.disabled||!1,disableConnectivity:st.disableConnectivity||!1,poweredOffSeverity:st.poweredOffSeverity==="critical"?"critical":st.poweredOffSeverity==="warning"?"warning":void 0,thresholds:Vn(st)});return}we.push({id:sr||We,name:sr||We,type:"dockerHost",resourceType:"Docker Host",disableConnectivity:st.disableConnectivity||!1,thresholds:Vn(st)});return}if(We.startsWith("pbs-")){const cr=(e.pbs||[]).find(sr=>sr.id===We);cr&&we.push({id:We,name:cr.name,type:"pbs",resourceType:"PBS",disableConnectivity:st.disableConnectivity||!1,thresholds:Vn(st)})}else{const cr=(e.nodes||[]).find(sr=>sr.id===We);if(cr)we.push({id:We,name:cr.name,type:"node",resourceType:"Node",disableConnectivity:st.disableConnectivity||!1,thresholds:Vn(st)});else{const sr=(e.storage||[]).find(wr=>wr.id===We);if(sr)we.push({id:We,name:sr.name,type:"storage",resourceType:"Storage",node:sr.node,instance:sr.instance,disabled:st.disabled||!1,thresholds:Vn(st)});else{const wr=(e.vms||[]).find(pr=>pr.id===We),Gt=(e.containers||[]).find(pr=>pr.id===We),br=wr||Gt;br&&we.push({id:We,name:br.name,type:"guest",resourceType:br.type==="qemu"?"VM":"CT",vmid:br.vmid,node:br.node,instance:br.instance,disabled:st.disabled||!1,poweredOffSeverity:st.poweredOffSeverity==="critical"?"critical":st.poweredOffSeverity==="warning"?"warning":void 0,thresholds:Vn(st)})}}}});const dt=H();(we.length!==dt.length||we.some(We=>{const st=dt.find(wr=>wr.id===We.id);if(!st)return!0;const nr=JSON.stringify(We.thresholds)!==JSON.stringify(st.thresholds),xr=(We.type==="node"||We.type==="pbs"||We.type==="dockerContainer")&&We.disableConnectivity!==st.disableConnectivity,cr=(We.type==="guest"||We.type==="storage")&&We.disabled!==st.disabled,sr=(We.type==="guest"||We.type==="dockerContainer")&&(We.poweredOffSeverity??null)!==(st.poweredOffSeverity??null);return nr||xr||cr||sr}))&&se(we)}});const C=async(et={})=>{z(!0),m(!1),u({cpu:80,memory:85,disk:90,diskRead:-1,diskWrite:-1,networkIn:-1,networkOut:-1}),V(!1),k("warning"),de({cpu:80,memory:85,disk:90,temperature:80}),T(85),O(Yr),he({guest:Yr,node:Yr,storage:Yr,pbs:Yr}),_e({}),_(la()),$(ml()),f(xl()),K(bl()),Y({enabled:!1,provider:"",server:"",port:587,username:"",password:"",from:"",to:[],tls:!0,startTLS:!1,replyTo:"",maxRetries:3,retryDelay:5,rateLimit:60});try{const we=await es.getConfig();if(we.guestDefaults?(u({cpu:Xr(we.guestDefaults.cpu)??80,memory:Xr(we.guestDefaults.memory)??85,disk:Xr(we.guestDefaults.disk)??90,diskRead:Xr(we.guestDefaults.diskRead)??-1,diskWrite:Xr(we.guestDefaults.diskWrite)??-1,networkIn:Xr(we.guestDefaults.networkIn)??-1,networkOut:Xr(we.guestDefaults.networkOut)??-1}),V(!!we.guestDefaults.disableConnectivity),k(we.guestDefaults.poweredOffSeverity==="critical"?"critical":"warning")):(V(!1),k("warning")),we.nodeDefaults&&de({cpu:Xr(we.nodeDefaults.cpu)??80,memory:Xr(we.nodeDefaults.memory)??85,disk:Xr(we.nodeDefaults.disk)??90,temperature:Xr(we.nodeDefaults.temperature)??80}),we.dockerDefaults&&x({cpu:Xr(we.dockerDefaults.cpu)??80,memory:Xr(we.dockerDefaults.memory)??85,restartCount:we.dockerDefaults.restartCount??3,restartWindow:we.dockerDefaults.restartWindow??300,memoryWarnPct:we.dockerDefaults.memoryWarnPct??90,memoryCriticalPct:we.dockerDefaults.memoryCriticalPct??95}),Q(we.dockerIgnoredContainerPrefixes??[]),we.storageDefault&&T(Xr(we.storageDefault)??85),we.timeThreshold!==void 0&&O(we.timeThreshold),we.timeThresholds)he({guest:we.timeThresholds.guest??Yr,node:we.timeThresholds.node??Yr,storage:we.timeThresholds.storage??Yr,pbs:we.timeThresholds.pbs??Yr});else{const Je=we.timeThreshold&&we.timeThreshold>0?we.timeThreshold:Yr;he({guest:Je,node:Je,storage:Je,pbs:Je})}if(we.metricTimeThresholds?_e(Di(we.metricTimeThresholds)):_e({}),we.pmgDefaults&&Oe({queueTotalWarning:we.pmgDefaults.queueTotalWarning??500,queueTotalCritical:we.pmgDefaults.queueTotalCritical??1e3,oldestMessageWarnMins:we.pmgDefaults.oldestMessageWarnMins??30,oldestMessageCritMins:we.pmgDefaults.oldestMessageCritMins??60,deferredQueueWarn:we.pmgDefaults.deferredQueueWarn??200,deferredQueueCritical:we.pmgDefaults.deferredQueueCritical??500,holdQueueWarn:we.pmgDefaults.holdQueueWarn??100,holdQueueCritical:we.pmgDefaults.holdQueueCritical??300,quarantineSpamWarn:we.pmgDefaults.quarantineSpamWarn??2e3,quarantineSpamCritical:we.pmgDefaults.quarantineSpamCritical??5e3,quarantineVirusWarn:we.pmgDefaults.quarantineVirusWarn??2e3,quarantineVirusCritical:we.pmgDefaults.quarantineVirusCritical??5e3,quarantineGrowthWarnPct:we.pmgDefaults.quarantineGrowthWarnPct??25,quarantineGrowthWarnMin:we.pmgDefaults.quarantineGrowthWarnMin??250,quarantineGrowthCritPct:we.pmgDefaults.quarantineGrowthCritPct??50,quarantineGrowthCritMin:we.pmgDefaults.quarantineGrowthCritMin??500}),Ze(we.disableAllNodes??!1),ct(we.disableAllGuests??!1),Ke(we.disableAllStorage??!1),_t(we.disableAllPBS??!1),vt(we.disableAllPMG??!1),lt(we.disableAllDockerHosts??!1),gt(we.disableAllDockerContainers??!1),Rt(we.disableAllNodesOffline??!1),Ae(we.disableAllGuestsOffline??!1),Qe(we.disableAllPBSOffline??!1),Vt(we.disableAllPMGOffline??!1),Jt(we.disableAllDockerHostsOffline??!1),ee(we.overrides||{}),we.schedule){if(we.schedule.quietHours){const Je=we.schedule.quietHours;let Ge;Array.isArray(Je.days)?Ge={sunday:Je.days.includes(0),monday:Je.days.includes(1),tuesday:Je.days.includes(2),wednesday:Je.days.includes(3),thursday:Je.days.includes(4),friday:Je.days.includes(5),saturday:Je.days.includes(6)}:Ge=Je.days||la().days;const pt={performance:Je.suppress?.performance??!1,storage:Je.suppress?.storage??!1,offline:Je.suppress?.offline??!1};_({enabled:Je.enabled||!1,start:Je.start||"22:00",end:Je.end||"08:00",timezone:Je.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",days:Ge,suppress:pt})}if(we.schedule.cooldown!==void 0&&$({enabled:we.schedule.cooldown>0,minutes:we.schedule.cooldown,maxAlerts:we.schedule.maxAlertsHour||3}),we.schedule.grouping?f({enabled:we.schedule.grouping.enabled||!1,window:Math.floor((we.schedule.grouping.window||300)/60),byNode:we.schedule.grouping.byNode!==void 0?we.schedule.grouping.byNode:!0,byGuest:we.schedule.grouping.byGuest!==void 0?we.schedule.grouping.byGuest:!1}):we.schedule.groupingWindow!==void 0&&f({enabled:we.schedule.groupingWindow>0,window:Math.floor(we.schedule.groupingWindow/60),byNode:!0,byGuest:!1}),we.schedule.escalation){const Ge=(we.schedule.escalation.levels||[]).map(pt=>({after:typeof pt.after=="number"?pt.after:15,notify:pt.notify||"all"}));K({enabled:!!we.schedule.escalation.enabled,levels:Ge})}}try{const Je=await fn.getEmailConfig();Y({enabled:Je.enabled,provider:Je.provider||"",server:Je.server||"",port:Je.port||587,username:Je.username||"",password:Je.password||"",from:Je.from||"",to:Je.to||[],tls:Je.tls!==void 0?Je.tls:!0,startTLS:Je.startTLS||!1,replyTo:"",maxRetries:3,retryDelay:5,rateLimit:60})}catch(Je){console.error("Failed to load email configuration:",Je)}et.notify&&Wt("Changes discarded")}catch(we){console.error("Failed to load alert configuration:",we),et.notify&&$t("Failed to reload configuration")}finally{z(!1)}};vr(()=>{C()}),ft(()=>{d()==="destinations"&&fn.getEmailConfig().then(et=>{Y({enabled:et.enabled,provider:et.provider||"",server:et.server||"",port:et.port||587,username:et.username||"",password:et.password||"",from:et.from||"",to:et.to||[],tls:et.tls!==void 0?et.tls:!0,startTLS:et.startTLS||!1,replyTo:"",maxRetries:3,retryDelay:5,rateLimit:60})}).catch(et=>{console.error("Failed to reload email configuration:",et)})});const ge=pe(()=>{const et=e.vms||[],we=e.containers||[];return[...et,...we]},[],{equals:(et,we)=>et.length!==we.length?!1:et.every((Je,Ge)=>Je.vmid===we[Ge].vmid&&Je.name===we[Ge].name)}),J={cpu:80,memory:85,disk:90,diskRead:-1,diskWrite:-1,networkIn:-1,networkOut:-1},N={cpu:80,memory:85,disk:90,temperature:80},F={cpu:80,memory:85,restartCount:3,restartWindow:300,memoryWarnPct:90,memoryCriticalPct:95},P=85,[E,u]=Z({...J}),[v,V]=Z(!1),[A,k]=Z("warning"),[w,de]=Z({...N}),[fe,x]=Z({...F}),[R,Q]=Z([]),[G,T]=Z(P),te=()=>{u({...J}),m(!0)},ae=()=>{de({...N}),m(!0)},M=()=>{x({...F}),m(!0)},ce=()=>{Q([]),m(!0)},ue=()=>{T(P),m(!0)},[re,O]=Z(Yr),[xe,he]=Z({guest:Yr,node:Yr,storage:Yr,pbs:Yr}),[me,_e]=Z({}),[Ce,Oe]=Z({queueTotalWarning:500,queueTotalCritical:1e3,oldestMessageWarnMins:30,oldestMessageCritMins:60,deferredQueueWarn:200,deferredQueueCritical:500,holdQueueWarn:100,holdQueueCritical:300,quarantineSpamWarn:2e3,quarantineSpamCritical:5e3,quarantineVirusWarn:2e3,quarantineVirusCritical:5e3,quarantineGrowthWarnPct:25,quarantineGrowthWarnMin:250,quarantineGrowthCritPct:50,quarantineGrowthCritMin:500}),[tt,Ze]=Z(!1),[bt,ct]=Z(!1),[qe,Ke]=Z(!1),[Xe,_t]=Z(!1),[Lt,vt]=Z(!1),[Ve,lt]=Z(!1),[Re,gt]=Z(!1),[mt,Rt]=Z(!1),[It,Ae]=Z(!1),[Fe,Qe]=Z(!1),[xt,Vt]=Z(!1),[Et,Jt]=Z(!1),er=[{id:"status",label:"Status",items:[{id:"overview",label:"Overview",icon:n(Gy,{class:"w-4 h-4",strokeWidth:2})},{id:"history",label:"History",icon:n(Wy,{class:"w-4 h-4",strokeWidth:2})}]},{id:"configuration",label:"Configuration",items:[{id:"thresholds",label:"Thresholds",icon:n(Ky,{class:"w-4 h-4",strokeWidth:2})},{id:"destinations",label:"Notifications",icon:n(Qy,{class:"w-4 h-4",strokeWidth:2})},{id:"schedule",label:"Schedule",icon:n(Xy,{class:"w-4 h-4",strokeWidth:2})}]}],Ut=er.flatMap(et=>et.items),[lr,Bt]=Z(!0);return(()=>{var et=nv();return t(et,n(it,{padding:"md",get children(){return n(rr,{get title(){return g().title},get description(){return g().description},size:"lg"})}}),null),t(et,n(h,{get when(){return $e(()=>!!(p()&&d()!=="overview"))()&&d()!=="history"},get children(){return n(it,{tone:"warning",padding:"sm",class:"border-yellow-200 dark:border-yellow-800 sm:p-4",get children(){var we=Zy(),Je=we.firstChild,Ge=Je.nextSibling,pt=Ge.firstChild,dt=pt.nextSibling;return pt.$$click=async()=>{try{const ht=(st,nr=5)=>{const xr=typeof st=="number"?st:0;return{trigger:xr,clear:Math.max(0,xr-nr)}},We={enabled:!0,disableAllNodes:tt(),disableAllGuests:bt(),disableAllStorage:qe(),disableAllPBS:Xe(),disableAllPMG:Lt(),disableAllDockerHosts:Ve(),disableAllDockerContainers:Re(),disableAllNodesOffline:mt(),disableAllGuestsOffline:It(),disableAllPBSOffline:Fe(),disableAllPMGOffline:xt(),disableAllDockerHostsOffline:Et(),guestDefaults:{cpu:ht(E().cpu),memory:ht(E().memory),disk:ht(E().disk),diskRead:ht(E().diskRead),diskWrite:ht(E().diskWrite),networkIn:ht(E().networkIn),networkOut:ht(E().networkOut),disableConnectivity:v(),poweredOffSeverity:A()},nodeDefaults:{cpu:ht(w().cpu),memory:ht(w().memory),disk:ht(w().disk),temperature:ht(w().temperature)},dockerDefaults:{cpu:ht(fe().cpu),memory:ht(fe().memory),restartCount:fe().restartCount,restartWindow:fe().restartWindow,memoryWarnPct:fe().memoryWarnPct,memoryCriticalPct:fe().memoryCriticalPct},dockerIgnoredContainerPrefixes:R().map(st=>st.trim()).filter(st=>st.length>0),storageDefault:ht(G()),minimumDelta:2,suppressionWindow:5,hysteresisMargin:5,timeThreshold:re()||0,timeThresholds:xe(),metricTimeThresholds:Di(me()),pmgDefaults:Ce(),overrides:le(),schedule:{quietHours:oe(),cooldown:B().enabled?B().minutes:0,groupingWindow:D().enabled&&D().window?D().window*60:30,maxAlertsHour:B().maxAlerts||10,escalation:j(),grouping:{enabled:D().enabled,window:D().window*60,byNode:D().byNode,byGuest:D().byGuest}},aggregation:{enabled:!0,timeWindow:10,countThreshold:3,similarityWindow:5},flapping:{enabled:!0,threshold:5,window:10,suppressionTime:30,minStability:.8},ioNormalization:{enabled:!0,vmDiskMax:500,containerDiskMax:300,networkMax:1e3}};if(await es.updateConfig(We),L.emailConfig){const st=L.emailConfig();await fn.updateEmailConfig(st)}m(!1),Wt("Configuration saved successfully!")}catch(ht){console.error("Failed to save configuration:",ht),$t(ht instanceof Error?ht.message:"Failed to save configuration")}},dt.$$click=async()=>{await C({notify:!0})},t(dt,()=>S()?"Discarding...":"Discard"),q(ht=>{var We=S(),st=S();return We!==ht.e&&(pt.disabled=ht.e=We),st!==ht.t&&(dt.disabled=ht.t=st),ht},{e:void 0,t:void 0}),we}})}}),null),t(et,n(it,{padding:"none",class:"relative lg:flex",get children(){return[(()=>{var we=ev(),Je=we.firstChild,Ge=Je.firstChild;return we.addEventListener("mouseleave",()=>Bt(!0)),we.addEventListener("mouseenter",()=>Bt(!1)),t(Ge,n(ze,{each:er,children:pt=>(()=>{var dt=av(),ht=dt.firstChild;return t(dt,n(h,{get when(){return!lr()},get children(){var We=sv();return t(We,()=>pt.label),We}}),ht),t(ht,n(ze,{get each(){return pt.items},children:We=>(()=>{var st=fl();return st.$$click=()=>b(We.id),t(st,()=>We.icon,null),t(st,n(h,{get when(){return!lr()},get children(){var nr=lv();return t(nr,()=>We.label),nr}}),null),q(nr=>{var xr=d()===We.id?"page":void 0,cr=`flex w-full items-center ${lr()?"justify-center":"gap-2.5"} rounded-md ${lr()?"px-2 py-2.5":"px-3 py-2"} text-sm font-medium transition-colors ${d()===We.id?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-200":"text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700/60 dark:hover:text-gray-100"}`,sr=lr()?We.label:void 0;return xr!==nr.e&&Te(st,"aria-current",nr.e=xr),cr!==nr.t&&y(st,nr.t=cr),sr!==nr.a&&Te(st,"title",nr.a=sr),nr},{e:void 0,t:void 0,a:void 0}),st})()})),dt})()})),q(pt=>{var dt=`hidden lg:flex lg:flex-col ${lr()?"w-16":"w-72"} ${lr()?"lg:min-w-[4rem] lg:max-w-[4rem] lg:basis-[4rem]":"lg:min-w-[18rem] lg:max-w-[18rem] lg:basis-[18rem]"} relative border-b border-gray-200 dark:border-gray-700 lg:border-b-0 lg:border-r lg:border-gray-200 dark:lg:border-gray-700 lg:align-top flex-shrink-0 transition-all duration-300`,ht=!lr(),We=`sticky top-24 ${lr()?"px-2":"px-5"} py-6 space-y-6 transition-all duration-300`;return dt!==pt.e&&y(we,pt.e=dt),ht!==pt.t&&Te(we,"aria-expanded",pt.t=ht),We!==pt.a&&y(Je,pt.a=We),pt},{e:void 0,t:void 0,a:void 0}),we})(),(()=>{var we=rv(),Je=we.firstChild;return t(we,n(h,{get when(){return Ut.length>0},get children(){var Ge=tv(),pt=Ge.firstChild,dt=pt.firstChild;return t(dt,n(ze,{each:Ut,children:ht=>(()=>{var We=fl();return We.$$click=()=>b(ht.id),t(We,()=>ht.label),q(()=>y(We,`flex-1 px-3 py-2 text-xs font-medium rounded-md transition-all whitespace-nowrap ${d()===ht.id?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`)),We})()})),Ge}}),Je),t(Je,n(h,{get when(){return d()==="overview"},get children(){return n(l1,{get overrides(){return H()},activeAlerts:r,updateAlert:s,showQuickTip:W,dismissQuickTip:I,showAcknowledged:ie,setShowAcknowledged:ne})}}),null),t(Je,n(h,{get when(){return d()==="thresholds"},get children(){return n(i1,{overrides:H,setOverrides:se,rawOverridesConfig:le,setRawOverridesConfig:ee,allGuests:ge,state:e,guestDefaults:E,guestDisableConnectivity:v,setGuestDefaults:u,setGuestDisableConnectivity:V,guestPoweredOffSeverity:A,setGuestPoweredOffSeverity:k,nodeDefaults:w,setNodeDefaults:de,dockerDefaults:fe,setDockerDefaults:x,dockerIgnoredPrefixes:R,setDockerIgnoredPrefixes:Q,storageDefault:G,setStorageDefault:T,resetGuestDefaults:te,resetNodeDefaults:ae,resetDockerDefaults:M,resetDockerIgnoredPrefixes:ce,resetStorageDefault:ue,factoryGuestDefaults:J,factoryNodeDefaults:N,factoryDockerDefaults:F,factoryStorageDefault:P,timeThresholds:xe,metricTimeThresholds:me,setMetricTimeThresholds:_e,pmgThresholds:Ce,setPMGThresholds:Oe,activeAlerts:r,setHasUnsavedChanges:m,hasUnsavedChanges:p,removeAlerts:l,disableAllNodes:tt,setDisableAllNodes:Ze,disableAllGuests:bt,setDisableAllGuests:ct,disableAllStorage:qe,setDisableAllStorage:Ke,disableAllPBS:Xe,setDisableAllPBS:_t,disableAllPMG:Lt,setDisableAllPMG:vt,disableAllDockerHosts:Ve,setDisableAllDockerHosts:lt,disableAllDockerContainers:Re,setDisableAllDockerContainers:gt,disableAllNodesOffline:mt,setDisableAllNodesOffline:Rt,disableAllGuestsOffline:It,setDisableAllGuestsOffline:Ae,disableAllPBSOffline:Fe,setDisableAllPBSOffline:Qe,disableAllPMGOffline:xt,setDisableAllPMGOffline:Vt,disableAllDockerHostsOffline:Et,setDisableAllDockerHostsOffline:Jt})}}),null),t(Je,n(h,{get when(){return d()==="destinations"},get children(){return n(o1,{ref(Ge){var pt=L;typeof pt=="function"?pt(Ge):L=Ge},hasUnsavedChanges:p,setHasUnsavedChanges:m,emailConfig:U,setEmailConfig:Y})}}),null),t(Je,n(h,{get when(){return d()==="schedule"},get children(){return n(d1,{hasUnsavedChanges:p,setHasUnsavedChanges:m,quietHours:oe,setQuietHours:_,cooldown:B,setCooldown:$,grouping:D,setGrouping:f,escalation:j,setEscalation:K})}}),null),t(Je,n(h,{get when(){return d()==="history"},get children(){return n(c1,{})}}),null),we})()]}}),null),et})()}function l1(e){const[r,s]=Z(new Set),l=pe(()=>{const b=Object.keys(e.activeAlerts).map(p=>e.activeAlerts[p]);return{active:b.filter(p=>!p.acknowledged).length,acknowledged:b.filter(p=>p.acknowledged).length,total24h:b.length,overrides:e.overrides.length}}),o=pe(()=>Object.values(e.activeAlerts).filter(b=>e.showAcknowledged()||!b.acknowledged).sort((b,p)=>b.acknowledged!==p.acknowledged?b.acknowledged?1:-1:new Date(p.startTime).getTime()-new Date(b.startTime).getTime())),a=pe(()=>Object.values(e.activeAlerts).filter(g=>!g.acknowledged)),[d,c]=Z(!1);return(()=>{var g=xv(),b=g.firstChild,p=b.nextSibling;return t(b,n(it,{padding:"sm",class:"sm:p-4",get children(){var m=iv(),S=m.firstChild,z=S.firstChild,ie=z.nextSibling;return t(ie,()=>l().active),m}}),null),t(b,n(it,{padding:"sm",class:"sm:p-4",get children(){var m=ov(),S=m.firstChild,z=S.firstChild,ie=z.nextSibling;return t(ie,()=>l().acknowledged),m}}),null),t(b,n(it,{padding:"sm",class:"sm:p-4",get children(){var m=dv(),S=m.firstChild,z=S.firstChild,ie=z.nextSibling;return t(ie,()=>l().total24h),m}}),null),t(b,n(it,{padding:"sm",class:"sm:p-4",get children(){var m=cv(),S=m.firstChild,z=S.firstChild,ie=z.nextSibling;return t(ie,()=>l().overrides),m}}),null),t(p,n(rr,{title:"Active Alerts",size:"md",class:"mb-3"}),null),t(p,n(h,{get when(){return Object.keys(e.activeAlerts).length>0},get fallback(){return bv()},get children(){return[n(h,{get when(){return l().acknowledged>0||l().active>0},get children(){var m=hv();return t(m,n(h,{get when(){return l().acknowledged>0},get children(){var S=uv(),z=S.firstChild;return S.$$click=()=>e.setShowAcknowledged(!e.showAcknowledged()),t(S,()=>e.showAcknowledged()?"Hide":"Show",z),S}}),null),t(m,n(h,{get when(){return l().active>0},get children(){var S=gv();return S.$$click=async()=>{if(d())return;const z=a();if(z.length!==0){c(!0);try{const ie=await es.bulkAcknowledge(z.map(X=>X.id)),ne=ie.results.filter(X=>X.success),W=ie.results.filter(X=>!X.success);ne.forEach(X=>{e.updateAlert(X.alertId,{acknowledged:!0,ackTime:new Date().toISOString()})}),ne.length>0&&Wt(`Acknowledged ${ne.length} ${ne.length===1?"alert":"alerts"}.`),W.length>0&&$t(`Failed to acknowledge ${W.length} ${W.length===1?"alert":"alerts"}.`)}catch(ie){console.error("Bulk acknowledge failed",ie),$t("Failed to acknowledge alerts")}finally{c(!1)}}},t(S,(()=>{var z=$e(()=>!!d());return()=>z()?"Acknowledging…":`Acknowledge all (${l().active})`})()),q(()=>S.disabled=d()),S}}),null),m}}),(()=>{var m=mv();return t(m,n(h,{get when(){return o().length===0},get children(){var S=fv();return t(S,()=>e.showAcknowledged()?"No active alerts":"No unacknowledged alerts"),S}}),null),t(m,n(ze,{get each(){return o()},children:S=>(()=>{var z=vv(),ie=z.firstChild,ne=ie.firstChild,W=ne.firstChild,X=W.nextSibling,I=X.firstChild,L=I.firstChild,H=L.nextSibling,se=H.firstChild,le=se.nextSibling;le.nextSibling;var ee=I.nextSibling,U=ee.nextSibling;U.firstChild;var Y=ne.nextSibling,oe=Y.firstChild;return t(W,(()=>{var _=$e(()=>!!S.acknowledged);return()=>_()?kv():wv()})()),t(L,()=>S.resourceName),t(H,()=>S.type,le),t(I,n(h,{get when(){return S.node},get children(){var _=pv();return _.firstChild,t(_,()=>S.node,null),_}}),null),t(I,n(h,{get when(){return S.acknowledged},get children(){return yv()}}),null),t(ee,()=>S.message),t(U,()=>new Date(S.startTime).toLocaleString(),null),oe.$$click=async _=>{if(_.preventDefault(),_.stopPropagation(),r().has(S.id))return;s($=>new Set($).add(S.id));const B=S.acknowledged;try{B?(await es.unacknowledge(S.id),e.updateAlert(S.id,{acknowledged:!1,ackTime:void 0,ackUser:void 0}),Wt("Alert restored")):(await es.acknowledge(S.id),e.updateAlert(S.id,{acknowledged:!0,ackTime:new Date().toISOString()}),Wt("Alert acknowledged"))}catch($){console.error(`Failed to ${B?"unacknowledge":"acknowledge"} alert:`,$),$t(`Failed to ${B?"restore":"acknowledge"} alert`)}finally{setTimeout(()=>{s($=>{const D=new Set($);return D.delete(S.id),D})},1500)}},t(oe,()=>r().has(S.id)?"Processing...":S.acknowledged?"Unacknowledge":"Acknowledge"),q(_=>{var B=`border rounded-lg p-4 transition-all ${r().has(S.id)?"opacity-50":""} ${S.acknowledged?"opacity-60 border-gray-300 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/20":S.level==="critical"?"border-red-300 dark:border-red-800 bg-red-50 dark:bg-red-900/20":"border-yellow-300 dark:border-yellow-800 bg-yellow-50 dark:bg-yellow-900/20"}`,$=`mr-3 mt-0.5 transition-all ${S.acknowledged?"text-green-600 dark:text-green-400":S.level==="critical"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,D=`text-sm font-medium truncate ${S.level==="critical"?"text-red-700 dark:text-red-400":"text-yellow-700 dark:text-yellow-400"}`,f=`px-3 py-1.5 text-xs font-medium border rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed ${S.acknowledged?"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600":"bg-white dark:bg-gray-700 text-yellow-700 dark:text-yellow-300 border-yellow-300 dark:border-yellow-700 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}`,j=r().has(S.id);return B!==_.e&&y(z,_.e=B),$!==_.t&&y(W,_.t=$),D!==_.a&&y(L,_.a=D),f!==_.o&&y(oe,_.o=f),j!==_.i&&(oe.disabled=_.i=j),_},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),z})()}),null),m})()]}}),null),g})()}function i1(e){return n(Uy,{get overrides(){return e.overrides},get setOverrides(){return e.setOverrides},get rawOverridesConfig(){return e.rawOverridesConfig},get setRawOverridesConfig(){return e.setRawOverridesConfig},get allGuests(){return e.allGuests},get nodes(){return e.state.nodes||[]},get storage(){return e.state.storage||[]},get dockerHosts(){return e.state.dockerHosts||[]},get pbsInstances(){return e.state.pbs||[]},get pmgInstances(){return e.state.pmg||[]},get pmgThresholds(){return e.pmgThresholds},get setPMGThresholds(){return e.setPMGThresholds},get guestDefaults(){return e.guestDefaults()},get guestDisableConnectivity(){return e.guestDisableConnectivity},get setGuestDefaults(){return e.setGuestDefaults},get setGuestDisableConnectivity(){return e.setGuestDisableConnectivity},get guestPoweredOffSeverity(){return e.guestPoweredOffSeverity},get setGuestPoweredOffSeverity(){return e.setGuestPoweredOffSeverity},get nodeDefaults(){return e.nodeDefaults()},get setNodeDefaults(){return e.setNodeDefaults},get dockerDefaults(){return e.dockerDefaults()},get setDockerDefaults(){return e.setDockerDefaults},get dockerIgnoredPrefixes(){return e.dockerIgnoredPrefixes},get setDockerIgnoredPrefixes(){return e.setDockerIgnoredPrefixes},get storageDefault(){return e.storageDefault},get setStorageDefault(){return e.setStorageDefault},get timeThresholds(){return e.timeThresholds},get metricTimeThresholds(){return e.metricTimeThresholds},get setMetricTimeThresholds(){return e.setMetricTimeThresholds},get setHasUnsavedChanges(){return e.setHasUnsavedChanges},get activeAlerts(){return e.activeAlerts},get removeAlerts(){return e.removeAlerts},get disableAllNodes(){return e.disableAllNodes},get setDisableAllNodes(){return e.setDisableAllNodes},get disableAllGuests(){return e.disableAllGuests},get setDisableAllGuests(){return e.setDisableAllGuests},get disableAllStorage(){return e.disableAllStorage},get setDisableAllStorage(){return e.setDisableAllStorage},get disableAllPBS(){return e.disableAllPBS},get setDisableAllPBS(){return e.setDisableAllPBS},get disableAllPMG(){return e.disableAllPMG},get setDisableAllPMG(){return e.setDisableAllPMG},get disableAllDockerHosts(){return e.disableAllDockerHosts},get setDisableAllDockerHosts(){return e.setDisableAllDockerHosts},get disableAllDockerContainers(){return e.disableAllDockerContainers},get setDisableAllDockerContainers(){return e.setDisableAllDockerContainers},get disableAllNodesOffline(){return e.disableAllNodesOffline},get setDisableAllNodesOffline(){return e.setDisableAllNodesOffline},get disableAllGuestsOffline(){return e.disableAllGuestsOffline},get setDisableAllGuestsOffline(){return e.setDisableAllGuestsOffline},get disableAllPBSOffline(){return e.disableAllPBSOffline},get setDisableAllPBSOffline(){return e.setDisableAllPBSOffline},get disableAllPMGOffline(){return e.disableAllPMGOffline},get setDisableAllPMGOffline(){return e.setDisableAllPMGOffline},get disableAllDockerHostsOffline(){return e.disableAllDockerHostsOffline},get setDisableAllDockerHostsOffline(){return e.setDisableAllDockerHostsOffline},get resetGuestDefaults(){return e.resetGuestDefaults},get resetNodeDefaults(){return e.resetNodeDefaults},get resetDockerDefaults(){return e.resetDockerDefaults},get resetDockerIgnoredPrefixes(){return e.resetDockerIgnoredPrefixes},get resetStorageDefault(){return e.resetStorageDefault},get factoryGuestDefaults(){return e.factoryGuestDefaults},get factoryNodeDefaults(){return e.factoryNodeDefaults},get factoryDockerDefaults(){return e.factoryDockerDefaults},get factoryStorageDefault(){return e.factoryStorageDefault}})}function o1(e){const[r,s]=Z([]),[l,o]=Z(!1),[a,d]=Z(null);vr(async()=>{try{const b=await fn.getWebhooks();s(b.map(p=>({...p,service:p.service||"generic"})))}catch(b){console.error("Failed to load webhooks:",b)}});const c=async()=>{o(!0);try{const b=e.emailConfig();await fn.testNotification({type:"email",config:{...b}}),Wt("Test email sent successfully!","Check your inbox.")}catch(b){console.error("Failed to send test email:",b),$t("Failed to send test email",b instanceof Error?b.message:"Unknown error")}finally{o(!1)}},g=async(b,p)=>{d(b);try{p?await fn.testWebhook(p):await fn.testNotification({type:"webhook",webhookId:b}),Wt("Test webhook sent successfully!")}catch(m){$t("Failed to send test webhook",m instanceof Error?m.message:"Unknown error")}finally{d(null)}};return(()=>{var b=_v();return t(b,n(Yn,{title:"Email notifications",description:"Configure SMTP delivery for alert emails.",get action(){return n(Tn,{get checked(){return e.emailConfig().enabled},onChange:p=>{e.setEmailConfig({...e.emailConfig(),enabled:p.currentTarget.checked}),e.setHasUnsavedChanges(!0)},containerClass:"sm:self-start",get label(){return(()=>{var p=As();return t(p,()=>e.emailConfig().enabled?"Enabled":"Disabled"),p})()}})},class:"min-w-0",bodyClass:"",get children(){var p=$v();return t(p,n(Vp,{get config(){return e.emailConfig()},onChange:m=>{e.setEmailConfig(m),e.setHasUnsavedChanges(!0)},onTest:c,get testing(){return l()}})),q(()=>y(p,`${e.emailConfig().enabled?"transition-opacity":"pointer-events-none opacity-50 transition-opacity"}`)),p}}),null),t(b,n(Yn,{title:"Webhooks",description:"Push alerts to chat apps or automation systems.",get action(){return(()=>{var p=Cv(),m=p.firstChild;return t(p,()=>r().length,m),p})()},class:"min-w-0",bodyClass:"space-y-4",get children(){return n(ay,{get webhooks(){return r()},onAdd:async p=>{try{const m=await fn.createWebhook(p);s([...r(),m]),Wt("Webhook added successfully")}catch(m){console.error("Failed to add webhook:",m),$t(m instanceof Error?m.message:"Failed to add webhook")}},onUpdate:async p=>{try{const m=await fn.updateWebhook(p.id,p);s(r().map(S=>S.id===p.id?m:S)),Wt("Webhook updated successfully")}catch(m){console.error("Failed to update webhook:",m),$t(m instanceof Error?m.message:"Failed to update webhook")}},onDelete:async p=>{try{await fn.deleteWebhook(p),s(r().filter(m=>m.id!==p)),Wt("Webhook deleted successfully")}catch(m){console.error("Failed to delete webhook:",m),$t(m instanceof Error?m.message:"Failed to delete webhook")}},onTest:g,get testing(){return a()}})}}),null),b})()}function d1(e){const r=e.quietHours,s=e.setQuietHours,l=e.cooldown,o=e.setCooldown,a=e.grouping,d=e.setGrouping,c=e.escalation,g=e.setEscalation,b=()=>{s(la()),o(ml()),d(xl()),g(bl()),e.setHasUnsavedChanges(!0)},p=["UTC","Africa/Cairo","Africa/Johannesburg","Africa/Lagos","Africa/Nairobi","America/Anchorage","America/Argentina/Buenos_Aires","America/Bogota","America/Caracas","America/Chicago","America/Denver","America/Halifax","America/Lima","America/Los_Angeles","America/Mexico_City","America/New_York","America/Phoenix","America/Santiago","America/Sao_Paulo","America/St_Johns","America/Toronto","America/Vancouver","Asia/Bangkok","Asia/Dhaka","Asia/Dubai","Asia/Hong_Kong","Asia/Jakarta","Asia/Jerusalem","Asia/Karachi","Asia/Kolkata","Asia/Kuala_Lumpur","Asia/Manila","Asia/Riyadh","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Taipei","Asia/Tehran","Asia/Tokyo","Australia/Adelaide","Australia/Brisbane","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Athens","Europe/Berlin","Europe/Brussels","Europe/Budapest","Europe/Copenhagen","Europe/Dublin","Europe/Helsinki","Europe/Istanbul","Europe/Lisbon","Europe/London","Europe/Madrid","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Prague","Europe/Rome","Europe/Stockholm","Europe/Vienna","Europe/Warsaw","Europe/Zurich","Pacific/Auckland","Pacific/Fiji","Pacific/Guam","Pacific/Honolulu"],m=[{key:"performance",label:"Performance alerts",description:"CPU, memory, disk, and network thresholds stay quiet."},{key:"storage",label:"Storage alerts",description:"Silence storage usage, disk health, and ZFS events."},{key:"offline",label:"Offline & power state",description:"Skip connectivity and powered-off alerts during backups."}],S=[{id:"monday",label:"M",fullLabel:"Monday"},{id:"tuesday",label:"T",fullLabel:"Tuesday"},{id:"wednesday",label:"W",fullLabel:"Wednesday"},{id:"thursday",label:"T",fullLabel:"Thursday"},{id:"friday",label:"F",fullLabel:"Friday"},{id:"saturday",label:"S",fullLabel:"Saturday"},{id:"sunday",label:"S",fullLabel:"Sunday"}];return(()=>{var z=Rv(),ie=z.firstChild,ne=ie.firstChild,W=ne.nextSibling,X=ie.nextSibling;return W.$$click=b,t(X,n(Yn,{title:"Quiet hours",description:"Pause non-critical alerts during specific times.",get action(){return n(Tn,{get checked(){return r().enabled},onChange:I=>{s({...r(),enabled:I.currentTarget.checked}),e.setHasUnsavedChanges(!0)},containerClass:"sm:self-start",get label(){return(()=>{var I=As();return t(I,()=>r().enabled?"Enabled":"Disabled"),I})()}})},class:"space-y-4",get children(){return n(h,{get when(){return r().enabled},get children(){var I=Sv(),L=I.firstChild,H=L.firstChild,se=H.firstChild,le=se.nextSibling,ee=H.nextSibling,U=ee.firstChild,Y=U.nextSibling,oe=ee.nextSibling,_=oe.firstChild,B=_.nextSibling,$=L.nextSibling,D=$.firstChild,f=D.nextSibling,j=f.nextSibling,K=$.nextSibling,C=K.firstChild,ge=C.nextSibling,J=ge.nextSibling;return y(H,Ht),le.addEventListener("change",N=>{s({...r(),start:N.currentTarget.value}),e.setHasUnsavedChanges(!0)}),y(ee,Ht),Y.addEventListener("change",N=>{s({...r(),end:N.currentTarget.value}),e.setHasUnsavedChanges(!0)}),y(oe,Ht),B.addEventListener("change",N=>{s({...r(),timezone:N.currentTarget.value}),e.setHasUnsavedChanges(!0)}),t(B,n(ze,{each:p,children:N=>(()=>{var F=Iv();return F.value=N,t(F,N),F})()})),t(f,n(ze,{each:S,children:N=>(()=>{var F=fl();return F.$$click=()=>{const P=r().days;s({...r(),days:{...P,[N.id]:!P[N.id]}}),e.setHasUnsavedChanges(!0)},t(F,()=>N.label),q(P=>{var E=N.fullLabel,u=`px-2 py-2 text-xs font-medium transition-all duration-200 ${r().days[N.id]?"rounded-md bg-blue-500 text-white shadow-sm":"rounded-md bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-400 dark:hover:bg-gray-600"}`;return E!==P.e&&Te(F,"title",P.e=E),u!==P.t&&y(F,P.t=u),P},{e:void 0,t:void 0}),F})()})),t(j,n(h,{get when(){return $e(()=>!!(r().days.monday&&r().days.tuesday&&r().days.wednesday&&r().days.thursday&&r().days.friday&&!r().days.saturday))()&&!r().days.sunday},children:"Weekdays only"}),null),t(j,n(h,{get when(){return $e(()=>!!(!r().days.monday&&!r().days.tuesday&&!r().days.wednesday&&!r().days.thursday&&!r().days.friday&&r().days.saturday))()&&r().days.sunday},children:"Weekends only"}),null),t(J,n(ze,{each:m,children:N=>(()=>{var F=Hv(),P=F.firstChild,E=P.nextSibling,u=E.nextSibling,v=u.firstChild,V=v.nextSibling;return P.addEventListener("change",A=>{s({...r(),suppress:{...r().suppress,[N.key]:A.currentTarget.checked}}),e.setHasUnsavedChanges(!0)}),t(E,n(h,{get when(){return r().suppress[N.key]},get children(){return Xa()}})),t(v,()=>N.label),t(V,()=>N.description),q(A=>{var k=`flex cursor-pointer items-start gap-3 rounded-lg border px-3 py-2 transition-colors ${r().suppress[N.key]?"border-blue-500 bg-blue-50 dark:border-blue-400 dark:bg-blue-500/10":"border-gray-200 hover:bg-gray-50 dark:border-gray-600 dark:hover:bg-gray-700"}`,w=`mt-1 flex h-4 w-4 items-center justify-center rounded border-2 ${r().suppress[N.key]?"border-blue-500 bg-blue-500":"border-gray-300 dark:border-gray-600"}`;return k!==A.e&&y(F,A.e=k),w!==A.t&&y(E,A.t=w),A},{e:void 0,t:void 0}),q(()=>P.checked=r().suppress[N.key]),F})()})),q(N=>{var F=yt("text-xs uppercase tracking-[0.08em]"),P=Dt("font-mono"),E=yt("text-xs uppercase tracking-[0.08em]"),u=Dt("font-mono"),v=yt("text-xs uppercase tracking-[0.08em]"),V=Dt("pr-8"),A=`${yt("text-xs uppercase tracking-[0.08em]")} mb-2 block`,k=`${yt("text-xs uppercase tracking-[0.08em]")} block`;return F!==N.e&&y(se,N.e=F),P!==N.t&&y(le,N.t=P),E!==N.a&&y(U,N.a=E),u!==N.o&&y(Y,N.o=u),v!==N.i&&y(_,N.i=v),V!==N.n&&y(B,N.n=V),A!==N.s&&y(D,N.s=A),k!==N.h&&y(C,N.h=k),N},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),q(()=>le.value=r().start),q(()=>Y.value=r().end),q(()=>B.value=r().timezone),I}})}}),null),t(X,n(Yn,{title:"Alert cooldown",description:"Limit alert frequency to prevent spam.",get action(){return n(Tn,{get checked(){return l().enabled},onChange:I=>{o({...l(),enabled:I.currentTarget.checked}),e.setHasUnsavedChanges(!0)},containerClass:"sm:self-start",get label(){return(()=>{var I=As();return t(I,()=>l().enabled?"Enabled":"Disabled"),I})()}})},class:"space-y-4",get children(){return n(h,{get when(){return l().enabled},get children(){var I=Tv(),L=I.firstChild,H=L.firstChild,se=H.firstChild,le=se.nextSibling,ee=le.firstChild,U=le.nextSibling,Y=H.nextSibling,oe=Y.firstChild,_=oe.nextSibling,B=_.firstChild,$=_.nextSibling;return y(H,Ht),ee.addEventListener("change",D=>{o({...l(),minutes:parseInt(D.currentTarget.value)}),e.setHasUnsavedChanges(!0)}),y(U,`${hr} mt-1`),y(Y,Ht),B.addEventListener("change",D=>{o({...l(),maxAlerts:parseInt(D.currentTarget.value)}),e.setHasUnsavedChanges(!0)}),y($,`${hr} mt-1`),q(D=>{var f=yt("text-xs uppercase tracking-[0.08em]"),j=Dt("pr-16"),K=yt("text-xs uppercase tracking-[0.08em]"),C=Dt("pr-16");return f!==D.e&&y(se,D.e=f),j!==D.t&&y(ee,D.t=j),K!==D.a&&y(oe,D.a=K),C!==D.o&&y(B,D.o=C),D},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>ee.value=l().minutes),q(()=>B.value=l().maxAlerts),I}})}}),null),t(X,n(Yn,{title:"Smart grouping",description:"Bundle similar alerts together.",get action(){return n(Tn,{get checked(){return a().enabled},onChange:I=>{d({...a(),enabled:I.currentTarget.checked}),e.setHasUnsavedChanges(!0)},containerClass:"sm:self-start",get label(){return(()=>{var I=As();return t(I,()=>a().enabled?"Enabled":"Disabled"),I})()}})},class:"space-y-4",get children(){return n(h,{get when(){return a().enabled},get children(){var I=Av(),L=I.firstChild,H=L.firstChild,se=H.nextSibling,le=se.firstChild,ee=le.nextSibling,U=ee.firstChild,Y=se.nextSibling,oe=L.nextSibling,_=oe.firstChild,B=_.nextSibling,$=B.firstChild,D=$.firstChild,f=D.nextSibling,j=$.nextSibling,K=j.firstChild,C=K.nextSibling;return y(L,Ht),le.addEventListener("change",ge=>{d({...a(),window:parseInt(ge.currentTarget.value)}),e.setHasUnsavedChanges(!0)}),t(ee,()=>a().window,U),y(Y,`${hr} mt-1`),D.addEventListener("change",ge=>{d({...a(),byNode:ge.currentTarget.checked}),e.setHasUnsavedChanges(!0)}),t(f,n(h,{get when(){return a().byNode},get children(){return Xa()}})),K.addEventListener("change",ge=>{d({...a(),byGuest:ge.currentTarget.checked}),e.setHasUnsavedChanges(!0)}),t(C,n(h,{get when(){return a().byGuest},get children(){return Xa()}})),q(ge=>{var J=yt("text-xs uppercase tracking-[0.08em]"),N=`${yt("text-xs uppercase tracking-[0.08em]")} mb-2 block`,F=`relative flex items-center gap-2 rounded-lg border-2 p-3 transition-all ${a().byNode?"border-blue-500 bg-blue-50 shadow-sm dark:bg-blue-900/20":"border-gray-200 hover:bg-gray-50 dark:border-gray-600 dark:hover:bg-gray-700"}`,P=`flex h-4 w-4 items-center justify-center rounded border-2 ${a().byNode?"border-blue-500 bg-blue-500":"border-gray-300 dark:border-gray-600"}`,E=`relative flex items-center gap-2 rounded-lg border-2 p-3 transition-all ${a().byGuest?"border-blue-500 bg-blue-50 shadow-sm dark:bg-blue-900/20":"border-gray-200 hover:bg-gray-50 dark:border-gray-600 dark:hover:bg-gray-700"}`,u=`flex h-4 w-4 items-center justify-center rounded border-2 ${a().byGuest?"border-blue-500 bg-blue-500":"border-gray-300 dark:border-gray-600"}`;return J!==ge.e&&y(H,ge.e=J),N!==ge.t&&y(_,ge.t=N),F!==ge.a&&y($,ge.a=F),P!==ge.o&&y(f,ge.o=P),E!==ge.i&&y(j,ge.i=E),u!==ge.n&&y(C,ge.n=u),ge},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),q(()=>le.value=a().window),q(()=>D.checked=a().byNode),q(()=>K.checked=a().byGuest),I}})}}),null),t(X,n(Yn,{title:"Alert escalation",description:"Notify additional contacts for persistent issues.",get action(){return n(Tn,{get checked(){return c().enabled},onChange:I=>{g({...c(),enabled:I.currentTarget.checked}),e.setHasUnsavedChanges(!0)},containerClass:"sm:self-start",get label(){return(()=>{var I=As();return t(I,()=>c().enabled?"Enabled":"Disabled"),I})()}})},class:"space-y-4",get children(){return n(h,{get when(){return c().enabled},get children(){var I=Dv(),L=I.firstChild,H=L.nextSibling;return y(L,hr),t(I,n(ze,{get each(){return c().levels},children:(se,le)=>(()=>{var ee=Uv(),U=ee.firstChild,Y=U.firstChild,oe=Y.firstChild,_=oe.nextSibling,B=Y.nextSibling,$=B.firstChild,D=$.nextSibling,f=U.nextSibling;return _.addEventListener("change",j=>{const K=[...c().levels],C=Number.parseInt(j.currentTarget.value,10);K[le()]={...se,after:Number.isNaN(C)?se.after:C},g({...c(),levels:K}),e.setHasUnsavedChanges(!0)}),D.addEventListener("change",j=>{const K=[...c().levels];K[le()]={...se,notify:j.currentTarget.value},g({...c(),levels:K}),e.setHasUnsavedChanges(!0)}),f.$$click=()=>{const j=c().levels.filter((K,C)=>C!==le());g({...c(),levels:j}),e.setHasUnsavedChanges(!0)},q(j=>{var K=`${Dt("px-2 py-1 text-sm")} w-20`,C=`${Dt("px-2 py-1 text-sm")} flex-1`;return K!==j.e&&y(_,j.e=K),C!==j.t&&y(D,j.t=C),j},{e:void 0,t:void 0}),q(()=>_.value=se.after),q(()=>D.value=se.notify),ee})()}),H),H.$$click=()=>{const se=c().levels[c().levels.length-1],le=typeof se?.after=="number"?se.after+30:15;g({...c(),levels:[...c().levels,{after:le,notify:"all"}]}),e.setHasUnsavedChanges(!0)},I}})}}),null),t(X,n(Yn,{title:"Configuration summary",description:"Preview of the active schedule settings.",tone:"muted",padding:"lg",bodyClass:"space-y-1 text-sm text-blue-800 dark:text-blue-300",class:"lg:col-span-2",get children(){return[n(h,{get when(){return r().enabled},get children(){var I=Mv(),L=I.firstChild,H=L.nextSibling,se=H.nextSibling,le=se.nextSibling,ee=le.nextSibling,U=ee.nextSibling;return U.nextSibling,t(I,()=>r().start,H),t(I,()=>r().end,le),t(I,()=>r().timezone,U),I}}),n(h,{get when(){return $e(()=>!!r().enabled)()&&(r().suppress.performance||r().suppress.storage||r().suppress.offline)},get children(){var I=Pv(),L=I.firstChild,H=L.nextSibling;return H.nextSibling,t(I,()=>m.filter(se=>r().suppress[se.key]).map(se=>se.label).join(", "),H),I}}),n(h,{get when(){return l().enabled},get children(){var I=Ev(),L=I.firstChild,H=L.nextSibling,se=H.nextSibling,le=se.nextSibling;return le.nextSibling,t(I,()=>l().minutes,H),t(I,()=>l().maxAlerts,le),I}}),n(h,{get when(){return a().enabled},get children(){var I=Nv(),L=I.firstChild,H=L.nextSibling;return H.nextSibling,t(I,()=>a().window,H),t(I,n(h,{get when(){return a().byNode||a().byGuest},get children(){return[" ","by"," ",$e(()=>[a().byNode&&"node",a().byGuest&&"guest"].filter(Boolean).join(" and "))]}}),null),I}}),n(h,{get when(){return $e(()=>!!c().enabled)()&&c().levels.length>0},get children(){var I=Ov(),L=I.firstChild,H=L.nextSibling,se=H.nextSibling,le=se.nextSibling;return le.nextSibling,t(I,()=>c().levels.length,H),t(I,()=>c().levels.length>1?"s":"",le),I}}),n(h,{get when(){return $e(()=>!r().enabled&&!l().enabled&&!a().enabled)()&&!c().enabled},get children(){return Lv()}})]}}),null),z})()}function c1(){const{state:e,activeAlerts:r}=qr(),[s,l]=Z(localStorage.getItem("alertHistoryTimeFilter")||"7d"),[o,a]=Z(localStorage.getItem("alertHistorySeverityFilter")||"all"),[d,c]=Z(""),[g,b]=Z([]),[p,m]=Z(!0),[S,z]=Z(null),ie=3600*1e3,ne=Intl.DateTimeFormat().resolvedOptions().locale||(typeof navigator<"u"?navigator.language:void 0)||"en-US",W=P=>{const E={},u=Date.now();switch(P){case"24h":E.limit=2e3,E.startTime=new Date(u-24*ie).toISOString();break;case"7d":E.limit=1e4,E.startTime=new Date(u-168*ie).toISOString();break;case"30d":E.limit=1e4,E.startTime=new Date(u-720*ie).toISOString();break;case"all":E.limit=0;break;default:E.limit=1e3}return E};let X=0;const I=async P=>{const E=++X;m(!0);try{const u=await es.getHistory(W(P));E===X&&b(u)}catch(u){E===X&&console.error("Failed to load alert history:",u)}finally{E===X&&m(!1)}};let L;ft(()=>{localStorage.setItem("alertHistoryTimeFilter",s())}),ft(()=>{localStorage.setItem("alertHistorySeverityFilter",o())});let H=null;ft(()=>{const P=s();H!==null&&P!==H&&z(null),H=P});let se=null;ft(()=>{const P=o();se!==null&&P!==se&&z(null),se=P}),vr(()=>{I(s());const P=E=>{const u=document.activeElement;if(u&&(u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.tagName==="SELECT")){E.key==="Escape"&&u===L&&(c(""),L.blur());return}E.key.length===1&&!E.ctrlKey&&!E.metaKey&&!E.altKey&&L?.focus()};document.addEventListener("keydown",P),Ar(()=>{document.removeEventListener("keydown",P),X++})});let le=!0;ft(()=>{const P=s();if(le){le=!1;return}I(P)});const ee=(P,E)=>{const u=new Date(P).getTime(),V=(E?new Date(E).getTime():Date.now())-u;if(V<0)return"0m";const A=Math.floor(V/6e4),k=Math.floor(A/60),w=Math.floor(k/24);return w>0?`${w}d ${k%24}h`:k>0?`${k}h ${A%60}m`:`${A}m`},U=(P,E)=>{const u=new Date(P),v=new Date(E),V=u.getFullYear()===v.getFullYear()&&u.getMonth()===v.getMonth()&&u.getDate()===v.getDate(),A=u.toLocaleDateString(ne,{month:"short",day:"numeric",year:u.getFullYear()!==v.getFullYear()?"numeric":void 0}),k=v.toLocaleDateString(ne,{month:"short",day:"numeric",year:"numeric"}),w={hour:"numeric",minute:"2-digit"},de=u.toLocaleTimeString(ne,w),fe=v.toLocaleTimeString(ne,w);return V?`${A}, ${de} – ${fe}`:`${A}, ${de} → ${k}, ${fe}`},Y=(P,E)=>{const u=typeof E?.resourceType=="string"?E.resourceType:void 0;return u&&u.trim().length>0?u:e.vms?.find(R=>R.name===P)?"VM":e.containers?.find(R=>R.name===P)?"CT":e.nodes?.find(R=>R.name===P)?"Node":e.storage?.find(R=>R.name===P||R.id===P)?"Storage":e.dockerHosts?.find(R=>R.displayName===P||R.hostname===P||R.agentId===P||R.id===P)?"Docker Host":e.dockerHosts?.flatMap(R=>R.containers||[]).find(R=>R.name===P||R.id===P)?"Docker Container":e.pbs?.find(R=>R.name===P||R.host===P||R.id===P)?"PBS":e.cephClusters?.find(R=>R.name===P||R.id===P)?"Ceph":"Unknown"},oe=pe(()=>{const P=[];Object.values(r||{}).forEach(u=>{P.push({...u,status:"active",duration:ee(u.startTime),resourceType:Y(u.resourceName,u.metadata)})});const E=new Set(Object.keys(r||{}));return g().forEach(u=>{E.has(u.id)||P.push({...u,status:u.acknowledged?"acknowledged":"resolved",duration:ee(u.startTime,u.lastSeen),resourceType:Y(u.resourceName,u.metadata)})}),P}),_=pe(()=>{let P=oe();if(o()!=="all"&&(P=P.filter(E=>E.level===o())),d()){const E=d().toLowerCase();P=P.filter(u=>{const v=u.resourceName?.toLowerCase()??"",V=u.message?.toLowerCase()??"",A=u.type?.toLowerCase()??"",k=u.node?.toLowerCase()??"";return v.includes(E)||V.includes(E)||A.includes(E)||k.includes(E)})}return P}),B=pe(()=>{let P=_();if(S()!==null){const E=K(),u=S(),v=E.bucketTimes[u],V=v+E.bucketSize*ie;P=P.filter(A=>{const k=new Date(A.startTime).getTime();return k>=v&&k<V})}else if(s()!=="all"){const E=Date.now(),u={"24h":E-1440*60*1e3,"7d":E-10080*60*1e3,"30d":E-720*60*60*1e3}[s()];u&&(P=P.filter(v=>new Date(v.startTime).getTime()>u))}return[...P].sort((E,u)=>new Date(u.startTime).getTime()-new Date(E.startTime).getTime())}),$=["January","February","March","April","May","June","July","August","September","October","November","December"],D=P=>{if(P>=11&&P<=13)return"th";switch(P%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},f=(P,E,u)=>{const v=$[P.getMonth()],V=P.getDate(),A=D(V),k=`${v} ${V}${A}`;return P.getTime()===E?`Today (${k})`:P.getTime()===u?`Yesterday (${k})`:k},j=pe(()=>{const P=new Date,E=new Date(P.getFullYear(),P.getMonth(),P.getDate()),u=E.getTime(),v=new Date(E);v.setDate(v.getDate()-1);const V=v.getTime(),A=new Map;return B().forEach(k=>{const w=new Date(k.startTime),de=new Date(w.getFullYear(),w.getMonth(),w.getDate()),fe=de.getTime();A.has(fe)||A.set(fe,{date:de,label:f(de,u,V),fullLabel:de.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),alerts:[]}),A.get(fe).alerts.push(k)}),Array.from(A.values()).sort((k,w)=>w.date.getTime()-k.date.getTime())}),K=pe(()=>{const P=Date.now(),E=ie,u=_(),v=[1,2,3,6,12,24,48,72,168,336,720,1440],V=30;let A,k,w;const de=s();if(de==="24h")A=1,k=24,w=P-k*E;else if(de==="7d")A=6,k=168,w=P-k*E;else if(de==="30d")A=24,k=720,w=P-k*E;else if(!u.length)A=24,k=24,w=P-k*E;else{const te=u.reduce((ue,re)=>{const O=new Date(re.startTime).getTime();return Math.min(ue,O)},P),ae=Math.max(1,Math.ceil((P-te)/E)),M=Math.max(1,Math.ceil(ae/V));A=v.find(ue=>ue>=M)??M,k=Math.max(ae,A);const ce=Math.min(Math.max(1,Math.ceil(k/A)),V);w=P-ce*A*E}const fe=Math.min(Math.max(1,Math.ceil(k/A)),V);w=Math.min(w,P-fe*A*E);const x=new Array(fe).fill(0),R=new Array(fe).fill(0).map((te,ae)=>w+ae*A*E),Q=w,G=P;u.forEach(te=>{const ae=new Date(te.startTime).getTime();if(ae<Q||ae>G)return;const M=Math.floor((ae-Q)/(A*E)),ce=Math.min(fe-1,Math.max(0,M));ce>=0&&ce<fe&&x[ce]++});const T=Math.max(...x,1);return{buckets:x,max:T,bucketSize:A,bucketTimes:R,rangeStart:Q,rangeHours:fe*A}}),C=pe(()=>{const P=K().bucketSize;if(!Number.isFinite(P)||P<=0)return"—";if(P%24===0){const E=P/24;return`${E} day${E===1?"":"s"}`}return`${P} hour${P===1?"":"s"}`}),ge=(P,E,u,v=!1)=>{if(!Number.isFinite(P))return"—";if(v&&Math.abs(Date.now()-P)<E*ie*.75)return"Now";const V=new Date(P),A={};return u<=48?(A.month="short",A.day="numeric",A.hour="2-digit",A.minute="2-digit"):u<=2160?(A.month="short",A.day="numeric",(E<=12||u<=336)&&(A.hour="2-digit")):(A.year="numeric",A.month="short",A.day="numeric"),V.toLocaleString(ne,A)},J=pe(()=>{const P=K();if(!P.bucketTimes.length||P.bucketSize<=0)return null;const E=P.bucketSize,u=Math.max(P.rangeHours??E,E),v=P.bucketTimes[0],V=v+P.buckets.length*E*ie;return{startLabel:ge(v,E,u),endLabel:ge(V,E,u,!0)}}),N=pe(()=>{const P=K();if(!P.bucketTimes.length||P.bucketSize<=0)return[];const E=P.bucketSize,u=Math.max(P.rangeHours??E,E),v=P.bucketTimes[0],V=Math.max(P.buckets.length*E*ie,E*ie),A=v+V,k=Math.min(5,P.bucketTimes.length+1),w=Math.max(1,Math.round(P.bucketTimes.length/Math.max(1,k-1))),de=[];for(let x=0;x<P.bucketTimes.length;x+=w){const R=P.bucketTimes[x],Q=Math.min(1,Math.max(0,(R-v)/(V||1)));de.push({position:Q,label:ge(R,E,u)})}!de.length||de[0].position>.01?de.unshift({position:0,label:ge(v,E,u)}):de[0]={position:0,label:ge(v,E,u)};const fe=de[de.length-1];return!fe||Math.abs(fe.position-1)>.01?de.push({position:1,label:ge(A,E,u,!0)}):de[de.length-1]={position:1,label:ge(A,E,u,!0)},de.map((x,R,Q)=>({position:x.position,label:x.label,align:R===0?"start":R===Q.length-1?"end":"center"}))}),F=pe(()=>{const P=S();if(P===null)return null;const E=K(),u=E.bucketTimes[P],v=u+E.bucketSize*ie;return{rangeLabel:U(u,v),start:u,end:v}});return(()=>{var P=Wv(),E=P.firstChild,u=E.firstChild,v=u.nextSibling,V=v.nextSibling,A=V.firstChild;t(P,n(it,{padding:"md",get children(){return[(()=>{var w=jv(),de=w.firstChild,fe=de.firstChild,x=fe.firstChild,R=x.firstChild;R.nextSibling;var Q=fe.nextSibling,G=Q.firstChild,T=G.firstChild,te=T.firstChild,ae=te.nextSibling,M=T.nextSibling,ce=M.firstChild,ue=ce.nextSibling;return t(w,n(rr,{title:"Alert frequency",get description(){return(()=>{var re=qv(),O=re.firstChild;return t(re,()=>B().length,O),re})()},size:"sm",class:"flex-1"}),de),t(de,n(h,{get when(){return F()},children:re=>(()=>{var O=Kv(),xe=O.firstChild,he=xe.nextSibling;return t(he,()=>re().rangeLabel),O})()}),fe),t(x,C,null),t(fe,n(h,{get when(){return J()},children:re=>(()=>{var O=Jv(),xe=O.firstChild,he=xe.nextSibling,me=he.nextSibling,_e=me.nextSibling;return t(he,()=>re().startLabel),t(_e,()=>re().endLabel),O})()}),null),t(Q,n(h,{get when(){return S()!==null},get children(){var re=Bv();return re.$$click=()=>z(null),re}}),G),t(T,()=>B().filter(re=>re.level==="warning").length,ae),t(M,()=>B().filter(re=>re.level==="critical").length,ue),w})(),(()=>{var w=Fv(),de=w.firstChild,fe=de.nextSibling,x=fe.nextSibling,R=x.nextSibling,Q=R.nextSibling,G=Q.nextSibling;return G.nextSibling,t(w,()=>K().buckets.length,fe),t(w,C,R),t(w,()=>B().length,G),w})(),$e(()=>(()=>{const w=K();return(()=>{var de=Qv(),fe=de.firstChild;return t(fe,()=>w.buckets.map((x,R)=>{const Q=x>0?Math.min(100,Math.max(20,Math.log(x+1)*20)):0,G=x>0?Math.max(8,Q/100*40):0,T=S()===R,te=w.bucketTimes[R],ae=te+w.bucketSize*ie,M=U(te,ae),ce=w.bucketSize%24===0?`${w.bucketSize/24} day${w.bucketSize/24===1?"":"s"}`:`${w.bucketSize} hour${w.bucketSize===1?"":"s"}`,ue=x===0?"No alerts":`${x} alert${x===1?"":"s"}`,re=[ue,`${ce} period`,M].join(`
|
||
`);return(()=>{var O=Yv(),xe=O.firstChild,he=xe.nextSibling;return O.$$keydown=me=>{(me.key==="Enter"||me.key===" ")&&(me.preventDefault(),z(R===S()?null:R))},O.$$click=()=>z(R===S()?null:R),Te(O,"aria-pressed",T),Te(O,"aria-label",`${ue} between ${M}`),he.addEventListener("mouseleave",()=>Cn()),he.addEventListener("mouseenter",me=>{if(x<=0){Cn();return}const _e=me.currentTarget.getBoundingClientRect();Xn(re,_e.left+_e.width/2,_e.top,{align:"center",direction:"up"})}),`${G}px`!=null?he.style.setProperty("height",`${G}px`):he.style.removeProperty("height"),(x>0?T?"#2563eb":"#3b82f6":"transparent")!=null?he.style.setProperty("background-color",x>0?T?"#2563eb":"#3b82f6":"transparent"):he.style.removeProperty("background-color"),(T?"1":"0.8")!=null?he.style.setProperty("opacity",T?"1":"0.8"):he.style.removeProperty("opacity"),(T?"0 0 0 2px rgba(37, 99, 235, 0.4)":"none")!=null?he.style.setProperty("box-shadow",T?"0 0 0 2px rgba(37, 99, 235, 0.4)":"none"):he.style.removeProperty("box-shadow"),Te(he,"title",M),O})()})),de})()})()),n(h,{get when(){return N().length>0},get children(){var w=Vv();return w.firstChild,t(w,n(ze,{get each(){return N()},children:de=>(()=>{var fe=Xv(),x=fe.firstChild,R=x.nextSibling;return t(R,()=>de.label),q(Q=>{var G=`${de.position*100}%`,T=de.align==="center",te=de.align==="end";return G!==Q.e&&((Q.e=G)!=null?fe.style.setProperty("left",G):fe.style.removeProperty("left")),T!==Q.t&&R.classList.toggle("-translate-x-1/2",Q.t=T),te!==Q.a&&R.classList.toggle("-translate-x-full",Q.a=te),Q},{e:void 0,t:void 0,a:void 0}),fe})()}),null),w}})]}}),E),u.addEventListener("change",w=>l(w.currentTarget.value)),v.addEventListener("change",w=>a(w.currentTarget.value)),A.$$keydown=w=>{w.key==="Escape"&&(c(""),w.currentTarget.blur())},A.$$input=w=>c(w.currentTarget.value);var k=L;return typeof k=="function"?fr(k,A):L=A,t(P,n(h,{get when(){return p()},get fallback(){return n(h,{get when(){return B().length>0},get fallback(){return e1()},get children(){var w=Zv(),de=w.firstChild,fe=de.firstChild,x=fe.firstChild,R=x.nextSibling;return t(R,n(ze,{get each(){return j()},children:Q=>[(()=>{var G=t1(),T=G.firstChild,te=T.firstChild,ae=te.firstChild,M=ae.nextSibling,ce=M.firstChild;return t(ae,()=>Q.label),t(M,()=>Q.alerts.length,ce),t(M,()=>Q.alerts.length===1?"alert":"alerts",null),q(()=>Te(ae,"title",Q.fullLabel)),G})(),n(ze,{get each(){return Q.alerts},children:G=>(()=>{var T=r1(),te=T.firstChild,ae=te.nextSibling,M=ae.nextSibling,ce=M.firstChild,ue=M.nextSibling,re=ue.firstChild,O=ue.nextSibling,xe=O.nextSibling,he=xe.nextSibling,me=he.firstChild,_e=he.nextSibling;return t(te,()=>new Date(G.startTime).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})),t(ae,()=>G.resourceName),t(ce,()=>G.type),t(re,()=>G.level),t(O,()=>G.message),t(xe,()=>G.duration),t(me,()=>G.status),t(_e,()=>G.node||"—"),q(Ce=>{var Oe=`border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700 ${G.status==="active"?"bg-red-50 dark:bg-red-900/10":""}`,tt=`text-xs px-1 py-0.5 rounded ${G.resourceType==="VM"?"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300":G.resourceType==="CT"?"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300":G.resourceType==="Node"?"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300":G.resourceType==="Storage"?"bg-orange-100 dark:bg-orange-900/50 text-orange-700 dark:text-orange-300":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,Ze=`text-xs px-2 py-0.5 rounded font-medium ${G.level==="critical"?"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300":"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300"}`,bt=G.message,ct=`text-xs px-2 py-0.5 rounded ${G.status==="active"?"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300 font-medium":G.status==="acknowledged"?"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`;return Oe!==Ce.e&&y(T,Ce.e=Oe),tt!==Ce.t&&y(ce,Ce.t=tt),Ze!==Ce.a&&y(re,Ce.a=Ze),bt!==Ce.o&&Te(O,"title",Ce.o=bt),ct!==Ce.i&&y(me,Ce.i=ct),Ce},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),T})()})]})),w}})},get children(){return Gv()}}),null),t(P,n(h,{get when(){return g().length>0},get children(){var w=zv(),de=w.firstChild,fe=de.firstChild,x=fe.firstChild,R=x.nextSibling;return R.$$click=async()=>{if(confirm(`Are you sure you want to clear all alert history?
|
||
|
||
This will permanently delete all historical alert data and cannot be undone.
|
||
|
||
This is typically only used for system maintenance or when starting fresh with a new monitoring setup.`))try{await es.clearHistory(),b([])}catch(Q){console.error("Error clearing alert history:",Q),$t("Error clearing alert history","Please check your connection and try again.")}},w}}),null),q(()=>u.value=s()),q(()=>v.value=o()),q(()=>A.value=d()),P})()}Xt(["click","input","keydown"]);var u1=i("<button type=button>"),g1=i('<svg class="h-4 w-4"viewBox="0 0 20 20"fill=currentColor aria-hidden=true><path fill-rule=evenodd d="M16.707 5.293a1 1 0 00-1.414 0L8 12.586 4.707 9.293a1 1 0 00-1.414 1.414l4 4a1 1 0 001.414 0l8-8a1 1 0 000-1.414z"clip-rule=evenodd>'),h1=i("<span>Copied"),f1=i('<svg class="h-4 w-4"viewBox="0 0 20 20"fill=currentColor aria-hidden=true><path d="M8 2a2 2 0 00-2 2v1H5a3 3 0 00-3 3v7a3 3 0 003 3h6a3 3 0 003-3v-1h1a2 2 0 002-2V7.414a2 2 0 00-.586-1.414l-3.414-3.414A2 2 0 0013.586 2H8zm4 4V3.414L15.586 7H13a1 1 0 01-1-1z"></path><path d="M3 8a1 1 0 011-1h6a1 1 0 011 1v7a1 1 0 01-1 1H4a1 1 0 01-1-1V8z">'),m1=i("<span>");function x1(e){const[r,s]=rs(e,["text","children","class","onClick"]),[l,o]=Z(!1);let a;const d=async c=>{const g=r.onClick;if(typeof g=="function"?g(c):g&&typeof g.handleEvent=="function"&&g.handleEvent(c),!c.defaultPrevented)try{await navigator.clipboard.writeText(r.text),o(!0),window.clearTimeout(a),a=window.setTimeout(()=>o(!1),2e3)}catch(b){console.error("Failed to copy to clipboard",b)}};return Ar(()=>{a&&window.clearTimeout(a)}),(()=>{var c=u1();return bs(c,kr(s,{onClick:d,get class(){return`inline-flex items-center justify-center gap-2 rounded-md border border-transparent bg-blue-600 px-4 py-2 text-xs sm:text-sm font-medium text-white shadow-sm transition-colors hover:bg-blue-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400 ${r.class??""}`}}),!1,!0),t(c,(()=>{var g=$e(()=>!!l());return()=>g()?[g1(),h1()]:[f1(),(()=>{var b=m1();return t(b,()=>r.children),b})()]})()),c})()}var b1=i('<button type=button class="absolute right-9 top-1/2 -translate-y-1/2 transform text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"aria-label="Clear search"title="Clear search"><svg class="h-4 w-4"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),p1=i('<div class="max-h-52 overflow-y-auto py-1">'),y1=i('<button type=button class="flex w-full items-center justify-center gap-2 border-t border-gray-200 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 focus:outline-none dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700/80 dark:hover:text-gray-200"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3m-9 0h12"></path></svg>Clear history'),v1=i('<div class="absolute left-0 right-0 top-full z-50 mt-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white text-sm shadow-xl dark:border-gray-700 dark:bg-gray-800"role=listbox>'),k1=i('<div class="inline-flex rounded-lg bg-gray-100 dark:bg-gray-700 p-0.5"><button type=button>Grouped</button><button type=button>List'),w1=i('<div class="flex items-center gap-1 rounded-full bg-blue-50 px-2 py-1 text-xs font-medium text-blue-700 dark:bg-blue-900/40 dark:text-blue-200"><span>Host: </span><button type=button class="text-blue-500 hover:text-blue-700 dark:text-blue-300 dark:hover:text-blue-100"title="Clear host filter">×'),$1=i('<div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block"aria-hidden=true>'),_1=i('<button type=button class="flex items-center justify-center gap-1 px-2.5 py-1 text-xs font-medium rounded-lg text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-900/70 transition-colors"title="Reset filters"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg><span class="hidden sm:inline">Reset'),C1=i('<div class="flex flex-col lg:flex-row gap-3"><div class="flex gap-2 flex-1 items-center"><div class="relative flex-1"><input type=text placeholder="Search containers or host:hostname"class="w-full pl-9 pr-16 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 dark:focus:border-blue-400 outline-none transition-all"title="Search containers by name, image, ID, or host"><svg class="absolute left-3 top-2 h-4 w-4 text-gray-400 dark:text-gray-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><div class="absolute inset-y-0 right-2 flex items-center gap-1"><button type=button class="flex h-6 w-6 items-center justify-center rounded-lg border border-transparent text-gray-400 transition-colors hover:border-gray-200 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:border-gray-700 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"aria-haspopup=listbox><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l2.5 1.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span class=sr-only>Show search history</span></button></div></div></div><div class="flex flex-wrap items-center gap-2">'),S1=i('<div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400">Searches you run will appear here.'),T1=i('<div class="flex items-center justify-between px-2 py-1.5 hover:bg-blue-50 dark:hover:bg-blue-900/20"><button type=button class="flex-1 truncate pr-2 text-left text-sm text-gray-700 transition-colors hover:text-blue-600 focus:outline-none dark:text-gray-200 dark:hover:text-blue-300"></button><button type=button class="ml-1 flex h-6 w-6 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-offset-1 focus:ring-offset-white dark:text-gray-500 dark:hover:bg-gray-700/70 dark:hover:text-gray-200 dark:focus:ring-blue-400/40 dark:focus:ring-offset-gray-900"title="Remove from history"><svg class="h-3.5 w-3.5"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg><span class=sr-only>Remove from history');const A1=e=>{const r=_a(Fs.DOCKER_SEARCH_HISTORY),[s,l]=Z([]),[o,a]=Z(!1);let d,c,g;vr(()=>{l(r.read())});const b=L=>{const H=L.trim();if(!H)return;const se=r.add(H);l(se)},p=L=>{l(r.remove(L))},m=()=>{l(r.clear()),a(!1),queueMicrotask(()=>g?.blur())},S=()=>{a(!1),queueMicrotask(()=>g?.blur())},z=L=>{const H=L.target,se=c?.contains(H)??!1,le=g?.contains(H)??!1;!se&&!le&&S()};ft(()=>{o()?document.addEventListener("mousedown",z):document.removeEventListener("mousedown",z)}),Ar(()=>{document.removeEventListener("mousedown",z)});const ie=()=>{queueMicrotask(()=>d?.focus())};let ne=!1;const W=()=>{ne=!0,queueMicrotask(()=>{ne=!1})},X=pe(()=>e.search().trim()!==""||!!e.groupingMode&&e.groupingMode()==="flat"||!!e.activeHostName),I=()=>{e.setSearch(""),e.setGroupingMode?.("grouped"),e.onClearHost?.(),e.onReset?.(),S(),ie()};return n(it,{class:"docker-filter mb-3",padding:"sm",get children(){var L=C1(),H=L.firstChild,se=H.firstChild,le=se.firstChild,ee=le.nextSibling,U=ee.nextSibling,Y=U.firstChild,oe=H.nextSibling;return le.addEventListener("blur",_=>{if(ne)return;const B=_.relatedTarget,$=B?c?.contains(B)||g?.contains(B):!1,D=B?.getAttribute("aria-controls")==="docker-search-help";!$&&!D&&b(_.currentTarget.value)}),le.$$keydown=_=>{_.key==="Enter"?(b(_.currentTarget.value),S()):_.key==="ArrowDown"&&s().length>0&&(_.preventDefault(),a(!0))},le.$$input=_=>e.setSearch(_.currentTarget.value),fr(_=>{d=_,e.searchInputRef?.(_)},le),t(se,n(h,{get when(){return e.search()},get children(){var _=b1();return _.$$mousedown=W,_.$$click=()=>e.setSearch(""),_}}),U),Y.$$mousedown=W,Y.$$click=()=>a(_=>{const B=!_;return B||queueMicrotask(()=>g?.blur()),B}),fr(_=>g=_,Y),t(U,n($a,{popoverId:"docker-search-help",intro:"Filter Docker containers quickly",tips:[{code:"name:api",description:'Match containers with "api" in the name'},{code:"image:postgres",description:"Find containers running a specific image"},{code:"host:prod",description:"Show containers on a host"},{code:"state:running",description:"Running containers only"}],triggerVariant:"icon",buttonLabel:"Search tips",openOnHover:!0}),null),t(se,n(h,{get when(){return o()},get children(){var _=v1();return fr(B=>c=B,_),t(_,n(h,{get when(){return s().length>0},get fallback(){return S1()},get children(){return[(()=>{var B=p1();return t(B,n(ze,{get each(){return s()},children:$=>(()=>{var D=T1(),f=D.firstChild,j=f.nextSibling;return f.$$mousedown=W,f.$$click=()=>{e.setSearch($),b($),a(!1),ie()},t(f,$),j.$$mousedown=W,j.$$click=()=>p($),D})()})),B})(),(()=>{var B=y1();return B.$$mousedown=W,B.$$click=m,B})()]}})),_}}),null),t(oe,n(h,{get when(){return e.groupingMode&&e.setGroupingMode},get children(){var _=k1(),B=_.firstChild,$=B.nextSibling;return B.$$click=()=>e.setGroupingMode?.("grouped"),$.$$click=()=>e.setGroupingMode?.("flat"),q(D=>{var f=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupingMode?.()==="grouped"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`,j=`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${e.groupingMode?.()==="flat"?"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"}`;return f!==D.e&&y(B,D.e=f),j!==D.t&&y($,D.t=j),D},{e:void 0,t:void 0}),_}}),null),t(oe,n(h,{get when(){return e.activeHostName},get children(){var _=w1(),B=_.firstChild;B.firstChild;var $=B.nextSibling;return t(B,()=>e.activeHostName,null),$.$$click=()=>e.onClearHost?.(),_}}),null),t(oe,n(h,{get when(){return X()},get children(){return[$1(),(()=>{var _=_1();return _.$$click=I,_})()]}}),null),q(_=>{var B=o(),$=s().length>0?"Show recent searches":"No recent searches yet";return B!==_.e&&Te(Y,"aria-expanded",_.e=B),$!==_.t&&Te(Y,"title",_.t=$),_},{e:void 0,t:void 0}),q(()=>le.value=e.search()),L}})};Xt(["input","keydown","click","mousedown"]);var D1=i("<span>");const M1=(e,r,s,l)=>{switch(e.toLowerCase()){case"online":case"running":case"healthy":return r;case"offline":case"exited":case"failed":case"unhealthy":return l;default:return s}},ia=e=>{const r=(e||"unknown").toLowerCase();return(()=>{var s=D1();return t(s,e||"unknown"),q(()=>y(s,`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold ${M1(r,"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300","bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300","bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300")}`)),s})()};var P1=i('<span class="text-xs text-gray-500 dark:text-gray-400 truncate">(<!>)'),E1=i('<span class="text-xs text-gray-500 dark:text-gray-400"> (Exit <!>)'),N1=i('<tr><td class="py-0.5 pr-2 pl-4 relative overflow-hidden"><div class="flex items-center gap-2 overflow-hidden"><span class="text-sm font-medium text-gray-900 dark:text-gray-100 truncate"></span></div></td><td class="py-0.5 px-2 overflow-hidden"><div class="flex h-[24px] items-center gap-1 overflow-hidden"></div></td><td class="py-0.5 px-2 overflow-hidden"></td><td class="py-0.5 px-2 overflow-hidden"></td><td class="py-0.5 px-2 text-sm text-gray-600 dark:text-gray-400 align-middle overflow-hidden"><span class=truncate>'),O1=i('<div class="rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Network</div><div class="mt-1 space-y-1">'),L1=i('<div class="rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Ports</div><div class="mt-1 flex flex-wrap gap-1">'),R1=i('<div class="flex items-start gap-1"><span class="text-gray-500 dark:text-gray-400 min-w-[50px]">Image:</span><span class=break-all>'),I1=i('<div class="flex items-start gap-1"><span class="text-gray-500 dark:text-gray-400 min-w-[50px]">Uptime:</span><span>'),H1=i('<div class="flex items-start gap-1"><span class="text-gray-500 dark:text-gray-400 min-w-[50px]">Created:</span><span>'),U1=i('<div class="flex items-start gap-1"><span class="text-gray-500 dark:text-gray-400 min-w-[50px]">Started:</span><span>'),B1=i('<tr><td class="px-4 py-2"colspan=5><div class="grid w-full gap-3 sm:grid-cols-2 lg:grid-cols-3"><div class="rounded border border-gray-200 bg-white/70 p-2 shadow-sm dark:border-gray-600/70 dark:bg-gray-900/30"><div class="text-[11px] font-medium text-gray-700 dark:text-gray-200">Info</div><div class="mt-1 space-y-1 text-gray-600 dark:text-gray-300">'),Mi=i('<span class="text-sm text-gray-400">-'),j1=i('<span class="text-gray-400 dark:text-gray-500">•'),F1=i('<span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">'),V1=i('<span class="rounded bg-purple-100 px-1.5 py-0.5 text-purple-700 dark:bg-purple-900/40 dark:text-purple-200">'),G1=i('<div class="flex flex-wrap items-center gap-1 text-gray-600 dark:text-gray-300"><span class=font-medium>'),z1=i('<span class="rounded bg-blue-100 px-1.5 py-0.5 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">→'),W1=i('<span class="text-xs text-gray-600 dark:text-gray-300">/'),q1=i("<div class=space-y-0>"),K1=i('<svg class="h-12 w-12 animate-spin text-blue-500"fill=none viewBox="0 0 24 24"stroke=currentColor><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),J1=i('<div class="bg-gray-50 dark:bg-gray-800 px-4 py-2 border-b border-gray-200 dark:border-gray-700 flex items-start justify-between gap-2"><div><h3 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Docker Hosts</h3><p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5"> </p></div><button type=button class="inline-flex items-center gap-1 rounded border border-blue-200 dark:border-blue-500/40 bg-white dark:bg-blue-500/10 px-2 py-1 text-[11px] font-medium text-blue-600 dark:text-blue-300 shadow-sm hover:bg-blue-50 dark:hover:bg-blue-500/20 transition-colors"><span class="text-base leading-none">+</span><span>Add Host'),Q1=i('<div class="divide-y divide-gray-200 dark:divide-gray-700">'),Y1=i('<div class="flex gap-4"><div class="flex-1 min-w-0">'),X1=i("<span>⚠ "),Z1=i('<span class="text-[10px] text-gray-500 dark:text-gray-400">'),ek=i('<button type=button><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-2 min-w-0 flex-1"><span></span></div></div><div class="flex items-center justify-between text-xs text-gray-600 dark:text-gray-400 mt-1"><span>/<!> running'),tk=i('<table class="w-full border-collapse table-fixed"><colgroup><col style=width:25%><col style=width:15%><col style=width:20%><col style=width:20%><col style=width:20%></colgroup><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="pl-4 pr-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Container</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Status</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">CPU</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Memory</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Restarts</th></tr></thead><tbody>'),rk=i('<span class="text-xs text-gray-500 dark:text-gray-400">(<!>)'),nk=i("<span>Updated "),Pi=i("<span>Agent "),sk=i('<tr class="bg-gray-50 dark:bg-gray-900/40"><td colspan=5 class="px-4 py-2 border-t-2 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between"><div class="flex items-center gap-3"><h3 class="text-sm font-bold text-gray-900 dark:text-gray-100"></h3><span class="text-xs text-gray-600 dark:text-gray-400"> </span></div><div class="flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400">'),ak=i('<span class="text-sm text-gray-500 dark:text-gray-400">(<!>)'),lk=i('<span class="text-xs text-gray-500 dark:text-gray-400">Updated '),ik=i('<div class="grid grid-cols-3 gap-4"><div><div class="text-[10px] text-gray-500 dark:text-gray-400 mb-1">CPU Usage</div></div><div><div class="text-[10px] text-gray-500 dark:text-gray-400 mb-1">Memory Usage</div></div><div><div class="text-[10px] text-gray-500 dark:text-gray-400 mb-1">Host Uptime</div><div class="text-sm font-medium text-gray-900 dark:text-gray-100">'),ok=i('<div class="bg-gray-50 dark:bg-gray-900/40 border-b-2 border-gray-200 dark:border-gray-700 px-4 py-3"><div class="flex items-center justify-between mb-3"><div class="flex items-center gap-3"><h3 class="text-base font-bold text-gray-900 dark:text-gray-100"></h3><span class="text-sm text-gray-600 dark:text-gray-400"> </span></div><div class="flex items-center gap-3">'),dk=i('<table class="w-full border-collapse table-fixed"><colgroup><col style=width:25%><col style=width:15%><col style=width:20%><col style=width:20%><col style=width:20%></colgroup><thead><tr class="bg-gray-50 dark:bg-gray-700/50 text-gray-600 dark:text-gray-300 border-b border-gray-200 dark:border-gray-600"><th class="pl-4 pr-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Container</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Status</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">CPU</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Memory</th><th class="px-2 py-1.5 text-left text-[11px] sm:text-xs font-medium uppercase tracking-wider">Restarts</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),ck=i('<svg class="h-12 w-12 text-gray-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z">'),uk=i("<span>Deploy the Pulse Docker agent on at least one Docker host to light up this tab. As soon as an agent reports in, container metrics appear automatically."),gk=i('<a href=https://github.com/rcourtman/Pulse/blob/main/docs/DOCKER_MONITORING.md target=_blank rel="noopener noreferrer"class="text-sm text-blue-600 dark:text-blue-400 hover:underline">Read the Docker monitoring guide');const Za=new Map,hk=(e,r)=>`${r}-${e.id}`,Ei=e=>{const{container:r,host:s}=e.entry,l=pe(()=>hk(r,s.id)),[o,a]=Z(Za.get(l())??!1),d=pe(()=>`docker:${s.id}/${r.id}`),c={hasUnacknowledgedAlert:!1,hasAcknowledgedOnlyAlert:!1,severity:null,hasAlert:!1,alertCount:0,unacknowledgedCount:0,acknowledgedCount:0,rowClass:"",indicatorClass:"",badgeClass:""},g=pe(()=>{if(!e.activeAlerts)return c;try{const le=typeof e.activeAlerts=="object"?{...e.activeAlerts}:e.activeAlerts;return wa(d(),le)||c}catch(le){return console.warn("Error getting alert styles for container:",d(),le),c}}),b=Math.max(0,Math.min(100,r.cpuPercent??0)),p=Math.max(0,Math.min(100,r.memoryPercent??0)),m=(()=>{if(!(!r.memoryUsageBytes&&!r.memoryLimitBytes))return r.memoryLimitBytes?`${Zt(r.memoryUsageBytes||0)}/${Zt(r.memoryLimitBytes)}`:`${Zt(r.memoryUsageBytes||0)} used`})(),S=()=>r.uptimeSeconds?js(r.uptimeSeconds):"—",z=()=>r.state?.toLowerCase()==="running",ie=pe(()=>r.ports&&r.ports.length>0||r.networks&&r.networks.length>0||r.createdAt||r.image||z()&&r.uptimeSeconds),ne=le=>{!ie()||le.target.closest("a, button, [data-prevent-toggle]")||a(U=>!U)};ft(Wn(l,le=>{const ee=Za.get(le);a(ee!==void 0?ee:!1)})),ft(()=>{Za.set(l(),o())});const W=pe(()=>g()?.hasUnacknowledgedAlert??!1),X=pe(()=>g()?.hasAcknowledgedOnlyAlert??!1),I=pe(()=>W()||X()),L=pe(()=>{if(I())return W()?g()?.severity==="critical"?"#ef4444":"#eab308":"#9ca3af"}),H=()=>{const le="transition-all duration-200 relative",ee="hover:shadow-sm",U=g()?.severity,Y=W()?U==="critical"?"bg-red-50 dark:bg-red-950/30":"bg-yellow-50 dark:bg-yellow-950/20":"",oe=W()?"":"hover:bg-gray-50 dark:hover:bg-gray-700/30",_=z()?"":"opacity-60",B=ie()?"cursor-pointer":"",$=o()&&!W()?"bg-gray-50 dark:bg-gray-800/40":"";return`${le} ${ee} ${oe} ${Y} ${_} ${B} ${$}`},se=pe(()=>{if(!I())return{};const le=L();return le?{"box-shadow":`inset 4px 0 0 0 ${le}`}:{}});return[(()=>{var le=N1(),ee=le.firstChild,U=ee.firstChild,Y=U.firstChild,oe=ee.nextSibling,_=oe.firstChild,B=oe.nextSibling,$=B.nextSibling,D=$.nextSibling,f=D.firstChild;return le.$$click=ne,t(Y,()=>r.name||r.id.slice(0,12)),t(_,()=>ia(r.state||r.status),null),t(_,n(h,{get when(){return r.health},get children(){var j=P1(),K=j.firstChild,C=K.nextSibling;return C.nextSibling,t(j,()=>r.health,C),j}}),null),t(B,n(h,{get when(){return z()&&r.cpuPercent!==void 0},get fallback(){return Mi()},get children(){return n(un,{value:b,get label(){return`${b.toFixed(0)}%`},type:"cpu"})}})),t($,n(h,{get when(){return z()&&r.memoryPercent!==void 0},get fallback(){return Mi()},get children(){return n(un,{value:p,get label(){return`${p.toFixed(0)}%`},sublabel:m,type:"memory"})}})),t(f,()=>r.restartCount??0,null),t(f,n(h,{get when(){return r.exitCode!==0&&r.exitCode!==void 0},get children(){var j=E1(),K=j.firstChild,C=K.nextSibling;return C.nextSibling,t(j,()=>r.exitCode,C),j}}),null),q(j=>{var K=H(),C=se(),ge=o(),J=r.name||r.id.slice(0,12);return K!==j.e&&y(le,j.e=K),j.t=xs(le,C,j.t),ge!==j.a&&Te(le,"aria-expanded",j.a=ge),J!==j.o&&Te(Y,"title",j.o=J),j},{e:void 0,t:void 0,a:void 0,o:void 0}),le})(),n(h,{get when(){return $e(()=>!!o())()&&ie()},get children(){var le=B1(),ee=le.firstChild,U=ee.firstChild,Y=U.firstChild,oe=Y.firstChild,_=oe.nextSibling;return t(U,n(h,{get when(){return r.networks&&r.networks.length>0},get children(){var B=O1(),$=B.firstChild,D=$.nextSibling;return t(D,n(ze,{get each(){return r.networks},children:f=>(()=>{var j=G1(),K=j.firstChild;return t(K,()=>f.name),t(j,n(h,{get when(){return f.ipv4||f.ipv6},get children(){return[j1(),n(h,{get when(){return f.ipv4},get children(){var C=F1();return t(C,()=>f.ipv4),C}}),n(h,{get when(){return f.ipv6},get children(){var C=V1();return t(C,()=>f.ipv6),C}})]}}),null),j})()})),B}}),Y),t(U,n(h,{get when(){return r.ports&&r.ports.length>0},get children(){var B=L1(),$=B.firstChild,D=$.nextSibling;return t(D,n(ze,{get each(){return r.ports},children:f=>n(h,{get when(){return f.publicPort},get fallback(){return(()=>{var j=W1(),K=j.firstChild;return t(j,()=>f.privatePort,K),t(j,()=>f.protocol,null),j})()},get children(){var j=z1(),K=j.firstChild;return t(j,()=>f.publicPort,K),t(j,()=>f.privatePort,null),j}})})),B}}),Y),t(_,n(h,{get when(){return r.image},get children(){var B=R1(),$=B.firstChild,D=$.nextSibling;return t(D,()=>r.image),B}}),null),t(_,n(h,{get when(){return z()},get children(){var B=I1(),$=B.firstChild,D=$.nextSibling;return t(D,S),B}}),null),t(_,n(h,{get when(){return r.createdAt},get children(){var B=H1(),$=B.firstChild,D=$.nextSibling;return t(D,()=>An(r.createdAt)),B}}),null),t(_,n(h,{get when(){return r.startedAt},get children(){var B=U1(),$=B.firstChild,D=$.nextSibling;return t(D,()=>An(r.startedAt)),B}}),null),q(()=>y(le,`text-[11px] ${z()?"bg-gray-50/60 text-gray-600 dark:bg-gray-800/40 dark:text-gray-300":"bg-gray-100/70 text-gray-400 dark:bg-gray-900/30 dark:text-gray-500"}`)),le}})]},fk=e=>{const r=In(),{initialDataReceived:s,reconnecting:l,connected:o}=qr(),a=pe(()=>{if(typeof s=="function"){const H=Array.isArray(e.hosts)?e.hosts.length:0;return!s()&&H===0}return!1}),d=pe(()=>[...e.hosts||[]].sort((se,le)=>se.displayName.localeCompare(le.displayName))),[c,g]=Z(null),[b,p]=Z(""),m=pe(()=>b().toLowerCase().split(/[\s,]+/).map(H=>H.trim()).filter(Boolean)),S=(H,se,le)=>{const[ee,U]=le.includes(":")?le.split(/:(.+)/):[null,le],Y=U||le,oe=[se.name,se.image,se.id,se.state,se.status,H.displayName,H.hostname,H.status];se.labels&&Object.entries(se.labels).forEach(([B,$])=>{oe.push(`${B}:${$}`)});const _=B=>B.filter(Boolean).some($=>$.toLowerCase().includes(Y));if(ee)switch(ee){case"host":return _([H.displayName,H.hostname]);case"name":return _([se.name]);case"image":return _([se.image]);case"state":return _([se.state,se.status]);case"id":return _([se.id]);case"label":return se.labels?Object.entries(se.labels).some(([B,$])=>`${B}:${$}`.toLowerCase().includes(Y)):!1;default:return _(oe)}return _(oe)},z=(H,se)=>{const le=m();return le.length===0?!0:le.every(ee=>S(H,se,ee))},ie=pe(()=>{const H=c(),se=new Map;return d().forEach(le=>{H&&le.id!==H||(le.containers||[]).forEach(ee=>{if(!z(le,ee))return;const U={host:le,container:ee},Y=se.get(le.id);Y?Y.push(U):se.set(le.id,[U])})}),d().filter(le=>!H||le.id===H).map(le=>({host:le,containers:se.get(le.id)??[]})).filter(le=>le.containers.length>0)}),ne=pe(()=>{const H=ie();return H&&H.length>0&&H.some(se=>se.containers.length>0)}),W=H=>{g(se=>se===H?null:H)},X=pe(()=>{const H=c();return H?d().find(le=>le.id===H)?.displayName:void 0}),I=pe(()=>{const H=c();if(!H)return[];const se=d().find(le=>le.id===H);return se?(se.containers||[]).filter(le=>z(se,le)).map(le=>({host:se,container:le})):[]}),L=pe(()=>{const H=c();return H?d().find(se=>se.id===H):null});return(()=>{var H=q1();return t(H,n(h,{get when(){return a()},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return K1()},get title(){return l()?"Reconnecting to Docker agents...":"Loading Docker data..."},get description(){return $e(()=>!!l())()?"Re-establishing metrics from the monitoring service.":o()?"Waiting for the first Docker update.":"Connecting to the monitoring service."}})}})}}),null),t(H,n(h,{get when(){return!a()},get children(){return n(h,{get when(){return d().length===0},get fallback(){return[n(A1,{search:b,setSearch:p,get activeHostName(){return X()},onClearHost:()=>g(null),onReset:()=>g(null)}),(()=>{var se=Y1(),le=se.firstChild;return t(se,n(it,{padding:"none",class:"w-72 flex-shrink-0 overflow-hidden",get children(){return[(()=>{var ee=J1(),U=ee.firstChild,Y=U.firstChild,oe=Y.nextSibling,_=oe.firstChild,B=U.nextSibling;return t(oe,()=>d().length,_),t(oe,()=>d().length===1?"host":"hosts",null),B.$$click=()=>r("/settings/docker"),ee})(),(()=>{var ee=Q1();return t(ee,n(ze,{get each(){return d()},children:U=>{const Y=()=>c()===U.id,oe=(U.containers||[]).length,_=(U.containers||[]).filter(f=>f.state?.toLowerCase()==="running").length,B=pe(()=>{if(!e.activeAlerts)return{hasAlerts:!1,criticalCount:0,warningCount:0};const f=U.containers||[];let j=0,K=0;return f.forEach(C=>{const ge=`docker:${U.id}/${C.id}`;try{const J=typeof e.activeAlerts=="object"?{...e.activeAlerts}:e.activeAlerts;Object.values(J).filter(F=>F?.resourceId===ge).forEach(F=>{F.level==="critical"?j++:F.level==="warning"&&K++})}catch{}}),{hasAlerts:j>0||K>0,criticalCount:j,warningCount:K}}),$=()=>{const f=B();let j="w-full text-left px-4 py-2.5 transition-all duration-200 relative";return Y()?j+=" bg-blue-100 dark:bg-blue-900/40":f.criticalCount>0?j+=" bg-red-50 dark:bg-red-950/30 hover:bg-red-100 dark:hover:bg-red-950/40":f.warningCount>0?j+=" bg-yellow-50 dark:bg-yellow-950/20 hover:bg-yellow-100 dark:hover:bg-yellow-950/30":j+=" hover:bg-blue-50 dark:hover:bg-blue-900/20",j},D=()=>{const f=B();return f.hasAlerts?{"box-shadow":`inset 4px 0 0 0 ${f.criticalCount>0?"#ef4444":"#eab308"}`}:{}};return(()=>{var f=ek(),j=f.firstChild,K=j.firstChild,C=K.firstChild,ge=j.nextSibling,J=ge.firstChild,N=J.firstChild,F=N.nextSibling;return F.nextSibling,f.$$click=()=>W(U.id),t(C,()=>U.displayName),t(K,()=>ia(U.status),null),t(j,n(h,{get when(){return B().hasAlerts},get children(){var P=X1();return P.firstChild,t(P,()=>B().criticalCount+B().warningCount,null),q(E=>{var u=`text-[9px] px-1.5 py-0.5 rounded font-medium flex-shrink-0 ${B().criticalCount>0?"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400":"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"}`,v=`${B().criticalCount} critical, ${B().warningCount} warning alerts`;return u!==E.e&&y(P,E.e=u),v!==E.t&&Te(P,"title",E.t=v),E},{e:void 0,t:void 0}),P}}),null),t(J,_,N),t(J,oe,F),t(ge,n(h,{get when(){return U.lastSeen},get children(){var P=Z1();return t(P,()=>An(U.lastSeen)),P}}),null),q(P=>{var E=$(),u=D(),v=`text-sm font-medium truncate ${Y()?"text-blue-900 dark:text-blue-100":"text-gray-900 dark:text-gray-100"}`,V=U.displayName;return E!==P.e&&y(f,P.e=E),P.t=xs(f,u,P.t),v!==P.a&&y(C,P.a=v),V!==P.o&&Te(C,"title",P.o=V),P},{e:void 0,t:void 0,a:void 0,o:void 0}),f})()}})),ee})()]}}),le),t(le,n(h,{get when(){return L()},get fallback(){return n(h,{get when(){return ne()},get fallback(){return n(it,{padding:"lg",get children(){return n(Ur,{title:"No containers found",get description(){return b().trim()?"No containers match your search.":"No containers on any host"}})}})},get children(){return n(it,{padding:"none",class:"overflow-hidden",get children(){return n(ol,{get children(){var ee=tk(),U=ee.firstChild,Y=U.nextSibling,oe=Y.nextSibling;return t(oe,n(ze,{get each(){return ie()},children:_=>[(()=>{var B=sk(),$=B.firstChild,D=$.firstChild,f=D.firstChild,j=f.firstChild,K=j.nextSibling,C=K.firstChild,ge=f.nextSibling;return t(j,()=>_.host.displayName),t(f,n(h,{get when(){return _.host.displayName!==_.host.hostname},get children(){var J=rk(),N=J.firstChild,F=N.nextSibling;return F.nextSibling,t(J,()=>_.host.hostname,F),J}}),K),t(f,()=>ia(_.host.status),K),t(K,()=>_.containers.length,C),t(K,()=>_.containers.length===1?"container":"containers",null),t(ge,n(h,{get when(){return _.host.lastSeen},get children(){var J=nk();return J.firstChild,t(J,()=>An(_.host.lastSeen),null),J}}),null),t(ge,n(h,{get when(){return _.host.agentVersion},get children(){var J=Pi();return J.firstChild,t(J,()=>_.host.agentVersion,null),J}}),null),B})(),n(ze,{get each(){return _.containers},children:B=>n(Ei,{entry:B,onHostSelect:W,get activeAlerts(){return e.activeAlerts}})})]})),ee}})}})}})},children:ee=>n(h,{get when(){return I().length>0},get fallback(){return n(it,{padding:"lg",get children(){return n(Ur,{title:"No containers found",get description(){return $e(()=>!!b().trim())()?"No containers match your search.":`No containers on ${ee().displayName}`}})}})},get children(){return n(it,{padding:"none",class:"overflow-hidden",get children(){return[(()=>{var U=ok(),Y=U.firstChild,oe=Y.firstChild,_=oe.firstChild,B=_.nextSibling,$=B.firstChild,D=oe.nextSibling;return t(_,()=>ee().displayName),t(oe,n(h,{get when(){return ee().displayName!==ee().hostname},get children(){var f=ak(),j=f.firstChild,K=j.nextSibling;return K.nextSibling,t(f,()=>ee().hostname,K),f}}),B),t(oe,()=>ia(ee().status),B),t(B,()=>I().length,$),t(B,()=>I().length===1?"container":"containers",null),t(D,n(h,{get when(){return ee().agentVersion},get children(){var f=Pi();return f.firstChild,t(f,()=>ee().agentVersion,null),q(()=>y(f,`text-[10px] px-2 py-0.5 rounded font-medium ${ee().agentVersion?.includes("dev")||ee().agentVersion?.startsWith("0.1")?"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400":"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400"}`)),f}}),null),t(D,n(h,{get when(){return ee().lastSeen},get children(){var f=lk();return f.firstChild,t(f,()=>An(ee().lastSeen),null),f}}),null),t(U,n(h,{get when(){return ee().status?.toLowerCase()==="online"||ee().status?.toLowerCase()==="running"},get children(){var f=ik(),j=f.firstChild;j.firstChild;var K=j.nextSibling;K.firstChild;var C=K.nextSibling,ge=C.firstChild,J=ge.nextSibling;return t(j,n(un,{get value(){const N=(ee().containers||[]).filter(F=>F.state?.toLowerCase()==="running").reduce((F,P)=>F+(P.cpuPercent||0),0);return Math.min(100,Math.max(0,N))},get label(){return`${(()=>{const N=(ee().containers||[]).filter(F=>F.state?.toLowerCase()==="running").reduce((F,P)=>F+(P.cpuPercent||0),0);return Math.min(100,Math.max(0,N)).toFixed(0)})()}%`},type:"cpu"}),null),t(K,n(un,{get value(){if(!ee().totalMemoryBytes)return 0;const N=(ee().containers||[]).reduce((F,P)=>F+(P.memoryUsageBytes||0),0);return Math.min(100,Math.max(0,N/ee().totalMemoryBytes*100))},get label(){return`${(()=>{if(!ee().totalMemoryBytes)return"0";const N=(ee().containers||[]).reduce((F,P)=>F+(P.memoryUsageBytes||0),0);return Math.min(100,Math.max(0,N/ee().totalMemoryBytes*100)).toFixed(0)})()}%`},get sublabel(){if(!ee().totalMemoryBytes)return;const N=(ee().containers||[]).reduce((F,P)=>F+(P.memoryUsageBytes||0),0);return`${Zt(N)}/${Zt(ee().totalMemoryBytes)}`},type:"memory"}),null),t(J,(()=>{var N=$e(()=>!!ee().uptimeSeconds);return()=>N()?js(ee().uptimeSeconds):"—"})()),f}}),null),U})(),n(ol,{get children(){var U=dk(),Y=U.firstChild,oe=Y.nextSibling,_=oe.nextSibling;return t(_,n(ze,{get each(){return I()},children:B=>n(Ei,{entry:B,onHostSelect:W,get activeAlerts(){return e.activeAlerts}})})),U}})]}})}})})),se})()]},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return ck()},title:"No Docker hosts configured",get description(){return uk()},get actions(){return[n(x1,{text:'docker run -d --name pulse-docker-agent -e PULSE_URL="http://<pulse-server>:8080" -e PULSE_TOKEN="<your-api-token>" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/rcourtman/pulse-docker-agent:latest',class:"w-full sm:w-auto",children:"Copy install command"}),gk()]}})}})}})}}),null),H})()};Xt(["click"]);var mk=i('<div class=relative><div class="absolute inset-0 bg-green-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z">'),xk=i('<div class=relative><div class="absolute inset-0 bg-red-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),bk=i('<div class=relative><div class="absolute inset-0 bg-yellow-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z">'),pk=i('<div class=relative><div class="absolute inset-0 bg-blue-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),yk=i('<p class="mt-1 text-xs text-gray-700 dark:text-gray-300 opacity-90">'),vk=i('<div><div class="backdrop-blur-xl bg-white/10 dark:bg-gray-900/30 border border-white/20 dark:border-gray-700/30 px-5 py-4 rounded-2xl shadow-2xl flex items-center gap-4 min-w-[320px] max-w-[500px]"><div></div><div class=flex-1><h3 class="text-sm font-medium text-gray-800 dark:text-gray-100"></h3></div><button type=button class="flex-shrink-0 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/10 rounded-lg p-1.5 transition-all duration-200"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),kk=i('<div class="fixed top-4 right-4 z-[9999] space-y-2 max-w-sm">');const wk=e=>{const[r,s]=Z(!0),l={success:mk(),error:xk(),warning:bk(),info:pk()},o={success:"text-green-400",error:"text-red-400",warning:"text-yellow-400",info:"text-blue-400"},a=()=>{s(!1),window.setTimeout(()=>e.onRemove(e.toast.id),300)};return window.setTimeout(()=>{a()},e.toast.duration||xa.TOAST_DURATION),(()=>{var d=vk(),c=d.firstChild,g=c.firstChild,b=g.nextSibling,p=b.firstChild,m=b.nextSibling;return c.style.setProperty("background","linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%)"),c.style.setProperty("box-shadow","0 8px 32px 0 rgba(31, 38, 135, 0.37), inset 0 0 0 1px rgba(255,255,255,0.1)"),t(g,()=>l[e.toast.type]),t(p,()=>e.toast.title),t(b,n(h,{get when(){return e.toast.message},get children(){var S=yk();return t(S,()=>e.toast.message),S}}),null),m.$$click=a,q(S=>{var z=`transform transition-all duration-500 ease-out ${r()?"translate-x-0 opacity-100 scale-100":"translate-x-full opacity-0 scale-95"} animate-slide-in-glass`,ie=`flex-shrink-0 ${o[e.toast.type]}`;return z!==S.e&&y(d,S.e=z),ie!==S.t&&y(g,S.t=ie),S},{e:void 0,t:void 0}),d})()},$k=()=>{const[e,r]=Z([]),s=l=>{r(e().filter(o=>o.id!==l))};return window.showToast=(l,o,a,d)=>{const c=Date.now().toString();r([...e(),{id:c,type:l,title:o,message:a,duration:d}])},n(ps,{get children(){var l=kk();return t(l,n(ze,{get each(){return e()},children:o=>n(wk,{toast:o,onRemove:s})})),l}})};Xt(["click"]);var _k=i('<div class=relative><div class="absolute inset-0 bg-green-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z">'),Ck=i('<div class=relative><div class="absolute inset-0 bg-red-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),Sk=i('<div class=relative><div class="absolute inset-0 bg-blue-400 rounded-full blur-xl opacity-50 animate-pulse"></div><svg class="w-6 h-6 relative"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),Tk=i('<div><div></div><div class=flex-1><p class="text-gray-800 dark:text-gray-100 font-medium text-sm leading-relaxed"></p></div><button type=button class="flex-shrink-0 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/10 rounded-lg p-1.5 transition-all duration-200"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">');const Ak=e=>{const[r,s]=Z(!0),[l,o]=Z(!1),a=()=>{o(!0),setTimeout(()=>{s(!1),e.onClose?.()},300)};vr(()=>{if(e.duration&&e.duration>0){const g=setTimeout(()=>{a()},e.duration);Ar(()=>clearTimeout(g))}});const d=()=>{switch(e.type){case"success":return"text-green-400";case"error":return"text-red-400";default:return"text-blue-400"}},c=()=>{switch(e.type){case"success":return _k();case"error":return Ck();default:return Sk()}};return n(h,{get when(){return r()},get children(){var g=Tk(),b=g.firstChild,p=b.nextSibling,m=p.firstChild,S=p.nextSibling;return g.style.setProperty("background","linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%)"),g.style.setProperty("box-shadow","0 8px 32px 0 rgba(31, 38, 135, 0.37), inset 0 0 0 1px rgba(255,255,255,0.1)"),t(b,c),t(m,()=>e.message),S.$$click=a,q(z=>{var ie=`
|
||
fixed top-4 right-4 z-50
|
||
backdrop-blur-xl bg-white/10 dark:bg-gray-900/30
|
||
border border-white/20 dark:border-gray-700/30
|
||
px-5 py-4 rounded-2xl shadow-2xl
|
||
flex items-center gap-4
|
||
min-w-[320px] max-w-[500px]
|
||
transition-all duration-500 ease-out
|
||
${l()?"opacity-0 translate-x-full scale-95":"opacity-100 translate-x-0 scale-100"}
|
||
animate-slide-in-glass
|
||
`,ne=`${d()} flex-shrink-0`;return ie!==z.e&&y(g,z.e=ie),ne!==z.t&&y(b,z.t=ne),z},{e:void 0,t:void 0}),g}})};Xt(["click"]);var Dk=i('<div class="fixed top-4 right-4 z-50 space-y-2">');const Mk=()=>n(ps,{get children(){var e=Dk();return t(e,n(ze,{get each(){return Yt.notifications},children:r=>n(Ak,{get message(){return r.message},get type(){return r.type},get duration(){return r.duration},onClose:()=>Yt.remove(r.id)})})),e}});var Pk=i('<div class="mt-3 space-y-1"><div class="text-xs space-y-1"><div class="flex items-center gap-2"><span></span><span>Credentials encrypted at rest</span></div><div class="flex items-center gap-2"><span></span><span>Export requires authentication</span></div><div class="flex items-center gap-2"><span></span><span>Authentication enabled</span></div><div class="flex items-center gap-2"><span></span><span>HTTPS connection</span></div><div class="flex items-center gap-2"><span></span><span>Audit logging enabled'),Ek=i('<div><div class="max-w-7xl mx-auto px-4 py-3"><div class="flex items-start justify-between"><div class="flex items-start space-x-3"><span class=text-2xl></span><div><div class="flex items-center gap-3"><button type=button class="text-sm text-blue-600 dark:text-blue-400 hover:underline"> Details</button></div><p class="text-sm text-gray-700 dark:text-gray-300 mt-1"></p><div class="flex items-center gap-3 mt-3"><a href="/settings?tab=security"class="text-sm font-medium text-blue-600 dark:text-blue-400 hover:underline">Enable Security →</a><a href=https://github.com/rcourtman/Pulse/blob/main/docs/SECURITY.md target=_blank class="text-sm text-gray-600 dark:text-gray-400 hover:underline">Learn More</a><div class="relative group"><button type=button class="text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300">Dismiss ▼</button><div class="absolute left-0 top-full mt-1 bg-white dark:bg-gray-800 rounded shadow-lg border border-gray-200 dark:border-gray-700 opacity-0 group-hover:opacity-100 pointer-events-none group-hover:pointer-events-auto transition-opacity"><button type=button class="block w-full text-left px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">For 1 day</button><button type=button class="block w-full text-left px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">For 1 week</button><button type=button class="block w-full text-left px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-700">Forever'),Nk=i("<span>Security score: <span>/"),Ok=i('<span class="font-semibold text-red-700 dark:text-red-300">⚠️ PUBLIC NETWORK ACCESS DETECTED - Your Proxmox credentials are exposed to the internet!');const Lk=()=>{const[e,r]=Z(!1),[s,l]=Z(null),[o,a]=Z(!1);vr(async()=>{const p=localStorage.getItem("securityWarningDismissed");if(p&&new Date(p)>new Date){r(!0);return}try{const m=await fetch("/api/security/status");if(m.ok){const S=await m.json();let z=0;const ie=5;S.credentialsEncrypted!==!1&&z++,S.exportProtected&&z++,S.apiTokenConfigured&&z++,(S.hasHTTPS||window.location.protocol==="https:")&&z++,S.hasAuthentication&&z++,l({hasAuthentication:S.hasAuthentication||!1,hasHTTPS:window.location.protocol==="https:",hasAPIToken:S.apiTokenConfigured||!1,hasAuditLogging:S.hasAuditLogging||!1,credentialsEncrypted:!0,exportProtected:S.exportProtected||!1,score:z,maxScore:ie,publicAccess:S.publicAccess||!1,isPrivateNetwork:S.isPrivateNetwork,clientIP:S.clientIP})}}catch(m){console.error("Failed to fetch security status:",m)}});const d=p=>{const m=new Date;p==="day"?m.setDate(m.getDate()+1):p==="week"?m.setDate(m.getDate()+7):m.setFullYear(m.getFullYear()+100),localStorage.setItem("securityWarningDismissed",m.toISOString()),r(!0)},c=(p,m)=>{const S=p/m*100;return S>=80?"text-green-600 dark:text-green-400":S>=60?"text-yellow-600 dark:text-yellow-400":S>=40?"text-orange-600 dark:text-orange-400":"text-red-600 dark:text-red-400"},g=(p,m)=>{const S=p/m*100;return S>=80?"🛡️":S>=60?"⚠️":"🚨"};return(e()||!s()?!1:s().publicAccess&&!s().hasAuthentication?!0:s().score<4)?n(ps,{get children(){var p=Ek(),m=p.firstChild,S=m.firstChild,z=S.firstChild,ie=z.firstChild,ne=ie.nextSibling,W=ne.firstChild,X=W.firstChild,I=X.firstChild,L=W.nextSibling,H=L.nextSibling,se=H.firstChild,le=se.nextSibling,ee=le.nextSibling,U=ee.firstChild,Y=U.nextSibling,oe=Y.firstChild,_=oe.nextSibling,B=_.nextSibling;return t(ie,()=>g(s().score,s().maxScore)),t(W,n(rr,{get title(){return(()=>{var $=Nk(),D=$.firstChild,f=D.nextSibling,j=f.firstChild;return t(f,()=>s().score,j),t(f,()=>s().maxScore,null),q(()=>y(f,c(s().score,s().maxScore))),$})()},size:"sm",class:"flex-1",titleClass:"text-gray-900 dark:text-gray-100"}),X),X.$$click=()=>a(!o()),t(X,()=>o()?"Hide":"Show",I),t(L,(()=>{var $=$e(()=>!!s().publicAccess);return()=>$()?Ok():"Your Pulse instance is accessible without authentication. Proxmox credentials could be exposed."})()),t(ne,n(h,{get when(){return o()},get children(){var $=Pk(),D=$.firstChild,f=D.firstChild,j=f.firstChild,K=f.nextSibling,C=K.firstChild,ge=K.nextSibling,J=ge.firstChild,N=ge.nextSibling,F=N.firstChild,P=N.nextSibling,E=P.firstChild;return t(j,()=>s().credentialsEncrypted?"✅":"❌"),t(C,()=>s().exportProtected?"✅":"❌"),t(J,()=>s().hasAuthentication?"✅":"❌"),t(F,()=>s().hasHTTPS?"✅":"❌"),t(E,()=>s().hasAuditLogging?"✅":"❌"),q(u=>{var v=s().credentialsEncrypted?"text-green-600":"text-red-600",V=s().exportProtected?"text-green-600":"text-red-600",A=s().hasAuthentication?"text-green-600":"text-red-600",k=s().hasHTTPS?"text-green-600":"text-red-600",w=s().hasAuditLogging?"text-green-600":"text-red-600";return v!==u.e&&y(j,u.e=v),V!==u.t&&y(C,u.t=V),A!==u.a&&y(J,u.a=A),k!==u.o&&y(F,u.o=k),w!==u.i&&y(E,u.i=w),u},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),$}}),H),U.$$click=()=>d("day"),oe.$$click=()=>d("day"),_.$$click=()=>d("week"),B.$$click=()=>d("forever"),q(()=>y(p,`fixed top-0 left-0 right-0 z-50 border-b shadow-sm ${s().publicAccess&&!s().hasAuthentication?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800":"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800"}`)),p}}):null};Xt(["click"]);var Rk=i('<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-cyan-50 dark:from-gray-900 dark:via-gray-800 dark:to-blue-900"><div class=text-center><div class="animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4"></div><p class="text-gray-600 dark:text-gray-400">Checking authentication...'),Ik=i('<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-cyan-50 dark:from-gray-900 dark:via-gray-800 dark:to-blue-900"><div class=text-center><div class="animate-spin h-12 w-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4"></div><p class="text-gray-600 dark:text-gray-400">Loading setup...'),Hk=i('<span class="inline-flex items-center gap-2"><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=1.8 d="M21 12c0 4.97-4.03 9-9 9m9-9c0-4.97-4.03-9-9-9m9 9H3m9 9c-4.97 0-9-4.03-9-9m9 9c-1.5-1.35-3-4.5-3-9s1.5-7.65 3-9m0 18c1.5-1.35 3-4.5 3-9s-1.5-7.65-3-9"></path></svg>Continue with Single Sign-On'),Uk=i('<div class="rounded-md bg-red-50 dark:bg-red-900/40 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-600 dark:text-red-300">'),Bk=i('<div class="rounded-md bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 px-3 py-2 text-sm text-green-600 dark:text-green-300">'),jk=i('<div class=space-y-3><button type=button></button><div class="flex items-center gap-3 pt-2"><span class="flex-1 h-px bg-gray-200 dark:bg-gray-700"></span><span class="text-xs uppercase tracking-wide text-gray-400 dark:text-gray-500">or</span><span class="flex-1 h-px bg-gray-200 dark:bg-gray-700"></span></div><p class="text-xs text-center text-gray-500 dark:text-gray-400">Use your admin credentials to sign in below.'),Fk=i('<svg class="h-5 w-5 text-orange-400"viewBox="0 0 20 20"fill=currentColor><path fill-rule=evenodd d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"clip-rule=evenodd>'),Vk=i('<p class="text-xs mt-1 text-orange-700 dark:text-orange-300">Lockouts automatically expire after the specified time. If you need immediate access, contact your administrator.'),Gk=i("<div><div class=flex><div class=flex-shrink-0></div><div class=ml-3><p>"),zk=i('<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),Wk=i('<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 via-white to-cyan-50 dark:from-gray-900 dark:via-gray-800 dark:to-blue-900 py-12 px-4 sm:px-6 lg:px-8"><div class="max-w-md w-full space-y-8"><div class=animate-fade-in><div class="flex justify-center mb-4"><div class="relative group"><div class="absolute -inset-1 bg-gradient-to-r from-blue-600 to-cyan-600 rounded-full blur opacity-25 group-hover:opacity-75 transition duration-1000 group-hover:duration-200 animate-pulse-slow"></div><img src=/logo.svg alt="Pulse Logo"class="relative w-24 h-24 transform transition duration-500 group-hover:scale-110"></div></div><h2 class="mt-6 text-center text-3xl font-extrabold bg-gradient-to-r from-blue-600 to-cyan-600 bg-clip-text text-transparent">Welcome to Pulse</h2><p class="mt-2 text-center text-sm text-gray-600 dark:text-gray-400">Enter your credentials to continue</p></div><form class="mt-8 space-y-6 bg-white/80 dark:bg-gray-800/80 backdrop-blur-lg rounded-lg p-8 shadow-xl animate-slide-up"><input type=hidden name=remember value=true><div class=space-y-4><div class=relative><label for=username class=sr-only>Username</label><div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"><svg class="h-5 w-5 text-gray-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg></div><input id=username name=username type=text autocomplete=username required class="appearance-none relative block w-full pl-10 pr-3 py-3 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400"placeholder=Username></div><div class=relative><label for=password class=sr-only>Password</label><div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"><svg class="h-5 w-5 text-gray-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg></div><input id=password name=password type=password autocomplete=current-password required class="appearance-none relative block w-full pl-10 pr-3 py-3 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400"placeholder=Password></div></div><div><button type=submit class="group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-lg text-white bg-gradient-to-r from-blue-600 to-cyan-600 hover:from-blue-700 hover:to-cyan-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transform transition hover:scale-105 shadow-lg">'),qk=i('<span class="inline-flex items-center gap-2"><span class="h-4 w-4 border-2 border-current border-t-transparent rounded-full animate-spin"></span>Redirecting…'),Kk=i('<svg class="h-5 w-5 text-red-400"viewBox="0 0 20 20"fill=currentColor><path fill-rule=evenodd d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"clip-rule=evenodd>');const Jk=Wo(()=>Ln(()=>import("./FirstRunSetup-wQBQ8FZA.js"),[]).then(e=>({default:e.FirstRunSetup}))),Qk=e=>{const[r,s]=Z(""),[l,o]=Z(""),[a,d]=Z(""),[c,g]=Z(!1),[b,p]=Z(null),[m,S]=Z(!0),[z,ie]=Z(!1),[ne,W]=Z(""),[X,I]=Z(""),L=()=>!!b()?.oidcEnabled,H=ee=>{switch(ee){case"email_restricted":return"Your account email is not permitted to access Pulse.";case"domain_restricted":return"Your email domain is not allowed for Pulse access.";case"group_restricted":return"Your account is not part of an authorized group to use Pulse.";case"invalid_state":return"The sign-in attempt expired. Please try again.";case"exchange_failed":return"We could not complete the sign-in request. Please try again shortly.";case"session_failed":return"Login succeeded but we could not create a session. Try again.";case"invalid_id_token":return"ID token verification failed. Check that OIDC_ISSUER_URL matches the issuer claim in your provider tokens (check server logs for details).";case"invalid_signature_alg":return"The identity provider is issuing HS256 tokens. Configure it to sign ID tokens with RS256 (see your IdP's OIDC settings).";case"invalid_nonce":return"Security validation failed (nonce mismatch). Please try again.";default:return"Single sign-on failed. Please try again or contact an administrator."}};vr(async()=>{const ee=localStorage.getItem(_n.DARK_MODE);ee==="false"?document.documentElement.classList.remove("dark"):ee==="true"||window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");const U=new URLSearchParams(window.location.search),Y=U.get("oidc");if(Y==="error"){const oe=U.get("oidc_error");W(H(oe)),d("")}else Y==="success"&&(I("Signed in successfully. Loading Pulse…"),d(""));if(Y){U.delete("oidc"),U.delete("oidc_error");const oe=U.toString(),_=`${window.location.pathname}${oe?`?${oe}`:""}`;window.history.replaceState({},document.title,_)}console.log("[Login] Starting auth check...");try{const oe=await fetch("/api/security/status");if(console.log("[Login] Auth check response:",oe.status),oe.ok){const _=await oe.json();console.log("[Login] Auth status data:",_),p(_)}else oe.status===429?(console.log("[Login] Rate limited, assuming auth is configured"),p({hasAuthentication:!0})):(console.log("[Login] Auth check failed, assuming no auth"),p({hasAuthentication:!1}))}catch(oe){console.error("[Login] Failed to check auth status:",oe),p({hasAuthentication:!1})}finally{console.log("[Login] Auth check complete, setting loading to false"),S(!1)}});const se=async()=>{if(!L())return;W(""),I(""),d(""),ie(!0);let ee=!1;try{const U=await fetch("/api/oidc/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({returnTo:`${window.location.pathname}${window.location.search}`})});if(!U.ok){const oe=await U.text();throw new Error(oe||"Failed to initiate OIDC login")}const Y=await U.json();if(Y.authorizationUrl){ee=!0,window.location.href=Y.authorizationUrl;return}throw new Error("OIDC response missing authorization URL")}catch(U){console.error("[Login] Failed to start OIDC login:",U),W("Failed to start single sign-on. Please try again.")}finally{ee||ie(!1)}},le=async ee=>{ee.preventDefault(),d(""),g(!0);try{const U=await fetch("/api/login",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({username:r(),password:l()}),credentials:"include"}),Y=await U.json();U.ok&&Y.success?(ul(r(),l()),e.onLogin()):U.status===403?(Y.remainingMinutes?d(`Account locked. Please try again in ${Y.remainingMinutes} ${Y.remainingMinutes===1?"minute":"minutes"}.`):d(Y.message||"Account temporarily locked due to too many failed attempts."),s(""),o("")):U.status===429?d(Y.message||"Too many requests. Please wait a moment and try again."):U.status===401?(Y.remaining!==void 0&&Y.remaining>0?d(`${Y.message||"Invalid username or password."} (${Y.remaining} ${Y.remaining===1?"attempt":"attempts"} remaining)`):Y.locked?d(Y.message||"Invalid username or password. Account is now locked."):d(Y.message||"Invalid username or password"),s(""),o("")):d(Y.message||"Server error. Please try again.")}catch{try{const Y=await fetch("/api/state",{headers:{Authorization:`Basic ${btoa(`${r()}:${l()}`)}`,"X-Requested-With":"XMLHttpRequest",Accept:"application/json"},credentials:"include"});Y.ok?(ul(r(),l()),e.onLogin()):Y.status===401?(d("Invalid username or password"),s(""),o("")):d("Server error. Please try again.")}catch{d("Failed to connect to server")}}finally{g(!1)}};return console.log("[Login] Render - loadingAuth:",m(),"authStatus:",b()),n(h,{get when(){return!m()},get fallback(){return Rk()},get children(){return n(h,{get when(){return b()?.hasAuthentication===!1},get fallback(){return n(Yk,{username:r,setUsername:s,password:l,setPassword:o,error:a,loading:c,handleSubmit:le,supportsOIDC:L,startOidcLogin:se,oidcLoading:z,oidcError:ne,oidcMessage:X})},get children(){return n(Qo,{get fallback(){return Ik()},get children(){return n(Jk,{})}})}})}})},Yk=e=>{const{username:r,setUsername:s,password:l,setPassword:o,error:a,loading:d,handleSubmit:c,supportsOIDC:g,startOidcLogin:b,oidcLoading:p,oidcError:m,oidcMessage:S}=e;return(()=>{var z=Wk(),ie=z.firstChild,ne=ie.firstChild,W=ne.nextSibling,X=W.firstChild,I=X.nextSibling,L=I.firstChild,H=L.firstChild,se=H.nextSibling,le=se.nextSibling,ee=L.nextSibling,U=ee.firstChild,Y=U.nextSibling,oe=Y.nextSibling,_=I.nextSibling,B=_.firstChild;return Gr(W,"submit",c),t(W,n(h,{get when(){return g()},get children(){var $=jk(),D=$.firstChild,f=D.nextSibling;return D.$$click=()=>b(),t(D,n(h,{get when(){return!p()},get fallback(){return qk()},get children(){return Hk()}})),t($,n(h,{get when(){return m()},get children(){var j=Uk();return t(j,m),j}}),f),t($,n(h,{get when(){return S()},get children(){var j=Bk();return t(j,S),j}}),f),q(j=>{var K=`w-full inline-flex items-center justify-center gap-2 px-4 py-3 rounded-lg border border-blue-500 text-blue-600 hover:bg-blue-50 transition dark:border-blue-400 dark:text-blue-200 dark:hover:bg-blue-900/40 ${p()?"opacity-75 cursor-wait":""}`,C=p();return K!==j.e&&y(D,j.e=K),C!==j.t&&(D.disabled=j.t=C),j},{e:void 0,t:void 0}),$}}),X),le.$$input=$=>s($.currentTarget.value),oe.$$input=$=>o($.currentTarget.value),t(W,n(h,{get when(){return a()},get children(){var $=Gk(),D=$.firstChild,f=D.firstChild,j=f.nextSibling,K=j.firstChild;return t(f,n(h,{get when(){return a().includes("locked")},get fallback(){return Kk()},get children(){return Fk()}})),t(K,a),t(j,n(h,{get when(){return $e(()=>!!a().includes("locked"))()&&a().includes("minute")},get children(){return Vk()}}),null),q(C=>{var ge=`rounded-md p-4 ${a().includes("locked")?"bg-orange-50 dark:bg-orange-900/20":"bg-red-50 dark:bg-red-900/20"}`,J=`text-sm ${a().includes("locked")?"text-orange-800 dark:text-orange-200":"text-red-800 dark:text-red-200"}`;return ge!==C.e&&y($,C.e=ge),J!==C.t&&y(K,C.t=J),C},{e:void 0,t:void 0}),$}}),_),t(B,n(h,{get when(){return d()},get children(){return zk()}}),null),t(B,n(h,{get when(){return d()},fallback:"Sign in to Pulse",children:"Authenticating..."}),null),q(()=>B.disabled=d()),q(()=>le.value=r()),q(()=>oe.value=l()),z})()};Xt(["click","input"]);var Xk=i('<div class="flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span>Estimated time: '),Zk=i('<div><div class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-2">Prerequisites</div><ul class=space-y-2>'),e2=i('<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3"><div class="flex items-start gap-2"><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg><div class="text-sm text-yellow-800 dark:text-yellow-200"><div class=font-medium>Root access required</div><div class="text-yellow-700 dark:text-yellow-300 mt-1">This update requires elevated privileges to modify system files.'),t2=i('<div class="flex items-center gap-2 text-sm text-green-600 dark:text-green-400"><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><span>Automatic backup will be created'),r2=i('<svg class="animate-spin h-4 w-4"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),n2=i('<div class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"><div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto"><div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between"><h2 class="text-xl font-semibold text-gray-900 dark:text-gray-100">Confirm Update</h2><button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div></div><div class="px-6 py-4 space-y-4"><div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4"><div class="text-sm font-medium text-blue-900 dark:text-blue-100 mb-2">Version Update</div><div class="flex items-center gap-3 text-blue-800 dark:text-blue-200"><span class="font-mono text-sm"></span><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 7l5 5m0 0l-5 5m5-5H6"></path></svg><span class="font-mono text-sm font-semibold"></span></div></div><div class="pt-4 border-t border-gray-200 dark:border-gray-700"><label class="flex items-start gap-3 cursor-pointer"><input type=checkbox class="mt-1 w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2"><span class="text-sm text-gray-700 dark:text-gray-300">I understand that Pulse will be temporarily unavailable during the update process.</span></label></div></div><div class="px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex items-center justify-end gap-3"><button class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed">Cancel</button><button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"><span>'),s2=i('<li class="flex items-start gap-2 text-sm text-gray-700 dark:text-gray-300"><svg class="w-4 h-4 mt-0.5 flex-shrink-0 text-orange-500"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><span>');function a2(e){const[r,s]=Z(!1),l=()=>{r()&&!e.isApplying&&e.onConfirm()};return n(h,{get when(){return e.isOpen},get children(){var o=n2(),a=o.firstChild,d=a.firstChild,c=d.firstChild,g=c.firstChild,b=g.nextSibling,p=d.nextSibling,m=p.firstChild,S=m.firstChild,z=S.nextSibling,ie=z.firstChild,ne=ie.nextSibling,W=ne.nextSibling,X=m.nextSibling,I=X.firstChild,L=I.firstChild,H=L.nextSibling;H.firstChild;var se=p.nextSibling,le=se.firstChild,ee=le.nextSibling,U=ee.firstChild;return Gr(b,"click",e.onClose,!0),t(ie,()=>e.currentVersion),t(W,()=>e.latestVersion),t(p,n(h,{get when(){return e.plan.estimatedTime},get children(){var Y=Xk(),oe=Y.firstChild,_=oe.nextSibling;return _.firstChild,t(_,()=>e.plan.estimatedTime,null),Y}}),X),t(p,n(h,{get when(){return e.plan.prerequisites&&e.plan.prerequisites.length>0},get children(){var Y=Zk(),oe=Y.firstChild,_=oe.nextSibling;return t(_,n(ze,{get each(){return e.plan.prerequisites},children:B=>(()=>{var $=s2(),D=$.firstChild,f=D.nextSibling;return t(f,B),$})()})),Y}}),X),t(p,n(h,{get when(){return e.plan.requiresRoot},get children(){return e2()}}),X),t(p,n(h,{get when(){return e.plan.rollbackSupport},get children(){return t2()}}),X),L.addEventListener("change",Y=>s(Y.currentTarget.checked)),t(H,()=>e.plan.rollbackSupport&&" A backup will be created automatically.",null),Gr(le,"click",e.onClose,!0),ee.$$click=l,t(ee,n(h,{get when(){return e.isApplying},get children(){return r2()}}),U),t(U,()=>e.isApplying?"Starting...":"Start Update"),q(Y=>{var oe=e.isApplying,_=e.isApplying,B=e.isApplying,$=!r()||e.isApplying;return oe!==Y.e&&(b.disabled=Y.e=oe),_!==Y.t&&(L.disabled=Y.t=_),B!==Y.a&&(le.disabled=Y.a=B),$!==Y.o&&(ee.disabled=Y.o=$),Y},{e:void 0,t:void 0,a:void 0,o:void 0}),q(()=>L.checked=r()),o}})}Xt(["click"]);var l2=i('<svg class="w-12 h-12 text-red-500"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),i2=i('<svg class="w-12 h-12 text-green-500"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z">'),o2=i('<svg class="w-12 h-12 text-blue-500 animate-spin"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),d2=i('<button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),c2=i('<div class="text-sm text-gray-500 dark:text-gray-400 mt-1 capitalize">'),u2=i('<div class=mt-6><div class="flex items-center justify-between text-sm text-gray-600 dark:text-gray-400 mb-2"><span>Progress</span><span>%</span></div><div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2"><div class="bg-blue-600 h-2 rounded-full transition-all duration-300">'),g2=i('<div class="mt-6 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4"><div class="text-sm text-red-800 dark:text-red-200"><div class="font-medium mb-1">Error Details:</div><div class="text-red-700 dark:text-red-300">'),h2=i("<span>Waiting for Pulse to complete restart. This page will reload automatically."),f2=i('<div class="mt-6 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3"><div class="flex items-start gap-2"><svg class="w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="text-sm text-blue-800 dark:text-blue-200">'),m2=i('<div class="mt-6 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3"><div class="flex items-start gap-2"><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-sm text-yellow-800 dark:text-yellow-200">Please do not close this window or refresh the page during the update.'),x2=i('<button class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors">View History'),b2=i('<button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors">Retry'),p2=i('<div class="px-6 py-4 bg-gray-50 dark:bg-gray-900/50 border-t border-gray-200 dark:border-gray-700 flex items-center justify-end gap-3"><button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors">Close'),y2=i('<div class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"><div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full"><div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center justify-between"><h2 class="text-xl font-semibold text-gray-900 dark:text-gray-100">Updating Pulse</h2></div></div><div class="px-6 py-8"><div class="flex flex-col items-center text-center space-y-4"><div><div class="text-lg font-medium text-gray-900 dark:text-gray-100">'),v2=i("<span>Pulse is restarting with the new version...");function k2(e){const[r,s]=Z(null),[l,o]=Z(!1),[a,d]=Z(!1),[c,g]=Z(!1),[b,p]=Z(!1);let m,S,z=0;const ie=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},ne=async()=>{try{const L=await yn.getUpdateStatus();if(s(L),L.status==="restarting"){g(!0),m&&clearInterval(m),W();return}(L.status==="completed"||L.status==="idle"||L.status==="error")&&(o(!0),(L.status==="error"||L.error)&&d(!0),m&&clearInterval(m))}catch(L){console.error("Failed to poll update status:",L);const H=r();!c()&&(!H||H.status!=="idle"&&H.status!=="error")&&(H||s({status:"restarting",progress:95,message:"Restarting service...",updatedAt:new Date().toISOString()}),g(!0),m&&clearInterval(m),W())}},W=()=>{ie(),z=0;const L=async()=>{let H=!1;try{(await fetch("/api/health",{cache:"no-store"})).ok&&(H=!0)}catch(ee){console.warn("Health check request failed, will retry",ee)}if(H){console.log("Backend is healthy again, reloading..."),window.location.reload();return}const se=Math.min(z,3),le=Math.min(2e3*Math.pow(2,se),15e3);z++,ie(),S=window.setTimeout(L,le)};S=window.setTimeout(L,0)};ft(()=>{if(!c())return;const L=e.connected?.(),H=e.reconnecting?.();L===!1&&!H&&p(!0),b()&&L===!0&&!H&&(console.log("WebSocket reconnected after restart, verifying health..."),setTimeout(async()=>{try{(await fetch("/api/health",{cache:"no-store"})).ok&&(console.log("Backend healthy after websocket reconnect, reloading..."),window.location.reload())}catch{console.warn("Health check failed after websocket reconnect, will keep trying")}},1e3))}),vr(()=>{e.isOpen&&(ne(),m=setInterval(ne,2e3))}),Ar(()=>{m&&clearInterval(m),ie()});const X=()=>r()?a()?l2():l()&&!a()?i2():o2():null,I=()=>{const L=r();return c()?"Pulse is restarting...":L?a()?"Update Failed":l()&&!a()?"Update Completed Successfully":L.message||"Updating...":"Initializing..."};return n(h,{get when(){return e.isOpen},get children(){var L=y2(),H=L.firstChild,se=H.firstChild,le=se.firstChild;le.firstChild;var ee=se.nextSibling,U=ee.firstChild,Y=U.firstChild,oe=Y.firstChild;return t(le,n(h,{get when(){return l()},get children(){var _=d2();return Gr(_,"click",e.onClose,!0),_}}),null),t(U,X,Y),t(oe,I),t(Y,n(h,{get when(){return $e(()=>!!r()?.status)()&&!l()},get children(){var _=c2();return t(_,()=>r().status.replace("-"," ")),_}}),null),t(ee,n(h,{get when(){return $e(()=>!l())()&&r()?.progress!==void 0},get children(){var _=u2(),B=_.firstChild,$=B.firstChild,D=$.nextSibling,f=D.firstChild,j=B.nextSibling,K=j.firstChild;return t(D,()=>r().progress,f),q(C=>(C=`${r().progress}%`)!=null?K.style.setProperty("width",C):K.style.removeProperty("width")),_}}),null),t(ee,n(h,{get when(){return $e(()=>!!a())()&&r()?.error},get children(){var _=g2(),B=_.firstChild,$=B.firstChild,D=$.nextSibling;return t(D,()=>r().error),_}}),null),t(ee,n(h,{get when(){return!l()},get children(){return[n(h,{get when(){return c()},get children(){var _=f2(),B=_.firstChild,$=B.firstChild,D=$.nextSibling;return t(D,n(h,{get when(){return b()},get fallback(){return v2()},get children(){return h2()}})),_}}),n(h,{get when(){return!c()},get children(){return m2()}})]}}),null),t(H,n(h,{get when(){return l()},get children(){var _=p2(),B=_.firstChild;return t(_,n(h,{get when(){return!a()},get children(){var $=x2();return Gr($,"click",e.onViewHistory,!0),$}}),B),t(_,n(h,{get when(){return a()},get children(){var $=b2();return $.$$click=()=>window.location.reload(),$}}),B),Gr(B,"click",e.onClose,!0),_}}),null),L}})}Xt(["click"]);var w2=i('<button class="px-3 py-1 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded transition-colors">Apply Update'),$2=i('<span class="px-2 py-0.5 text-xs font-medium bg-orange-100 dark:bg-orange-900/30 text-orange-800 dark:text-orange-200 rounded">Manual steps required'),_2=i('<p class="text-orange-600 dark:text-orange-400 text-xs">This is a pre-release version'),C2=i('<div class="mt-3 pt-3 border-t border-blue-200 dark:border-blue-800"><div class="font-medium mb-2">Update Instructions:</div><div class=space-y-2>'),S2=i('<div class="mt-3 pt-3 border-t border-blue-200 dark:border-blue-800"><button class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded transition-colors">Apply Update Automatically'),T2=i(`<div class="mt-2 pb-1"><div class="text-sm text-blue-700 dark:text-blue-300 space-y-1"><p><span class=font-medium>Current:</span> <!> →<span class="font-medium ml-1">Latest:</span> </p><div class="flex gap-3 mt-2"><a target=_blank rel="noopener noreferrer"class="text-blue-600 dark:text-blue-400 underline hover:text-blue-700 dark:hover:text-blue-300 text-xs">View release notes</a><button class="text-blue-600/70 dark:text-blue-400/70 hover:text-blue-700 dark:hover:text-blue-300 text-xs underline">Don't show again for this version`),A2=i('<div class="bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800 text-blue-800 dark:text-blue-200 relative animate-slideDown"><div class="px-4 py-1.5"><div class="flex items-center justify-between"><div class="flex items-center gap-3"><svg class="w-4 h-4 flex-shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M12 2v6m0 0l3-3m-3 3l-3-3"stroke-linecap=round stroke-linejoin=round></path><path d="M2 17l.621 2.485A2 2 0 0 0 4.561 21h14.878a2 2 0 0 0 1.94-1.515L22 17"stroke-linecap=round stroke-linejoin=round></path></svg><div class="flex items-center gap-3 flex-wrap"><span class="text-sm font-medium"></span></div></div><div class="flex items-center gap-2"><button class="p-1 hover:bg-blue-100 dark:hover:bg-blue-800/30 rounded transition-colors"><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="6 9 12 15 18 9"></polyline></svg></button><button class="p-1 hover:bg-blue-100 dark:hover:bg-blue-800/30 rounded transition-colors"title="Dismiss this update"><svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>'),D2=i('<span class="text-blue-600 dark:text-blue-400 text-sm hidden sm:inline">•'),M2=i('<span class="text-blue-600 dark:text-blue-400 text-sm hidden sm:inline">'),P2=i('<a target=_blank rel="noopener noreferrer"class="text-blue-600 dark:text-blue-400 underline text-sm hidden sm:inline hover:text-blue-700 dark:hover:text-blue-300">View details →'),E2=i("<p><span class=font-medium>Quick upgrade:</span> "),N2=i('<svg class="w-4 h-4 text-green-600 dark:text-green-400"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M5 13l4 4L19 7">'),O2=i('<div class="bg-gray-50 dark:bg-gray-900/50 rounded border border-blue-200 dark:border-blue-700 p-2"><div class="flex items-start justify-between gap-2"><code class="text-xs text-gray-800 dark:text-gray-200 font-mono flex-1 break-all"></code><button class="flex-shrink-0 p-1 hover:bg-blue-100 dark:hover:bg-blue-800/30 rounded transition-colors"title="Copy to clipboard">'),L2=i('<svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z">');function R2(){const e=In(),r=Rn(Sa),[s,l]=Z(!1),[o,a]=Z(null),[d,c]=Z(!1),[g,b]=Z(!1),[p,m]=Z(!1),[S,z]=Z(null);ft(async()=>{const L=Tr.updateInfo();if(L?.available&&L.latestVersion)try{const H=await yn.getUpdatePlan(L.latestVersion);a(H)}catch(H){console.error("Failed to fetch update plan:",H)}});const ie=()=>{c(!0)},ne=async()=>{const L=Tr.updateInfo();if(L?.downloadUrl){m(!0);try{await yn.applyUpdate(L.downloadUrl),c(!1),b(!0)}catch(H){console.error("Failed to start update:",H),alert("Failed to start update. Please try again.")}finally{m(!1)}}},W=async(L,H)=>{try{await navigator.clipboard.writeText(L),z(H),setTimeout(()=>z(null),2e3)}catch(se){console.error("Failed to copy:",se)}},X=()=>{switch(Tr.versionInfo()?.deploymentType||"systemd"){case"proxmoxve":return"ProxmoxVE users: type 'update' in console";case"docker":return"Docker: pull latest image";case"source":return"Source: pull and rebuild";default:return""}},I=()=>{const L=Tr.updateInfo();return L?`New version available: ${L.latestVersion}`:""};return n(h,{get when(){return Tr.isUpdateVisible()},get children(){return[(()=>{var L=A2(),H=L.firstChild,se=H.firstChild,le=se.firstChild,ee=le.firstChild,U=ee.nextSibling,Y=U.firstChild,oe=le.nextSibling,_=oe.firstChild,B=_.firstChild,$=_.nextSibling;return t(Y,I),t(U,n(h,{get when(){return $e(()=>!!o()?.canAutoUpdate)()&&!s()},get children(){var D=w2();return D.$$click=ie,D}}),null),t(U,n(h,{get when(){return $e(()=>!!(o()&&!o()?.canAutoUpdate))()&&!s()},get children(){return $2()}}),null),t(U,(()=>{var D=$e(()=>!!(!s()&&X()));return()=>D()&&[D2(),(()=>{var f=M2();return t(f,X),f})()]})(),null),t(U,(()=>{var D=$e(()=>!s());return()=>D()&&(()=>{var f=P2();return q(()=>Te(f,"href",`https://github.com/rcourtman/Pulse/releases/tag/${Tr.updateInfo()?.latestVersion}`)),f})()})(),null),_.$$click=()=>l(!s()),$.$$click=()=>Tr.dismissUpdate(),t(H,n(h,{get when(){return s()},get children(){var D=T2(),f=D.firstChild,j=f.firstChild,K=j.firstChild,C=K.nextSibling,ge=C.nextSibling,J=ge.nextSibling,N=J.nextSibling;N.nextSibling;var F=j.nextSibling,P=F.firstChild,E=P.nextSibling;return t(j,()=>Tr.versionInfo()?.version||"Unknown",ge),t(j,()=>Tr.updateInfo()?.latestVersion,null),t(f,(()=>{var u=$e(()=>!!X());return()=>u()&&(()=>{var v=E2(),V=v.firstChild;return V.nextSibling,t(v,X,null),v})()})(),F),t(f,n(h,{get when(){return Tr.updateInfo()?.isPrerelease},get children(){return _2()}}),F),t(f,n(h,{get when(){return $e(()=>!!o()?.instructions)()&&(o()?.instructions?.length??0)>0},get children(){var u=C2(),v=u.firstChild,V=v.nextSibling;return t(V,n(ze,{get each(){return o()?.instructions||[]},children:(A,k)=>(()=>{var w=O2(),de=w.firstChild,fe=de.firstChild,x=fe.nextSibling;return t(fe,A),x.$$click=()=>W(A,k()),t(x,n(h,{get when(){return S()===k()},get fallback(){return L2()},get children(){return N2()}})),w})()})),u}}),F),t(f,n(h,{get when(){return o()?.canAutoUpdate},get children(){var u=S2(),v=u.firstChild;return v.$$click=ie,u}}),F),E.$$click=()=>Tr.dismissUpdate(),q(()=>Te(P,"href",`https://github.com/rcourtman/Pulse/releases/tag/${Tr.updateInfo()?.latestVersion}`)),D}}),null),q(D=>{var f=s()?"Show less":"Show more",j=`w-4 h-4 transform transition-transform ${s()?"rotate-180":""}`;return f!==D.e&&Te(_,"title",D.e=f),j!==D.t&&Te(B,"class",D.t=j),D},{e:void 0,t:void 0}),L})(),n(a2,{get isOpen(){return d()},onClose:()=>c(!1),onConfirm:ne,get currentVersion(){return Tr.versionInfo()?.version||"Unknown"},get latestVersion(){return Tr.updateInfo()?.latestVersion||""},get plan(){return o()||{canAutoUpdate:!1,requiresRoot:!1,rollbackSupport:!1}},get isApplying(){return p()}}),n(k2,{get isOpen(){return g()},onClose:()=>b(!1),onViewHistory:()=>{b(!1),e("/settings/updates")},get connected(){return r?.connected},get reconnecting(){return r?.reconnecting}})]}})}Xt(["click"]);var I2=i('<div class="bg-orange-50 dark:bg-orange-900/20 border-b border-orange-200 dark:border-orange-800 text-orange-800 dark:text-orange-200 relative animate-slideDown"><div class="px-4 py-2"><div class="flex items-center justify-between gap-4"><div class="flex items-center gap-3"><svg class="w-5 h-5 flex-shrink-0"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"stroke-linecap=round stroke-linejoin=round></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg><div class="flex items-center gap-3 flex-wrap"><div class="text-sm space-x-1"><span class=font-medium>Legacy temperature monitoring detected.</span><span>Remove each node and re-add it using the installer script in Settings → Nodes (advanced: rerun the host installer script directly).</span><a href=https://github.com/rcourtman/Pulse/blob/main/docs/PULSE_SENSOR_PROXY_HARDENING.md#upgrading-existing-installations target=_blank rel=noreferrer class="underline decoration-dashed underline-offset-2 hover:decoration-solid">View upgrade guide ↗</a></div><button class="px-3 py-1 text-xs font-medium bg-orange-600 hover:bg-orange-700 dark:bg-orange-700 dark:hover:bg-orange-800 text-white rounded transition-colors">Go to Nodes →</button></div></div><button class="p-1 hover:bg-orange-100 dark:hover:bg-orange-800/30 rounded transition-colors flex-shrink-0"title=Dismiss><svg class="w-4 h-4"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>');function H2(){const e=In(),[r,s]=Z(!1),[l,o]=Z(!1);vr(()=>{localStorage.getItem("legacySSHBannerDismissed")==="true"&&(o(!0),s(!1))}),ft(async()=>{if(!l())try{const c=await(await fetch("/api/health")).json();c.legacySSHDetected&&c.recommendProxyUpgrade&&(s(!0),console.info("[Migration] Legacy SSH banner shown to user"))}catch{}});const a=()=>{o(!0),s(!1),localStorage.setItem("legacySSHBannerDismissed","true"),console.info("[Migration] Legacy SSH banner dismissed by user")};return n(h,{get when(){return r()},get children(){var d=I2(),c=d.firstChild,g=c.firstChild,b=g.firstChild,p=b.firstChild,m=p.nextSibling,S=m.firstChild,z=S.nextSibling,ie=b.nextSibling;return z.$$click=()=>e("/settings/nodes"),ie.$$click=a,d}})}Xt(["click"]);var U2=i('<div class="bg-blue-50 dark:bg-blue-900/20 border-b border-blue-200 dark:border-blue-800 px-3 py-2"><div class="container mx-auto flex items-center justify-between text-sm"><div class="flex items-center gap-2 text-blue-700 dark:text-blue-300"><svg class="w-4 h-4"fill=currentColor viewBox="0 0 20 20"><path fill-rule=evenodd d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"clip-rule=evenodd></path></svg><span>Demo instance with mock data (read-only)</span></div><button class="p-1 hover:bg-blue-100 dark:hover:bg-blue-800/50 rounded text-blue-600 dark:text-blue-400 transition-colors"title=Dismiss><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">');function B2(){const[e,r]=Z(!1),[s,l]=Z(!1);vr(async()=>{try{(await fetch("/api/health")).headers.get("X-Demo-Mode")==="true"&&r(!0)}catch{}});const o=()=>{l(!0),sessionStorage.setItem("demoBannerDismissed","true")};return vr(()=>{sessionStorage.getItem("demoBannerDismissed")==="true"&&l(!0)}),n(h,{get when(){return $e(()=>!!e())()&&!s()},get children(){var a=U2(),d=a.firstChild,c=d.firstChild,g=c.nextSibling;return g.$$click=o,a}})}Xt(["click"]);var j2=i("<div class=space-y-3>"),F2=i('<svg class="h-12 w-12 text-amber-400"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z">'),V2=i('<svg class="h-12 w-12 text-blue-500"fill=none viewBox="0 0 24 24"stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m5.618-4.016A9 9 0 105.64 5.64a9 9 0 0014.978 0z">'),G2=i('<div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Cluster Nodes</h4></div><div class=overflow-x-auto><table class="w-full text-xs"><thead class="bg-gray-50 dark:bg-gray-800/70 border-b border-gray-200 dark:border-gray-700"><tr class="text-[11px] uppercase tracking-wide text-gray-600 dark:text-gray-300"><th class="px-2 py-1 text-left">Name</th><th class="px-2 py-1 text-left">Role</th><th class="px-2 py-1 text-left">Status</th><th class="px-2 py-1 text-left">Uptime</th><th class="px-2 py-1 text-left">Load Avg</th><th class="px-2 py-1 text-left">Queue Depth</th><th class="px-2 py-1 text-left">Oldest Msg</th></tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">'),z2=i('<div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="sticky top-0 z-10 flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-800/40 border-b border-gray-200 dark:border-gray-700"><div class="flex items-center gap-3"><span></span><a target=_blank rel="noopener noreferrer"class="text-sm font-semibold text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400"></a><span class="text-xs text-gray-500 dark:text-gray-400">v</span><span class="text-xs text-gray-500 dark:text-gray-400">•</span><span class="text-xs text-gray-500 dark:text-gray-400 capitalize"></span></div><div class="text-xs text-gray-500 dark:text-gray-400">Updated </div></div><div class="p-3 space-y-3"><div class="grid grid-cols-1 lg:grid-cols-3 gap-3"><div class=space-y-3><div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Mail Flow (24h)</h4></div><table class="w-full text-xs"><tbody class="divide-y divide-gray-200 dark:divide-gray-700"><tr><td class="px-2 py-1.5"><div class="text-xs font-semibold text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Total processed</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of total</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Inbound</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of total</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Outbound</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs font-medium text-orange-600 dark:text-orange-400"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% rate</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Spam caught</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs font-medium text-red-600 dark:text-red-400"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% rate</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Viruses blocked</td></tr></tbody></table></div><div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Traffic Volume</h4></div><table class="w-full text-xs"><tbody class="divide-y divide-gray-200 dark:divide-gray-700"><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"> MB</div><div class="text-[11px] text-gray-500 dark:text-gray-400"> MB/hr avg</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Inbound bytes</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"> MB</div><div class="text-[11px] text-gray-500 dark:text-gray-400"> MB/hr avg</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Outbound bytes</td></tr></tbody></table></div></div><div class=space-y-3><div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Threat & Quarantine</h4></div><table class="w-full text-xs"><tbody class="divide-y divide-gray-200 dark:divide-gray-700"><tr><td class="px-2 py-1.5"><div class="text-xs font-medium text-orange-600 dark:text-orange-400"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">% of quarantine</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Spam quarantined</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs font-medium text-red-600 dark:text-red-400"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">% of quarantine</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Virus quarantined</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs font-medium text-yellow-600 dark:text-yellow-400"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">% of quarantine</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Attachments blocked</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">% of quarantine</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Blacklisted</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs font-semibold text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Total quarantined</td></tr></tbody></table></div></div><div><div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Delivery Health</h4></div><table class="w-full text-xs"><tbody class="divide-y divide-gray-200 dark:divide-gray-700"><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Bounces inbound</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of outbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Bounces outbound</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">RBL rejects</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Pregreet rejects</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Greylisted</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"></div><div class="text-[11px] text-gray-500 dark:text-gray-400">/hr · <!>% of inbound</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Junk mail</td></tr><tr><td class="px-2 py-1.5"><div class="text-xs text-gray-900 dark:text-gray-100"> s</div><div class="text-[11px] text-gray-500 dark:text-gray-400">~<!> msg/min</div></td><td class="px-2 py-1.5 text-[11px] text-gray-500 dark:text-gray-400">Avg process time'),W2=i('<div class="border border-gray-200 dark:border-gray-700 rounded overflow-hidden"><div class="px-2 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200 dark:border-gray-700"><h4 class="text-[10px] font-semibold uppercase tracking-wide text-gray-600 dark:text-gray-300">Spam Score Distribution</h4></div><div class=p-2><div class="grid grid-cols-3 gap-1.5">'),q2=i('<div class="text-center border border-gray-200 dark:border-gray-700 rounded px-1 py-1"><div class="text-[10px] text-gray-500 dark:text-gray-400"></div><div class="text-xs font-semibold text-gray-900 dark:text-gray-100"></div><div class="text-[10px] text-gray-500 dark:text-gray-400">%'),K2=i("<div>"),J2=i('<div class="text-[11px] text-gray-500 dark:text-gray-400">A:<!> D:<!> H:<!> I:'),Q2=i("<span>"),Y2=i('<tr><td class="px-2 py-1.5 text-xs font-medium text-gray-900 dark:text-gray-100"></td><td class="px-2 py-1.5 text-xs text-gray-700 dark:text-gray-300 capitalize"></td><td class="px-2 py-1.5"><div class="flex items-center gap-1.5"><span></span><span class="text-xs text-gray-700 dark:text-gray-300 capitalize"></span></div></td><td class="px-2 py-1.5 text-xs text-gray-700 dark:text-gray-300"></td><td class="px-2 py-1.5 text-xs text-gray-700 dark:text-gray-300"></td><td class="px-2 py-1.5"></td><td class="px-2 py-1.5">'),Ni=i('<span class="text-xs text-gray-500 dark:text-gray-400">—');const Hr=e=>e==null||Number.isNaN(e)?"—":Math.round(e).toLocaleString(),ir=(e,r=1)=>e==null||Number.isNaN(e)?"—":e.toFixed(r),el=e=>{if(!e)return;const r=Date.parse(e);return Number.isNaN(r)?void 0:r},X2=()=>{const{state:e,connected:r}=qr(),s=pe(()=>e.pmg??[]);return(()=>{var l=j2();return t(l,n(Ca,{current:"mail"}),null),t(l,n(h,{get when(){return!r()},get children(){return n(it,{padding:"lg",tone:"warning",get children(){return n(Ur,{get icon(){return F2()},title:"Disconnected from backend",description:"Waiting for backend to reconnect before loading Mail Gateway details."})}})}}),null),t(l,n(h,{get when(){return r()},get children(){return[n(h,{get when(){return s().length===0},get children(){return n(it,{padding:"lg",get children(){return n(Ur,{get icon(){return V2()},title:"No Mail Gateways configured",description:"Add a Proxmox Mail Gateway via Settings → Nodes to start collecting mail analytics."})}})}}),n(ze,{get each(){return s()},children:o=>{const a=(o.connectionHealth||o.status||"").toLowerCase(),d=a.includes("healthy")||(o.status||"").toLowerCase()==="online",c=a.includes("degraded")||a.includes("warning"),g=d?"bg-green-500":c?"bg-amber-500":"bg-red-500",b=()=>{const K=el(o.mailStats?.updatedAt)??el(o.lastUpdated)??el(o.lastSeen);return K?An(K):"—"},p=o.mailStats?.countTotal||0,m=o.mailStats?.countIn||0,S=o.mailStats?.countOut||0,z=o.mailStats?.spamIn||0,ie=o.mailStats?.virusIn||0,ne=o.mailStats?.bouncesIn||0,W=o.mailStats?.bouncesOut||0,X=o.mailStats?.bytesIn||0,I=o.mailStats?.bytesOut||0,L=o.mailStats?.rblRejects||0,H=o.mailStats?.pregreetRejects||0,se=o.mailStats?.greylistCount||0,le=o.mailStats?.junkIn||0,ee=o.quarantine?.spam||0,U=o.quarantine?.virus||0,Y=o.quarantine?.attachment||0,oe=o.quarantine?.blacklisted||0,_=ee+U+Y+oe,B=z/Math.max(p,1)*100,$=ie/Math.max(p,1)*100,D=m/Math.max(p,1)*100,f=S/Math.max(p,1)*100,j=L/Math.max(m,1)*100;return(()=>{var K=z2(),C=K.firstChild,ge=C.firstChild,J=ge.firstChild,N=J.nextSibling,F=N.nextSibling;F.firstChild;var P=F.nextSibling,E=P.nextSibling,u=ge.nextSibling;u.firstChild;var v=C.nextSibling,V=v.firstChild,A=V.firstChild,k=A.firstChild,w=k.firstChild,de=w.nextSibling,fe=de.firstChild,x=fe.firstChild,R=x.firstChild,Q=R.firstChild,G=Q.nextSibling,T=G.firstChild,te=x.nextSibling,ae=te.firstChild,M=ae.firstChild,ce=M.nextSibling,ue=ce.firstChild,re=ue.nextSibling;re.nextSibling;var O=te.nextSibling,xe=O.firstChild,he=xe.firstChild,me=he.nextSibling,_e=me.firstChild,Ce=_e.nextSibling;Ce.nextSibling;var Oe=O.nextSibling,tt=Oe.firstChild,Ze=tt.firstChild,bt=Ze.nextSibling,ct=bt.firstChild,qe=ct.nextSibling;qe.nextSibling;var Ke=Oe.nextSibling,Xe=Ke.firstChild,_t=Xe.firstChild,Lt=_t.nextSibling,vt=Lt.firstChild,Ve=vt.nextSibling;Ve.nextSibling;var lt=k.nextSibling,Re=lt.firstChild,gt=Re.nextSibling,mt=gt.firstChild,Rt=mt.firstChild,It=Rt.firstChild,Ae=It.firstChild,Fe=Ae.firstChild,Qe=Ae.nextSibling,xt=Qe.firstChild,Vt=Rt.nextSibling,Et=Vt.firstChild,Jt=Et.firstChild,er=Jt.firstChild,Ut=Jt.nextSibling,lr=Ut.firstChild,Bt=A.nextSibling,et=Bt.firstChild,we=et.firstChild,Je=we.nextSibling,Ge=Je.firstChild,pt=Ge.firstChild,dt=pt.firstChild,ht=dt.firstChild,We=ht.nextSibling,st=We.firstChild,nr=pt.nextSibling,xr=nr.firstChild,cr=xr.firstChild,sr=cr.nextSibling,wr=sr.firstChild,Gt=nr.nextSibling,br=Gt.firstChild,pr=br.firstChild,yr=pr.nextSibling,Er=yr.firstChild,Nr=Gt.nextSibling,Or=Nr.firstChild,Zr=Or.firstChild,gn=Zr.nextSibling,en=gn.firstChild,sn=Nr.nextSibling,hn=sn.firstChild,xn=hn.firstChild,bn=xn.nextSibling,Dn=bn.firstChild,an=Dn.nextSibling;an.nextSibling;var Hn=Bt.nextSibling,kn=Hn.firstChild,Br=kn.firstChild,ke=Br.nextSibling,Me=ke.firstChild,Ee=Me.firstChild,Se=Ee.firstChild,De=Se.firstChild,be=De.nextSibling,ve=be.firstChild,ye=ve.nextSibling;ye.nextSibling;var Ie=Ee.nextSibling,Le=Ie.firstChild,rt=Le.firstChild,je=rt.nextSibling,jt=je.firstChild,Ct=jt.nextSibling;Ct.nextSibling;var Mt=Ie.nextSibling,Pt=Mt.firstChild,Kt=Pt.firstChild,ur=Kt.nextSibling,$r=ur.firstChild,Ir=$r.nextSibling;Ir.nextSibling;var St=Mt.nextSibling,tr=St.firstChild,Lr=tr.firstChild,gr=Lr.nextSibling,Kr=gr.firstChild,Rr=Kr.nextSibling;Rr.nextSibling;var ln=St.nextSibling,wn=ln.firstChild,Jr=wn.firstChild,Un=Jr.nextSibling,Kn=Un.firstChild,Bn=Kn.nextSibling;Bn.nextSibling;var ss=ln.nextSibling,Ta=ss.firstChild,Gs=Ta.firstChild,ys=Gs.nextSibling,zs=ys.firstChild,vs=zs.nextSibling;vs.nextSibling;var Aa=ss.nextSibling,Da=Aa.firstChild,ks=Da.firstChild,Mr=ks.firstChild,He=ks.nextSibling,nt=He.firstChild,Ne=nt.nextSibling;return Ne.nextSibling,y(J,`h-2.5 w-2.5 rounded-full ${g}`),t(N,()=>o.name),t(F,()=>o.version||"?",null),t(E,()=>o.status||"unknown"),t(u,b,null),t(Q,()=>Hr(p)),t(G,()=>ir(p/24),T),t(M,()=>Hr(m)),t(ce,()=>ir(m/24),ue),t(ce,()=>ir(D),re),t(he,()=>Hr(S)),t(me,()=>ir(S/24),_e),t(me,()=>ir(f),Ce),t(Ze,()=>Hr(z)),t(bt,()=>ir(z/24),ct),t(bt,()=>ir(B),qe),t(_t,()=>Hr(ie)),t(Lt,()=>ir(ie/24),vt),t(Lt,()=>ir($),Ve),t(Ae,()=>ir(X/1024/1024),Fe),t(Qe,()=>ir(X/1024/1024/24),xt),t(Jt,()=>ir(I/1024/1024),er),t(Ut,()=>ir(I/1024/1024/24),lr),t(ht,()=>Hr(ee)),t(We,()=>ir(ee/Math.max(_,1)*100),st),t(cr,()=>Hr(U)),t(sr,()=>ir(U/Math.max(_,1)*100),wr),t(pr,()=>Hr(Y)),t(yr,()=>ir(Y/Math.max(_,1)*100),Er),t(Zr,()=>Hr(oe)),t(gn,()=>ir(oe/Math.max(_,1)*100),en),t(xn,()=>Hr(_)),t(bn,()=>ir(_/24),Dn),t(bn,()=>ir(_/Math.max(m,1)*100),an),t(Bt,n(h,{get when(){return(o.spamDistribution?.length??0)>0},get children(){return(()=>{const ut=o.spamDistribution?.reduce((kt,Tt)=>kt+Tt.count,0)||1;return(()=>{var kt=W2(),Tt=kt.firstChild,At=Tt.nextSibling,Ue=At.firstChild;return t(Ue,n(ze,{get each(){return o.spamDistribution},children:Be=>{const at=Be.count/ut*100;return(()=>{var zt=q2(),wt=zt.firstChild,or=wt.nextSibling,Cr=or.nextSibling,jn=Cr.firstChild;return t(wt,()=>Be.score),t(or,()=>Hr(Be.count)),t(Cr,()=>ir(at),jn),zt})()}})),kt})()})()}}),null),t(De,()=>Hr(ne)),t(be,()=>ir(ne/24),ve),t(be,()=>ir(ne/Math.max(m,1)*100),ye),t(rt,()=>Hr(W)),t(je,()=>ir(W/24),jt),t(je,()=>ir(W/Math.max(S,1)*100),Ct),t(Kt,()=>Hr(L)),t(ur,()=>ir(L/24),$r),t(ur,()=>ir(j),Ir),t(Lr,()=>Hr(H)),t(gr,()=>ir(H/24),Kr),t(gr,()=>ir(H/Math.max(m,1)*100),Rr),t(Jr,()=>Hr(se)),t(Un,()=>ir(se/24),Kn),t(Un,()=>ir(se/Math.max(m,1)*100),Bn),t(Gs,()=>Hr(le)),t(ys,()=>ir(le/24),zs),t(ys,()=>ir(le/Math.max(m,1)*100),vs),t(ks,(()=>{var ut=$e(()=>!!o.mailStats?.averageProcessTimeMs);return()=>ut()?ir(o.mailStats.averageProcessTimeMs/1e3,2):"—"})(),Mr),t(He,(()=>{var ut=$e(()=>!!o.mailStats?.averageProcessTimeMs);return()=>ut()?Hr(6e4/o.mailStats.averageProcessTimeMs):"—"})(),Ne),t(v,n(h,{get when(){return(o.nodes?.length??0)>0},get children(){var ut=G2(),kt=ut.firstChild,Tt=kt.nextSibling,At=Tt.firstChild,Ue=At.firstChild,Be=Ue.nextSibling;return t(Be,n(ze,{get each(){return o.nodes},children:at=>{const zt=(at.status||"").toLowerCase()==="online"?"bg-green-500":"bg-red-500",wt=at.queueStatus,or=wt?.total||0,jn=or>0&&or>50?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-300",Pe=wt?.oldestAge||0,Nt=Math.floor(Pe/60),Qt=Math.floor(Nt/60),Ye=Pe>1800?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-300";return(()=>{var ar=Y2(),Pr=ar.firstChild,_r=Pr.nextSibling,Vr=_r.nextSibling,mr=Vr.firstChild,$n=mr.firstChild,Qr=$n.nextSibling,Dr=Vr.nextSibling,ws=Dr.nextSibling,_l=ws.nextSibling,To=_l.nextSibling;return t(Pr,()=>at.name),t(_r,()=>at.role||"—"),y($n,`h-1.5 w-1.5 rounded-full ${zt}`),t(Qr,()=>at.status||"unknown"),t(Dr,n(h,{get when(){return at.uptime},fallback:"—",get children(){return[$e(()=>Math.floor((at.uptime??0)/86400)),"d ",$e(()=>Math.floor((at.uptime??0)%86400/3600)),"h"]}})),t(ws,()=>at.loadAvg||"—"),t(_l,n(h,{when:wt,get fallback(){return Ni()},get children(){return[(()=>{var tn=K2();return y(tn,`text-xs font-medium ${jn}`),t(tn,()=>Hr(or)),tn})(),(()=>{var tn=J2(),Ao=tn.firstChild,Cl=Ao.nextSibling,Do=Cl.nextSibling,Sl=Do.nextSibling,Mo=Sl.nextSibling,Tl=Mo.nextSibling;return Tl.nextSibling,t(tn,()=>wt.active,Cl),t(tn,()=>wt.deferred,Sl),t(tn,()=>wt.hold,Tl),t(tn,()=>wt.incoming,null),tn})()]}})),t(To,n(h,{when:wt&&Pe>0,get fallback(){return Ni()},get children(){var tn=Q2();return y(tn,`text-xs ${Ye}`),t(tn,Qt>0?`${Qt}h ${Nt%60}m`:`${Nt}m`),tn}})),ar})()}})),ut}}),null),q(()=>Te(N,"href",o.host||`https://${o.name}:8006`)),K})()}})]}}),null),l})()},Z2={path:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z"},ew={path:"M4.928 1.825c-1.09.553-1.09.64-.07 1.78 5.655 6.295 7.004 7.782 7.107 7.782.139.017 7.971-8.542 8.058-8.801.034-.07-.208-.312-.519-.536-.415-.312-.864-.433-1.712-.467-1.59-.104-2.144.242-4.115 2.455-.899 1.003-1.66 1.833-1.66 1.833-.017 0-.76-.813-1.642-1.798S8.473 2.1 8.127 1.91c-.796-.45-2.421-.484-3.2-.086zM1.297 4.367C.45 4.695 0 5.007 0 5.248c0 .121 1.331 1.678 2.94 3.459 1.625 1.78 2.939 3.268 2.939 3.302 0 .035-1.331 1.522-2.94 3.303C1.314 17.11.017 18.683.035 18.822c.086.467 1.504 1.055 2.541 1.055 1.678-.018 2.058-.312 5.603-4.202 1.78-1.954 3.233-3.614 3.233-3.666 0-.069-1.435-1.694-3.199-3.63-2.3-2.508-3.423-3.632-3.96-3.874-.812-.398-2.126-.467-2.956-.138zm18.467.12c-.502.26-1.764 1.505-3.943 3.891-1.763 1.937-3.199 3.562-3.199 3.631 0 .07 1.453 1.712 3.234 3.666 3.544 3.89 3.925 4.184 5.602 4.202 1.038 0 2.455-.588 2.542-1.055.017-.156-1.28-1.712-2.905-3.493-1.608-1.78-2.94-3.285-2.94-3.32 0-.034 1.332-1.539 2.94-3.32C22.72 6.91 24.017 5.352 24 5.214c-.087-.45-1.366-.968-2.473-1.038-.795-.034-1.21.035-1.763.312zM7.954 16.973c-2.144 2.369-3.908 4.374-3.943 4.46-.034.07.208.312.52.537.414.311.864.432 1.711.467 1.574.103 2.161-.26 4.15-2.508.864-.968 1.608-1.78 1.625-1.78s.761.812 1.643 1.798c2.023 2.248 2.559 2.576 4.132 2.49.848-.035 1.297-.156 1.712-.467.311-.225.553-.467.519-.536-.087-.26-7.92-8.819-8.058-8.801-.069 0-1.867 1.954-4.011 4.34z"};var tw=i('<svg role=img viewBox="0 0 24 24"xmlns=http://www.w3.org/2000/svg><title></title><path fill=currentColor>');const rw=e=>(()=>{var r=tw(),s=r.firstChild,l=s.nextSibling;return t(s,()=>e.title??"Proxmox"),q(o=>{var a=e.class,d=e.title??"Proxmox",c=ew.path;return a!==o.e&&Te(r,"class",o.e=a),d!==o.t&&Te(r,"aria-label",o.t=d),c!==o.a&&Te(l,"d",o.a=c),o},{e:void 0,t:void 0,a:void 0}),r})();var nw=i('<svg role=img viewBox="0 0 24 24"xmlns=http://www.w3.org/2000/svg><title></title><path fill=currentColor>');const sw=e=>(()=>{var r=nw(),s=r.firstChild,l=s.nextSibling;return t(s,()=>e.title??"Docker"),q(o=>{var a=e.class,d=e.title??"Docker",c=Z2.path;return a!==o.e&&Te(r,"class",o.e=a),d!==o.t&&Te(r,"aria-label",o.t=d),c!==o.a&&Te(l,"d",o.a=c),o},{e:void 0,t:void 0,a:void 0}),r})();/**
|
||
* @license lucide-solid v0.545.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const aw=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],lw=e=>n(nn,kr(e,{iconNode:aw,name:"bell"})),iw=e=>n(lw,kr(e,{strokeWidth:2})),ow=e=>n(yo,kr(e,{strokeWidth:2}));var dw=i('<button type=button class="absolute top-3 right-3 rounded-md px-2 py-1 text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"aria-label="Close token dialog">Close'),cw=i('<span class="inline-flex items-center rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide">'),uw=i('<div class="flex items-start gap-3"><div class="flex-shrink-0 rounded-full bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300 p-2"><svg class="w-6 h-6"viewBox="0 0 24 24"fill=none stroke=currentColor><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg></div><div class="space-y-2 flex-1"><div class="flex flex-wrap items-center gap-2"><h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">API token ready</h2></div><p class="text-sm text-gray-700 dark:text-gray-300 leading-snug">'),gw=i('<span> · Hint: <code class="rounded bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 font-mono text-[11px] text-gray-600 dark:text-gray-400">'),hw=i('<div class="mt-5 space-y-3"><div class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400">Token value</div><div class="flex flex-col sm:flex-row sm:items-center gap-2"><code class="flex-1 rounded-lg border border-green-300 dark:border-green-700 bg-white dark:bg-gray-900 px-4 py-3 font-mono text-base font-semibold text-gray-900 dark:text-gray-100 break-all"></code><button type=button class="inline-flex items-center justify-center rounded-lg bg-green-600 hover:bg-green-700 text-white text-sm font-semibold px-4 py-2 transition-colors shadow-sm"></button></div><div class="text-xs text-gray-600 dark:text-gray-400">Label: <span class="font-semibold text-gray-800 dark:text-gray-200">'),fw=i('<div class="mt-6 flex justify-end"><button type=button class="rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors">Dismiss'),mw=i('<div class="fixed inset-0 z-[60] flex items-center justify-center px-4 py-6"><div class="absolute inset-0 bg-gray-900/70 backdrop-blur-sm"role=presentation></div><div class="relative z-[61] w-full max-w-xl">');const xw=e=>e?e.split(/[-_\s]+/).filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "):"",bw=()=>{const e=po(),[r,s]=Z(!1),l=()=>{Bh(),s(!1)},o=async a=>{await on(a)?(s(!0),Wt("Token copied to clipboard"),setTimeout(()=>s(!1),2e3)):$t("Failed to copy token")};return ft(()=>{const a=e();if(s(!1),!a)return;const d=c=>{c.key==="Escape"&&l()};window.addEventListener("keydown",d),Ar(()=>window.removeEventListener("keydown",d))}),n(h,{get when(){return e()},children:a=>{const d=a(),c=xw(d.source),g=d.record?.name?.trim()||"Untitled token",b=d.note||"Copy this token now; Pulse will not display it again after you close this dialog.",p=d.record?.prefix&&d.record?.suffix?`${d.record.prefix}…${d.record.suffix}`:d.record?.prefix?`${d.record.prefix}…`:d.record?.suffix?`…${d.record.suffix}`:null;return(()=>{var m=mw(),S=m.firstChild,z=S.nextSibling;return S.$$click=l,t(z,n(it,{padding:"lg",class:"shadow-2xl relative",get children(){return[(()=>{var ie=dw();return ie.$$click=l,ie})(),(()=>{var ie=uw(),ne=ie.firstChild,W=ne.nextSibling,X=W.firstChild;X.firstChild;var I=X.nextSibling;return t(X,n(h,{when:c,get children(){var L=cw();return t(L,c),L}}),null),t(I,b),ie})(),(()=>{var ie=hw(),ne=ie.firstChild,W=ne.nextSibling,X=W.firstChild,I=X.nextSibling,L=W.nextSibling,H=L.firstChild,se=H.nextSibling;return t(X,()=>d.token),I.$$click=()=>o(d.token),t(I,()=>r()?"Copied!":"Copy token"),t(se,g),t(L,n(h,{when:p,get children(){var le=gw(),ee=le.firstChild,U=ee.nextSibling;return t(U,p),le}}),null),ie})(),(()=>{var ie=fw(),ne=ie.firstChild;return ne.$$click=l,ie})()]}})),m})()}})};Xt(["click"]);var pw=i("<div>Loading..."),yw=i('<div class="min-h-screen bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-gray-200 font-sans py-4 sm:py-6">'),vw=i('<div class="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900"><div class="text-gray-600 dark:text-gray-400">Loading...'),kw=i("<div>Initializing..."),ww=i('<span class="text-xs px-1.5 py-0.5 bg-orange-500 text-white rounded font-bold">RC'),$w=i('<svg class="animate-spin h-3 w-3 flex-shrink-0"fill=none viewBox="0 0 24 24"><circle class=opacity-25 cx=12 cy=12 r=10 stroke=currentColor stroke-width=4></circle><path class=opacity-75 fill=currentColor d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),_w=i('<span class="h-2.5 w-2.5 rounded-full bg-green-600 dark:bg-green-400 flex-shrink-0">'),Cw=i('<span class="h-2.5 w-2.5 rounded-full bg-gray-600 dark:bg-gray-400 flex-shrink-0">'),Sw=i('<span class="text-xs px-2 py-1 text-gray-600 dark:text-gray-400">'),Tw=i('<button type=button class="group relative flex h-7 items-center justify-center gap-1 rounded-full bg-gray-200 px-2 text-xs text-gray-700 transition-all duration-500 ease-in-out hover:bg-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"title=Logout aria-label=Logout><svg class="h-3 w-3 flex-shrink-0"fill=none viewBox="0 0 24 24"stroke=currentColor stroke-width=2 aria-hidden=true><path stroke-linecap=round stroke-linejoin=round d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg><span class="max-w-0 overflow-hidden whitespace-nowrap opacity-0 transition-all duration-500 ease-in-out group-hover:ml-1 group-hover:max-w-[80px] group-hover:opacity-100 group-focus-visible:ml-1 group-focus-visible:max-w-[80px] group-focus-visible:opacity-100">Logout'),Aw=i("<span class=mx-2>|"),Dw=i("<span>Last refresh: "),Mw=i('<div class=pulse-shell><div class="header flex flex-row justify-between items-center mb-2"><div class="hidden md:block md:flex-1"></div><div class="flex items-center gap-1 flex-none"><svg width=20 height=20 viewBox="0 0 256 256"xmlns=http://www.w3.org/2000/svg><title>Pulse Logo</title><circle class="pulse-bg fill-blue-600 dark:fill-blue-500"cx=128 cy=128 r=122></circle><circle class="pulse-ring fill-none stroke-white stroke-[14] opacity-[0.92]"cx=128 cy=128 r=84></circle><circle class="pulse-center fill-white dark:fill-[#dbeafe]"cx=128 cy=128 r=26></circle></svg><span class="text-lg font-medium text-gray-800 dark:text-gray-200">Pulse</span></div><div class="header-controls flex justify-end items-center gap-4 md:flex-1"><div class="flex items-center gap-2"><div><span></span></div></div></div></div><div class="tabs flex items-end gap-2 mb-2 border-b border-gray-300 dark:border-gray-700 overflow-x-auto overflow-y-hidden whitespace-nowrap scrollbar-hide"role=tablist aria-label="Primary navigation"><div class="flex items-end gap-1"role=group aria-label=Infrastructure></div><div class="flex items-end gap-2 ml-auto"role=group aria-label=System><div class="flex items-end gap-1 pl-3 sm:pl-4"></div></div></div><main id=main class="tab-content block bg-white dark:bg-gray-800 rounded-b rounded-tr shadow mb-2"><div class=pulse-panel></div></main><footer class="text-center text-xs text-gray-500 dark:text-gray-400 py-4">Pulse | Version: <a href=https://github.com/rcourtman/Pulse/releases target=_blank rel="noopener noreferrer"class="text-blue-600 dark:text-blue-400 hover:underline">'),Pw=i('<span class="ml-1 text-[10px] uppercase tracking-wide text-gray-400 dark:text-gray-600">Add host'),Ew=i("<div role=tab><span>"),Nw=i('<span class="ml-1 w-2 h-2 bg-red-500 rounded-full animate-pulse">'),Ow=i('<div role=tab><span class="flex items-center gap-1.5"><span>'),Lw=i('<span class="inline-flex items-center gap-1">'),Rw=i('<span class="inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-bold text-white bg-red-600 dark:bg-red-500 rounded-full">'),Iw=i('<span class="inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-semibold text-amber-900 dark:text-amber-100 bg-amber-200 dark:bg-amber-500/80 rounded-full">');const Sa=fs(),qr=()=>{const e=Rn(Sa);if(!e)throw new Error("useWebSocket must be used within WebSocketContext.Provider");return e},So=fs(()=>!1),Hw=()=>{const e=Rn(So);if(!e)throw new Error("useDarkMode must be used within DarkModeContext.Provider");return e};function Uw(){const e=Rn(Sa);if(!e)return pw();const{state:r,activeAlerts:s}=e,l=pe(()=>r.dockerHosts??[]);return n(fk,{get hosts(){return l()},activeAlerts:s})}function Bw(){const e=hc(),r=Ls(),s=()=>(r?ka(r,()=>Na()):Na())||Na(),l={nodes:[],vms:[],containers:[],dockerHosts:[],storage:[],cephClusters:[],physicalDisks:[],pbs:[],pmg:[],metrics:[],pveBackups:{backupTasks:[],storageBackups:[],guestSnapshots:[]},pbsBackups:[],performance:{apiCallDuration:{},lastPollDuration:0,pollingStartTime:"",totalApiCalls:0,failedApiCalls:0,cacheHits:0,cacheMisses:0},connectionHealth:{},stats:{startTime:new Date().toISOString(),uptime:0,pollingCycles:0,webSocketClients:0,version:"0.0.0"},activeAlerts:[],recentlyResolved:[],lastUpdate:""},[o,a]=Z(!0),[d,c]=Z(!1),[g,b]=Z(!1),[p,m]=Z(null),[S,z]=Z(null),ie=()=>S()?.state||l,ne=()=>S()?.connected()||!1,W=()=>S()?.reconnecting()||!1,[X,I]=Z(!1);let L;const[H,se]=Z(""),le=J=>J?new Date(J).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0}):"";ft(()=>{const J=ie().lastUpdate;J&&J!==""&&(I(!0),se(le(J)),window.clearTimeout(L),L=window.setTimeout(()=>I(!1),xa.DATA_FLASH))});const[ee,U]=Z(null),Y=localStorage.getItem(_n.DARK_MODE),oe=Y!==null,_=oe?Y==="true":window.matchMedia("(prefers-color-scheme: dark)").matches,[B,$]=Z(_),[,D]=Z(!1);_?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");const f=async()=>{const J=!B();if($(J),localStorage.setItem(_n.DARK_MODE,String(J)),J?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),Sr.info("Theme changed",{mode:J?"dark":"light"}),!d())try{await Sn.updateSystemSettings({theme:J?"dark":"light"}),Sr.info("Theme preference saved to server")}catch(N){Sr.error("Failed to save theme preference to server",N)}};vr(()=>{const J=N=>{if(!N)return;Sr.info("Received theme change from another browser instance",{theme:N});const F=N==="dark";$(F),localStorage.setItem(_n.DARK_MODE,String(F)),F?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};dn.on("theme_changed",J),Ar(()=>{dn.off("theme_changed",J)})}),vr(async()=>{if(console.log("[App] Starting auth check..."),localStorage.getItem("just_logged_out")){localStorage.removeItem("just_logged_out"),console.log("[App] Just logged out, showing login page"),b(!0),c(!0),a(!1);return}try{const F=await(await Zn("/api/security/status")).json();if(console.log("[App] Security status:",F),F.disabled===!0){if(console.log("[App] Auth is disabled via DISABLE_AUTH, skipping authentication"),b(!1),c(!1),z(s()),!oe)try{const u=await Sn.getSystemSettings();if(u.theme&&u.theme!==""){const v=u.theme==="dark";$(v),localStorage.setItem(_n.DARK_MODE,String(v)),v?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}D(!0)}catch(u){console.error("Failed to load theme from server:",u)}yn.getVersion().then(u=>{U(u),Tr.checkForUpdates()}).catch(u=>console.error("Failed to load version:",u)),a(!1);return}const P=F.hasAuthentication||!1;if(b(P),F.hasProxyAuth&&F.proxyAuthUsername){if(console.log("[App] Proxy auth detected, user:",F.proxyAuthUsername),m({username:F.proxyAuthUsername,logoutURL:F.proxyAuthLogoutURL}),c(!1),z(s()),!oe)try{const u=await Sn.getSystemSettings();if(u.theme&&u.theme!==""){const v=u.theme==="dark";$(v),localStorage.setItem(_n.DARK_MODE,String(v)),v?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}D(!0)}catch(u){console.error("Failed to load theme from server:",u)}yn.getVersion().then(u=>{U(u),Tr.checkForUpdates()}).catch(u=>console.error("Failed to load version:",u)),a(!1);return}if(F.oidcEnabled&&F.oidcUsername){if(console.log("[App] OIDC session detected, user:",F.oidcUsername),b(!0),m({username:F.oidcUsername,logoutURL:F.oidcLogoutURL}),c(!1),z(s()),!oe)try{const u=await Sn.getSystemSettings();if(u.theme&&u.theme!==""){const v=u.theme==="dark";$(v),localStorage.setItem(_n.DARK_MODE,String(v)),v?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}D(!0)}catch(u){console.error("Failed to load theme from server:",u)}yn.getVersion().then(u=>{U(u),Tr.checkForUpdates()}).catch(u=>console.error("Failed to load version:",u)),a(!1);return}if(!P){console.log("[App] No auth configured, showing Login/FirstRunSetup"),c(!0),a(!1);return}if((await Zn("/api/state",{headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}})).status===401)c(!0);else if(c(!1),z(s()),oe)D(!0);else try{const u=await Sn.getSystemSettings();if(u.theme&&u.theme!==""){const v=u.theme==="dark";$(v),localStorage.setItem(_n.DARK_MODE,String(v)),v?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}D(!0)}catch(u){console.error("Failed to load theme from server:",u)}}catch(N){console.error("Auth check error:",N),c(!1),z(s())}finally{a(!1)}yn.getVersion().then(N=>{U(N),Tr.checkForUpdates()}).catch(N=>console.error("Failed to load version:",N))});const j=()=>{window.location.reload()},K=async()=>{const J=p();if(J?.logoutURL){window.location.href=J.logoutURL;return}try{const{apiFetch:F,clearAuth:P}=await Ln(async()=>{const{apiFetch:u,clearAuth:v}=await Promise.resolve().then(()=>zn);return{apiFetch:u,clearAuth:v}},void 0),E=await F("/api/logout",{method:"POST"});E.ok||console.error("Logout failed:",E.status),P()}catch(F){console.error("Logout error:",F)}const N=localStorage.getItem(_n.DARK_MODE);localStorage.clear(),sessionStorage.clear(),localStorage.setItem("just_logged_out","true"),N&&localStorage.setItem(_n.DARK_MODE,N),S()&&z(null),window.location.href="/"},C=()=>S();return n(Qd,{root:J=>n(h,{get when(){return!o()},get fallback(){return vw()},get children(){return n(h,{get when(){return!d()},get fallback(){return n(Qk,{onLogin:j})},get children(){return n(oo,{get children(){return n(h,{get when(){return C()},get fallback(){return kw()},get children(){return n(Sa.Provider,{get value(){return C()},get children(){return n(So.Provider,{value:B,get children(){return[n(Lk,{}),n(B2,{}),n(R2,{}),n(H2,{}),(()=>{var N=yw();return t(N,n(jw,{connected:ne,reconnecting:W,dataUpdated:X,lastUpdateText:H,versionInfo:ee,hasAuth:g,needsAuth:d,proxyAuthInfo:p,handleLogout:K,state:ie,get children(){return J.children}})),N})(),n($k,{}),n(Mk,{}),n(bw,{}),n(e,{})]}})}})}})}})}})}}),get children(){return[n(pn,{path:"/",component:()=>n(qs,{href:"/proxmox/overview"})}),n(pn,{path:"/proxmox",component:()=>n(qs,{href:"/proxmox/overview"})}),n(pn,{path:"/proxmox/overview",component:()=>n(f0,{get vms(){return ie().vms},get containers(){return ie().containers},get nodes(){return ie().nodes}})}),n(pn,{path:"/proxmox/storage",component:rg}),n(pn,{path:"/proxmox/mail",component:X2}),n(pn,{path:"/proxmox/backups",component:ih}),n(pn,{path:"/storage",component:()=>n(qs,{href:"/proxmox/storage"})}),n(pn,{path:"/backups",component:()=>n(qs,{href:"/proxmox/backups"})}),n(pn,{path:"/docker",component:Uw}),n(pn,{path:"/alerts/*",component:a1}),n(pn,{path:"/settings/*",component:()=>n(Lp,{darkMode:B,toggleDarkMode:f})})]}})}function jw(e){const r=In(),s=Bs(),l="pulse-platforms-seen",o=()=>{if(typeof window>"u")return{};try{const W=window.localStorage.getItem(l);if(W){const X=JSON.parse(W);if(X&&typeof X=="object")return X}}catch(W){console.warn("Failed to parse stored platform visibility preferences",W)}return{}},[a,d]=Z(o()),c=W=>{if(!(typeof window>"u"))try{window.localStorage.setItem(l,JSON.stringify(W))}catch(X){console.warn("Failed to persist platform visibility preferences",X)}},g=W=>{d(X=>{if(X[W])return X;const I={...X,[W]:!0};return c(I),I})},b=()=>{const W=s.pathname;return W.startsWith("/proxmox")?"proxmox":W.startsWith("/docker")?"docker":W.startsWith("/alerts")?"alerts":W.startsWith("/settings")?"settings":"proxmox"},p=pe(()=>(e.state().dockerHosts?.length??0)>0),m=pe(()=>(e.state().nodes?.length??0)>0||(e.state().vms?.length??0)>0||(e.state().containers?.length??0)>0);ft(()=>{p()&&g("docker")}),ft(()=>{m()&&g("proxmox")});const S=pe(()=>[{id:"proxmox",label:"Proxmox",route:"/proxmox/overview",settingsRoute:"/settings",tooltip:"Monitor Proxmox clusters and nodes",enabled:m()||!!a().proxmox,live:m(),icon:n(rw,{class:"w-4 h-4 shrink-0"})},{id:"docker",label:"Docker",route:"/docker",settingsRoute:"/settings/docker",tooltip:"Monitor Docker hosts and containers",enabled:p()||!!a().docker,live:p(),icon:n(sw,{class:"w-4 h-4 shrink-0"})}]),z=pe(()=>{const X=(e.state().activeAlerts||[]).reduce((L,H)=>(H?.acknowledged||(String(H?.level||"").toLowerCase()==="critical"?L.critical+=1:L.warning+=1),L),{warning:0,critical:0});return[{id:"alerts",label:"Alerts",route:"/alerts",tooltip:"Review active alerts and automation rules",badge:null,count:X.warning+X.critical,breakdown:X,icon:n(iw,{class:"w-4 h-4 shrink-0"})},{id:"settings",label:"Settings",route:"/settings",tooltip:"Configure Pulse preferences and integrations",badge:Tr.isUpdateVisible()?"update":null,count:void 0,breakdown:void 0,icon:n(ow,{class:"w-4 h-4 shrink-0"})}]}),ie=W=>{W.enabled?r(W.route):r(W.settingsRoute)},ne=W=>{r(W.route)};return(()=>{var W=Mw(),X=W.firstChild,I=X.firstChild,L=I.nextSibling,H=L.firstChild;H.nextSibling;var se=L.nextSibling,le=se.firstChild,ee=le.firstChild,U=ee.firstChild,Y=X.nextSibling,oe=Y.firstChild,_=oe.nextSibling,B=_.firstChild,$=Y.nextSibling,D=$.firstChild,f=$.nextSibling,j=f.firstChild,K=j.nextSibling;return t(L,n(h,{get when(){return e.versionInfo()?.channel==="rc"},get children(){return ww()}}),null),t(ee,n(h,{get when(){return e.reconnecting()},get children(){return $w()}}),U),t(ee,n(h,{get when(){return e.connected()},get children(){return _w()}}),U),t(ee,n(h,{get when(){return $e(()=>!e.connected())()&&!e.reconnecting()},get children(){return Cw()}}),U),t(U,(()=>{var C=$e(()=>!!e.connected());return()=>C()?"Connected":e.reconnecting()?"Reconnecting...":"Disconnected"})()),t(le,n(h,{get when(){return $e(()=>!!e.hasAuth())()&&!e.needsAuth()},get children(){return[n(h,{get when(){return e.proxyAuthInfo()?.username},get children(){var C=Sw();return t(C,()=>e.proxyAuthInfo()?.username),C}}),(()=>{var C=Tw();return Gr(C,"click",e.handleLogout,!0),C})()]}}),null),t(oe,n(ze,{get each(){return S()},children:C=>{const ge=()=>b()===C.id,J=()=>!C.enabled,N="tab relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium flex items-center gap-1 sm:gap-1.5 rounded-t border border-transparent transition-colors whitespace-nowrap cursor-pointer",F=()=>ge()?`${N} bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-400 border-gray-300 dark:border-gray-700 border-b border-b-white dark:border-b-gray-800 shadow-sm font-semibold`:J()?`${N} cursor-not-allowed text-gray-400 dark:text-gray-600 opacity-70 bg-gray-100/40 dark:bg-gray-800/40`:`${N} text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60`,P=()=>J()?`${C.label} is not configured yet. Click to open settings.`:C.tooltip;return(()=>{var E=Ew(),u=E.firstChild;return E.$$click=()=>ie(C),t(E,()=>C.icon,u),t(u,()=>C.label),t(E,n(h,{get when(){return J()&&!C.live},get children(){return Pw()}}),null),q(v=>{var V=F(),A=J(),k=P();return V!==v.e&&y(E,v.e=V),A!==v.t&&Te(E,"aria-disabled",v.t=A),k!==v.a&&Te(E,"title",v.a=k),v},{e:void 0,t:void 0,a:void 0}),E})()}})),t(B,n(ze,{get each(){return z()},children:C=>{const ge=()=>b()===C.id,J="tab relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium flex items-center gap-1 sm:gap-1.5 rounded-t border border-transparent transition-colors whitespace-nowrap cursor-pointer",N=()=>ge()?`${J} bg-white dark:bg-gray-800 text-blue-600 dark:text-blue-400 border-gray-300 dark:border-gray-700 border-b border-b-white dark:border-b-gray-800 shadow-sm font-semibold`:`${J} text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hover:bg-gray-200/60 dark:hover:bg-gray-700/60`;return(()=>{var F=Ow(),P=F.firstChild,E=P.firstChild;return F.$$click=()=>ne(C),Te(F,"aria-disabled",!1),t(F,()=>C.icon,P),t(E,()=>C.label),t(P,(()=>{var u=$e(()=>C.id==="alerts");return()=>u()&&((C.count??0)<=0?null:(()=>{var V=Lw();return t(V,(()=>{var A=$e(()=>C.breakdown?.critical>0);return()=>A()&&(()=>{var k=Rw();return t(k,()=>C.breakdown.critical),k})()})(),null),t(V,(()=>{var A=$e(()=>C.breakdown?.warning>0);return()=>A()&&(()=>{var k=Iw();return t(k,()=>C.breakdown.warning),k})()})(),null),V})())})(),null),t(F,n(h,{get when(){return C.badge==="update"},get children(){return Nw()}}),null),q(u=>{var v=N(),V=C.tooltip;return v!==u.e&&y(F,u.e=v),V!==u.t&&Te(F,"title",u.t=V),u},{e:void 0,t:void 0}),F})()}})),t(D,()=>e.children),t(K,()=>e.versionInfo()?.version||"loading..."),t(f,()=>e.versionInfo()?.isDevelopment&&" (Development)",null),t(f,()=>e.versionInfo()?.isDocker&&" - Docker",null),t(f,n(h,{get when(){return e.lastUpdateText()},get children(){return[Aw(),(()=>{var C=Dw();return C.firstChild,t(C,()=>e.lastUpdateText(),null),C})()]}}),null),q(C=>{var ge=`pulse-logo ${e.connected()&&e.dataUpdated()?"animate-pulse-logo":""}`,J=`group status text-xs rounded-full flex items-center justify-center transition-all duration-500 ease-in-out px-1.5 ${e.connected()?"connected bg-green-200 dark:bg-green-700 text-green-700 dark:text-green-300 min-w-6 h-6 group-hover:px-3":e.reconnecting()?"reconnecting bg-yellow-200 dark:bg-yellow-700 text-yellow-700 dark:text-yellow-300 py-1":"disconnected bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 min-w-6 h-6 group-hover:px-3"}`,N=`whitespace-nowrap overflow-hidden transition-all duration-500 ${e.connected()||!e.connected()&&!e.reconnecting()?"max-w-0 group-hover:max-w-[100px] group-hover:ml-2 group-hover:mr-1 opacity-0 group-hover:opacity-100":"max-w-[100px] ml-1 opacity-100"}`;return ge!==C.e&&Te(H,"class",C.e=ge),J!==C.t&&y(ee,C.t=J),N!==C.a&&y(U,C.a=N),C},{e:void 0,t:void 0,a:void 0}),W})()}Xt(["click"]);const tl=document.getElementById("root");console.log("[Index] Starting Pulse app...");Sr.info("Pulse monitoring dashboard starting");if(tl){console.log("[Index] Root element found, rendering App...");try{id(()=>n(Bw,{}),tl),console.log("[Index] Render call completed")}catch(e){console.error("[Index] Render error:",e),tl.innerHTML=`<div style="color: red; padding: 20px;">
|
||
<h1>Error Loading App</h1>
|
||
<pre>${e}</pre>
|
||
</div>`}}else console.error("[Index] Root element not found!");export{_n as S,n as a,rr as b,Z as c,h as d,q as e,y as f,pa as g,Wt as h,t as i,on as j,Xt as k,$e as m,vr as o,$t as s,i as t};
|