import{bo as r,bH as d,C as c}from"./index-DET0E_3l.js";const h=async(s,t)=>{const o=new URLSearchParams;return o.set("project",t),o.set("recursion","1"),fetch(`/1.0/networks/${encodeURIComponent(s)}/forwards?${o.toString()}`).then(c).then(e=>e.metadata.sort((n,a)=>n.listen_address.localeCompare(a.listen_address)*10+(n.location&&a.location?n.location.localeCompare(a.location):0)))},m=async(s,t,o,e)=>{const n=new URLSearchParams;return n.set("project",o),n.set("recursion","1"),r(n,e),fetch(`/1.0/networks/${encodeURIComponent(s)}/forwards/${encodeURIComponent(t)}?${n.toString()}`).then(c).then(a=>a.metadata)},w=async(s,t,o)=>{const e=new URLSearchParams;return e.set("project",o),r(e,t.location),fetch(`/1.0/networks/${encodeURIComponent(s)}/forwards?${e.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(d).then(n=>{const a=n.headers.get("Location");return(a==null?void 0:a.split("/").pop())??""})},l=async(s,t,o)=>{const e=new URLSearchParams;e.set("project",o),r(e,t.location),await fetch(`/1.0/networks/${encodeURIComponent(s)}/forwards/${encodeURIComponent(t.listen_address)}?${e.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(c)},R=async(s,t,o)=>{const e=new URLSearchParams;e.set("project",o),r(e,t.location),await fetch(`/1.0/networks/${encodeURIComponent(s.name)}/forwards/${encodeURIComponent(t.listen_address)}?${e.toString()}`,{method:"DELETE"}).then(c)};export{h as a,w as c,R as d,m as f,l as u};
