/** * Path helpers shared across all validator checkers. * * All paths are handled as **forward-slash POSIX strings** because that is * how OPC part names are defined. We never touch the host's path separator. */ /** * Strip a single leading `/` if present. OPC `PartName` values start with * `/` by spec, but zip entries do not. */ export declare function stripLeadingSlash(p: string): string; /** `.xml`, `.rels`, or `.vml` — the payloads we parse as XML. */ export declare function isXmlLike(pathName: string): boolean; /** * Directory in which a relationships part's **source** part lives. OPC * resolves rel Targets relative to the source part's directory, NOT the * `.rels` file's directory. Examples: * * | .rels path | source dir | * |-----------------------------------------|---------------------| * | `_rels/.rels` | `` | * | `xl/_rels/workbook.xml.rels` | `xl` | * | `xl/worksheets/_rels/sheet1.xml.rels` | `xl/worksheets` | */ export declare function getRelsSourceDir(relsPath: string): string; /** * Basename without directory, e.g. `xl/foo/bar.xml` → `bar.xml`. */ export declare function posixBasename(p: string): string; /** Extension without the leading dot, lowercase. `""` when missing. */ export declare function getExtension(p: string): string; /** * Resolve a relationship Target against a .rels path. Handles absolute * targets starting with `/` (relative to package root), `../` traversal, * `./`, and plain relative segments. Never returns a leading slash. * * We do NOT use `node:path` so this module is usable in browsers. */ export declare function resolveRelTarget(relsPath: string, target: string): string; /** * `false` when a resolved rel target escapes the package root. Targets * that escape are malicious or accidentally produced by broken * serialisers and always indicate a corrupt package. */ export declare function isSafeResolvedPath(resolved: string): boolean; /** * Derive the .rels path for a given source part. Symmetric with * `getRelsSourceDir`. Examples: * * | source part | rels path | * |--------------------------------|----------------------------------------| * | `xl/workbook.xml` | `xl/_rels/workbook.xml.rels` | * | `xl/worksheets/sheet1.xml` | `xl/worksheets/_rels/sheet1.xml.rels` | */ export declare function relsPathForPart(partPath: string): string; /** * Inverse of {@link relsPathForPart}: source part for a given rels file. * Returns undefined for the root rels (which has no conventional source). */ export declare function sourcePartForRels(relsPath: string): string | undefined; /** * Part name satisfies OPC PartName grammar — not empty, uses only safe * characters, does not end with `/` and does not contain `.` or `..` * segments. We do not validate the full grammar but cover the cases that * break Excel in practice. */ export declare function isLegalPartName(partName: string): boolean;