"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),x={create:()=>Promise.resolve({data:null}),deleteOne:()=>Promise.resolve({data:null}),getList:()=>Promise.resolve({data:Array.from({length:30}).map((e,n)=>({name:n,id:n})),total:20}),getMany:()=>Promise.resolve({data:[]}),getManyReference:()=>Promise.resolve({data:[],total:0}),getOne:()=>Promise.resolve({data:null}),update:()=>Promise.resolve({data:null})},A=new WeakMap,M=(...e)=>{var n;const r=e[0],o=(n=a.getCurrentInstance())==null?void 0:n.proxy;if(o==null)throw new Error("injectLocal must be called in setup");return A.has(o)&&r in A.get(o)?A.get(o)[r]:a.inject(...e)};function D(e){return typeof e=="function"?e():a.unref(e)}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const B=()=>{};function S(e,n=!1,r="Timeout"){return new Promise((o,h)=>{setTimeout(n?()=>h(r):o,e)})}function C(e,n=!1){function r(t,{flush:u="sync",deep:l=!1,timeout:c,throwOnTimeout:g}={}){let f=null;const v=[new Promise(y=>{f=a.watch(e,d=>{t(d)!==n&&(f==null||f(),y(d))},{flush:u,deep:l,immediate:!0})})];return c!=null&&v.push(S(c,g).then(()=>D(e)).finally(()=>f==null?void 0:f())),Promise.race(v)}function o(t,u){if(!a.isRef(t))return r(d=>d===t,u);const{flush:l="sync",deep:c=!1,timeout:g,throwOnTimeout:f}=u??{};let i=null;const y=[new Promise(d=>{i=a.watch([e,t],([s,T])=>{n!==(s===T)&&(i==null||i(),d(s))},{flush:l,deep:c,immediate:!0})})];return g!=null&&y.push(S(g,f).then(()=>D(e)).finally(()=>(i==null||i(),D(e)))),Promise.race(y)}function h(t){return r(u=>!!u,t)}function p(t){return o(null,t)}function b(t){return o(void 0,t)}function O(t){return r(Number.isNaN,t)}function E(t,u){return r(l=>{const c=Array.from(l);return c.includes(t)||c.includes(D(t))},u)}function w(t){return m(1,t)}function m(t=1,u){let l=-1;return r(()=>(l+=1,l>=t),u)}return Array.isArray(D(e))?{toMatch:r,toContains:E,changed:w,changedTimes:m,get not(){return C(e,!n)}}:{toMatch:r,toBe:o,toBeTruthy:h,toBeNull:p,toBeNaN:O,toBeUndefined:b,changed:w,changedTimes:m,get not(){return C(e,!n)}}}function _(e){return C(e)}const F=Symbol("DATA_PROVIDER_CONTEXT"),N=()=>M(F,x);function j(e){const{initialData:n,shallow:r,onSuccess:o=B,onError:h=B,immediate:p,resetOnExecute:b=!1,queryFn:O,queryKey:E}=e,w=(r?a.shallowRef:a.ref)(n),m=a.ref(!1),t=a.ref(!1),u=a.ref(!1),l=a.shallowRef(),c=s=>{t.value=s,m.value=!s},g=()=>{b&&(w.value=n)},f=()=>new Promise((s,T)=>{_(m).toBe(!0).then(()=>l.value?T(l.value):s(d))}),i={then:(...s)=>f().then(...s),catch:(...s)=>f().catch(...s)};let v=0;const y=s=>{if(l.value=void 0,t.value)return i;if(O===void 0)return m.value=!0,i;g(),c(!0),v+=1;const T=v;return O(s).then(P=>{const R=P;w.value=R,o(R)}).catch(P=>{l.value=P,h(P)}).finally(()=>{var P;(P=e.onFinish)==null||P.call(e),T===v&&c(!1)}),i};p&&y();const d={data:w,error:l,isFinished:m,isLoading:t,isAborted:u,isCanceled:u,execute:y};return{...d,...i}}const k=(e,n=!1)=>{const{deleteOne:r}=N(),o=j({immediate:n,queryFn:p=>r(e,p)}),h=o.execute;return{...o,sendDelete:h}};exports.useDelete=k;
//# sourceMappingURL=useDelete.js.map
