import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{r as t}from"./helpers-X4cpMMfY.mjs";import{destr as n}from"destr";const r=i=>{let a=async(r,a)=>{if(!(typeof r==`string`||r instanceof Request)&&r.url&&(a={...r,...a},r=r.url),a?.hooks?.beforeRequest){for(let e of a.hooks.beforeRequest)e(a);delete a.hooks}if(a={...i,...a},a?.json&&!a.body&&(a.body=a.json,delete a.json),a?.form&&!a.body&&(a.body=new URLSearchParams(a.form).toString(),a.headers||={},a.headers[`content-type`]=`application/x-www-form-urlencoded`,delete a.form),a?.searchParams&&(r+=`?`+t(a.searchParams),delete a.searchParams),a.parseResponse=e=>({data:n(e),body:e}),(a?.responseType===`buffer`||a?.responseType===`arrayBuffer`)&&(a.responseType=`arrayBuffer`,delete a.parseResponse),a.cookieJar){let e=a.cookieJar.getCookiesSync(r);e.length&&(a.headers||={},a.headers.cookie=e.join(`; `)),delete a.cookieJar}let o=e(r,a);if(a?.responseType===`arrayBuffer`){let e=await o;return{data:Buffer.from(e),body:Buffer.from(e)}}return o};return a.get=(e,t)=>a(e,{...t,method:`GET`}),a.post=(e,t)=>a(e,{...t,method:`POST`}),a.put=(e,t)=>a(e,{...t,method:`PUT`}),a.patch=(e,t)=>a(e,{...t,method:`PATCH`}),a.head=(e,t)=>a(e,{...t,method:`HEAD`}),a.delete=(e,t)=>a(e,{...t,method:`DELETE`}),a.extend=e=>r(e),a};var i=r();export{i as t};