import{ar as e,as as a,am as s,at as r,au as u}from"./main-def8a0ab.js";async function i(i,t,o){const n=new e("updateLovelaceResources"),l=await a(i),d="/hacsfiles/"+t.full_name.split("/")[1],c=s({repository:t,version:o}),p=l.find(e=>e.url.includes(d));n.debug({namespace:d,url:c,exsisting:p}),p&&p.url!==c?(n.debug("Updating exsusting resource for "+d),await r(i,{url:c,resource_id:p.id,res_type:p.type})):l.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};
