import{h as O,a3 as n,a4 as $,a5 as x,a6 as C}from"./Cx8pZeM5.js";import{u as E}from"./BnTjGDoV.js";function R(s,r,c){const[e={},u]=typeof r=="string"?[{},r]:[r,c],t=O(()=>n(s)),o=e.key||$([u,typeof t.value=="string"?t.value:"",...L(e)]);if(!o||typeof o!="string")throw new TypeError("[nuxt] [useFetch] key must be a string: "+o);if(!s)throw new Error("[nuxt] [useFetch] request is missing.");const i=o===u?"$f"+o:o;if(!e.baseURL&&typeof t.value=="string"&&t.value[0]==="/"&&t.value[1]==="/")throw new Error('[nuxt] [useFetch] the request URL must not start with "//".');const{server:y,lazy:d,default:b,transform:g,pick:w,watch:h,immediate:v,getCachedData:_,deep:k,dedupe:D,...T}=e,l=x({...C,...T,cache:typeof e.cache=="boolean"?void 0:e.cache}),F={server:y,lazy:d,default:b,transform:g,pick:w,immediate:v,getCachedData:_,deep:k,dedupe:D,watch:h===!1?[]:[l,t,...h||[]]};let a;return E(i,()=>{var m;(m=a==null?void 0:a.abort)==null||m.call(a),a=typeof AbortController<"u"?new AbortController:{};const p=n(e.timeout);let f;return p&&(f=setTimeout(()=>a.abort(),p),a.signal.onabort=()=>clearTimeout(f)),(e.$fetch||globalThis.$fetch)(t.value,{signal:a.signal,...l}).finally(()=>{clearTimeout(f)})},F)}function L(s){var c;const r=[((c=n(s.method))==null?void 0:c.toUpperCase())||"GET",n(s.baseURL)];for(const e of[s.params||s.query]){const u=n(e);if(!u)continue;const t={};for(const[o,i]of Object.entries(u))t[n(o)]=n(i);r.push(t)}return r}export{R as u};