import{$n as e,Cn as t,M as n,Rt as r,j as i,t as a}from"./DLvf9lie.js";import{t as o}from"./fR_czS54.js";function s(e){return e.split(`
`).map(e=>e.trim()).filter(e=>e.length>0)}function c(e){return e.join(`
`)}function l(){let l=n(),{hasFeature:u}=i(),{t:d}=r(),f=t(()=>u(`system-proxy`)),p=e(!1),m=e(0),h=e(``),g=e(!1);o(()=>{v()});let _=e=>{p.value=e.enabled,m.value=e.port,h.value=c(e.bypass)},v=async()=>{g.value=!0;try{_(await l.getSysProxy())}catch(e){a.error(d(`systemProxyLoadFailed`),{description:e instanceof Error?e.message:String(e)})}finally{g.value=!1}},y=async e=>{g.value=!0;try{return _(await l.setSysProxy({enabled:p.value,bypass:s(h.value)})),e?.silent||a.success(d(`systemProxyApplied`)),!0}catch(e){return a.error(d(`systemProxyApplyFailed`),{description:e instanceof Error?e.message:String(e)}),!1}finally{g.value=!1}};return{available:f,enabled:p,port:m,bypassText:h,loading:g,load:v,save:y,toggle:async e=>{let t=p.value;p.value=e,await y({silent:!0})||(p.value=t)}}}export{l as t};