import{u as y,p as x,C as j,D as E}from"./q-DElv2fU_.js";import{e as D}from"./q-DElv2fU_.js";import{H as b,I as q,J as _}from"./q-DZlJcqMj.js";const $=async function(...s){const[u,d,i,w,a]=y(),n=s.length>0&&s[0]instanceof AbortSignal?s.shift():void 0;{const c=x(),h=s.map(t=>t instanceof SubmitEvent&&t.target instanceof HTMLFormElement?new FormData(t.target):t instanceof Event||t instanceof Node?null:t),r=a.getHash();let l="";const f={...u,method:i,headers:{...d,"Content-Type":"application/qwik-json",Accept:"application/json, application/qwik-json, text/qwik-json-stream, text/plain","X-QRL":r},signal:n},p=await j([a,...h]);i==="GET"?l+=`&${_}=${encodeURIComponent(p)}`:f.body=p;const e=await fetch(`${w}?${b}=${r}${l}`,f),o=e.headers.get("Content-Type");if(e.ok&&o==="text/qwik-json-stream"&&e.body)return async function*(){try{for await(const t of q(e.body,c??document.documentElement,n))yield t}finally{n!=null&&n.aborted||await e.body.cancel()}}();if(o==="application/qwik-json"){const t=await e.text(),m=await E(t,c??document.documentElement);if(e.status>=400)throw m;return m}else if(o==="application/json"){const t=await e.json();if(e.status>=400)throw t;return t}else if(o==="text/plain"||o==="text/html"){const t=await e.text();if(e.status>=400)throw t;return t}}};export{D as _hW,$ as s_3GGH96fItK0};