// serialize-html.ts import { Primitive } from '../../../core/types.js' import { is_Primitive } from '../../../core/value-guards.js'; import { ELEM_TAG, EVERY_VSN, HSON_SYS_PREFIX, HTML_KEY_PREFIX, OBJ_TAG, ROOT_TAG, STR_TAG, VAL_TAG } from '../../../core/constants.js'; import { build_wire_attrs } from '../utils/html-utils/build-wire-attrs.js'; import { escape_html_text } from '../utils/html-utils/escape-html.js'; import { make_string } from '../../../core/stringify.js'; import { _snip } from '../utils/sys-utils/snip.utils.js'; import { is_Node } from '../../../core/node-guards.js'; import { assert_invariants } from '../../../core/assert-invariants.js'; import { collect_hson_node_quid_claims } from '../../../core/hson-node-quid.js'; import { clone_node } from '../../../core/clone-node.js'; import { HsonNode } from '../../../core/types.js'; import { _throw_transform_err } from '../utils/sys-utils/throw-transform-err.utils.js'; import { encode_html_key_tag } from '../utils/html-utils/encode-html-tag.js'; const RAWTEXT = new Set(["style", "script"]); /** * Collect raw textual content from a subtree without trimming or escaping. * * Behavior: * - Walks a mixed list of `HsonNode | Primitive`. * - For `_hson_str` nodes: * - Takes the first `$_content` entry (if any), * - Uses it as a string if already a string, otherwise stringifies it. * - For other node types: * - Recursively descends into their `$_content`. * - For primitive leaves: * - Appends `String(primitive)` directly. * * Notes: * - Does not perform any HTML/XML escaping. * - Does not collapse whitespace or remove newlines. * * Intended use: * - Raw-text serialization for RAWTEXT elements like `