{"version":3,"file":"useImageProxy-C0JiCsoR.mjs","names":[],"sources":["../src/components/composable/useImageProxy.ts"],"sourcesContent":["import { useApiStore } from \"../../stores/ApiStore\";\nexport const useImageProxy = ()=>{\n\n  const apiStore = useApiStore();\n\n  function useProxyImageUrl(url: string|undefined, width: string, height?: string, blur=false): string {\n    if (!url) {\n      return \"\";\n    }\n\n    // Encode URL to prevent some display issues\n    url = encodeURI(url);\n\n    if (apiStore.imageUrl && url.includes(\"http\")) {\n      const size = height ? \"height=\" + height : \"width=\" + width;\n      const encode = btoa(url).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n      return (\n        apiStore.imageUrl +\n        \"image/\" +\n        (blur ? \"noRedirect/\":\"\")+\n        encode +\n        \"?\" +\n        size +\n        \"&useWebp=true\"+\n        (blur ? \"&blur=true\":\"\")\n      );\n    }\n    return url;\n  }\n\n  return {\n    useProxyImageUrl\n  }\n}\n"],"mappings":";;AACA,IAAa,sBAAoB;CAE/B,MAAM,WAAW,YAAY;CAE7B,SAAS,iBAAiB,KAAuB,OAAe,QAAiB,OAAK,OAAe;EACnG,IAAI,CAAC,KACH,OAAO;EAIT,MAAM,UAAU,GAAG;EAEnB,IAAI,SAAS,YAAY,IAAI,SAAS,MAAM,GAAG;GAC7C,MAAM,OAAO,SAAS,YAAY,SAAS,WAAW;GACtD,MAAM,SAAS,KAAK,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;GAClF,OACE,SAAS,WACT,YACC,OAAO,gBAAc,MACtB,SACA,MACA,OACA,mBACC,OAAO,eAAa;EAEzB;EACA,OAAO;CACT;CAEA,OAAO,EACL,iBACF;AACF"}