import{j as i,q as c}from"./@tanstack-BUCbhJyH.js";import{l as p,m as l,k as m,n as u,F as h}from"./index-QQb7wQEC.js";import{o as f}from"./url-D5le3J4q.js";async function s(t){const e=p(l.components.all)+(t?`?${f(t)}`:""),n=await m(e,{method:"GET",headers:{"Content-Type":"application/json"}});if(n.status===404&&u(),!n.ok){const r=await n.json().then(o=>Array.isArray(o.detail)?o.detail[1]:o.detail).catch(()=>"Error while fetching stack components");throw new h({status:n.status,statusText:n.statusText,message:r})}return n.json()}const a={all:["components"],componentListInfinite:t=>i({queryKey:[...a.all,t],queryFn:async({pageParam:e})=>s({...t,page:e}),getNextPageParam:e=>e.index<e.total_pages?e.index+1:null,initialPageParam:1}),componentList:t=>c({queryKey:[...a.all,t],queryFn:async()=>s(t)})};export{a as c};
