import{j as n,c as a,a0 as s}from"./dVzHJMF1.js";const w=(g,e)=>{const r=n("idle"),l=n(),c=n(),y=a(()=>r.value==="pending"),f=a(()=>r.value==="success"),m=a(()=>r.value==="error"),E=async v=>{var t,d;r.value="pending",c.value=null;try{const u=await g(v);return l.value=u,r.value="success",(t=e==null?void 0:e.onSuccess)==null||t.call(e,u,v),u}catch(u){throw r.value="error",c.value=u,(d=e==null?void 0:e.onError)==null||d.call(e,u,v),u}};function S(){r.value="idle",l.value=void 0,c.value=null}return{response:a(()=>l.value),error:s(c),status:s(r),isLoading:s(y),isSuccess:s(f),isError:s(m),execute:E,reset:S}};export{w as u};
