const m="modulepreload",_=function(s,o){return s.startsWith(".")?new URL(s,o).href:s},u={},y=function(o,l,c){if(!l||l.length===0)return o();const a=document.getElementsByTagName("link");return Promise.all(l.map(n=>{if(n=_(n,c),n in u)return;u[n]=!0;const t=n.endsWith(".css"),f=t?'[rel="stylesheet"]':"";if(!!c)for(let r=a.length-1;r>=0;r--){const i=a[r];if(i.href===n&&(!t||i.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${f}`))return;const e=document.createElement("link");if(e.rel=t?"stylesheet":m,t||(e.as="script",e.crossOrigin=""),e.href=n,document.head.appendChild(e),t)return new Promise((r,i)=>{e.addEventListener("load",r),e.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>o())};export{y as _};
