import{D as DataModel}from"./data-model-88af49fc.js";import{C as Comparison}from"./filter-cbaa3d7d.js";import{r as replaceParamsInFilter,c as cloneFilter}from"./filter-8542e288.js";var ItemDataProvider=function(){function a(a,t,r,e,i,s){this.apiData=a;this.callback=s;this.params=t;this.table=r;this.fields=i;this.query=e}a.prototype.fetchData=function(a){var t=this;var r;if(a.isPending){return}this.callback(a.beforeFetch());var e=this.table.name;var i=((r=this.query)===null||r===void 0?void 0:r.filter)?replaceParamsInFilter(cloneFilter(this.query.filter),this.params):{comparison:Comparison.Eq,id:"_id",value:this.params.itemId};var s={fields:this.fields,filter:i,limit:1,skip:0};this.apiData.query(e,s).then((function(r){t.callback(a.afterFetch(r.results.length>0?r.results[0]:new DataModel))}),(function(r){t.callback(a.afterFetchError(r))}))};return a}();export{ItemDataProvider as I};