import{$ as y,r as n,j as p,B as o}from"./index-DnbYEqLr.js";const g=y("transport",()=>{const s=n(null),u=n([]),l=n(!1),a=n(null),f=p(()=>s.value?.mesh_only??!1),m=p(()=>(s.value?.transports??[]).filter(e=>e.available).map(e=>e.kind));async function c(){try{l.value=!0,a.value=null;const e=await o.call({method:"transport.status"});s.value=e}catch(e){a.value=e instanceof Error?e.message:"Failed to fetch transport status"}finally{l.value=!1}}async function i(){try{const e=await o.call({method:"transport.peers"});u.value=e.peers}catch(e){a.value=e instanceof Error?e.message:"Failed to fetch transport peers"}}async function h(e,t){try{return a.value=null,await o.call({method:"transport.send",params:{did:e,payload:t}})}catch(r){throw a.value=r instanceof Error?r.message:"Failed to send via transport",r}}async function d(e){try{a.value=null,await o.call({method:"transport.set-mode",params:{mesh_only:e}}),await c()}catch(t){throw a.value=t instanceof Error?t.message:"Failed to set transport mode",t}}async function v(){await Promise.all([c(),i()])}return{status:s,peers:u,loading:l,error:a,meshOnly:f,availableTransports:m,fetchStatus:c,fetchPeers:i,sendMessage:h,setMeshOnly:d,refreshAll:v}});export{g as u};