import{a as n,k as o}from"./init-Ck7wRxmZ.js";import{N as a}from"./Navbar-CshJBn-L.js";import"./theme-BfDtj5yE.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";const l=n({components:{Navbar:a},inject:["i18n"],data(){return{clients:[],closeAppPressed:!1,closeAppStatus:null,ddResetPressed:!1,ddResetStatus:null,logs:"Loading...",logFilter:null,logInterval:null,serverRestarting:!1,serverQuitting:!1,serverQuit:!1,platform:""}},computed:{actualLogs(){if(!this.logFilter)return this.logs;let e=this.logs.split(`
`);return e=e.filter(t=>t.indexOf(this.logFilter)!==-1),e.join(`
`)}},created(){fetch("/api/config").then(e=>e.json()).then(e=>{this.platform=e.platform}),this.logInterval=setInterval(()=>{this.refreshLogs()},5e3),this.refreshLogs()},beforeDestroy(){clearInterval(this.logInterval)},methods:{refreshLogs(){fetch("./api/logs",{credentials:"include"}).then(e=>{const s=(e.headers.get("Content-Type")||"").match(/charset=([^;]+)/i),r=s?s[1].trim():"utf-8";return e.arrayBuffer().then(i=>new TextDecoder(r).decode(i))}).then(e=>{this.logs=e}).catch(e=>console.error("Error fetching logs:",e))},closeApp(){this.closeAppPressed=!0,fetch("./api/apps/close",{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{this.closeAppPressed=!1,this.closeAppStatus=e.status,setTimeout(()=>{this.closeAppStatus=null},5e3)})},copyLogs(){navigator.clipboard.writeText(this.actualLogs)},restart(){this.serverRestarting=!0,setTimeout(()=>{this.serverRestarting=!1},5e3),fetch("./api/restart",{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>{if(e.status!==200){setTimeout(()=>{location.reload()},1e3);return}}).catch(e=>{this.serverRestarting=!1,console.error(e),setTimeout(()=>{location.reload()},1e3)})},quit(){window.confirm(this.i18n.t("troubleshooting.quit_apollo_confirm"))&&(this.serverQuitting=!0,fetch("./api/quit",{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"}}).then(()=>{this.serverQuitting=!1,this.serverQuit=!1,alert("Exit failed!")}).catch(()=>{this.serverQuitting=!1,this.serverQuit=!0}))},ddResetPersistence(){this.ddResetPressed=!0,fetch("/api/reset-display-device-persistence",{credentials:"include",method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{this.ddResetPressed=!1,this.ddResetStatus=e.status,setTimeout(()=>{this.ddResetStatus=null},5e3)})}}});o(l);
