import type { Code, VariantCode } from "../../CodeHighlighter/types.mjs";
/**
 * Configuration for rewriting URL prefixes on code data.
 *
 * Useful for translating local `file://` URLs gathered at build time into
 * publicly-accessible URLs (for example `https://github.com/owner/repo/tree/<branch>/`)
 * before they reach the client.
 */
export type UrlPrefix = {
  /** URL prefix to strip (e.g. `file:///path/to/project/`). */
  from: string;
  /** Replacement URL prefix (e.g. `https://github.com/owner/repo/tree/main/`). */
  to: string;
};
/**
 * Replaces `urlPrefix.from` with `urlPrefix.to` at the start of `url`.
 * Returns the original value when `url` is falsy or doesn't start with `from`.
 */
export declare function replaceUrlPrefix(url: string | undefined, urlPrefix: UrlPrefix): string | undefined;
/**
 * Returns a new `VariantCode` with `url` and any string-form `extraFiles`
 * entries rewritten via `urlPrefix`. Object-form `extraFiles` entries are
 * left untouched because their effective URL is derived from the variant
 * `url` and `relativeUrl` at consumption time.
 */
export declare function applyUrlPrefixToVariant(variant: VariantCode, urlPrefix: UrlPrefix): VariantCode;
/**
 * Returns a new `Code` map with each variant's URLs rewritten via `urlPrefix`.
 * Returns the original reference when nothing changes so identity-based memos
 * downstream don't invalidate.
 */
export declare function applyUrlPrefixToCode(code: Code, urlPrefix: UrlPrefix): Code;
/**
 * Rewrites `Code` entries in a `globalsCode`-style array via
 * `applyUrlPrefixToCode`. String entries are left untouched: they represent
 * unresolved URLs that still need to be loaded by the server (e.g. via
 * `loadCodeMeta`), which expects the original `file://` URL it can read from
 * disk. The resulting loaded `Code` is rewritten downstream.
 */
export declare function applyUrlPrefixToGlobalsCode<T extends Code | string>(globalsCode: Array<T>, urlPrefix: UrlPrefix): Array<T>;