import{B as e,Bt as t,Dt as n,F as r,G as i,L as a,M as o,Mt as s,N as c,P as l,R as u,T as d,Tt as f,Ut as p,Y as m,bt as h,j as g,ot as _,qt as v,y}from"./vue-3bs2-dMU.js";import{K as b,U as x,r as S}from"./stores-DmetsdTd.js";import{C,D as w,Ft as T,G as E,K as D,L as O,S as k,T as A,h as j,ht as M,mt as N,w as P,y as F}from"./vuetify-gGrfRH2I.js";i(),p();var I={key:1,"data-testid":`mixedbtn-text`},L=e({__name:`MixedButton`,props:{mobileOverride:{type:Boolean},mobileValue:{type:Boolean},position:{},icon:{},text:{}},setup(e){let t=e,{mobile:n}=T(),i=g(()=>t.mobileOverride?t.mobileValue:n.value);return(t,n)=>(_(),c(D,{icon:i.value},{default:h(()=>[i.value||e.position===`left`?(_(),c(N,{key:0,"data-testid":`mixedbtn-icon-left`},{default:h(()=>[a(v(e.icon),1)]),_:1})):l(``,!0),i.value?l(``,!0):(_(),r(`span`,I,v(e.text),1)),!i.value&&e.position===`right`?(_(),c(N,{key:2,"data-testid":`mixedbtn-icon-right`},{default:h(()=>[a(v(e.icon),1)]),_:1})):l(``,!0)]),_:1},8,[`icon`]))}});i(),f(),p(),y();var R=[`href`,`title`],z=e({__name:`PluginManagerDialog`,props:{guid:{}},setup(e){let{isOpened:r}=x(e.guid),{t:i}=b(),l=S(),f=[{title:i(`dialogs.pluginManager.headers.enabled`),key:`enabled`,sortable:!1},{title:i(`dialogs.pluginManager.headers.name`),key:`fullName`},{title:i(`dialogs.pluginManager.headers.version`),key:`version`},{title:i(`dialogs.pluginManager.headers.url`),key:`url`},{title:i(`dialogs.pluginManager.headers.actions`),key:`actions`}],p=s(!1),g=s(!1),y=s(!1),T=s(!1),I=s(``);async function z(e){await l.toggleSearchPlugin(e),await l.fetchSearchPlugins()}async function B(){g.value=!0,await l.updatePlugins().then(()=>new Promise(e=>setTimeout(e,2e3))),await l.fetchSearchPlugins(),g.value=!1}async function V(){W(),p.value=!0,await l.installSearchPlugin(I.value),I.value=``,setTimeout(()=>void l.fetchSearchPlugins().then(()=>p.value=!1),1e3)}async function H(e){p.value=!0,await l.uninstallSearchPlugin(e.name),await l.fetchSearchPlugins(),p.value=!1}function U(){r.value=!1}function W(){y.value=!1}return(e,i)=>(_(),c(k,{modelValue:t(r),"onUpdate:modelValue":i[4]||=e=>n(r)?r.value=e:null},{default:h(()=>[u(C,null,{default:h(()=>[u(A,{class:`d-flex`},{default:h(()=>[o(`div`,null,v(e.$t(`dialogs.pluginManager.title`)),1),u(M),u(L,{icon:`mdi-update`,text:e.$t(`dialogs.pluginManager.update`),color:`accent`,class:`mr-2`,loading:g.value,onClick:B},null,8,[`text`,`loading`]),u(k,{modelValue:y.value,"onUpdate:modelValue":i[3]||=e=>y.value=e},{activator:h(({props:t})=>[u(L,m({icon:`mdi-toy-brick-plus`,text:e.$t(`dialogs.pluginManager.install.activator`)},t,{color:`primary`}),null,16,[`text`])]),default:h(()=>[u(C,{title:e.$t(`dialogs.pluginManager.install.title`)},{default:h(()=>[u(P,null,{default:h(()=>[u(t(F),{modelValue:T.value,"onUpdate:modelValue":i[1]||=e=>T.value=e,onSubmit:i[2]||=d(()=>{},[`prevent`])},{default:h(()=>[u(E,{modelValue:I.value,"onUpdate:modelValue":i[0]||=e=>I.value=e,autofocus:``,label:e.$t(`dialogs.pluginManager.install.label`)},null,8,[`modelValue`,`label`])]),_:1},8,[`modelValue`])]),_:1}),u(w,null,{default:h(()=>[u(M),u(D,{color:`error`,onClick:W},{default:h(()=>[a(v(e.$t(`common.cancel`)),1)]),_:1}),u(D,{color:`accent`,onClick:V},{default:h(()=>[a(v(e.$t(`common.ok`)),1)]),_:1})]),_:1})]),_:1},8,[`title`])]),_:1},8,[`modelValue`])]),_:1}),u(P,null,{default:h(()=>[u(j,{mobile:null,headers:f,"items-per-page":`-1`,items:t(l).searchPlugins,"sort-by":[{key:`fullName`,order:`asc`}],loading:p.value},{"item.enabled":h(({item:e})=>[u(O,{"model-value":e.enabled,onClick:t=>z(e)},null,8,[`model-value`,`onClick`])]),"item.url":h(({item:e})=>[o(`a`,{href:e.url,title:e.name,target:`_blank`,rel:`noopener noreferrer`},v(e.url),9,R)]),"item.actions":h(({item:e})=>[u(N,{color:`red`,icon:`mdi-delete`,onClick:t=>H(e)},null,8,[`onClick`])]),_:2},1032,[`items`,`loading`])]),_:1}),u(w,null,{default:h(()=>[u(M),u(D,{color:`accent`,onClick:U},{default:h(()=>[a(v(e.$t(`common.close`)),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`modelValue`]))}});export{z as default};