import{b as t}from"./c.4fceb30e.js";const a=async a=>{let o;try{o=await t(a)}catch(t){throw new Error(`Error fetching manifest.json for ${a}: ${t}`)}const r=o.map((async t=>{const a=new URL(t.path,location.href).toString(),o=await fetch(a);if(!o.ok)throw new Error(`Downloading firmware ${t.path} failed: ${o.status}`);return o.arrayBuffer()})),f=[];for(const t of o){const a=await r.shift();f.push({data:a,offset:t.offset})}return f},o=async(t,a,o,r)=>{const f=await t.runStub();o&&await f.eraseFlash();let s=0;for(const t of a)s+=t.data.byteLength;let e=0,n=0;r(0);for(const t of a)await f.flashData(t.data,(t=>{const a=Math.floor((n+t)/s*100);a!==e&&(e=a,r(a))}),t.offset,!0),n+=t.data.byteLength;r(100)};export{o as f,a as g};
