import"./rolldown-runtime-DIIn1E2Q.js";import{D as e,c as t,kt as n}from"./vendor-vue-core-DO0afONr.js";import{u as r}from"./vendor-other-CiPV8GBG.js";import{n as i}from"./types-DPJvCrdo.js";import{t as a}from"./envUtil-DWap3SmU.js";var o=t(`downloads`,()=>{let t=n([]),o=i?a().DownloadManager:void 0,findByUrl=e=>t.value.find(t=>e===t.url),initialize=async()=>{if(!i||!o)return;let e=await o.getAllDownloads();for(let n of e)t.value.push(n);o.onDownloadProgress(e=>{findByUrl(e.url)||t.value.push(e);let n=findByUrl(e.url);n&&(n.progress=e.progress,n.status=e.status,n.filename=e.filename,n.savePath=e.savePath)})};initialize();let start=({url:e,savePath:t,filename:n})=>o.startDownload(e,t,n),pause=e=>o.pauseDownload(e),resume=e=>o.resumeDownload(e),cancel=e=>o.cancelDownload(e);return{downloads:t,start,pause,resume,cancel,findByUrl,initialize,inProgressDownloads:e(()=>t.value.filter(({status:e})=>e!==r.COMPLETED))}});export{o as t};
//# sourceMappingURL=electronDownloadStore-DudKQmD7.js.map