import{$ as m,r as l,A as i}from"./index.js";const v=m("domains",()=>{const a=l([]),r=l({});function u(n){for(let e=0;e<a.value.length;e++){let o=!1;for(let t of n)if(a.value[e].id==t.id){o=!0;break}o||(a.value.splice(e,1),e--)}for(let e of n){let o=!1;for(let t=0;t<a.value.length;t++)if(a.value[t].id==e.id){a.value[t].domain=e.domain,a.value[t].connections=e.connections,a.value[t].status=e.status,o=!0;break}o||a.value.push(e)}}async function f(){return await i.query("service_get_domain_list.html",[]).then(async({data:{code:n,data:e}})=>{if(n==0){u(Array.from(e));for(let o=0;o<a.value.length;o++){let t=a.value[o].domain;await i.post("service_get_domain_common_option.html","domain="+t).then(({data:{code:s,data:c}})=>{s==0&&(r.value[t]=c)}).catch(s=>{})}return!0}else return i.logout(),!1}).catch(n=>!1)}return{domainData:a,domainConfig:r,fetchDomains:f}});export{v as u};
