import{p as F,l as R,z as I,r as k,j as N,am as z,P as w,al as H,a0 as M,a4 as x,m as o,B as O,ay as U,o as W,R as y,q as V,D as C,J as j,E as q,w as s,t as G,H as _,S as J,G as D,F as p,I as B,$ as A,M as K}from"./index-5ee1411a.js";import{m as Q,V as X,b as L}from"./VOverlay-1134342d.js";import{f as Y}from"./forwardRefs-2fb8bd5a.js";import{u as Z}from"./scopeId-4c4b48c5.js";import{c as ee,x as te}from"./transition-cd9cc606.js";import{V as ae,e as S,b as T,a as ne}from"./VCard-8ba7cfc2.js";import{a as P}from"./VBtn-1e45aba2.js";import"./VImg-71612e97.js";import"./VProgressCircular-4762adb7.js";import"./resizeObserver-5499429a.js";const oe=F({fullscreen:Boolean,retainFocus:{type:Boolean,default:!0},scrollable:Boolean,...Q({origin:"center center",scrollStrategy:"block",transition:{component:X},zIndex:2400})},"VDialog"),le=R()({name:"VDialog",props:oe(),emits:{"update:modelValue":e=>!0,afterEnter:()=>!0,afterLeave:()=>!0},setup(e,E){let{emit:d,slots:r}=E;const f=I(e,"modelValue"),{scopeId:b}=Z(),t=k();function n(a){var c,v;const u=a.relatedTarget,m=a.target;if(u!==m&&((c=t.value)!=null&&c.contentEl)&&((v=t.value)!=null&&v.globalTop)&&![document,t.value.contentEl].includes(m)&&!t.value.contentEl.contains(m)){const i=H(t.value.contentEl);if(!i.length)return;const g=i[0],$=i[i.length-1];u===g?$.focus():g.focus()}}N(()=>{document.removeEventListener("focusin",n)}),z&&w(()=>f.value&&e.retainFocus,a=>{a?document.addEventListener("focusin",n):document.removeEventListener("focusin",n)},{immediate:!0});function l(){var a;d("afterEnter"),(a=t.value)!=null&&a.contentEl&&!t.value.contentEl.contains(document.activeElement)&&t.value.contentEl.focus({preventScroll:!0})}function h(){d("afterLeave")}return w(f,async a=>{var u;a||(await M(),(u=t.value.activatorEl)==null||u.focus({preventScroll:!0}))}),ee(()=>{const a=L.filterProps(e),u=x({"aria-haspopup":"dialog"},e.activatorProps),m=x({tabindex:-1},e.contentProps);return o(L,x({ref:t,class:["v-dialog",{"v-dialog--fullscreen":e.fullscreen,"v-dialog--scrollable":e.scrollable},e.class],style:e.style},a,{modelValue:f.value,"onUpdate:modelValue":c=>f.value=c,"aria-modal":"true",activatorProps:u,contentProps:m,height:e.fullscreen?void 0:e.height,width:e.fullscreen?void 0:e.width,maxHeight:e.fullscreen?void 0:e.maxHeight,maxWidth:e.fullscreen?void 0:e.maxWidth,role:"dialog",onAfterEnter:l,onAfterLeave:h},b),{activator:r.activator,default:function(){for(var c=arguments.length,v=new Array(c),i=0;i<c;i++)v[i]=arguments[i];return o(te,{root:"VDialog"},{default:()=>{var g;return[(g=r.default)==null?void 0:g.call(r,...v)]}})}})}),Y({},t)}}),se={class:"bg-background grid grid-cols-1 p-4 md:grid-cols-2 xl:grid-cols-4"},re={class:""},Ee=O({__name:"Devices",setup(e){const E=U(),d=k(),r=k(!1),f=async function(t){await y.deleteDevice(t),d.value=await y.getAllDevices(!1),r.value=!0},b=function(t){E.push(`/settings/editdevice/${t}`)};return W(async()=>{d.value=await y.getAllDevices(!1)}),(t,n)=>(V(),C("div",se,[(V(!0),C(j,null,q(d.value,(l,h)=>(V(),C("div",{key:h},[l.id!="9c0e0865-f3b0-488f-8d3f-b3b0cdda5de7"?(V(),G(T,{key:0,class:"elevation-2 m-4 max-w-sm"},{default:s(()=>[o(ae,null,{default:s(()=>[_("span",{class:J(["mdi pr-2",l.icon])},null,2),_("span",re,D(l.name),1)]),_:2},1024),o(S,null,{default:s(()=>[o(P,{class:"m-2",onClick:a=>b(l.id)},{default:s(()=>[p(D(B(A)("settings.edit_action")),1)]),_:2},1032,["onClick"]),o(P,{class:"m-2",onClick:a=>f(l.id)},{default:s(()=>[p(D(B(A)("settings.delete_action")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)):K("",!0)]))),128)),o(le,{modelValue:r.value,"onUpdate:modelValue":n[1]||(n[1]=l=>r.value=l),width:"auto"},{default:s(()=>[o(T,null,{default:s(()=>[o(ne,null,{default:s(()=>n[2]||(n[2]=[p(" Please remove the device manually from the config file. ")])),_:1}),o(S,null,{default:s(()=>[o(P,{color:"primary",block:"",onClick:n[0]||(n[0]=l=>r.value=!1)},{default:s(()=>n[3]||(n[3]=[p(" Close ")])),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]))}});export{Ee as default};
