import{P as m,dq as u,Q as a,T as t,eA as y,eB as T,A as c,eC as M,x as g,f as $,U as q,E as P}from"./index-C1DmWO_C.js";const h=m.injectEndpoints({endpoints:r=>({getModelsList:r.query({query:({pId:e,params:s={offset:0,limit:40}})=>({url:`project/${e}/modelregistries/${e}/models?${u.stringify(s)}`}),extraOptions:{skipError:!0},providesTags:a.providesListItems(t.ProjectTags.ModelVersions)}),getModel:r.query({query:({projectId:e,modelName:s})=>({url:`project/${e}/modelregistries/${e}/models?filter_by=name_eq:${s}`}),providesTags:a.providesListItems(t.ProjectTags.Model)}),getModelVersion:r.query({query:({projectId:e,modelName:s,modelVersion:o})=>({url:`project/${e}/modelregistries/${e}/models/${s}_${o}?expand=modelschema&expand=inputexample`})}),deleteModelVersion:r.mutation({query:({projectId:e,mlId:s})=>({url:`project/${e}/modelregistries/${e}/models/${s}`,method:"delete"}),invalidatesTags:[{type:t.ProjectTags.Model,id:"LIST"},{type:t.ProjectTags.ModelVersions,id:"LIST"}]}),getModelTags:r.query({query:({projectId:e,modelId:s})=>({url:`project/${e}/modelregistries/${e}/models/${s}/tags?expand=tag_schemas`}),extraOptions:{skipError:!0},transformResponse:e=>{var s;return((s=e.items)==null?void 0:s.map(y))||[]},providesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")}),addModelTags:r.mutation({async queryFn({projectId:e,modelId:s,tags:o},f,v,p){const n=T(o).map(l=>p({url:`
            project/${e}/
            modelregistries/${e}/
            models/${s}/
            tags/${l.key}
            `.replace(/\s/g,""),method:"put",data:l.formattedArray})),d=await Promise.all(n),i=c(M(["error","response"]),d);return i?{error:g({error:$(P({data:{usrMsg:"Error while adding tags"}},"response"),g({data:q("usrMsg")}))},i)}:{data:d}},invalidatesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")}),deleteModelTag:r.mutation({query:({projectId:e,modelId:s,tagName:o})=>({url:`project/${e}/modelregistries/${e}/models/${s}/tags/${o}`,method:"delete"}),extraOptions:{skipError:!0},invalidatesTags:a.cacheByIdArgProperty(t.ProjectTags.ModelTag,"modelId")})})}),{useGetModelsListQuery:j,useGetModelQuery:k,useGetModelVersionQuery:E,useDeleteModelVersionMutation:L,useGetModelTagsQuery:Q,useAddModelTagsMutation:V,useDeleteModelTagMutation:_}=h;export{_ as a,Q as b,j as c,E as d,k as e,L as f,h as m,V as u};
