import{D as DataModel}from"./data-model-f5160369.js";import{C as Comparison}from"./filter-cbaa3d7d.js";import{r as replaceParamsInFilter,c as cloneFilter}from"./filter-8542e288.js";var ItemDataProvider=function(){function t(t,a,r,e,i,s){this.apiData=t;this.callback=s;this.params=a;this.table=r;this.fields=i;this.query=e}t.prototype.fetchData=function(t){var a=this;var r;if(t.isPending){return}this.callback(t.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){a.callback(t.afterFetch(r.results.length>0?r.results[0]:new DataModel))}),(function(r){a.callback(t.afterFetchError(r))}))};return t}();export{ItemDataProvider as I};