import{D as s}from"./p-aa5ffe14.js";import{C as i}from"./p-d343a062.js";import{r as t,c as h}from"./p-f46dff5e.js";class a{constructor(s,i,t,h,a,r){this.apiData=s,this.callback=r,this.params=i,this.table=t,this.fields=a,this.query=h}fetchData(a){var r;if(a.isPending)return;this.callback(a.beforeFetch());const{name:o}=this.table,f=(null===(r=this.query)||void 0===r?void 0:r.filter)?t(h(this.query.filter),this.params):{comparison:i.Eq,id:"_id",value:this.params.itemId};this.apiData.query(o,{fields:this.fields,filter:f,limit:1,skip:0}).then((i=>{this.callback(a.afterFetch(i.results.length>0?i.results[0]:new s))}),(s=>{this.callback(a.afterFetchError(s))}))}}export{a as I}