/** The value of a parsed XML attribute (always a string in this flat tree). */ export type XmlAttrValue = string; /** A parsed XML element: attributes (`@_`-prefixed) and child tags keyed by name. */ export type XmlElement = Record; /** * Narrow an arbitrary parsed value to an {@link XmlElement}. * * @returns The value as an element record, or `undefined` when it is null, a * primitive, or an array (i.e. not a single element node). */ export declare function asElement(v: unknown): XmlElement | undefined; /** * Coerce a value to an array, treating a lone element as a one-item array. * `fast-xml-parser` collapses a single repeated child to a bare object; this * normalizes it so callers can always iterate. * * @returns The value as an array (empty for null/undefined). */ export declare function asArray(v: unknown): ReadonlyArray; /** * Read a string attribute off an element, trying the `w:`-prefixed name first * then the unprefixed fallback (e.g. `@_w:val` then `@_val`). * * @param node The element to read from. * @param name The local attribute name (without the `@_`/`w:` prefix). * @returns The attribute value, or `undefined` when the node is not an element * or the attribute is absent / non-string. */ export declare function getAttr(node: unknown, name: string): string | undefined; /** Shorthand for {@link getAttr}`(node, 'val')` — the ubiquitous `@w:val` attribute. */ export declare function getVal(node: unknown): string | undefined; /** * Read an attribute and parse it as a finite number. * * @param node The element to read from. * @param name The local attribute name. * @returns The parsed number, or `undefined` when absent or not finite. */ /** * §17.3.2.38 ST_HpsMeasure — a size in HALF-POINTS, or the same universal * measure with a unit on it ("20pt"). The two units differ by a factor of ten * from the twips a length is written in, so a size is read here rather than * through {@link parseIntAttr}: tdf108408.docx writes `w:sz w:val="20pt"` and * read as twips it set its sample text 200 points tall. * * @param node The element carrying the attribute. * @param name The attribute name. * @returns The size in half-points, or undefined. */ export declare function parseHalfPointAttr(node: unknown, name: string): number | undefined; export declare function parseIntAttr(node: unknown, name: string): number | undefined; /** * Parse a toggle (boolean) property per ECMA-376 Part 1 §17.17.4: * - Absent → `undefined` (inherit) * - Present without `val`, or `val ∈ {true, 1, on}` → `true` * - Present with `val ∈ {false, 0, off}` → `false` * * @returns The toggle state, or `undefined` when the property is absent. */ export declare function parseToggle(node: unknown): boolean | undefined; /** * Read the `#text` content of a node. A bare string/number is returned directly; * an element returns its `#text` child (coerced to string), else the empty string. */ export declare function getText(node: unknown): string;