import{u as w}from"./vue-router-BgJK_hRC.js";import{c as i,_ as x}from"./index-CxiRlsCY.js";import{E as M}from"./EditConfig-CHstsLqU.js";import{n as $}from"./index.browser-OxPLOBIU.js";import{d as B,a as N,l as D,L as O}from"./vuetify-RelkxOq-.js";import{d as j,r as p,c as z,w as S,b as f,e as c,I as v,D as T,H as n,u as A,E as d,f as r,$ as H,a1 as l}from"./lucide-C2DU1LFb.js";import{u as L}from"./vue-i18n-DySrp6mW.js";import"./qrcode-DSFhiIp2.js";import"./marked-C0Rlrcoy.js";import"./color-BTziYnFN.js";import"./vueuse-DIaEWNCo.js";/* empty css            */import"./swiper-Jy9GbtzK.js";import"./index-DV1JBmju.js";import"./utils-CDN07tui.js";import"./reka-ui-GpbaI08z.js";import"./index-B_jtOnfb.js";const P={class:"edit-core-config"},R={key:0},U={class:"header-content"},q={class:"header-icon"},F={class:"header-info"},G={class:"header-title"},J={class:"header-description"},K=j({__name:"EditCoreConfig",props:{domain:{}},setup(_){const g=w(),{t:m}=L(),t=p(),h=$(11),s=p(!1),C=_,y=z(()=>t.value?Object.values(t.value.values):[]);S(()=>C.domain,async e=>{e&&(t.value=await i.getCoreConfig(e))},{immediate:!0});const V=e=>{const o=m(`settings.core_module.${e.domain}.name`);return o!==`settings.core_module.${e.domain}.name`?o:i.providerManifests[e.domain].name},k=e=>{const o=m(`settings.core_module.${e.domain}.description`);return o!==`settings.core_module.${e.domain}.description`?o:i.providerManifests[e.domain].description},b=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(()=>{s.value=!1,g.push({name:"providersettings"})}).catch(o=>{alert(o),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=h,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=>{alert(a),s.value=!1})};return(e,o)=>(c(),f("section",P,[t.value&&A(i).providerManifests[t.value.domain]?(c(),f("div",R,[n(N,{class:"header-card mb-4",elevation:"0"},{default:d(()=>[r("div",U,[r("div",q,[n(B,{size:"32",color:"primary"},{default:d(()=>[H(l(b(t.value.domain)),1)]),_:1})]),r("div",F,[r("h2",G,l(V(t.value)),1),r("p",J,l(k(t.value)),1)])])]),_:1})])):v("",!0),t.value?(c(),T(M,{key:1,"config-entries":y.value,disabled:!1,onSubmit:E,onAction:I},null,8,["config-entries"])):v("",!0),n(O,{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=a=>s.value=a),scrim:"true",persistent:"",class:"loading-overlay"},{default:d(()=>[n(D,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}}),ue=x(K,[["__scopeId","data-v-f9c4c36a"]]);export{ue as default};
