import i from"node:path";import{PUBLIC_STATIC_FOLDER as f}from"../constants/common.js";import{isLocalLink as p}from"../../shared/utils.js";import{copyStaticFile as u,FileNotFoundError as F}from"./fs.js";async function x(r,n,o){if(!p(r))return r;const t=r.startsWith("/")?i.posix.join(f,r):void 0;if(t&&await n.exists(t))return r;const m=r.startsWith("/")?r.slice(1):i.posix.join(i.dirname(o.fromFileRelativePath),r),c=await n.getFileInfo(m);if(!c)throw new F(`Cannot resolve asset path: ${r}`,r);return u(o.contentDir,c.realRelativePath,o.outdir)}export{x as resolveAssetPath};
