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