import{_ as y}from"./index-DszNaKSN.js";import{_ as E}from"./Card.vue_vue_type_script_setup_true_lang-DL-AoWAy.js";import{_ as R}from"./CardContent.vue_vue_type_script_setup_true_lang-FICIWzWX.js";import{_ as T}from"./CardHeader.vue_vue_type_script_setup_true_lang-B7D3vZSh.js";import{_ as I}from"./Label.vue_vue_type_script_setup_true_lang-DGLuVkHJ.js";import{_ as U}from"./Spinner.vue_vue_type_script_setup_true_lang-BvQnMr3d.js";import{u as P,am as D,an as F}from"./reka-ui-DIvBdk1-.js";import{e as C,a as $,_ as N}from"./index-STpfFCKU.js";import{d as B,G as O,H as n,J as a,u as t,ae as H,h as A,L as M,M as q,D as G,b as g,w as J,o as K,r as p,a as Q,c as h,j as W,e as l,a2 as k,a4 as d,bD as X,bE as Y,aH as Z,F as ee,K as te,g as L}from"./lucide-OrjrigGq.js";import{l as se}from"./vueuse-BZBkof_U.js";import"./index-DIT3TkWC.js";import"./qrcode-BWzeHGfy.js";import"./marked-BPdRUrA1.js";import"./vue-router-DHBbBOYe.js";import"./vue-i18n-B2QXlTQD.js";import"./vuetify-Cc3ogKHH.js";import"./color-CqFg8eif.js";/* empty css            */import"./swiper-Bq331F5K.js";const ae=B({__name:"Switch",props:{defaultValue:{},modelValue:{},disabled:{type:Boolean},id:{},value:{},trueValue:{},falseValue:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:["update:modelValue"],setup(w,{emit:i}){const u=w,_=i,f=se(u,"class"),m=P(f,_);return(c,r)=>(g(),O(t(F),G({"data-slot":"switch"},t(m),{class:t(C)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",u.class)}),{default:n(x=>[a(t(D),{"data-slot":"switch-thumb",class:H(t(C)("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"))},{default:n(()=>[A(c.$slots,"thumb",M(q(x)))]),_:2},1032,["class"])]),_:3},16,["class"]))}}),oe={class:"flex h-full flex-col p-6 pb-40"},re={class:"flex flex-wrap items-center justify-between gap-2"},le={class:"flex items-center gap-2"},ne={class:"flex gap-2"},ie={key:0,class:"flex flex-col items-center justify-center gap-4 p-8"},ce={class:"text-sm text-muted-foreground"},de={key:1,class:"flex flex-col items-center justify-center gap-4 p-8"},ue={class:"text-sm text-destructive"},fe={key:0,class:"px-4 pt-4"},me={class:"rounded-md bg-muted/50 px-4 py-3 text-sm text-muted-foreground"},pe={class:"log-content"},b=150,ge=B({__name:"ServerLogs",setup(w){const i=p(""),u=p(!0),_=p(!1),f=p(""),m=p(!0),c=p(null);let r=null;const x=L(()=>{const e=i.value.split(`
`);return e.length>b?e.slice(-b).join(`
`):i.value}),z=L(()=>i.value.split(`
`).length>b),V=()=>{c.value&&W(()=>{c.value&&(c.value.scrollTop=c.value.scrollHeight)})},v=async(e=!1)=>{try{e?_.value=!0:u.value=!0,f.value="";const s=await $.sendCommand("logging/get"),o=i.value;i.value=s,(!e||s!==o)&&setTimeout(()=>V(),100)}catch(s){f.value=s instanceof Error?s.message:"Failed to load server logs",console.error("Error loading logs:",s)}finally{u.value=!1,_.value=!1}},j=()=>{v(!0)},S=async()=>{try{const e=await $.sendCommand("logging/get"),s=window.URL.createObjectURL(new Blob([e],{type:"text/plain"})),o=document.createElement("a");o.href=s,o.download="music-assistant.log",document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(s)}catch(e){console.error("Error downloading log:",e)}};return J(m,e=>{e?r=setInterval(()=>{v(!0)},5e3):r&&(clearInterval(r),r=null)}),K(async()=>{await v(!1),m.value&&(r=setInterval(()=>{v(!0)},5e3))}),Q(()=>{r&&clearInterval(r)}),(e,s)=>(g(),h("div",oe,[a(t(E),{class:"flex flex-1 flex-col gap-0 overflow-hidden py-0 min-h-0"},{default:n(()=>[a(t(T),{class:"shrink-0 border-b px-6 py-4"},{default:n(()=>[l("div",re,[l("div",le,[a(t(ae),{id:"auto-refresh",checked:m.value,"onUpdate:checked":s[0]||(s[0]=o=>m.value=o)},null,8,["checked"]),a(t(I),{class:"cursor-pointer",for:"auto-refresh"},{default:n(()=>[k(d(e.$t("settings.auto_refresh_log")),1)]),_:1})]),l("div",ne,[a(t(y),{variant:"outline",size:"sm",disabled:_.value,onClick:j},{default:n(()=>[a(t(X),{class:"size-4"}),k(" "+d(e.$t("settings.reload")),1)]),_:1},8,["disabled"]),a(t(y),{size:"sm",onClick:S},{default:n(()=>[a(t(Y),{class:"size-4"}),k(" "+d(e.$t("settings.download_log")),1)]),_:1})])])]),_:1}),a(t(R),{class:"p-0"},{default:n(()=>[u.value?(g(),h("div",ie,[a(t(U),{class:"size-8"}),l("p",ce,d(e.$t("loading")),1)])):f.value?(g(),h("div",de,[a(t(Z),{class:"size-12 text-destructive"}),l("p",ue,d(f.value),1)])):(g(),h(ee,{key:2},[z.value?(g(),h("div",fe,[l("div",me,d(e.$t("settings.log_truncated",[b])),1)])):te("",!0),l("div",{ref_key:"logContainer",ref:c,class:"log-container"},[l("pre",pe,d(x.value),1)],512)],64))]),_:1})]),_:1})]))}}),Ie=N(ge,[["__scopeId","data-v-234f8a24"]]);export{Ie as default};
