import{a as i,t as p,_ as x}from"./index-Cc0s9xHj.js";import{n as M}from"./index.browser-BY9c7rfI.js";import{u as B}from"./vue-router-lrCq0UAu.js";import{E as N}from"./EditConfig-BtpVihKG.js";import{a as $,a0 as O,d as j,k as z}from"./vuetify-CvGbteJu.js";import{d as D,w as S,c as f,K as v,G as T,J as r,r as _,u as A,H as c,g as G,e as n,a2 as H,a4 as d,b as l}from"./lucide-C_a_D9Y7.js";import{u as J}from"./vue-i18n-COI_JhGQ.js";import"./qrcode-DICVlH4J.js";import"./marked-D9eDbhZJ.js";import"./color-CqFg8eif.js";import"./vueuse-Blk5jQ0T.js";/* empty css            */import"./swiper-UowLVX5q.js";import"./index-CT6dMj3N.js";import"./reka-ui-jliV5UPF.js";import"./index-DX8SDiTF.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-7ardqVNw.js";import"./NumberFieldInput.vue_vue_type_script_setup_true_lang-C70L_o2l.js";const K={class:"edit-core-config"},P={key:0},R={class:"header-content"},U={class:"header-icon"},q={class:"header-info"},F={class:"header-title"},L={class:"header-description"},Q=D({__name:"EditCoreConfig",props:{domain:{}},setup(g){const h=B(),{t:m}=J(),t=_(),y=M(11),s=_(!1),C=g,V=G(()=>t.value?Object.values(t.value.values):[]);S(()=>C.domain,async e=>{e&&(t.value=await i.getCoreConfig(e))},{immediate:!0});const k=e=>{const o=m(`settings.core_module.${e.domain}.name`);return o!==`settings.core_module.${e.domain}.name`?o:i.providerManifests[e.domain].name},b=e=>{const o=m(`settings.core_module.${e.domain}.description`);return o!==`settings.core_module.${e.domain}.description`?o:i.providerManifests[e.domain].description},w=e=>({streams:"mdi-radio-tower",players:"mdi-speaker-multiple",metadata:"mdi-tag-multiple",music:"mdi-music",webserver:"mdi-web",cache:"mdi-cached"})[e]||"mdi-cog",E=async function(e){s.value=!0,i.saveCoreConfig(t.value.domain,e).then(()=>{h.push({name:"systemsettings"})}).catch(o=>{p.error(o.message||o)}).finally(()=>{s.value=!1})},I=async function(e,o){s.value=!0;for(const a of Object.values(t.value.values))a.value!==void 0&&o[a.key]==null&&(o[a.key]=a.value);o.session_id=y,i.getCoreConfigEntries(t.value.domain,e,o).then(a=>{t.value.values={};for(const u of a)t.value.values[u.key]=u;s.value=!1}).catch(a=>{p.error(a.message||a),s.value=!1})};return(e,o)=>(l(),f("section",K,[t.value&&A(i).providerManifests[t.value.domain]?(l(),f("div",P,[r($,{class:"header-card mb-4",elevation:"0"},{default:c(()=>[n("div",R,[n("div",U,[r(j,{size:"32",color:"primary"},{default:c(()=>[H(d(w(t.value.domain)),1)]),_:1})]),n("div",q,[n("h2",F,d(k(t.value)),1),n("p",L,d(b(t.value)),1)])])]),_:1})])):v("",!0),t.value?(l(),T(N,{key:1,"config-entries":V.value,disabled:!1,onSubmit:E,onAction:I},null,8,["config-entries"])):v("",!0),r(O,{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=a=>s.value=a),scrim:"true",persistent:"",class:"loading-overlay"},{default:c(()=>[r(z,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}}),fe=x(Q,[["__scopeId","data-v-03c6d489"]]);export{fe as default};
