import{Q as a}from"./index-CZy-fyXs.js";import{s as e}from"./c.BqFZjOdP.js";const r=async e=>{let r;try{r=await fetch(a(e))}catch(a){throw new Error(`Downloading firmware failed: ${a}`)}if(!r.ok)throw new Error(`Downloading firmware failed: ${r.status}`);const t=new FileReader,s=await r.blob();return[{data:await new Promise((a=>{t.addEventListener("load",(()=>a(t.result))),t.readAsBinaryString(s)})),address:0}]},t=async(a,e,r,t)=>{r&&await a.eraseFlash();let s=0;for(const a of e)s+=a.data.length;let o=0;t(0),await a.writeFlash({fileArray:e,flashSize:"keep",flashMode:"keep",flashFreq:"keep",eraseAll:!1,compress:!0,reportProgress:(a,r,i)=>{const n=r/i*e[a].data.length,l=Math.floor((o+n)/s*100);r!==i?t(l):o+=n}}),t(100)},s=async a=>{await a.setRTS(!0),await e(100),await a.setRTS(!1)};export{t as f,r as g,s as r};
//# sourceMappingURL=c.CIUz35e2.js.map
