import{n as a,Q as t,P as e,l as s,ah as o,p as l}from"./utils-lib.js?v=1761009159";import{_ as n}from"./index105.js?v=1761009159";import{c as i,r,e as c,w as m,q as p,H as u,v as d,x as _,B as b,C as f,I as h,y,G as v}from"./base-lib.js?v=1761009159";import{a as j,d as k,h as w,u as q,c as C}from"./column.js?v=1761009159";import{getModulesList as g,deleteDatabase as x,backupSqliteData as E,deleteSqliteData as R}from"./database.js?v=1761009159";import{g as D}from"./useStore2.js?v=1761009159";import{i as T,o as I,h as L}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const P=i({__name:"index",setup(i){const{refs:{isRefreshTable:P},resetRefresh:A}=D(),O=r(),V=r(!1),H=r([]),Q=async(a,t,e,s,o)=>{const{label:l,value:n}=s;await a({title:"批量".concat(l),content:"批量".concat(l,"已选数据库，是否继续操作！"),column:[{prop:"name",label:"数据库名"},C()],onConfirm:async()=>{const a=await(async()=>{const a={back:E,delete:R}[n],t=e.value.map(a=>({path:a.path,name:a.name})),s=L([],[],!1,{params:{database_list:t}});if(a)return await a(s)})();W();const{data:t}=T(a.data);I(t,{title:"".concat(l)}),o&&o()}})},S=()=>{a({title:"添加SQLite数据库",area:48,btn:!0,component:()=>t(()=>import("./add-sqlite.js?v=1761009159"),__vite__mapDeps([]),import.meta.url)})},W=async()=>{try{const a=await e({request:g({},"sqlite"),loading:V});H.value=null==a?void 0:a.data}catch(a){}},z=[j({type:"page",key:"name"}),{label:"数据库名称",prop:"name",minWidth:90},{label:"备份",minWidth:180,isCustom:!0,render:e=>c("span",{class:"cursor-pointer",style:{color:e.backup_count>0?"var(--el-color-primary)":"#f0ad4e"},onClick:()=>(e=>{a({title:"数据库备份详情【"+e.name+"】",area:70,compData:e,component:()=>t(()=>import("./back-sqlite.js?v=1761009159"),__vite__mapDeps([]),import.meta.url)})})(e)},[e.backup_count>0?"有备份(".concat(e.backup_count,")"):"点击备份"])},k({prop:"path"}),w({prop:"size",width:100}),q([{onClick:e=>{a({title:"管理",area:[114,65],compData:{...e,list:H.value},component:()=>t(()=>import("./index140.js?v=1761009159"),__vite__mapDeps([]),import.meta.url)})},title:"管理"},{onClick:async a=>{try{await l({title:"删除数据库文件【"+(null==a?void 0:a.name)+"】",content:"删除选中的数据库文件后，该数据库文件将不在列表中显示，是否继续操作？"}),await e({request:x({path:a.path},"sqlite"),loading:"正在删除数据库,请稍后...",message:!0}),W()}catch(t){}},title:"删除"}])],B=[{label:"备份数据库",value:"back",event:Q},{label:"删除数据库",value:"delete",event:Q}];return m(()=>P.value,async a=>{a&&await W(),A()}),p(()=>{W()}),(a,t)=>{const e=v,l=s,i=o,r=n,m=u("bt-loading");return d(),_("div",null,[c(r,null,{"header-left":b(()=>[c(e,{type:"primary",onClick:S},{default:b(()=>t[0]||(t[0]=[f(" 添加数据库文件 ",-1)])),_:1,__:[0]})]),content:b(()=>[h(c(l,{ref_key:"sqliteTableRef",ref:O,column:z,data:y(H)},null,8,["data"]),[[m,y(V)],[m,"正在加载数据库列表...","title"]])]),"footer-left":b(()=>[c(i,{"table-ref":y(O),options:B},null,8,["table-ref"])]),_:1})])}}});export{P as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
