import{ap as e,aq as s,ak as a,ar as r,as as u}from"./main-10cdb7d6.js";async function i(i,o,t){const n=new e("updateLovelaceResources"),d=await s(i),l=`/hacsfiles/${o.full_name.split("/")[1]}`,c=a({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};
