// @blocklet/sdk/lib/component shim
function _getUrl(path?: string) {
  const base = (globalThis as any).__CF_ENV__?.APP_URL || '';
  if (!path) return base;
  // In CF Workers there is no blocklet prefix — assets are served from root
  return `${base}${path.startsWith('/') ? path : '/' + path}`;
}

const component = {
  getUrl: _getUrl,
};

export default component;
export function getUrl(path?: string) {
  return _getUrl(path);
}
export function getResources() { return []; }
export function getPackResources() { return []; }
