import{i as e,n as t}from"./backendApi-CRLUmnjv.js";var n=null,r=class{static getCacheUrl(e){if(n===null&&(n=t()),!e)return;if(e.startsWith(`http`))return e;e.startsWith(`/`)&&(e=e.slice(1)),(e===`cache`||e.startsWith(`cache/`))&&(e=e.slice(6));let r=n.cacheRoute.startsWith(`/`)?n.cacheRoute:`/${n.cacheRoute}`;return`${n.useHttps?`https`:`http`}://${n.host}:${n.port}${r}/${e}`}static getObjectiveAssetUrl(t){return new Promise((n,r)=>{e.get(`cache/objective/${t}`).then(e=>{if(e.status===200){let i=this.getCacheUrl(e.data);if(i===void 0){r(Error(`Empty objective asset URL for type ${t}`));return}n(i)}else r(Error(`Failed to fetch objective asset URL for type ${t}, status code: ${e.status}`))}).catch(e=>{console.error(`Error fetching objective asset URL for type ${t}:`,e),r(e)})})}};export{r as t};