import { type StageIdentityAttrs } from './preview-runtime.js'; /** Base64url encode a string (URL-safe, no padding) */ export declare function base64urlEncode(str: string): string; /** Base64url decode */ export declare function base64urlDecode(str: string): string; /** Set the root that doc paths are encoded against (the Vite root / staging dir) */ export declare function setDocPathRoot(root: string): void; /** Encode a doc entity (file + entity slug) for URLs and emitted file names. * The slug rides inside the token as a '#' fragment so every URL shape keeps * exactly one token path segment. */ export declare function encodeEntityId(filePath: string, entitySlug: string): string; /** The docEntries key for one entity of one file */ export declare function entityKey(filePath: string, entitySlug: string): string; /** * Find the entry a parsed id refers to. * * Normally the key matches outright. The fallback exists for a token encoded * against a different root — a standalone MCP server has no dev server to ask * which one — and matching by path suffix beats telling a caller that a stage * it can see plainly doesn't exist. It has to apply everywhere an id is * resolved, not just at the first hop: serving the preview shell and then * 404-ing the module it imports produces a page that loads and shows nothing, * which is worse than an honest miss. */ export declare function lookupEntry(entries: Map, parsed: { docFilePath: string; entitySlug: string; relPath?: string; }): T | undefined; /** Resolve relative imports to absolute paths for use in virtual components */ export declare function resolveImportsToAbsolute(imports: string[], docFilePath: string): string[]; /** One relative import: its specifier and where it sits in the script. */ export interface ScannedImport { spec: string; start: number; end: number; } /** * The script's *relative* import specifiers, with their offsets. * * Matches against the scrubbed text (comments and string/template contents * blanked, offsets preserved) so an import-shaped substring inside a string * literal — a code sample, say — is never treated as an import; the real * specifier is then read back from the original at the same offsets. Bare * specifiers (npm packages) are skipped: only relative paths are ours to * resolve. Single source of truth for both rewriting and existence checks. */ export declare function scanRelativeImports(script: string): ScannedImport[]; export declare function resolveScriptImports(script: string, docFilePath: string): string; /** Generate a virtual Svelte iframe wrapper component for a snippet. * Includes $state for reactive prop updates via postMessage, invokes * component methods on request, and broadcasts exported state values. */ export declare function generateIframeComponent(scriptPrelude: string, snippetBody: string, stateNames?: string[], componentName?: string, stage?: { maxWidth: string; padding: string; direction?: string; gap?: string; contentX?: string; contentY?: string; background?: string; minHeight?: string; }, extras?: { /** The block's declared `args={{ … }}` literal — seeded as the initial * state so a component using a required prop has it on first render, * before the Controls' first message arrives. */ args?: Record; /** Block-level