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