import{E as e,G as t,O as n,Rt as r,S as i,T as a,W as o,_t as s,dt as c,kt as l,mt as u,n as d,p as f,q as p,v as ee,y as m}from"./vue-i18n-Bp4YYb-2.js";import{C as h,Lt as g,Tr as _,_ as v,ai as y,dr as b,gr as x,lr as S,pi as C,v as w,x as T,y as E,ya as D}from"./index-BOiiIZox.js";import{n as O,t as k}from"./column-Bqn4T3tI.js";import{t as A}from"./tag-DtMBeMTe.js";var j={class:`flex h-[3.5rem] border-b-4 border-border-one items-center justify-between`},M={class:`pl-4 py-2 text-2xl font-bold`},N={class:`mt-8 flex flex-col max-w-3xl`},P={class:`pb-3 ml-1 font-semibold text-xl text-text-color`},F={class:`ml-1 text-text-color-secondary leading-relaxed`},I={class:`mt-3 ml-1 inline-flex items-center gap-1.5 underline text-text-color`,href:`https://docs.coolercontrol.org/automation/plugins.html`,target:`_blank`,rel:`noopener noreferrer`},L={class:`mt-6 flex flex-col gap-3 max-w-3xl ml-1`},R={class:`flex items-start gap-2 text-text-color-secondary`},z={class:`flex items-start gap-2 text-text-color-secondary`},B={class:`mt-8 flex flex-col`},V={class:`pb-3 ml-1 font-semibold text-xl text-text-color`},H={class:`flex items-center gap-2 text-text-color-secondary py-4`},U={class:`text-text-color-secondary text-sm`},W=3e4,G=n({__name:`PluginsOverView`,setup(n){let G=g(),K=D(),{t:q}=d(),J=l(new Map),Y,X=ee(()=>G.plugins.map(e=>({...e,status:J.value.get(e.id)??S.Unmanaged}))),Z=(e,t)=>{if(t)return`warn`;switch(e){case S.Running:return`success`;case S.Stopped:return`danger`;default:return`secondary`}},Q=(e,t)=>t?q(`models.pluginStatus.disabled`):b(e),$=async()=>{let e=new Map;for(let t of G.plugins){if(t.disabled)continue;let n=await G.daemonClient.getPluginStatus(t.id);e.set(t.id,n.status)}J.value=e},te=e=>{K.push({name:`plugin-page`,params:{pluginId:e.data.id}})};return o(async()=>{await G.loadAllPlugins(),await $(),Y=setInterval($,W)}),t(()=>{Y!=null&&clearInterval(Y)}),(t,n)=>(p(),i(f,null,[m(`div`,j,[m(`div`,M,s(r(q)(`layout.plugins.overview`)),1)]),e(r(T),{style:{"--scrollbar-size":`10px`}},{default:c(()=>[e(r(v),{class:`p-4 pb-16 h-screen w-full whitespace-normal`},{default:c(()=>[m(`div`,N,[m(`span`,P,s(r(q)(`layout.plugins.plugins`)),1),m(`p`,F,s(r(q)(`layout.plugins.gettingStarted`)),1),m(`a`,I,[e(r(h),{type:`mdi`,path:r(_),size:r(G).getREMSize(1.25)},null,8,[`path`,`size`]),a(` `+s(r(q)(`layout.plugins.docsLink`))+` `,1),e(r(h),{type:`mdi`,path:r(y),size:r(G).getREMSize(.875)},null,8,[`path`,`size`])])]),m(`div`,L,[m(`div`,R,[e(r(h),{type:`mdi`,class:`shrink-0 mt-0.5`,path:r(x),size:r(G).getREMSize(1.25)},null,8,[`path`,`size`]),m(`span`,null,s(r(q)(`layout.plugins.restartNote`)),1)]),m(`div`,z,[e(r(h),{type:`mdi`,class:`shrink-0 mt-0.5`,path:r(x),size:r(G).getREMSize(1.25)},null,8,[`path`,`size`]),m(`span`,null,s(r(q)(`layout.plugins.containerNote`)),1)])]),m(`div`,B,[m(`span`,V,s(r(q)(`layout.plugins.installedPlugins`)),1),e(r(O),{value:X.value,"selection-mode":`single`,"data-key":`id`,"meta-key-selection":!1,onRowSelect:te},{empty:c(()=>[m(`div`,H,[e(r(h),{type:`mdi`,path:r(C),size:r(G).getREMSize(1.25)},null,8,[`path`,`size`]),a(` `+s(r(q)(`layout.plugins.noPlugins`)),1)])]),default:c(()=>[e(r(k),{field:`id`,header:r(q)(`common.name`),"body-class":`underline`},null,8,[`header`]),e(r(k),{field:`service_type`,header:r(q)(`layout.plugins.type`)},null,8,[`header`]),e(r(k),{field:`status`,header:r(q)(`common.state`)},{body:c(t=>[e(r(A),{value:Q(t.data.status,t.data.disabled),severity:Z(t.data.status,t.data.disabled)},null,8,[`value`,`severity`])]),_:1},8,[`header`]),e(r(k),{field:`version`,header:r(q)(`views.appInfo.version`)},{body:c(e=>[a(s(e.data.version??`-`),1)]),_:1},8,[`header`]),e(r(k),{field:`description`,header:r(q)(`layout.plugins.description`)},{body:c(e=>[m(`span`,U,s(e.data.description??`-`),1)]),_:1},8,[`header`]),e(r(k),{field:`privileged`,header:r(q)(`layout.plugins.privileges`)},{body:c(e=>[m(`span`,{class:u({"font-bold":e.data.privileged})},s(e.data.privileged?r(q)(`layout.settings.plugins.privileged`):r(q)(`layout.settings.plugins.restricted`)),3)]),_:1},8,[`header`])]),_:1},8,[`value`])])]),_:1}),e(r(E),{class:`flex select-none touch-none p-0.5 bg-transparent transition-colors duration-[120ms] ease-out data-[orientation=vertical]:w-2.5`,orientation:`vertical`},{default:c(()=>[e(r(w),{class:`flex-1 bg-border-one opacity-80 rounded-lg relative before:content-[''] before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full before:min-w-[44px] before:min-h-[44px]`})]),_:1})]),_:1})],64))}});export{G as default};