import{c as n}from"./config-C5ccHKCm.js";import{y as g}from"./main.js";const p=g((r,c)=>({historyList:[],loading:!1,total:0,pageNo:1,pageSize:10,currentHistory:null,detailLoading:!1,error:null,fetchHistoryList:async(t,e,a)=>{r({loading:!0,error:null});try{const{pageNo:o,pageSize:s}=c(),l=(await n.historyList({dataId:t,groupName:e,namespaceId:a,pageNo:o,pageSize:s})).data;r({historyList:l.pageItems||[],total:l.totalCount||0,loading:!1})}catch(o){const i=o.response?.data?.message||"Failed to fetch history list";r({loading:!1,error:i,historyList:[],total:0})}},fetchHistoryDetail:async(t,e,a)=>{r({detailLoading:!0,error:null});try{const s=await n.historyDetail({nid:t,dataId:e,groupName:a});r({currentHistory:s.data,detailLoading:!1})}catch(o){const i=o.response?.data?.message||"Failed to fetch history detail";r({detailLoading:!1,error:i,currentHistory:null})}},setPage:(t,e)=>{r(a=>({pageNo:t,pageSize:e??a.pageSize}))},clearCurrentHistory:()=>{r({currentHistory:null})},clearError:()=>{r({error:null})}}));export{p as u};
