import{a8 as e,a9 as a,Z as s,aa as r,ab as u}from"./main-add588c4.js";async function i(i,o,t){const n=new e("updateLovelaceResources"),d=await a(i),l="/hacsfiles/"+o.full_name.split("/")[1],c=s({repository:o,version:t}),p=d.find(e=>e.url.includes(l));n.debug({namespace:l,url:c,exsisting:p}),p&&p.url!==c?(n.debug("Updating exsusting resource for "+l),await r(i,{url:c,resource_id:p.id,res_type:p.type})):d.map(e=>e.url).includes(c)||(n.debug(`Adding ${c} to Lovelace resources`),await u(i,{url:c,res_type:"module"}))}export{i as u};
