import{a7 as c,a4 as a,h as p,p as m,a as y,aT as $}from"./index-dNe6i2rS.js";import{s as l}from"./sortBy-COer1Ia5.js";import{m as d}from"./mergeRight-D1nsCm60.js";import{b as f}from"./time-utils-CQYZ5msB.js";const v=c.injectEndpoints({endpoints:g=>({getFvMonitoringConfigByEntity:g.query({query:({pId:r,fsId:i,fvName:t,fvVersion:e,modelName:n,modelVersion:s})=>{const o={};return n!==void 0&&s!==void 0&&(o.modelName=n,o.modelVersion=s),{url:$.stringifyUrl({url:`
              project/${r}/
              featurestores/${i}/
              featureview/${t}/version/${e}/
              featuremonitoring/config/entity/
            `.replace(/\s/g,""),query:o})}},providesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`}]}),updateFvMonitoringConfig:g.mutation({query:({pId:r,fsId:i,fvName:t,fvVersion:e,configId:n,enabled:s,triggerType:o})=>({url:`
          project/${r}/
          featurestores/${i}/
          featureview/${t}/version/${e}/
          featuremonitoring/config/${n}
        `.replace(/\s/g,""),method:"PUT",data:{enabled:s,triggerType:o}}),invalidatesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`},a.ProjectTags.ModelMonitoringConfig]}),deleteFvMonitoringConfig:g.mutation({query:({pId:r,fsId:i,fvName:t,fvVersion:e,configId:n})=>({url:`
          project/${r}/
          featurestores/${i}/
          featureview/${t}/version/${e}/
          featuremonitoring/config/${n}
        `.replace(/\s/g,""),method:"DELETE"}),invalidatesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`},a.ProjectTags.ModelMonitoringConfig]}),getFvMonitoringResult:g.query({query:({pId:r,fsId:i,fvName:t,fvVersion:e,configId:n,query:s={}})=>{const o={expand:"statistics",filter_by:[`monitoring_time_gte:${f({days:7},new Date).getTime()}`,`monitoring_time_lt:${new Date().getTime()}`]};return{url:$.stringifyUrl({url:`
           project/${r}/
           featurestores/${i}/
           featureview/${t}/version/${e}/
           featuremonitoring/result/byconfig/${n}
        `.replace(/\s/g,""),query:d(o,s)})}},providesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`}],transformResponse:p(y([],"items"),l(m("monitoringTime")))}),getFvMonitoringShiftsByConfigs:g.query({query:({pId:r,fsId:i,fvName:t,fvVersion:e,configIds:n})=>{const s=`
          project/${r}/
          featurestores/${i}/
          featureview/${t}/version/${e}/
          featuremonitoring/result/byconfigs/shifts
        `.replace(/\s/g,""),o=new URLSearchParams;return o.append("filter_by",`monitoring_time_gte:${f({days:7},new Date).getTime()}`),o.append("filter_by",`monitoring_time_lt:${new Date().getTime()}`),n.forEach(u=>o.append("configId",String(u))),{url:`${s}?${o.toString()}`}},providesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`}],transformResponse:r=>{const i=(r==null?void 0:r.items)??[],t={};return i.forEach(e=>{const n=e.shiftedFeatureNames??[];t[e.featureMonitoringConfigId]={shiftedFeatureCount:e.shiftedFeatureCount??n.length,shiftedFeatureNames:n,lastShiftAt:e.lastShiftAt??null}}),t}}),getFvMonitoringResultsByConfigs:g.query({query:({pId:r,fsId:i,fvName:t,fvVersion:e,configIds:n})=>{const s=`
          project/${r}/
          featurestores/${i}/
          featureview/${t}/version/${e}/
          featuremonitoring/result/byconfigs
        `.replace(/\s/g,""),o=new URLSearchParams;return o.append("filter_by",`monitoring_time_gte:${f({days:7},new Date).getTime()}`),o.append("filter_by",`monitoring_time_lt:${new Date().getTime()}`),n.forEach(u=>o.append("configId",String(u))),{url:`${s}?${o.toString()}`}},providesTags:(r,i,{fvName:t,fvVersion:e})=>[{type:a.ProjectTags.FVMonitoringConfig,id:`${t}-${e}`}],transformResponse:p(y([],"items"),l(m("monitoringTime")))})})}),{useGetFvMonitoringConfigByEntityQuery:C,useUpdateFvMonitoringConfigMutation:h,useDeleteFvMonitoringConfigMutation:j,useGetFvMonitoringResultQuery:w,useGetFvMonitoringResultsByConfigsQuery:q,useGetFvMonitoringShiftsByConfigsQuery:P,endpoints:S,util:E}=v;export{h as a,w as b,P as c,j as d,E as f,C as u};
