@office-open/docx 0.10.9 → 0.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-Di_7M9eJ.mjs","names":[],"sources":["../src/parts/fonts/obfuscate-ttf-to-odttf.ts","../src/parts/header-footer.ts","../src/compiler.ts","../src/generate.ts"],"sourcesContent":["/**\n * Font obfuscation module for embedding fonts in WordprocessingML documents.\n *\n * This module implements the OOXML font obfuscation algorithm used to embed\n * fonts in DOCX documents. Obfuscation is required by the OOXML specification\n * to prevent simple extraction of embedded font files.\n *\n * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)\n *\n * @module\n */\n\n/** Start offset for obfuscation in the font file */\nconst obfuscatedStartOffset = 0;\n/** End offset for obfuscation (first 32 bytes are obfuscated) */\nconst obfuscatedEndOffset = 32;\n/** Expected GUID size (32 hex characters without dashes) */\nconst guidSize = 32;\n\n/**\n * Obfuscates a TrueType font file for embedding in OOXML documents.\n *\n * The obfuscation algorithm XORs the first 32 bytes of the font file\n * with a reversed byte sequence derived from the font's GUID key.\n * This prevents simple extraction while maintaining font functionality.\n *\n * @param buf - The original font file as a byte array\n * @param fontKey - The GUID key for the font (with or without dashes)\n * @returns The obfuscated font data\n * @throws Error if the fontKey is not a valid 32-character GUID\n *\n * @example\n * ```typescript\n * const fontData = readFileSync(\"font.ttf\");\n * const fontKey = \"00000000-0000-0000-0000-000000000000\";\n * const obfuscatedData = obfuscate(fontData, fontKey);\n * ```\n *\n * @internal\n */\nexport const obfuscate = (buf: Uint8Array, fontKey: string): Uint8Array => {\n const guid = fontKey.replace(/-/g, \"\");\n if (guid.length !== guidSize) {\n throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);\n }\n\n const hexStrings = guid.replace(/(..)/g, \"$1 \").trim().split(\" \");\n const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16));\n hexNumbers.reverse();\n\n const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset);\n const obfuscatedBytes = bytesToObfuscate.map(\n (byte, i) => byte ^ hexNumbers[i % hexNumbers.length],\n );\n\n const out = new Uint8Array(\n obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset),\n );\n out.set(buf.slice(0, obfuscatedStartOffset));\n out.set(obfuscatedBytes, obfuscatedStartOffset);\n out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);\n return out;\n};\n","/**\n * Header/Footer entry module for WordprocessingML documents.\n *\n * Replaces the former HeaderWrapper/FooterWrapper/Header/Footer/HeaderFooterBase\n * class hierarchy with a simple data structure + pure serialization function.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_HdrFtr\n *\n * @module\n */\n\nimport type { Relationships } from \"@office-open/core\";\nimport { escapeXml } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { stringifyBodyChild } from \"../body\";\nimport type { BodyContext } from \"../context\";\nimport { DocumentAttributeNamespaces } from \"./document/document-attributes\";\nimport type { DocumentAttributeNamespace } from \"./document/document-attributes\";\n\n/**\n * Simple data structure for a header or footer entry.\n *\n * Replaces HeaderWrapper/FooterWrapper — holds children, relationships,\n * and the reference ID needed for section property references.\n *\n * Children are raw SectionChild objects (plain JSON or class instances).\n */\nexport interface HeaderFooterEntry {\n children: SectionChild[];\n relationships: Relationships;\n referenceId: number;\n}\n\n/**\n * Namespace keys used by header elements.\n * @internal\n */\nexport const HEADER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"cx\",\n \"cx1\",\n \"cx2\",\n \"cx3\",\n \"cx4\",\n \"cx5\",\n \"cx6\",\n \"cx7\",\n \"cx8\",\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"w16cid\",\n \"w16se\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Namespace keys used by footer elements.\n * @internal\n */\nexport const FOOTER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Serialize a header or footer to XML.\n *\n * Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,\n * then serializes each child element via `stringifyBodyChild()`.\n *\n * @param tag - Element tag name (\"w:hdr\" or \"w:ftr\")\n * @param namespaces - Namespace keys to declare on the root element\n * @param children - Block-level child elements (raw SectionChild objects)\n * @param ctx - Body context for stringification\n */\nexport function stringifyHeaderFooter(\n tag: string,\n namespaces: DocumentAttributeNamespace[],\n children: SectionChild[],\n ctx: BodyContext,\n): string {\n const attrParts: string[] = [];\n for (const ns of namespaces) {\n attrParts.push(`xmlns:${ns}=\"${escapeXml(DocumentAttributeNamespaces[ns])}\"`);\n }\n // mc:Ignorable must declare the ignorable namespaces (w14/w15/wp14) that\n // header/footer content uses (e.g. w14:paraId). Without it, Word in\n // compatibility mode 14 rejects the part as unreadable content.\n attrParts.push('mc:Ignorable=\"w14 w15 wp14\"');\n const attrStr = attrParts.join(\" \");\n\n const childParts: string[] = [];\n for (const child of children) {\n childParts.push(stringifyBodyChild(child, ctx));\n }\n\n const body = childParts.join(\"\");\n return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;\n}\n","/**\n * DOCX document compiler — pure function entry point.\n *\n * compileDocument() accepts DocumentOptions directly,\n * creates a DocxWriteContext internally, and produces a Zippable result.\n * All XML parts are produced via descriptors or serialize() —\n * no Formatter dependency.\n *\n * @module\n */\n\nimport {\n addSmartArtRelationships,\n createThemeXml,\n findAndReplaceImagePlaceholders,\n formatId,\n hasPlaceholders,\n levelForMediaName,\n optionalRelsPart,\n replaceAllPlaceholders,\n replaceNumberingPlaceholders,\n} from \"@office-open/core\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"@office-open/core\";\nimport {\n DEFAULT_DRAWING_XML,\n getColorXml,\n getLayoutXml,\n getStyleXml,\n} from \"@office-open/core/smartart\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { obfuscate } from \"@parts/fonts/obfuscate-ttf-to-odttf\";\nimport { HEADER_NAMESPACES, FOOTER_NAMESPACES, stringifyHeaderFooter } from \"@parts/header-footer\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\n\nimport { stringifyDocumentXml, stringifyBodyChild, type BodyContext } from \"./body\";\nimport { DocxWriteContext } from \"./context\";\nimport {\n corePropertiesDesc,\n customPropertiesDesc,\n appPropertiesDesc,\n contentTypesDesc,\n buildContentTypesFromRegistry,\n withAltChunkOverrides,\n withMediaDefaults,\n fontTableDesc,\n webSettingsDesc,\n commentsDesc,\n bibliographyDesc,\n settingsDesc,\n footnotesDesc,\n endnotesDesc,\n glossaryDesc,\n} from \"./parts\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\n/** XML declaration prepended to every OOXML part. */\nconst XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';\n\n/** Extended context for header/footer formatted view caching. */\ntype DocxContext = BodyContext & {\n headerFormattedViews?: Map<number, string>;\n footerFormattedViews?: Map<number, string>;\n};\n\n// ── Public API ──\n\n/**\n * Compile document options into a flat file map suitable for fflate zipSync.\n *\n * This is the primary entry point for DOCX generation — accepts DocumentOptions\n * directly.\n */\nexport function compileDocument(\n options: DocumentOptions,\n overrides: XmlifyedFile[] = [],\n mediaLevel: number = 0,\n): Zippable {\n const ctx = new DocxWriteContext(options);\n const files: Zippable = {};\n\n const headerFormattedViews = new Map<number, string>();\n const footerFormattedViews = new Map<number, string>();\n\n const xmlifiedFileMapping = xmlifyContext(ctx, headerFormattedViews, footerFormattedViews);\n const map = new Map<string, XmlifyedFile | XmlifyedFile[]>(Object.entries(xmlifiedFileMapping));\n\n for (const [, obj] of map) {\n if (obj === undefined) continue;\n if (Array.isArray(obj)) {\n for (const subFile of obj) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n } else {\n files[obj.path] = typeof obj.data === \"string\" ? encoder.encode(obj.data) : obj.data;\n }\n }\n\n for (const subFile of overrides) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n\n // Media files\n const mediaArray = ctx.media.array;\n for (const mediaData of mediaArray) {\n files[`word/media/${mediaData.fileName}`] = [\n mediaData.data as Uint8Array,\n { level: levelForMediaName(mediaData.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n if (mediaData.type === \"svg\") {\n files[`word/media/${mediaData.fallback.fileName}`] = [\n mediaData.fallback.data as Uint8Array,\n {\n level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) as ZipOptions[\"level\"],\n },\n ];\n }\n }\n\n // OLE embedding binaries (word/embeddings/oleObjectN.bin)\n for (const embedding of ctx.embeddings.array) {\n files[`word/embeddings/${embedding.fileName}`] = [\n embedding.data as Uint8Array,\n { level: levelForMediaName(embedding.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n }\n\n // Font files — only fonts carrying binary data produce a .odttf part.\n // Round-tripped fonts (rawOdttf) keep their original obfuscated bytes.\n for (const font of ctx.fontTable.fontOptionsWithKey) {\n if (font.data === undefined) continue;\n const [nameWithoutExtension] = font.name.split(\".\");\n const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;\n files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);\n }\n\n // Raw passthrough parts (word/theme/*, customXml/*, …) — generate doesn't\n // rebuild these, so copy their original bytes verbatim to keep [Content_Types]\n // declarations valid and the package openable in Word.\n for (const part of ctx._options.rawParts ?? []) {\n files[part.path] = part.data;\n }\n\n // [Content_Types].xml is serialized last: parts register their media/fonts\n // during stringify (run by xmlifyContext above), so backfilling <Default>\n // extensions from `ctx` now sees the complete set. Building it inside\n // xmlifyContext's object literal evaluated it before header/footer/font media\n // was registered, leaving jpg/gif/odttf without a covering Default.\n files[\"[Content_Types].xml\"] = encoder.encode(buildContentTypesData(ctx, files));\n\n return files;\n}\n\n// ── Internal ──\n\n/**\n * Complete mapping of all XML files in an OOXML document package.\n */\ninterface XmlifyedFileMapping {\n Document: XmlifyedFile;\n Styles: XmlifyedFile;\n Properties: XmlifyedFile;\n Numbering: XmlifyedFile;\n Relationships: XmlifyedFile;\n FileRelationships: XmlifyedFile;\n Headers: XmlifyedFile[];\n Footers: XmlifyedFile[];\n HeaderRelationships: XmlifyedFile[];\n FooterRelationships: XmlifyedFile[];\n CustomProperties: XmlifyedFile;\n AppProperties: XmlifyedFile;\n FootNotes: XmlifyedFile;\n FootNotesRelationships?: XmlifyedFile;\n Endnotes: XmlifyedFile;\n EndnotesRelationships?: XmlifyedFile;\n Settings: XmlifyedFile;\n Comments?: XmlifyedFile;\n CommentsRelationships?: XmlifyedFile;\n FontTable?: XmlifyedFile;\n FontTableRelationships?: XmlifyedFile;\n Bibliography?: XmlifyedFile;\n Charts?: XmlifyedFile[];\n DiagramData?: XmlifyedFile[];\n DiagramLayout?: XmlifyedFile[];\n DiagramStyle?: XmlifyedFile[];\n DiagramColors?: XmlifyedFile[];\n DiagramDrawing?: XmlifyedFile[];\n AltChunks?: XmlifyedFile[];\n SubDocs?: XmlifyedFile[];\n Glossary?: XmlifyedFile;\n WebSettings?: XmlifyedFile;\n}\n\n/**\n * Comments carried by the document: those the caller listed explicitly\n * (`options.comments`) plus entries registered by `{ comment }` sugar children\n * during body stringification. Drives both word/comments.xml generation and the\n * [Content_Types] comments Override, which must stay in sync (OPC consistency).\n */\nfunction mergedCommentChildren(ctx: DocxWriteContext): CommentOptions[] {\n return [...(ctx._options.comments?.children ?? []), ...ctx.comments.entries];\n}\n\n/**\n * Serialize [Content_Types].xml from the part registry, then backfill media/\n * font/embedding `<Default>` entries from the parts actually written.\n *\n * Must run after every part has been stringified (parts call `ctx.addMedia`\n * during stringify), so call this once `xmlifyContext` has finished — not from\n * inside its object literal, where ContentTypes would evaluate before the\n * later-defined header/footer/font parts have registered their media.\n */\nfunction buildContentTypesData(ctx: DocxWriteContext, files: Zippable): string {\n const altChunks = ctx.altChunks.array.map((ac) => ({\n path: `/word/${ac.path}`,\n contentType: ac.contentType ?? \"application/xhtml+xml\",\n }));\n // Round-trip passes the source [Content_Types] through, but the compiler\n // regenerates altChunk part paths — realign the afchunk Overrides to the\n // freshly written parts (else O5/O6).\n const base = ctx._options.contentTypes\n ? withAltChunkOverrides(ctx._options.contentTypes, altChunks)\n : buildContentTypesFromRegistry(\n new Map<string, boolean | number>([\n [\"freshCompile\", true],\n [\"hasComments\", mergedCommentChildren(ctx).length > 0],\n [\"hasBibliography\", !!ctx._options.bibliography],\n [\"hasGlossary\", !!ctx.glossaryOptions],\n [\"hasWebSettings\", !!ctx.webSettings],\n [\"headerCount\", ctx.headers.length],\n [\"footerCount\", ctx.footers.length],\n [\"chartCount\", ctx.charts.array.length],\n [\"smartArtCount\", ctx.smartArts.array.length],\n ]),\n {\n altChunks,\n subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` })),\n },\n );\n // Backfill <Default> extensions from every part actually written to the\n // package — the parts on disk are the single source of truth, so media/font/\n // embedding defaults can never drift from what the package contains (e.g. a\n // font written via the fallback path when `odttfPath` is unset).\n const withMedia = withMediaDefaults(base, Object.keys(files));\n return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? \"\");\n}\n\nfunction xmlifyContext(\n ctx: DocxWriteContext,\n headerFormattedViews: Map<number, string>,\n footerFormattedViews: Map<number, string>,\n): XmlifyedFileMapping {\n const mkCtx = (viewWrapper: DocxContext[\"viewWrapper\"] = ctx.document): DocxContext => ({\n fileData: ctx,\n file: ctx,\n viewWrapper,\n stringifyChild: stringifyBodyChild,\n addRelationship: (type: string, target: string, mode?: string) =>\n ctx.addRelationship(type, target, mode),\n addMedia: (data: Uint8Array, type: string) => ctx.addMedia(data, type),\n });\n\n const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;\n // Per-part media-replacement results shared between the .rels pass and the\n // body-XML pass so both use identical rId offsets. Each header/footer part\n // has its own relationship numbering (independent of the document part).\n const footerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const headerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const docCtx = mkCtx(ctx.document);\n const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, docCtx);\n\n // Comments is an optional part — skip it entirely (no comments.xml, no\n // comments rels, no [Content_Types] Override) when the document carries none.\n // Emitting an empty comments.xml with a dangling relationship is the OPC\n // violation that makes Word reject the package on open.\n const mergedCommentChildrenList = mergedCommentChildren(ctx);\n const hasComments = mergedCommentChildrenList.length > 0;\n const commentRelationshipCount = hasComments\n ? ctx.comments.relationships.relationshipCount + 1\n : 0;\n const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;\n const commentXmlData = commentCtx\n ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx)\n : \"\";\n\n const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;\n const footnoteCtx = mkCtx({\n relationships: ctx.footNotes.relationships,\n });\n const footnoteXmlData =\n XML_DECL +\n (footnotesDesc.stringify(\n {\n notes: ctx.footNotes.notes,\n separator: ctx.footNotes.separator,\n continuationSeparator: ctx.footNotes.continuationSeparator,\n },\n footnoteCtx,\n ) ?? \"\");\n\n const documentMedia = findAndReplaceImagePlaceholders(\n documentXmlData,\n ctx.media.array,\n documentRelationshipCount,\n );\n // OLE embeddings reuse the same {fileName} placeholder bridge as images; run\n // after media so {oleObjectN.bin} placeholders resolve against the embedding array.\n const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;\n const documentEmbeddings = findAndReplaceImagePlaceholders(\n documentMedia.xml,\n ctx.embeddings.array,\n documentEmbeddingOffset,\n );\n const commentMedia = hasComments\n ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount)\n : { xml: \"\", referenced: [] as { fileName: string }[] };\n const footnoteMedia = findAndReplaceImagePlaceholders(\n footnoteXmlData,\n ctx.media.array,\n footnoteRelationshipCount,\n );\n // Register footnote media relationships eagerly so the relationshipCount used\n // to gate footnotes.xml.rels reflects the final state (see FootNotesRelationships).\n for (let i = 0; i < footnoteMedia.referenced.length; i++) {\n ctx.footNotes.relationships.addRelationship(\n footnoteRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footnoteMedia.referenced[i].fileName}`,\n );\n }\n\n return {\n AppProperties: {\n data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? \"\"),\n path: \"docProps/app.xml\",\n },\n ...(hasComments\n ? {\n Comments: {\n data: (() => {\n const xmlData =\n commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/comments.xml\",\n },\n CommentsRelationships: (() => {\n for (let i = 0; i < commentMedia.referenced.length; i++) {\n ctx.comments.relationships.addRelationship(\n commentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${commentMedia.referenced[i].fileName}`,\n );\n }\n return optionalRelsPart(\n ctx.comments.relationships,\n XML_DECL,\n \"word/_rels/comments.xml.rels\",\n );\n })(),\n }\n : {}),\n CustomProperties: {\n data:\n XML_DECL +\n (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ??\n \"\"),\n path: \"docProps/custom.xml\",\n },\n Document: {\n data: (() => {\n let xmlData = documentEmbeddings.xml;\n if (hasPlaceholders(xmlData)) {\n const mediaCount = documentMedia.referenced.length;\n const embeddingCount = documentEmbeddings.referenced.length;\n const chartKeys = ctx.charts.array.map((c) => c.key);\n const smartArtKeys = ctx.smartArts.array.map((s) => s.key);\n const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;\n const smartArtOffset = chartOffset + chartKeys.length;\n\n // Build combined replacement entries for charts, smartart, and numbering\n const entries: Array<{ prefix?: string; key: string; value: string }> = [];\n for (let i = 0; i < chartKeys.length; i++) {\n entries.push({\n prefix: \"chart:\",\n key: chartKeys[i],\n value: formatId(chartOffset, i, \"rId\"),\n });\n }\n const saPrefixes = [\"smartart:\", \"smartart-lo:\", \"smartart-qs:\", \"smartart-cs:\"];\n for (let i = 0; i < smartArtKeys.length; i++) {\n for (let p = 0; p < saPrefixes.length; p++) {\n entries.push({\n prefix: saPrefixes[p],\n key: smartArtKeys[i],\n value: formatId(smartArtOffset + p * smartArtKeys.length, i, \"rId\"),\n });\n }\n }\n for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) {\n entries.push({ key: `${reference}-${instance}`, value: numId.toString() });\n }\n xmlData = replaceAllPlaceholders(xmlData, entries);\n } else {\n xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n }\n return xmlData;\n })(),\n path: \"word/document.xml\",\n },\n // Theme — fresh-compile emits a language-neutral default theme\n // (createThemeXml). Round-trip carries the source theme in rawParts,\n // already copied verbatim above, so skip emitting here to avoid a duplicate.\n ...(ctx._options.rawParts?.some((part) => part.path.startsWith(\"word/theme/\"))\n ? {}\n : {\n Theme: {\n data: XML_DECL + createThemeXml(),\n path: \"word/theme/theme1.xml\",\n },\n }),\n Endnotes: {\n data: (() => {\n const endnoteCtx = mkCtx({\n relationships: ctx.endnotes.relationships,\n });\n const xmlData =\n XML_DECL +\n (endnotesDesc.stringify(\n {\n notes: ctx.endnotes.notes,\n separator: ctx.endnotes.separator,\n continuationSeparator: ctx.endnotes.continuationSeparator,\n },\n endnoteCtx,\n ) ?? \"\");\n const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;\n const endnoteMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n endnoteRelCount,\n );\n if (endnoteMedia.referenced.length > 0) {\n for (let i = 0; i < endnoteMedia.referenced.length; i++) {\n ctx.endnotes.relationships.addRelationship(\n endnoteRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${endnoteMedia.referenced[i].fileName}`,\n );\n }\n return replaceNumberingPlaceholders(endnoteMedia.xml, ctx.numbering.concreteNumbering);\n }\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/endnotes.xml\",\n },\n EndnotesRelationships:\n ctx.endnotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.endnotes.relationships.serialize(),\n path: \"word/_rels/endnotes.xml.rels\",\n }\n : undefined,\n FileRelationships: {\n data: XML_DECL + ctx.fileRelationships.serialize(),\n path: \"_rels/.rels\",\n },\n FontTable: {\n data:\n XML_DECL +\n (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? \"\"),\n path: \"word/fontTable.xml\",\n },\n FontTableRelationships: optionalRelsPart(\n ctx.fontTable.relationships,\n XML_DECL,\n \"word/_rels/fontTable.xml.rels\",\n ),\n FootNotes: {\n data: (() => {\n const xmlData = footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/footnotes.xml\",\n },\n FootNotesRelationships:\n ctx.footNotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.footNotes.relationships.serialize(),\n path: \"word/_rels/footnotes.xml.rels\",\n }\n : undefined,\n FooterRelationships: ctx.footers\n .map((entry, index) => {\n const footerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:ftr\", FOOTER_NAMESPACES, entry.children, footerCtx);\n footerFormattedViews.set(index, xmlData);\n // Footer images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const footerRelCount = entry.relationships.relationshipCount + 1;\n const footerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n footerRelCount,\n );\n footerMediaResults.set(index, footerMedia);\n\n for (let i = 0; i < footerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n footerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/footer${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Footers: ctx.footers.map((_entry, index) => {\n const footerMedia = footerMediaResults.get(index)!;\n const tempXmlData = footerFormattedViews.get(index)!;\n const xmlData = footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/footer${index + 1}.xml`,\n };\n }),\n HeaderRelationships: ctx.headers\n .map((entry, index) => {\n const headerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:hdr\", HEADER_NAMESPACES, entry.children, headerCtx);\n headerFormattedViews.set(index, xmlData);\n // Header images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const headerRelCount = entry.relationships.relationshipCount + 1;\n const headerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n headerRelCount,\n );\n headerMediaResults.set(index, headerMedia);\n\n for (let i = 0; i < headerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n headerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${headerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/header${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Headers: ctx.headers.map((_entry, index) => {\n const headerMedia = headerMediaResults.get(index)!;\n const tempXmlData = headerFormattedViews.get(index)!;\n const xmlData = headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/header${index + 1}.xml`,\n };\n }),\n Numbering: {\n data: ctx.numbering.serialize(),\n path: \"word/numbering.xml\",\n },\n Properties: {\n data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? \"\"),\n path: \"docProps/core.xml\",\n },\n Relationships: {\n data: (() => {\n for (let i = 0; i < documentMedia.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${documentMedia.referenced[i].fileName}`,\n );\n }\n for (let i = 0; i < documentEmbeddings.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentEmbeddingOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\",\n `embeddings/${documentEmbeddings.referenced[i].fileName}`,\n );\n }\n\n const chartOffset =\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length;\n for (let i = 0; i < ctx.charts.array.length; i++) {\n ctx.document.relationships.addRelationship(\n chartOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `charts/chart${i + 1}.xml`,\n );\n }\n\n addSmartArtRelationships(\n ctx.smartArts.array.map((s) => s.key),\n (id, type, target) => {\n ctx.document.relationships.addRelationship(id, type, target);\n },\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length +\n ctx.charts.array.length,\n 0,\n {\n pathPrefix: \"\",\n styleRelType: \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\",\n },\n );\n\n ctx.document.relationships.addRelationship(\n ctx.document.relationships.relationshipCount + 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\",\n \"fontTable.xml\",\n );\n\n return XML_DECL + ctx.document.relationships.serialize();\n })(),\n path: \"word/_rels/document.xml.rels\",\n },\n Settings: {\n data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? \"\"),\n path: \"word/settings.xml\",\n },\n Styles: {\n data: (() => {\n const xmlStyles = ctx.styles.serialize();\n return replaceNumberingPlaceholders(xmlStyles, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/styles.xml\",\n },\n ...(ctx._options.bibliography\n ? {\n Bibliography: {\n data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? \"\"),\n path: \"word/bibliography.xml\",\n },\n }\n : {}),\n ...(ctx.charts.array.length > 0\n ? {\n Charts: ctx.charts.array.map((chartData, i) => ({\n data: XML_DECL + chartData.chartSpaceXml,\n path: `word/charts/chart${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.smartArts.array.length > 0\n ? {\n DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({\n data: XML_DECL + smartArtData.dataModelXml,\n path: `word/diagrams/data${i + 1}.xml`,\n })),\n DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getLayoutXml(smartArtData.layout),\n path: `word/diagrams/layout${i + 1}.xml`,\n })),\n DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getStyleXml(smartArtData.style),\n path: `word/diagrams/quickStyle${i + 1}.xml`,\n })),\n DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getColorXml(smartArtData.color),\n path: `word/diagrams/colors${i + 1}.xml`,\n })),\n DiagramDrawing: ctx.smartArts.array.map((_, i) => ({\n data: DEFAULT_DRAWING_XML,\n path: `word/diagrams/drawing${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.altChunks.array.length > 0\n ? {\n AltChunks: ctx.altChunks.array.map((altChunkData) => ({\n data: altChunkData.data,\n path: `word/${altChunkData.path}`,\n })),\n }\n : {}),\n ...(ctx.subDocs.array.length > 0\n ? {\n SubDocs: ctx.subDocs.array.map((subDocData) => ({\n data: subDocData.data,\n path: `word/${subDocData.path}`,\n })),\n }\n : {}),\n ...(ctx.glossaryOptions\n ? {\n Glossary: {\n data: (() => {\n const glossaryCtx = mkCtx(undefined);\n return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions!, glossaryCtx) ?? \"\");\n })(),\n path: \"word/glossary/document.xml\",\n },\n }\n : {}),\n ...(ctx.webSettings\n ? {\n WebSettings: {\n data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? \"\"),\n path: \"word/webSettings.xml\",\n },\n }\n : {}),\n };\n}\n","/**\n * Pure function API for generating DOCX files.\n *\n * @module\n */\n\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\nimport type { OutputByType, OutputType, PackerOptions } from \"@office-open/core\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\n\nimport { compileDocument } from \"./compiler\";\n\n/** @internal Packer instance for DOCX generation. */\nconst Packer = createPacker<DocumentOptions>({\n compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),\n mimeType: OoxmlMimeType.DOCX,\n});\n\n/**\n * Generate a DOCX file from pure JSON options.\n *\n * The output format is controlled by `packerOptions.type` (default: `\"nodebuffer\"` → Buffer).\n * For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.\n *\n * @param options - Document options (sections, styles, numbering, etc.)\n * @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)\n *\n * @example\n * ```typescript\n * import { generateDocument } from \"@office-open/docx\";\n *\n * const buffer = await generateDocument({ sections: [...] });\n * const bytes = await generateDocument({ sections: [...] }, { type: \"uint8array\" });\n * const blob = await generateDocument({ sections: [...] }, { type: \"blob\" });\n * ```\n */\nexport function generateDocument<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): Promise<OutputByType[T]> {\n return Packer.pack(options, packerOptions) as Promise<OutputByType[T]>;\n}\n\n/**\n * Synchronously generate a DOCX file from pure JSON options.\n */\nexport function generateDocumentSync<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): OutputByType[T] {\n return Packer.packSync(options, packerOptions) as OutputByType[T];\n}\n\n/**\n * Generate a DOCX file as a `ReadableStream<Uint8Array>`.\n */\nexport function generateDocumentStream(\n options: DocumentOptions,\n packerOptions?: PackerOptions,\n): ReadableStream<Uint8Array> {\n return Packer.toStream(options, packerOptions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,wBAAwB;;AAE9B,MAAM,sBAAsB;;AAE5B,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;AAuBjB,MAAa,aAAa,KAAiB,YAAgC;CACzE,MAAM,OAAO,QAAQ,QAAQ,MAAM,EAAE;CACrC,IAAI,KAAK,WAAW,UAClB,MAAM,IAAI,MAAM,kDAAkD,SAAS;CAI7E,MAAM,aADa,KAAK,QAAQ,SAAS,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GACjC,CAAC,CAAC,KAAK,cAAc,SAAS,WAAW,EAAE,CAAC;CACxE,WAAW,QAAQ;CAGnB,MAAM,kBADmB,IAAI,MAAM,uBAAuB,mBACnB,CAAC,CAAC,KACtC,MAAM,MAAM,OAAO,WAAW,IAAI,WAAW,OAChD;CAEA,MAAM,MAAM,IAAI,WACd,wBAAwB,gBAAgB,SAAS,KAAK,IAAI,GAAG,IAAI,SAAS,mBAAmB,CAC/F;CACA,IAAI,IAAI,IAAI,MAAM,GAAG,qBAAqB,CAAC;CAC3C,IAAI,IAAI,iBAAiB,qBAAqB;CAC9C,IAAI,IAAI,IAAI,MAAM,mBAAmB,GAAG,wBAAwB,gBAAgB,MAAM;CACtF,OAAO;AACT;;;;;;;ACxBA,MAAa,oBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAC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;CAC3C,UAAU,SAAS,WAAW,eAAe,gBAAgB,SAAS,WAAW,UAAU;CAC3F,UAAU,cAAc;AAC1B,CAAC;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,iBACd,SACA,eAC0B;CAC1B,OAAO,OAAO,KAAK,SAAS,aAAa;AAC3C;;;;AAKA,SAAgB,qBACd,SACA,eACiB;CACjB,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C;;;;AAKA,SAAgB,uBACd,SACA,eAC4B;CAC5B,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C"}
1
+ {"version":3,"file":"generate-fsy5ESN0.mjs","names":[],"sources":["../src/parts/fonts/obfuscate-ttf-to-odttf.ts","../src/parts/header-footer.ts","../src/compiler.ts","../src/generate.ts"],"sourcesContent":["/**\n * Font obfuscation module for embedding fonts in WordprocessingML documents.\n *\n * This module implements the OOXML font obfuscation algorithm used to embed\n * fonts in DOCX documents. Obfuscation is required by the OOXML specification\n * to prevent simple extraction of embedded font files.\n *\n * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)\n *\n * @module\n */\n\n/** Start offset for obfuscation in the font file */\nconst obfuscatedStartOffset = 0;\n/** End offset for obfuscation (first 32 bytes are obfuscated) */\nconst obfuscatedEndOffset = 32;\n/** Expected GUID size (32 hex characters without dashes) */\nconst guidSize = 32;\n\n/**\n * Obfuscates a TrueType font file for embedding in OOXML documents.\n *\n * The obfuscation algorithm XORs the first 32 bytes of the font file\n * with a reversed byte sequence derived from the font's GUID key.\n * This prevents simple extraction while maintaining font functionality.\n *\n * @param buf - The original font file as a byte array\n * @param fontKey - The GUID key for the font (with or without dashes)\n * @returns The obfuscated font data\n * @throws Error if the fontKey is not a valid 32-character GUID\n *\n * @example\n * ```typescript\n * const fontData = readFileSync(\"font.ttf\");\n * const fontKey = \"00000000-0000-0000-0000-000000000000\";\n * const obfuscatedData = obfuscate(fontData, fontKey);\n * ```\n *\n * @internal\n */\nexport const obfuscate = (buf: Uint8Array, fontKey: string): Uint8Array => {\n const guid = fontKey.replace(/-/g, \"\");\n if (guid.length !== guidSize) {\n throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);\n }\n\n const hexStrings = guid.replace(/(..)/g, \"$1 \").trim().split(\" \");\n const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16));\n hexNumbers.reverse();\n\n const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset);\n const obfuscatedBytes = bytesToObfuscate.map(\n (byte, i) => byte ^ hexNumbers[i % hexNumbers.length],\n );\n\n const out = new Uint8Array(\n obfuscatedStartOffset + obfuscatedBytes.length + Math.max(0, buf.length - obfuscatedEndOffset),\n );\n out.set(buf.slice(0, obfuscatedStartOffset));\n out.set(obfuscatedBytes, obfuscatedStartOffset);\n out.set(buf.slice(obfuscatedEndOffset), obfuscatedStartOffset + obfuscatedBytes.length);\n return out;\n};\n","/**\n * Header/Footer entry module for WordprocessingML documents.\n *\n * Replaces the former HeaderWrapper/FooterWrapper/Header/Footer/HeaderFooterBase\n * class hierarchy with a simple data structure + pure serialization function.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_HdrFtr\n *\n * @module\n */\n\nimport type { Relationships } from \"@office-open/core\";\nimport { escapeXml } from \"@office-open/xml\";\nimport type { SectionChild } from \"@shared/section\";\n\nimport { stringifyBodyChild } from \"../body\";\nimport type { BodyContext } from \"../context\";\nimport { DocumentAttributeNamespaces } from \"./document/document-attributes\";\nimport type { DocumentAttributeNamespace } from \"./document/document-attributes\";\n\n/**\n * Simple data structure for a header or footer entry.\n *\n * Replaces HeaderWrapper/FooterWrapper — holds children, relationships,\n * and the reference ID needed for section property references.\n *\n * Children are raw SectionChild objects (plain JSON or class instances).\n */\nexport interface HeaderFooterEntry {\n children: SectionChild[];\n relationships: Relationships;\n referenceId: number;\n}\n\n/**\n * Namespace keys used by header elements.\n * @internal\n */\nexport const HEADER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"cx\",\n \"cx1\",\n \"cx2\",\n \"cx3\",\n \"cx4\",\n \"cx5\",\n \"cx6\",\n \"cx7\",\n \"cx8\",\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"w16cid\",\n \"w16se\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Namespace keys used by footer elements.\n * @internal\n */\nexport const FOOTER_NAMESPACES: DocumentAttributeNamespace[] = [\n \"m\",\n \"mc\",\n \"o\",\n \"r\",\n \"v\",\n \"w\",\n \"w10\",\n \"w14\",\n \"w15\",\n \"wne\",\n \"wp\",\n \"wp14\",\n \"wpc\",\n \"wpg\",\n \"wpi\",\n \"wps\",\n];\n\n/**\n * Serialize a header or footer to XML.\n *\n * Builds the `<w:hdr>` or `<w:ftr>` element with namespace declarations,\n * then serializes each child element via `stringifyBodyChild()`.\n *\n * @param tag - Element tag name (\"w:hdr\" or \"w:ftr\")\n * @param namespaces - Namespace keys to declare on the root element\n * @param children - Block-level child elements (raw SectionChild objects)\n * @param ctx - Body context for stringification\n */\nexport function stringifyHeaderFooter(\n tag: string,\n namespaces: DocumentAttributeNamespace[],\n children: SectionChild[],\n ctx: BodyContext,\n): string {\n const attrParts: string[] = [];\n for (const ns of namespaces) {\n attrParts.push(`xmlns:${ns}=\"${escapeXml(DocumentAttributeNamespaces[ns])}\"`);\n }\n // mc:Ignorable must declare the ignorable namespaces (w14/w15/wp14) that\n // header/footer content uses (e.g. w14:paraId). Without it, Word in\n // compatibility mode 14 rejects the part as unreadable content.\n attrParts.push('mc:Ignorable=\"w14 w15 wp14\"');\n const attrStr = attrParts.join(\" \");\n\n const childParts: string[] = [];\n for (const child of children) {\n childParts.push(stringifyBodyChild(child, ctx));\n }\n\n const body = childParts.join(\"\");\n return body.length === 0 ? `<${tag} ${attrStr}/>` : `<${tag} ${attrStr}>${body}</${tag}>`;\n}\n","/**\n * DOCX document compiler — pure function entry point.\n *\n * compileDocument() accepts DocumentOptions directly,\n * creates a DocxWriteContext internally, and produces a Zippable result.\n * All XML parts are produced via descriptors or serialize() —\n * no Formatter dependency.\n *\n * @module\n */\n\nimport {\n addSmartArtRelationships,\n createThemeXml,\n findAndReplaceImagePlaceholders,\n formatId,\n hasPlaceholders,\n levelForMediaName,\n optionalRelsPart,\n replaceAllPlaceholders,\n replaceNumberingPlaceholders,\n} from \"@office-open/core\";\nimport type { XmlifyedFile, ZipOptions, Zippable } from \"@office-open/core\";\nimport {\n DEFAULT_DRAWING_XML,\n getColorXml,\n getLayoutXml,\n getStyleXml,\n} from \"@office-open/core/smartart\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\nimport { obfuscate } from \"@parts/fonts/obfuscate-ttf-to-odttf\";\nimport { HEADER_NAMESPACES, FOOTER_NAMESPACES, stringifyHeaderFooter } from \"@parts/header-footer\";\nimport type { CommentOptions } from \"@parts/paragraph/run/comment-run\";\n\nimport { stringifyDocumentXml, stringifyBodyChild, type BodyContext } from \"./body\";\nimport { DocxWriteContext } from \"./context\";\nimport {\n corePropertiesDesc,\n customPropertiesDesc,\n appPropertiesDesc,\n contentTypesDesc,\n buildContentTypesFromRegistry,\n withAltChunkOverrides,\n withMediaDefaults,\n fontTableDesc,\n webSettingsDesc,\n commentsDesc,\n bibliographyDesc,\n settingsDesc,\n footnotesDesc,\n endnotesDesc,\n glossaryDesc,\n} from \"./parts\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\n/** XML declaration prepended to every OOXML part. */\nconst XML_DECL = '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';\n\n/** Extended context for header/footer formatted view caching. */\ntype DocxContext = BodyContext & {\n headerFormattedViews?: Map<number, string>;\n footerFormattedViews?: Map<number, string>;\n};\n\n// ── Public API ──\n\n/**\n * Compile document options into a flat file map suitable for fflate zipSync.\n *\n * This is the primary entry point for DOCX generation — accepts DocumentOptions\n * directly.\n */\nexport function compileDocument(\n options: DocumentOptions,\n overrides: XmlifyedFile[] = [],\n mediaLevel: number = 0,\n): Zippable {\n const ctx = new DocxWriteContext(options);\n const files: Zippable = {};\n\n const headerFormattedViews = new Map<number, string>();\n const footerFormattedViews = new Map<number, string>();\n\n const xmlifiedFileMapping = xmlifyContext(ctx, headerFormattedViews, footerFormattedViews);\n const map = new Map<string, XmlifyedFile | XmlifyedFile[]>(Object.entries(xmlifiedFileMapping));\n\n for (const [, obj] of map) {\n if (obj === undefined) continue;\n if (Array.isArray(obj)) {\n for (const subFile of obj) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n } else {\n files[obj.path] = typeof obj.data === \"string\" ? encoder.encode(obj.data) : obj.data;\n }\n }\n\n for (const subFile of overrides) {\n files[subFile.path] =\n typeof subFile.data === \"string\" ? encoder.encode(subFile.data) : subFile.data;\n }\n\n // Media files\n const mediaArray = ctx.media.array;\n for (const mediaData of mediaArray) {\n files[`word/media/${mediaData.fileName}`] = [\n mediaData.data as Uint8Array,\n { level: levelForMediaName(mediaData.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n if (mediaData.type === \"svg\") {\n files[`word/media/${mediaData.fallback.fileName}`] = [\n mediaData.fallback.data as Uint8Array,\n {\n level: levelForMediaName(mediaData.fallback.fileName, mediaLevel) as ZipOptions[\"level\"],\n },\n ];\n }\n }\n\n // OLE embedding binaries (word/embeddings/oleObjectN.bin)\n for (const embedding of ctx.embeddings.array) {\n files[`word/embeddings/${embedding.fileName}`] = [\n embedding.data as Uint8Array,\n { level: levelForMediaName(embedding.fileName, mediaLevel) as ZipOptions[\"level\"] },\n ];\n }\n\n // Font files — only fonts carrying binary data produce a .odttf part.\n // Round-tripped fonts (rawOdttf) keep their original obfuscated bytes.\n for (const font of ctx.fontTable.fontOptionsWithKey) {\n if (font.data === undefined) continue;\n const [nameWithoutExtension] = font.name.split(\".\");\n const filePath = font.odttfPath ?? `word/fonts/${nameWithoutExtension}.odttf`;\n files[filePath] = font.rawOdttf ? font.data : obfuscate(font.data, font.fontKey);\n }\n\n // Raw passthrough parts (word/theme/*, customXml/*, …) — generate doesn't\n // rebuild these, so copy their original bytes verbatim to keep [Content_Types]\n // declarations valid and the package openable in Word.\n for (const part of ctx._options.rawParts ?? []) {\n files[part.path] = part.data;\n }\n\n // [Content_Types].xml is serialized last: parts register their media/fonts\n // during stringify (run by xmlifyContext above), so backfilling <Default>\n // extensions from `ctx` now sees the complete set. Building it inside\n // xmlifyContext's object literal evaluated it before header/footer/font media\n // was registered, leaving jpg/gif/odttf without a covering Default.\n files[\"[Content_Types].xml\"] = encoder.encode(buildContentTypesData(ctx, files));\n\n return files;\n}\n\n// ── Internal ──\n\n/**\n * Complete mapping of all XML files in an OOXML document package.\n */\ninterface XmlifyedFileMapping {\n Document: XmlifyedFile;\n Styles: XmlifyedFile;\n Properties: XmlifyedFile;\n Numbering: XmlifyedFile;\n Relationships: XmlifyedFile;\n FileRelationships: XmlifyedFile;\n Headers: XmlifyedFile[];\n Footers: XmlifyedFile[];\n HeaderRelationships: XmlifyedFile[];\n FooterRelationships: XmlifyedFile[];\n CustomProperties: XmlifyedFile;\n AppProperties: XmlifyedFile;\n FootNotes: XmlifyedFile;\n FootNotesRelationships?: XmlifyedFile;\n Endnotes: XmlifyedFile;\n EndnotesRelationships?: XmlifyedFile;\n Settings: XmlifyedFile;\n Comments?: XmlifyedFile;\n CommentsRelationships?: XmlifyedFile;\n FontTable?: XmlifyedFile;\n FontTableRelationships?: XmlifyedFile;\n Bibliography?: XmlifyedFile;\n Charts?: XmlifyedFile[];\n DiagramData?: XmlifyedFile[];\n DiagramLayout?: XmlifyedFile[];\n DiagramStyle?: XmlifyedFile[];\n DiagramColors?: XmlifyedFile[];\n DiagramDrawing?: XmlifyedFile[];\n AltChunks?: XmlifyedFile[];\n SubDocs?: XmlifyedFile[];\n Glossary?: XmlifyedFile;\n WebSettings?: XmlifyedFile;\n}\n\n/**\n * Comments carried by the document: those the caller listed explicitly\n * (`options.comments`) plus entries registered by `{ comment }` sugar children\n * during body stringification. Drives both word/comments.xml generation and the\n * [Content_Types] comments Override, which must stay in sync (OPC consistency).\n */\nfunction mergedCommentChildren(ctx: DocxWriteContext): CommentOptions[] {\n return [...(ctx._options.comments?.children ?? []), ...ctx.comments.entries];\n}\n\n/**\n * Serialize [Content_Types].xml from the part registry, then backfill media/\n * font/embedding `<Default>` entries from the parts actually written.\n *\n * Must run after every part has been stringified (parts call `ctx.addMedia`\n * during stringify), so call this once `xmlifyContext` has finished — not from\n * inside its object literal, where ContentTypes would evaluate before the\n * later-defined header/footer/font parts have registered their media.\n */\nfunction buildContentTypesData(ctx: DocxWriteContext, files: Zippable): string {\n const altChunks = ctx.altChunks.array.map((ac) => ({\n path: `/word/${ac.path}`,\n contentType: ac.contentType ?? \"application/xhtml+xml\",\n }));\n // Round-trip passes the source [Content_Types] through, but the compiler\n // regenerates altChunk part paths — realign the afchunk Overrides to the\n // freshly written parts (else O5/O6).\n const base = ctx._options.contentTypes\n ? withAltChunkOverrides(ctx._options.contentTypes, altChunks)\n : buildContentTypesFromRegistry(\n new Map<string, boolean | number>([\n [\"freshCompile\", true],\n [\"hasComments\", mergedCommentChildren(ctx).length > 0],\n [\"hasBibliography\", !!ctx._options.bibliography],\n [\"hasGlossary\", !!ctx.glossaryOptions],\n [\"hasWebSettings\", !!ctx.webSettings],\n [\"headerCount\", ctx.headers.length],\n [\"footerCount\", ctx.footers.length],\n [\"chartCount\", ctx.charts.array.length],\n [\"smartArtCount\", ctx.smartArts.array.length],\n ]),\n {\n altChunks,\n subDocs: ctx.subDocs.array.map((sd) => ({ path: `/word/${sd.path}` })),\n },\n );\n // Backfill <Default> extensions from every part actually written to the\n // package — the parts on disk are the single source of truth, so media/font/\n // embedding defaults can never drift from what the package contains (e.g. a\n // font written via the fallback path when `odttfPath` is unset).\n const withMedia = withMediaDefaults(base, Object.keys(files));\n return XML_DECL + (contentTypesDesc.stringify(withMedia, ctx) ?? \"\");\n}\n\nfunction xmlifyContext(\n ctx: DocxWriteContext,\n headerFormattedViews: Map<number, string>,\n footerFormattedViews: Map<number, string>,\n): XmlifyedFileMapping {\n const mkCtx = (viewWrapper: DocxContext[\"viewWrapper\"] = ctx.document): DocxContext => ({\n fileData: ctx,\n file: ctx,\n viewWrapper,\n stringifyChild: stringifyBodyChild,\n addRelationship: (type: string, target: string, mode?: string) =>\n ctx.addRelationship(type, target, mode),\n addMedia: (data: Uint8Array, type: string) => ctx.addMedia(data, type),\n });\n\n const documentRelationshipCount = ctx.document.relationships.relationshipCount + 1;\n // Per-part media-replacement results shared between the .rels pass and the\n // body-XML pass so both use identical rId offsets. Each header/footer part\n // has its own relationship numbering (independent of the document part).\n const footerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const headerMediaResults = new Map<number, { xml: string; referenced: { fileName: string }[] }>();\n const docCtx = mkCtx(ctx.document);\n const documentXmlData = XML_DECL + stringifyDocumentXml(ctx, docCtx);\n\n // Comments is an optional part — skip it entirely (no comments.xml, no\n // comments rels, no [Content_Types] Override) when the document carries none.\n // Emitting an empty comments.xml with a dangling relationship is the OPC\n // violation that makes Word reject the package on open.\n const mergedCommentChildrenList = mergedCommentChildren(ctx);\n const hasComments = mergedCommentChildrenList.length > 0;\n const commentRelationshipCount = hasComments\n ? ctx.comments.relationships.relationshipCount + 1\n : 0;\n const commentCtx = hasComments ? mkCtx({ relationships: ctx.comments.relationships }) : null;\n const commentXmlData = commentCtx\n ? XML_DECL + commentsDesc.stringify({ children: mergedCommentChildrenList }, commentCtx)\n : \"\";\n\n const footnoteRelationshipCount = ctx.footNotes.relationships.relationshipCount + 1;\n const footnoteCtx = mkCtx({\n relationships: ctx.footNotes.relationships,\n });\n const footnoteXmlData =\n XML_DECL +\n (footnotesDesc.stringify(\n {\n notes: ctx.footNotes.notes,\n separator: ctx.footNotes.separator,\n continuationSeparator: ctx.footNotes.continuationSeparator,\n },\n footnoteCtx,\n ) ?? \"\");\n\n const documentMedia = findAndReplaceImagePlaceholders(\n documentXmlData,\n ctx.media.array,\n documentRelationshipCount,\n );\n // OLE embeddings reuse the same {fileName} placeholder bridge as images; run\n // after media so {oleObjectN.bin} placeholders resolve against the embedding array.\n const documentEmbeddingOffset = documentRelationshipCount + documentMedia.referenced.length;\n const documentEmbeddings = findAndReplaceImagePlaceholders(\n documentMedia.xml,\n ctx.embeddings.array,\n documentEmbeddingOffset,\n );\n const commentMedia = hasComments\n ? findAndReplaceImagePlaceholders(commentXmlData, ctx.media.array, commentRelationshipCount)\n : { xml: \"\", referenced: [] as { fileName: string }[] };\n const footnoteMedia = findAndReplaceImagePlaceholders(\n footnoteXmlData,\n ctx.media.array,\n footnoteRelationshipCount,\n );\n // Register footnote media relationships eagerly so the relationshipCount used\n // to gate footnotes.xml.rels reflects the final state (see FootNotesRelationships).\n for (let i = 0; i < footnoteMedia.referenced.length; i++) {\n ctx.footNotes.relationships.addRelationship(\n footnoteRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footnoteMedia.referenced[i].fileName}`,\n );\n }\n\n return {\n AppProperties: {\n data: XML_DECL + (appPropertiesDesc.stringify(ctx._options.appProperties ?? {}, ctx) ?? \"\"),\n path: \"docProps/app.xml\",\n },\n ...(hasComments\n ? {\n Comments: {\n data: (() => {\n const xmlData =\n commentMedia.referenced.length > 0 ? commentMedia.xml : commentXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/comments.xml\",\n },\n CommentsRelationships: (() => {\n for (let i = 0; i < commentMedia.referenced.length; i++) {\n ctx.comments.relationships.addRelationship(\n commentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${commentMedia.referenced[i].fileName}`,\n );\n }\n return optionalRelsPart(\n ctx.comments.relationships,\n XML_DECL,\n \"word/_rels/comments.xml.rels\",\n );\n })(),\n }\n : {}),\n CustomProperties: {\n data:\n XML_DECL +\n (customPropertiesDesc.stringify({ properties: ctx._options.customProperties ?? [] }, ctx) ??\n \"\"),\n path: \"docProps/custom.xml\",\n },\n Document: {\n data: (() => {\n let xmlData = documentEmbeddings.xml;\n if (hasPlaceholders(xmlData)) {\n const mediaCount = documentMedia.referenced.length;\n const embeddingCount = documentEmbeddings.referenced.length;\n const chartKeys = ctx.charts.array.map((c) => c.key);\n const smartArtKeys = ctx.smartArts.array.map((s) => s.key);\n const chartOffset = documentRelationshipCount + mediaCount + embeddingCount;\n const smartArtOffset = chartOffset + chartKeys.length;\n\n // Build combined replacement entries for charts, smartart, and numbering\n const entries: Array<{ prefix?: string; key: string; value: string }> = [];\n for (let i = 0; i < chartKeys.length; i++) {\n entries.push({\n prefix: \"chart:\",\n key: chartKeys[i],\n value: formatId(chartOffset, i, \"rId\"),\n });\n }\n const saPrefixes = [\"smartart:\", \"smartart-lo:\", \"smartart-qs:\", \"smartart-cs:\"];\n for (let i = 0; i < smartArtKeys.length; i++) {\n for (let p = 0; p < saPrefixes.length; p++) {\n entries.push({\n prefix: saPrefixes[p],\n key: smartArtKeys[i],\n value: formatId(smartArtOffset + p * smartArtKeys.length, i, \"rId\"),\n });\n }\n }\n for (const { reference, instance, numId } of ctx.numbering.concreteNumbering) {\n entries.push({ key: `${reference}-${instance}`, value: numId.toString() });\n }\n xmlData = replaceAllPlaceholders(xmlData, entries);\n } else {\n xmlData = replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n }\n return xmlData;\n })(),\n path: \"word/document.xml\",\n },\n // Theme — fresh-compile emits a language-neutral default theme\n // (createThemeXml). Round-trip carries the source theme in rawParts,\n // already copied verbatim above, so skip emitting here to avoid a duplicate.\n ...(ctx._options.rawParts?.some((part) => part.path.startsWith(\"word/theme/\"))\n ? {}\n : {\n Theme: {\n data: XML_DECL + createThemeXml(),\n path: \"word/theme/theme1.xml\",\n },\n }),\n Endnotes: {\n data: (() => {\n const endnoteCtx = mkCtx({\n relationships: ctx.endnotes.relationships,\n });\n const xmlData =\n XML_DECL +\n (endnotesDesc.stringify(\n {\n notes: ctx.endnotes.notes,\n separator: ctx.endnotes.separator,\n continuationSeparator: ctx.endnotes.continuationSeparator,\n },\n endnoteCtx,\n ) ?? \"\");\n const endnoteRelCount = ctx.endnotes.relationships.relationshipCount + 1;\n const endnoteMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n endnoteRelCount,\n );\n if (endnoteMedia.referenced.length > 0) {\n for (let i = 0; i < endnoteMedia.referenced.length; i++) {\n ctx.endnotes.relationships.addRelationship(\n endnoteRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${endnoteMedia.referenced[i].fileName}`,\n );\n }\n return replaceNumberingPlaceholders(endnoteMedia.xml, ctx.numbering.concreteNumbering);\n }\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/endnotes.xml\",\n },\n EndnotesRelationships:\n ctx.endnotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.endnotes.relationships.serialize(),\n path: \"word/_rels/endnotes.xml.rels\",\n }\n : undefined,\n FileRelationships: {\n data: XML_DECL + ctx.fileRelationships.serialize(),\n path: \"_rels/.rels\",\n },\n FontTable: {\n data:\n XML_DECL +\n (fontTableDesc.stringify({ fonts: ctx.fontTable.fontOptionsWithKey }, ctx) ?? \"\"),\n path: \"word/fontTable.xml\",\n },\n FontTableRelationships: optionalRelsPart(\n ctx.fontTable.relationships,\n XML_DECL,\n \"word/_rels/fontTable.xml.rels\",\n ),\n FootNotes: {\n data: (() => {\n const xmlData = footnoteMedia.referenced.length > 0 ? footnoteMedia.xml : footnoteXmlData;\n return replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/footnotes.xml\",\n },\n FootNotesRelationships:\n ctx.footNotes.relationships.relationshipCount > 0\n ? {\n data: XML_DECL + ctx.footNotes.relationships.serialize(),\n path: \"word/_rels/footnotes.xml.rels\",\n }\n : undefined,\n FooterRelationships: ctx.footers\n .map((entry, index) => {\n const footerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:ftr\", FOOTER_NAMESPACES, entry.children, footerCtx);\n footerFormattedViews.set(index, xmlData);\n // Footer images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const footerRelCount = entry.relationships.relationshipCount + 1;\n const footerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n footerRelCount,\n );\n footerMediaResults.set(index, footerMedia);\n\n for (let i = 0; i < footerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n footerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${footerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/footer${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Footers: ctx.footers.map((_entry, index) => {\n const footerMedia = footerMediaResults.get(index)!;\n const tempXmlData = footerFormattedViews.get(index)!;\n const xmlData = footerMedia.referenced.length > 0 ? footerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/footer${index + 1}.xml`,\n };\n }),\n HeaderRelationships: ctx.headers\n .map((entry, index) => {\n const headerCtx = mkCtx({ relationships: entry.relationships });\n const xmlData =\n XML_DECL + stringifyHeaderFooter(\"w:hdr\", HEADER_NAMESPACES, entry.children, headerCtx);\n headerFormattedViews.set(index, xmlData);\n // Header images get per-part relationship IDs starting at\n // relationshipCount+1, mirroring the document part. The placeholder pass\n // uses referenced-local positions, so body r:embed and .rels stay aligned.\n const headerRelCount = entry.relationships.relationshipCount + 1;\n const headerMedia = findAndReplaceImagePlaceholders(\n xmlData,\n ctx.media.array,\n headerRelCount,\n );\n headerMediaResults.set(index, headerMedia);\n\n for (let i = 0; i < headerMedia.referenced.length; i++) {\n entry.relationships.addRelationship(\n headerRelCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${headerMedia.referenced[i].fileName}`,\n );\n }\n\n return optionalRelsPart(\n entry.relationships,\n XML_DECL,\n `word/_rels/header${index + 1}.xml.rels`,\n );\n })\n .filter((r): r is XmlifyedFile => r !== undefined),\n Headers: ctx.headers.map((_entry, index) => {\n const headerMedia = headerMediaResults.get(index)!;\n const tempXmlData = headerFormattedViews.get(index)!;\n const xmlData = headerMedia.referenced.length > 0 ? headerMedia.xml : tempXmlData;\n\n return {\n data: replaceNumberingPlaceholders(xmlData, ctx.numbering.concreteNumbering),\n path: `word/header${index + 1}.xml`,\n };\n }),\n Numbering: {\n data: ctx.numbering.serialize(),\n path: \"word/numbering.xml\",\n },\n Properties: {\n data: XML_DECL + (corePropertiesDesc.stringify(ctx._options, ctx) ?? \"\"),\n path: \"docProps/core.xml\",\n },\n Relationships: {\n data: (() => {\n for (let i = 0; i < documentMedia.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentRelationshipCount + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `media/${documentMedia.referenced[i].fileName}`,\n );\n }\n for (let i = 0; i < documentEmbeddings.referenced.length; i++) {\n ctx.document.relationships.addRelationship(\n documentEmbeddingOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject\",\n `embeddings/${documentEmbeddings.referenced[i].fileName}`,\n );\n }\n\n const chartOffset =\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length;\n for (let i = 0; i < ctx.charts.array.length; i++) {\n ctx.document.relationships.addRelationship(\n chartOffset + i,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `charts/chart${i + 1}.xml`,\n );\n }\n\n addSmartArtRelationships(\n ctx.smartArts.array.map((s) => s.key),\n (id, type, target) => {\n ctx.document.relationships.addRelationship(id, type, target);\n },\n documentRelationshipCount +\n documentMedia.referenced.length +\n documentEmbeddings.referenced.length +\n ctx.charts.array.length,\n 0,\n {\n pathPrefix: \"\",\n styleRelType: \"http://schemas.microsoft.com/office/2007/relationships/diagramStyle\",\n },\n );\n\n ctx.document.relationships.addRelationship(\n ctx.document.relationships.relationshipCount + 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\",\n \"fontTable.xml\",\n );\n\n return XML_DECL + ctx.document.relationships.serialize();\n })(),\n path: \"word/_rels/document.xml.rels\",\n },\n Settings: {\n data: XML_DECL + (settingsDesc.stringify(ctx._settingsOptions, ctx) ?? \"\"),\n path: \"word/settings.xml\",\n },\n Styles: {\n data: (() => {\n const xmlStyles = ctx.styles.serialize();\n return replaceNumberingPlaceholders(xmlStyles, ctx.numbering.concreteNumbering);\n })(),\n path: \"word/styles.xml\",\n },\n ...(ctx._options.bibliography\n ? {\n Bibliography: {\n data: XML_DECL + (bibliographyDesc.stringify(ctx._options.bibliography, ctx) ?? \"\"),\n path: \"word/bibliography.xml\",\n },\n }\n : {}),\n ...(ctx.charts.array.length > 0\n ? {\n Charts: ctx.charts.array.map((chartData, i) => ({\n data: XML_DECL + chartData.chartSpaceXml,\n path: `word/charts/chart${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.smartArts.array.length > 0\n ? {\n DiagramData: ctx.smartArts.array.map((smartArtData, i) => ({\n data: XML_DECL + smartArtData.dataModelXml,\n path: `word/diagrams/data${i + 1}.xml`,\n })),\n DiagramLayout: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getLayoutXml(smartArtData.layout),\n path: `word/diagrams/layout${i + 1}.xml`,\n })),\n DiagramStyle: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getStyleXml(smartArtData.style),\n path: `word/diagrams/quickStyle${i + 1}.xml`,\n })),\n DiagramColors: ctx.smartArts.array.map((smartArtData, i) => ({\n data: getColorXml(smartArtData.color),\n path: `word/diagrams/colors${i + 1}.xml`,\n })),\n DiagramDrawing: ctx.smartArts.array.map((_, i) => ({\n data: DEFAULT_DRAWING_XML,\n path: `word/diagrams/drawing${i + 1}.xml`,\n })),\n }\n : {}),\n ...(ctx.altChunks.array.length > 0\n ? {\n AltChunks: ctx.altChunks.array.map((altChunkData) => ({\n data: altChunkData.data,\n path: `word/${altChunkData.path}`,\n })),\n }\n : {}),\n ...(ctx.subDocs.array.length > 0\n ? {\n SubDocs: ctx.subDocs.array.map((subDocData) => ({\n data: subDocData.data,\n path: `word/${subDocData.path}`,\n })),\n }\n : {}),\n ...(ctx.glossaryOptions\n ? {\n Glossary: {\n data: (() => {\n const glossaryCtx = mkCtx(undefined);\n return XML_DECL + (glossaryDesc.stringify(ctx.glossaryOptions!, glossaryCtx) ?? \"\");\n })(),\n path: \"word/glossary/document.xml\",\n },\n }\n : {}),\n ...(ctx.webSettings\n ? {\n WebSettings: {\n data: XML_DECL + (webSettingsDesc.stringify(ctx._options.webSettings ?? {}, ctx) ?? \"\"),\n path: \"word/webSettings.xml\",\n },\n }\n : {}),\n };\n}\n","/**\n * Pure function API for generating DOCX files.\n *\n * @module\n */\n\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\nimport type { OutputByType, OutputType, PackerOptions } from \"@office-open/core\";\nimport type { DocumentOptions } from \"@parts/core-properties\";\n\nimport { compileDocument } from \"./compiler\";\n\n/** @internal Packer instance for DOCX generation. */\nconst Packer = createPacker<DocumentOptions>({\n compile: (options, overrides, mediaLevel) => compileDocument(options, overrides, mediaLevel),\n mimeType: OoxmlMimeType.DOCX,\n});\n\n/**\n * Generate a DOCX file from pure JSON options.\n *\n * The output format is controlled by `packerOptions.type` (default: `\"nodebuffer\"` → Buffer).\n * For synchronous generation, use {@link generateDocumentSync}. For streaming, use {@link generateDocumentStream}.\n *\n * @param options - Document options (sections, styles, numbering, etc.)\n * @param packerOptions - Optional packer configuration (type, compression, overrides, etc.)\n *\n * @example\n * ```typescript\n * import { generateDocument } from \"@office-open/docx\";\n *\n * const buffer = await generateDocument({ sections: [...] });\n * const bytes = await generateDocument({ sections: [...] }, { type: \"uint8array\" });\n * const blob = await generateDocument({ sections: [...] }, { type: \"blob\" });\n * ```\n */\nexport function generateDocument<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): Promise<OutputByType[T]> {\n return Packer.pack(options, packerOptions) as Promise<OutputByType[T]>;\n}\n\n/**\n * Synchronously generate a DOCX file from pure JSON options.\n */\nexport function generateDocumentSync<T extends OutputType = \"nodebuffer\">(\n options: DocumentOptions,\n packerOptions?: PackerOptions<T>,\n): OutputByType[T] {\n return Packer.packSync(options, packerOptions) as OutputByType[T];\n}\n\n/**\n * Generate a DOCX file as a `ReadableStream<Uint8Array>`.\n */\nexport function generateDocumentStream(\n options: DocumentOptions,\n packerOptions?: PackerOptions,\n): ReadableStream<Uint8Array> {\n return Packer.toStream(options, packerOptions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,wBAAwB;;AAE9B,MAAM,sBAAsB;;AAE5B,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;AAuBjB,MAAa,aAAa,KAAiB,YAAgC;CACzE,MAAM,OAAO,QAAQ,QAAQ,MAAM,EAAE;CACrC,IAAI,KAAK,WAAW,UAClB,MAAM,IAAI,MAAM,kDAAkD,SAAS;CAI7E,MAAM,aADa,KAAK,QAAQ,SAAS,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GACjC,CAAC,CAAC,KAAK,cAAc,SAAS,WAAW,EAAE,CAAC;CACxE,WAAW,QAAQ;CAGnB,MAAM,kBADmB,IAAI,MAAM,uBAAuB,mBACnB,CAAC,CAAC,KACtC,MAAM,MAAM,OAAO,WAAW,IAAI,WAAW,OAChD;CAEA,MAAM,MAAM,IAAI,WACd,wBAAwB,gBAAgB,SAAS,KAAK,IAAI,GAAG,IAAI,SAAS,mBAAmB,CAC/F;CACA,IAAI,IAAI,IAAI,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A,CAAG;GACH,MAAM;EACR,EACF,IACA,CAAC;EACL,GAAI,IAAI,cACJ,EACE,aAAa;GACX,MAAM,YAAY,gBAAgB,UAAU,IAAI,SAAS,eAAe,CAAC,GAAG,GAAG,KAAK;GACpF,MAAM;EACR,EACF,IACA,CAAC;CACP;AACF;;;;;;;;;AC5sBA,MAAM,SAAS,aAA8B;CAC3C,UAAU,SAAS,WAAW,eAAe,gBAAgB,SAAS,WAAW,UAAU;CAC3F,UAAU,cAAc;AAC1B,CAAC;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,iBACd,SACA,eAC0B;CAC1B,OAAO,OAAO,KAAK,SAAS,aAAa;AAC3C;;;;AAKA,SAAgB,qBACd,SACA,eACiB;CACjB,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C;;;;AAKA,SAAgB,uBACd,SACA,eAC4B;CAC5B,OAAO,OAAO,SAAS,SAAS,aAAa;AAC/C"}
@@ -1,4 +1,4 @@
1
- import { t as DocumentOptions } from "./core-properties-i25gKEDT.mjs";
1
+ import { t as DocumentOptions } from "./core-properties-C510YJhg.mjs";
2
2
  import { OutputByType, OutputType, PackerOptions } from "@office-open/core";
3
3
 
4
4
  //#region src/generate.d.ts
package/dist/generate.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-Di_7M9eJ.mjs";
1
+ import { n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-fsy5ESN0.mjs";
2
2
  export { generateDocument, generateDocumentStream, generateDocumentSync };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CaptionOptions, $a as YearShort, $i as SdtRowOptions, $n as SmartTagRunOptions, $o as FontAttributesProperties, $r as TextVerticalType, $t as parseSectionPropertiesEl, A as SubDocData, Aa as MoveRangeStartOptions, Ai as ParagraphPropertiesChangeOptions, An as CustomXmlCellOptions, Ao as parseTocFieldFromElements, Ar as MediaTransformation, At as DocPartGallery, B as DefaultStylesOptions, Ba as DayLong, Bi as FrameWrap, Bn as TableRowPropertiesOptionsBase, Bo as SdtListItem, Br as WpgMediaData, Bt as endnotesDesc, C as TargetScreenSize, Ca as MathScriptType, Ci as TextWrapping, Cn as DocGridAttributesProperties, Co as VerticalAlignSection, Cr as DocumentBackgroundOptions, Ct as Numbering, D as framesetXml, Da as DisplacedByCustomXml, Di as DrawingOptions, Dn as ColumnAttributes, Do as VerticalMergeRevisionType, Dr as ImageOptions, Dt as LevelSuffix, E as frameXml, Ea as BookmarkStartOptions, Ei as Distance, En as ColumnsAttributes, Eo as CellMergeAttributes, Er as ChartOptions, Et as LevelFormat, F as extractStyleId, Fa as RunOptions, Fi as TextboxTightWrapType, Fn as SdtCellOptions, Fo as SdtComboBoxOptions, Fr as MediaData, Ft as FootnoteSeparator, G as TableStyleOptions, Ga as MonthLong, Gi as VerticalPositionAlign, Gn as HyperlinkType, Go as TableOfContentsOptions, Gr as WpsShapeOptions, Gt as sectionMarginDefaults, H as NumberingStyleOptions, Ha as EndnoteReference, Hi as HorizontalPositionAlign, Hn as NumberedItemReferenceFormat, Ho as SdtPropertiesOptions, Hr as ShapeStyleOptions, Ht as SectionPropertiesChangeOptions, I as parseStyleDefinitions, Ia as breakXml, Ii as AlignmentFrameOptions, In as TableCellOptions, Io as SdtDataBindingOptions, Ir as MediaDataTransformation, It as FootnotesData, J as stringifyConditionalTableStyle, Ja as PageNumberElement, Ji as parseTableRowPropertiesEl, Jn as ParagraphChild, Jo as RunPropertiesChangeOptions, Jr as NormalAutofitOptions, Jt as DocumentAttributeNamespaces, K as TableStyleOverrideType, Ka as MonthShort, Ki as parseTableCellPropertiesEl, Kn as InternalHyperlinkOptions, Ko as HighlightColor, Kr as BodyPropertiesOptions, Kt as sectionPageSizeDefaults, L as CharacterStyleOptions, La as AnnotationReference, Li as DropCapType, Ln as CnfStyleOptions, Lo as SdtDateMappingType, Lr as NonVisualPropertiesOptions, Lt as footnotesDesc, M as StylesOptions, Ma as BreakOptions, Mi as ParagraphPropertiesOptionsBase, Mn as CustomXmlPropertiesOptions, Mo as selectTocEntryElements, Mr as ChartMediaData, Mt as DocPartType, N as buildNumberingCache, Na as PageNumber, Ni as ParagraphStylePropertiesOptions, Nn as CustomXmlRowOptions, No as SdtCheckboxOptions, Nr as ExtendedMediaData, Nt as GlossaryDocumentOptions, O as webSettingsDesc, Oa as MarkupRangeOptions, Oi as SymbolRunOptions, On as CustomXmlAttributeOptions, Oo as stringifyTableOfContents, Or as createImageData, Ot as LevelsOptions, P as buildStyleCache, Pa as ParagraphRunOptions, Pi as TextAlignmentType, Pn as CustomXmlRunOptions, Po as SdtCheckboxSymbol, Pr as GroupChildMediaData, Pt as glossaryDesc, Q as AutoCaptionOptions, Qa as YearLong, Qi as HeightRule, Qn as ProofErrorTypeValue, Qo as UnderlineType, Qr as TextVertOverflowType, Qt as SubDocOptions, R as ConditionalTableStyleOptions, Ra as CarriageReturn, Ri as FrameAnchorType, Rn as TableRowPropertiesChangeOptions, Ro as SdtDateOptions, Rr as SmartArtMediaData, Rt as EndnoteSeparator, S as OptimizeForBrowserOptions, Sa as MathRunPropertiesOptions, Si as createWrapTight, Sn as PageSizeAttributes, So as TableVerticalAlign, Sr as BackgroundRawMediaOptions, St as AbstractNumberingOptions, T as WebSettingsOptions, Ta as BookmarkOptions, Ti as TextWrappingType, Tn as createDocumentGrid, To as createVerticalAlign, Tr as SmartArtOptions, Tt as parseNumberingDefinitions, U as ParagraphStyleOptions, Ua as FootnoteReferenceElement, Ui as NumberFormat, Un as NumberedItemReferenceOptions, Uo as SdtTextOptions, Ur as StyleMatrixReferenceOptions, Ut as SectionPropertiesOptions, V as DocumentDefaultsOptions, Va as DayShort, Vi as XYFrameOptions, Vn as DirOptions, Vo as SdtLock, Vr as WpsMediaData, Vt as HeaderFooterGroup, W as StyleOptions, Wa as LastRenderedPageBreak, Wi as SpaceType, Wn as ExternalHyperlinkOptions, Wo as StyleLevel, Wr as WpsShapeCoreOptions, Wt as SectionPropertiesOptionsBase, X as stringifyParagraphStyle, Xa as SoftHyphen, Xi as tableDesc, Xn as SdtRunOptions, Xo as RunStylePropertiesOptions, Xr as TextBodyWrappingType, Xt as SectionOptions, Y as stringifyNumberingStyle, Ya as Separator, Yi as setTableParseChild, Yn as ParagraphOptions, Yo as RunPropertiesOptions, Yr as PresetTextShapeOptions, Yt as SectionChild, Z as stringifyTableStyle, Za as Tab, Zi as TableOptions, Zn as ProofErrorType, Zo as TextEffect, Zr as TextHorzOverflowType, Zt as VmlShapeStyle, _ as parseArchive, _a as TableBordersOptions, _i as HorizontalPositionRelativeFrom, _n as PageBordersOptions, _o as BordersOptions, _r as CommentsOptions, _s as SourceTypeOptions, _t as SettingsOptions, a as CustomPropertyOptions, aa as TablePropertyExOptions, ai as GroupChild, an as createHeaderFooterReference, ao as objectDesc, ar as FormFieldTextType, as as AltChunkOptions, at as MailMergeDataType, b as DivBorderOptions, ba as MathNaryLimitLocation, bi as VerticalPositionRelativeFrom, bn as createPageNumberType, bo as WidthType, br as WpsShapeRunOptions, bt as CompatibilityOptions, c as AppPropertiesOptions, ca as TablePropertiesOptionsBase, ci as DrawingDescriptorOptions, cn as LineNumberAttributes, co as TabStopPosition, cr as parseFormFieldData, cs as CharacterSet, ct as MailMergeOptions, d as EmbeddedFontOptionsWithKey, da as OverlapType, di as drawingDesc, dn as PageTextDirectionType, do as LineRuleType, dr as PositionalTabAlignment, ds as ContentTypesInput, dt as OdsoFieldMapDataOptions, ea as TableRowOptions, ei as VerticalAnchor, en as sectionPropertiesDesc, eo as ObjectControlOptions, er as CheckBoxOptions, es as EmphasisMarkType, et as CaptionsOptions, f as BodyContext, fa as RelativeHorizontalPosition, fi as resetDrawingIdGen, fn as PageMarginAttributes, fo as SpacingProperties, fr as PositionalTabLeader, fs as buildContentTypesFromRegistry, ft as OdsoFieldType, g as DocxPartRefs, ga as TABLE_BORDERS_NONE, gi as HorizontalPositionOptions, gn as PageBorderZOrder, go as CnfConditionalOptions, gr as CommentOptions, gs as BibliographyOptions, gt as RsidsOptions, h as DocxDocument, ha as TableFloatOptions, hi as Floating, hn as PageBorderOffsetFrom, ho as IndentAttributesProperties, hr as CommentChildOptions, hs as withMediaDefaults, ht as RevisionViewOptions, i as CustomPropertiesInput, ia as TablePropertyExChangeOptions, ii as ChildOffset, in as HeaderFooterType, io as ObjectLinkOptions, ir as FormFieldTextOptions, is as BorderStyle, it as HyphenationOptions, j as Styles, ja as BreakClear, ji as ParagraphPropertiesOptions, jn as CustomXmlDataBindingOptions, jo as parseTocFieldInstruction, jr as createTransformation, jt as DocPartOptions, k as SubDocCollection, ka as MoveRangeOptions, ki as LevelParagraphStylePropertiesOptions, kn as CustomXmlBlockOptions, ko as parseToc, kr as Media, kt as DocPartBehavior, l as appPropertiesDesc, la as TableLookOptions, li as GraphicFrameLocksOptions, ln as LineNumberRestartFormat, lo as TabStopType, lr as RubyAlign, ls as ContentTypeDefault, lt as MailMergeSourceType, m as DocxWriteContext, ma as TableAnchorType, mi as createHorizontalPosition, mn as PageBorderDisplay, mo as BreakTypeValue, mr as PositionalTabRelativeTo, ms as withAltChunkOverrides, mt as ReadModeInkLockDownOptions, n as FeaturesOptions, na as TextDirection, ni as parseBodyProperties, nn as HeaderFooterReferenceOptions, no as ObjectEmbedOptions, nr as FormFieldCommonOptions, ns as ShadingType, nt as EndnotePropertiesOptions, o as customPropertiesDesc, oa as TablePropertiesChangeOptions, oi as WpgGroupCoreOptions, on as SectionType, oo as LeaderType, or as TextInputOptions, os as AltChunkCollection, ot as MailMergeDest, p as DocxReadContext, pa as RelativeVerticalPosition, pi as createVerticalPosition, pn as createPageMargin, po as BreakType, pr as PositionalTabOptions, ps as contentTypesDesc, pt as OdsoOptions, q as stringifyCharacterStyle, qa as NoBreakHyphen, qi as parseTablePropertiesEl, qn as FootnoteEndnoteReferenceOptions, qo as ParagraphRunPropertiesOptions, qr as FlatTextOptions, qt as DocumentAttributeNamespace, r as corePropertiesDesc, ra as VerticalMergeType, ri as ChildExtent, rn as HeaderFooterReferenceType, ro as ObjectIconImageOptions, rr as FormFieldOptions, rs as BorderOptions, rt as FootnotePropertiesOptions, s as AppPropertiesInput, sa as TablePropertiesOptions, si as WpgGroupOptions, sn as createSectionType, so as TabStopDefinition, sr as createFormFieldData, ss as AltChunkData, st as MailMergeDocType, t as DocumentOptions, ta as TableCellBordersOptions, ti as createBodyProperties, tn as stringifySectionPropertiesXml, to as ObjectElementOptions, tr as DropDownListOptions, ts as ShadingAttributesProperties, tt as DocumentProtectionOptions, u as settingsDesc, ua as TableLayoutType, ui as GroupShapeLocksOptions, un as createLineNumberType, uo as HeadingLevel, ur as RubyOptions, us as ContentTypeOverride, ut as MathPropertiesOptions, v as parseDocument, va as MathDelimiterProperties, vi as Margins, vn as PageNumberSeparator, vo as AlignmentType, vr as SimpleFieldOptions, vs as bibliographyDesc, vt as WriteProtectionOptions, w as WebSettingsInput, wa as MathStyleType, wi as TextWrappingSide, wn as DocumentGridType, wo as VerticalAlignTable, wr as SmartArtNode, wt as NumberingOptions, x as DivOptions, xa as MathNaryProperties, xi as createWrapThrough, xn as PageOrientation, xo as SectionVerticalAlign, xr as BackgroundImageOptions, xt as ConcreteNumberingOptions, y as parseDocx, ya as MathInput, yi as VerticalPositionOptions, yn as PageNumberTypeAttributes, yo as TableWidthProperties, yr as WpgGroupRunOptions, yt as CompatSettingOptions, z as DefaultStylesFactory, za as ContinuationSeparator, zi as FrameOptions, zn as TableRowPropertiesOptions, zo as SdtDropDownListOptions, zr as WpgCommonMediaData, zt as EndnotesData } from "./core-properties-i25gKEDT.mjs";
1
+ import { $ as CaptionOptions, $a as YearShort, $i as SdtRowOptions, $n as SmartTagRunOptions, $o as TextEffect, $r as TextVerticalType, $t as parseSectionPropertiesEl, A as SubDocData, Aa as MoveRangeStartOptions, Ai as ParagraphPropertiesChangeOptions, An as CustomXmlCellOptions, Ao as stringifyTableOfContents, Ar as MediaTransformation, At as DocPartGallery, B as DefaultStylesOptions, Ba as DayLong, Bi as FrameWrap, Bn as TableRowPropertiesOptionsBase, Bo as SdtDateOptions, Br as WpgMediaData, Bt as endnotesDesc, C as TargetScreenSize, Ca as MathScriptType, Ci as TextWrapping, Cn as DocGridAttributesProperties, Co as SectionVerticalAlign, Cr as DocumentBackgroundOptions, Ct as Numbering, D as framesetXml, Da as DisplacedByCustomXml, Di as DrawingOptions, Dn as ColumnAttributes, Do as createVerticalAlign, Dr as ImageOptions, Dt as LevelSuffix, E as frameXml, Ea as BookmarkStartOptions, Ei as Distance, En as ColumnsAttributes, Eo as VerticalAlignTable, Er as ChartOptions, Et as LevelFormat, F as extractStyleId, Fa as RunOptions, Fi as TextboxTightWrapType, Fn as SdtCellOptions, Fo as SdtCheckboxOptions, Fr as MediaData, Ft as FootnoteSeparator, G as TableStyleOptions, Ga as MonthLong, Gi as VerticalPositionAlign, Gn as HyperlinkType, Go as SdtTextOptions, Gr as WpsShapeOptions, Gt as sectionMarginDefaults, H as NumberingStyleOptions, Ha as EndnoteReference, Hi as HorizontalPositionAlign, Hn as NumberedItemReferenceFormat, Ho as SdtListItem, Hr as ShapeStyleOptions, Ht as SectionPropertiesChangeOptions, I as parseStyleDefinitions, Ia as breakXml, Ii as AlignmentFrameOptions, In as TableCellOptions, Io as SdtCheckboxSymbol, Ir as MediaDataTransformation, It as FootnotesData, J as stringifyConditionalTableStyle, Ja as PageNumberElement, Ji as parseTableRowPropertiesEl, Jn as ParagraphChild, Jo as HighlightColor, Jr as NormalAutofitOptions, Jt as DocumentAttributeNamespaces, K as TableStyleOverrideType, Ka as MonthShort, Ki as parseTableCellPropertiesEl, Kn as InternalHyperlinkOptions, Ko as StyleLevel, Kr as BodyPropertiesOptions, Kt as sectionPageSizeDefaults, L as CharacterStyleOptions, La as AnnotationReference, Li as DropCapType, Ln as CnfStyleOptions, Lo as SdtComboBoxOptions, Lr as NonVisualPropertiesOptions, Lt as footnotesDesc, M as StylesOptions, Ma as BreakOptions, Mi as ParagraphPropertiesOptionsBase, Mn as CustomXmlPropertiesOptions, Mo as parseTocFieldFromElements, Mr as ChartMediaData, Mt as DocPartType, N as buildNumberingCache, Na as PageNumber, Ni as ParagraphStylePropertiesOptions, Nn as CustomXmlRowOptions, No as parseTocFieldInstruction, Nr as ExtendedMediaData, Nt as GlossaryDocumentOptions, O as webSettingsDesc, Oa as MarkupRangeOptions, Oi as SymbolRunOptions, On as CustomXmlAttributeOptions, Oo as CellMergeAttributes, Or as createImageData, Ot as LevelsOptions, P as buildStyleCache, Pa as ParagraphRunOptions, Pi as TextAlignmentType, Pn as CustomXmlRunOptions, Po as selectTocEntryElements, Pr as GroupChildMediaData, Pt as glossaryDesc, Q as AutoCaptionOptions, Qa as YearLong, Qi as HeightRule, Qn as ProofErrorTypeValue, Qo as RunStylePropertiesOptions, Qr as TextVertOverflowType, Qt as SubDocOptions, R as ConditionalTableStyleOptions, Ra as CarriageReturn, Ri as FrameAnchorType, Rn as TableRowPropertiesChangeOptions, Ro as SdtDataBindingOptions, Rr as SmartArtMediaData, Rt as EndnoteSeparator, S as OptimizeForBrowserOptions, Sa as MathRunPropertiesOptions, Si as createWrapTight, Sn as PageSizeAttributes, So as widthPctToFiftieths, Sr as BackgroundRawMediaOptions, St as AbstractNumberingOptions, T as WebSettingsOptions, Ta as BookmarkOptions, Ti as TextWrappingType, Tn as createDocumentGrid, To as VerticalAlignSection, Tr as SmartArtOptions, Tt as parseNumberingDefinitions, U as ParagraphStyleOptions, Ua as FootnoteReferenceElement, Ui as NumberFormat, Un as NumberedItemReferenceOptions, Uo as SdtLock, Ur as StyleMatrixReferenceOptions, Ut as SectionPropertiesOptions, V as DocumentDefaultsOptions, Va as DayShort, Vi as XYFrameOptions, Vn as DirOptions, Vo as SdtDropDownListOptions, Vr as WpsMediaData, Vt as HeaderFooterGroup, W as StyleOptions, Wa as LastRenderedPageBreak, Wi as SpaceType, Wn as ExternalHyperlinkOptions, Wo as SdtPropertiesOptions, Wr as WpsShapeCoreOptions, Wt as SectionPropertiesOptionsBase, X as stringifyParagraphStyle, Xa as SoftHyphen, Xi as tableDesc, Xn as SdtRunOptions, Xo as RunPropertiesChangeOptions, Xr as TextBodyWrappingType, Xt as SectionOptions, Y as stringifyNumberingStyle, Ya as Separator, Yi as setTableParseChild, Yn as ParagraphOptions, Yo as ParagraphRunPropertiesOptions, Yr as PresetTextShapeOptions, Yt as SectionChild, Z as stringifyTableStyle, Za as Tab, Zi as TableOptions, Zn as ProofErrorType, Zo as RunPropertiesOptions, Zr as TextHorzOverflowType, Zt as VmlShapeStyle, _ as parseArchive, _a as TableBordersOptions, _i as HorizontalPositionRelativeFrom, _n as PageBordersOptions, _o as BordersOptions, _r as CommentsOptions, _s as withMediaDefaults, _t as SettingsOptions, a as CustomPropertyOptions, aa as TablePropertyExOptions, ai as GroupChild, an as createHeaderFooterReference, ao as objectDesc, ar as FormFieldTextType, as as BorderOptions, at as MailMergeDataType, b as DivBorderOptions, ba as MathNaryLimitLocation, bi as VerticalPositionRelativeFrom, bn as createPageNumberType, bo as WidthType, br as WpsShapeRunOptions, bs as bibliographyDesc, bt as CompatibilityOptions, c as AppPropertiesOptions, ca as TablePropertiesOptionsBase, ci as DrawingDescriptorOptions, cn as LineNumberAttributes, co as TabStopPosition, cr as parseFormFieldData, cs as AltChunkCollection, ct as MailMergeOptions, d as EmbeddedFontOptionsWithKey, da as OverlapType, di as drawingDesc, dn as PageTextDirectionType, do as LineRuleType, dr as PositionalTabAlignment, ds as ContentTypeDefault, dt as OdsoFieldMapDataOptions, ea as TableRowOptions, ei as VerticalAnchor, en as sectionPropertiesDesc, eo as ObjectControlOptions, er as CheckBoxOptions, es as UnderlineType, et as CaptionsOptions, f as BodyContext, fa as RelativeHorizontalPosition, fi as resetDrawingIdGen, fn as PageMarginAttributes, fo as SpacingProperties, fr as PositionalTabLeader, fs as ContentTypeOverride, ft as OdsoFieldType, g as DocxPartRefs, ga as TABLE_BORDERS_NONE, gi as HorizontalPositionOptions, gn as PageBorderZOrder, go as CnfConditionalOptions, gr as CommentOptions, gs as withAltChunkOverrides, gt as RsidsOptions, h as DocxDocument, ha as TableFloatOptions, hi as Floating, hn as PageBorderOffsetFrom, ho as IndentAttributesProperties, hr as CommentChildOptions, hs as contentTypesDesc, ht as RevisionViewOptions, i as CustomPropertiesInput, ia as TablePropertyExChangeOptions, ii as ChildOffset, in as HeaderFooterType, io as ObjectLinkOptions, ir as FormFieldTextOptions, is as ShadingType, it as HyphenationOptions, j as Styles, ja as BreakClear, ji as ParagraphPropertiesOptions, jn as CustomXmlDataBindingOptions, jo as parseToc, jr as createTransformation, jt as DocPartOptions, k as SubDocCollection, ka as MoveRangeOptions, ki as LevelParagraphStylePropertiesOptions, kn as CustomXmlBlockOptions, ko as VerticalMergeRevisionType, kr as Media, kt as DocPartBehavior, l as appPropertiesDesc, la as TableLookOptions, li as GraphicFrameLocksOptions, ln as LineNumberRestartFormat, lo as TabStopType, lr as RubyAlign, ls as AltChunkData, lt as MailMergeSourceType, m as DocxWriteContext, ma as TableAnchorType, mi as createHorizontalPosition, mn as PageBorderDisplay, mo as BreakTypeValue, mr as PositionalTabRelativeTo, ms as buildContentTypesFromRegistry, mt as ReadModeInkLockDownOptions, n as FeaturesOptions, na as TextDirection, ni as parseBodyProperties, nn as HeaderFooterReferenceOptions, no as ObjectEmbedOptions, nr as FormFieldCommonOptions, ns as EmphasisMarkType, nt as EndnotePropertiesOptions, o as customPropertiesDesc, oa as TablePropertiesChangeOptions, oi as WpgGroupCoreOptions, on as SectionType, oo as LeaderType, or as TextInputOptions, os as BorderStyle, ot as MailMergeDest, p as DocxReadContext, pa as RelativeVerticalPosition, pi as createVerticalPosition, pn as createPageMargin, po as BreakType, pr as PositionalTabOptions, ps as ContentTypesInput, pt as OdsoOptions, q as stringifyCharacterStyle, qa as NoBreakHyphen, qi as parseTablePropertiesEl, qn as FootnoteEndnoteReferenceOptions, qo as TableOfContentsOptions, qr as FlatTextOptions, qt as DocumentAttributeNamespace, r as corePropertiesDesc, ra as VerticalMergeType, ri as ChildExtent, rn as HeaderFooterReferenceType, ro as ObjectIconImageOptions, rr as FormFieldOptions, rs as ShadingAttributesProperties, rt as FootnotePropertiesOptions, s as AppPropertiesInput, sa as TablePropertiesOptions, si as WpgGroupOptions, sn as createSectionType, so as TabStopDefinition, sr as createFormFieldData, ss as AltChunkOptions, st as MailMergeDocType, t as DocumentOptions, ta as TableCellBordersOptions, ti as createBodyProperties, tn as stringifySectionPropertiesXml, to as ObjectElementOptions, tr as DropDownListOptions, ts as FontAttributesProperties, tt as DocumentProtectionOptions, u as settingsDesc, ua as TableLayoutType, ui as GroupShapeLocksOptions, un as createLineNumberType, uo as HeadingLevel, ur as RubyOptions, us as CharacterSet, ut as MathPropertiesOptions, v as parseDocument, va as MathDelimiterProperties, vi as Margins, vn as PageNumberSeparator, vo as AlignmentType, vr as SimpleFieldOptions, vs as BibliographyOptions, vt as WriteProtectionOptions, w as WebSettingsInput, wa as MathStyleType, wi as TextWrappingSide, wn as DocumentGridType, wo as TableVerticalAlign, wr as SmartArtNode, wt as NumberingOptions, x as DivOptions, xa as MathNaryProperties, xi as createWrapThrough, xn as PageOrientation, xo as widthFiftiethsToPct, xr as BackgroundImageOptions, xt as ConcreteNumberingOptions, y as parseDocx, ya as MathInput, yi as VerticalPositionOptions, yn as PageNumberTypeAttributes, yo as TableWidthProperties, yr as WpgGroupRunOptions, ys as SourceTypeOptions, yt as CompatSettingOptions, z as DefaultStylesFactory, za as ContinuationSeparator, zi as FrameOptions, zn as TableRowPropertiesOptions, zo as SdtDateMappingType, zr as WpgCommonMediaData, zt as EndnotesData } from "./core-properties-C510YJhg.mjs";
2
2
  import { generateDocument, generateDocumentStream, generateDocumentSync } from "./generate.mjs";
3
3
  import { Patch, PatchComment, PatchDocumentOptions, patchDetector, patchDocument } from "./patch/index.mjs";
4
4
  import { CompressionOptions, OutputByType, OutputType, PackerOptions, XmlifyedFile, Zippable } from "@office-open/core";
@@ -115,5 +115,5 @@ declare const customXmlBlockDesc: CustomDescriptor<CustomXmlBlockDescriptorOptio
115
115
  //#region src/compiler.d.ts
116
116
  declare function compileDocument(options: DocumentOptions, overrides?: XmlifyedFile[], mediaLevel?: number): Zippable;
117
117
  //#endregion
118
- export { AbstractNumberingOptions, AlignmentFrameOptions, AlignmentType, AltChunkCollection, AltChunkData, AltChunkOptions, AnnotationReference, type AppPropertiesInput, type AppPropertiesOptions, AutoCaptionOptions, BackgroundImageOptions, BackgroundRawMediaOptions, BibliographyOptions, type BodyContext, BodyPropertiesOptions, BookmarkOptions, BookmarkStartOptions, BorderOptions, BorderStyle, BordersOptions, BreakClear, BreakOptions, BreakType, BreakTypeValue, CaptionOptions, CaptionsOptions, CarriageReturn, CellMergeAttributes, CharacterSet, CharacterStyleOptions, ChartMediaData, ChartOptions, CheckBoxOptions, ChildExtent, ChildOffset, CnfConditionalOptions, CnfStyleOptions, ColumnAttributes, ColumnsAttributes, CommentChildOptions, CommentOptions, CommentsOptions, type CompatSettingOptions, type CompatibilityOptions, type CompressionOptions, ConcreteNumberingOptions, ConditionalTableStyleOptions, ContentTypeDefault, ContentTypeOverride, ContentTypesInput, ContinuationSeparator, type CustomPropertiesInput, type CustomPropertyOptions, type CustomXmlAttributeOptions, CustomXmlBlockDescriptorOptions, type CustomXmlBlockOptions, type CustomXmlCellOptions, type CustomXmlDataBindingOptions, type CustomXmlPropertiesOptions, type CustomXmlRowOptions, type CustomXmlRunOptions, DayLong, DayShort, DefaultStylesFactory, DefaultStylesOptions, DirOptions, DisplacedByCustomXml, Distance, DivBorderOptions, DivOptions, DocGridAttributesProperties, DocPartBehavior, DocPartGallery, DocPartOptions, DocPartType, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentBackgroundOptions, DocumentDefaultsOptions, DocumentGridType, DocumentOptions, DocumentProtectionOptions, DocxDocument, DocxPartRefs, DocxReadContext, DocxWriteContext, DrawingDescriptorOptions, DrawingOptions, DropCapType, DropDownListOptions, EditGroup, EditGroupType, EmphasisMarkType, EndnoteOptions, EndnotePropertiesOptions, EndnoteReference, EndnoteSeparator, EndnoteType, EndnotesData, ExtendedMediaData, ExternalHyperlinkOptions, FeaturesOptions, FlatTextOptions, Floating, FontAttributesProperties, FontTableInput, FootnoteEndnoteReferenceOptions, FootnoteOptions, FootnotePropertiesOptions, FootnoteReferenceElement, FootnoteSeparator, FootnoteType, FootnotesData, FormFieldCommonOptions, FormFieldOptions, FormFieldTextOptions, FormFieldTextType, FrameAnchorType, FrameOptions, FrameWrap, GlossaryDocumentOptions, GraphicFrameLocksOptions, GroupChild, GroupChildMediaData, GroupShapeLocksOptions, HeaderFooterGroup, HeaderFooterReferenceOptions, HeaderFooterReferenceType, HeaderFooterType, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionOptions, HorizontalPositionRelativeFrom, HyperlinkType, HyphenationOptions, ImageOptions, IndentAttributesProperties, InternalHyperlinkOptions, LastRenderedPageBreak, LeaderType, LevelFormat, LevelParagraphStylePropertiesOptions, LevelSuffix, LevelsOptions, LineNumberAttributes, LineNumberRestartFormat, LineRuleType, MailMergeDataType, MailMergeDest, MailMergeDocType, MailMergeOptions, MailMergeSourceType, Margins, MarkupRangeOptions, MathDelimiterProperties, MathInput, MathNaryLimitLocation, MathNaryProperties, MathPropertiesOptions, MathRunPropertiesOptions, MathScriptType, MathStyleType, Media, MediaData, MediaDataTransformation, MediaTransformation, MonthLong, MonthShort, MoveRangeOptions, MoveRangeStartOptions, NoBreakHyphen, NonVisualPropertiesOptions, NormalAutofitOptions, NumberFormat, NumberedItemReferenceFormat, NumberedItemReferenceOptions, Numbering, NumberingOptions, NumberingStyleOptions, type ObjectControlOptions, type ObjectElementOptions, type ObjectEmbedOptions, type ObjectIconImageOptions, type ObjectLinkOptions, OdsoFieldMapDataOptions, OdsoFieldType, OdsoOptions, OptimizeForBrowserOptions, type OutputByType, type OutputType, OverlapType, type PackerOptions, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBordersOptions, PageMarginAttributes, PageNumber, PageNumberElement, PageNumberSeparator, PageNumberTypeAttributes, PageOrientation, PageSizeAttributes, PageTextDirectionType, ParagraphChild, ParagraphOptions, ParagraphPropertiesChangeOptions, ParagraphPropertiesOptions, ParagraphPropertiesOptionsBase, ParagraphRunOptions, ParagraphRunPropertiesOptions, ParagraphStyleOptions, ParagraphStylePropertiesOptions, Patch, PatchComment, PatchDocumentOptions, PermStartOptions, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PresetTextShapeOptions, ProofErrorType, ProofErrorTypeValue, ReadModeInkLockDownOptions, RelationshipEntry, RelationshipsInput, RelativeHorizontalPosition, RelativeVerticalPosition, RevisionViewOptions, RsidsOptions, RubyAlign, RubyOptions, RunOptions, RunPropertiesChangeOptions, RunPropertiesOptions, RunStylePropertiesOptions, SdtBlockOptions, SdtCellOptions, SdtCheckboxOptions, SdtCheckboxSymbol, SdtComboBoxOptions, SdtDataBindingOptions, SdtDateMappingType, SdtDateOptions, SdtDropDownListOptions, SdtListItem, SdtLock, SdtPropertiesOptions, SdtRowOptions, SdtRunOptions, SdtTextOptions, SectionChild, SectionOptions, SectionPropertiesChangeOptions, SectionPropertiesOptions, SectionPropertiesOptionsBase, SectionType, SectionVerticalAlign, Separator, SettingsOptions, ShadingAttributesProperties, ShadingType, ShapeStyleOptions, SimpleFieldOptions, SmartArtMediaData, SmartArtNode, SmartArtOptions, SmartTagRunOptions, SoftHyphen, SourceTypeOptions, SpaceType, SpacingProperties, StyleLevel, StyleMatrixReferenceOptions, StyleOptions, Styles, StylesOptions, SubDocCollection, SubDocData, SubDocOptions, SymbolRunOptions, TABLE_BORDERS_NONE, Tab, TabStopDefinition, TabStopPosition, TabStopType, TableAnchorType, TableBordersOptions, TableCellBordersOptions, TableCellOptions, TableFloatOptions, TableLayoutType, TableLookOptions, TableOfContentsOptions, TableOptions, TablePropertiesChangeOptions, TablePropertiesOptions, TablePropertiesOptionsBase, TablePropertyExChangeOptions, TablePropertyExOptions, TableRowOptions, TableRowPropertiesChangeOptions, TableRowPropertiesOptions, TableRowPropertiesOptionsBase, TableStyleOptions, TableStyleOverrideType, TableVerticalAlign, TableWidthProperties, TargetScreenSize, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextInputOptions, TextVertOverflowType, TextVerticalType, TextWrapping, TextWrappingSide, TextWrappingType, TextboxOptions, TextboxTightWrapType, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionOptions, VerticalPositionRelativeFrom, WebSettingsInput, WebSettingsOptions, WidthType, WpgCommonMediaData, WpgGroupCoreOptions, WpgGroupOptions, WpgGroupRunOptions, WpgMediaData, WpsMediaData, WpsShapeCoreOptions, WpsShapeOptions, WpsShapeRunOptions, WriteProtectionOptions, XYFrameOptions, YearLong, YearShort, altChunkDesc, appPropertiesDesc, bibliographyDesc, breakXml, buildContentTypesFromRegistry, buildNumberingCache, buildStyleCache, checkboxSymbolRunInner, commentsDesc, compileDocument, contentTypesDesc, corePropertiesDesc, createBodyProperties, createDocumentGrid, createFormFieldData, createHeaderFooterReference, createHorizontalPosition, createImageData, createLineNumberType, createPageMargin, createPageNumberType, createSectionType, createTransformation, createVerticalAlign, createVerticalPosition, createWrapThrough, createWrapTight, customPropertiesDesc, customXmlBlockDesc, drawingDesc, endnotesDesc, extractStyleId, fontTableDesc, footnotesDesc, frameXml, framesetXml, generateDocument, generateDocumentStream, generateDocumentSync, glossaryDesc, objectDesc, parseArchive, parseBodyProperties, parseCustomXmlProperties, parseDocument, parseDocx, parseFormFieldData, parseNumberingDefinitions, parseSdtBlock, parseSdtProperties, parseSectionPropertiesEl, parseStyleDefinitions, parseTableCellPropertiesEl, parseTablePropertiesEl, parseTableRowPropertiesEl, parseToc, parseTocFieldFromElements, parseTocFieldInstruction, patchDetector, patchDocument, relationshipsDesc, resetDrawingIdGen, sdtBlockDesc, sectionMarginDefaults, sectionPageSizeDefaults, sectionPropertiesDesc, selectTocEntryElements, setBodyParseChild, setTableParseChild, settingsDesc, stringifyCharacterStyle, stringifyChildDispatch, stringifyConditionalTableStyle, stringifyCustomXmlShell, stringifyNumberingStyle, stringifyParagraphInline, stringifyParagraphStyle, stringifyRunInline, stringifySdtPr, stringifySdtShell, stringifySectionPropertiesXml, stringifyTableOfContents, stringifyTableStyle, subDocDesc, tableDesc, webSettingsDesc, withAltChunkOverrides, withMediaDefaults };
118
+ export { AbstractNumberingOptions, AlignmentFrameOptions, AlignmentType, AltChunkCollection, AltChunkData, AltChunkOptions, AnnotationReference, type AppPropertiesInput, type AppPropertiesOptions, AutoCaptionOptions, BackgroundImageOptions, BackgroundRawMediaOptions, BibliographyOptions, type BodyContext, BodyPropertiesOptions, BookmarkOptions, BookmarkStartOptions, BorderOptions, BorderStyle, BordersOptions, BreakClear, BreakOptions, BreakType, BreakTypeValue, CaptionOptions, CaptionsOptions, CarriageReturn, CellMergeAttributes, CharacterSet, CharacterStyleOptions, ChartMediaData, ChartOptions, CheckBoxOptions, ChildExtent, ChildOffset, CnfConditionalOptions, CnfStyleOptions, ColumnAttributes, ColumnsAttributes, CommentChildOptions, CommentOptions, CommentsOptions, type CompatSettingOptions, type CompatibilityOptions, type CompressionOptions, ConcreteNumberingOptions, ConditionalTableStyleOptions, ContentTypeDefault, ContentTypeOverride, ContentTypesInput, ContinuationSeparator, type CustomPropertiesInput, type CustomPropertyOptions, type CustomXmlAttributeOptions, CustomXmlBlockDescriptorOptions, type CustomXmlBlockOptions, type CustomXmlCellOptions, type CustomXmlDataBindingOptions, type CustomXmlPropertiesOptions, type CustomXmlRowOptions, type CustomXmlRunOptions, DayLong, DayShort, DefaultStylesFactory, DefaultStylesOptions, DirOptions, DisplacedByCustomXml, Distance, DivBorderOptions, DivOptions, DocGridAttributesProperties, DocPartBehavior, DocPartGallery, DocPartOptions, DocPartType, DocumentAttributeNamespace, DocumentAttributeNamespaces, DocumentBackgroundOptions, DocumentDefaultsOptions, DocumentGridType, DocumentOptions, DocumentProtectionOptions, DocxDocument, DocxPartRefs, DocxReadContext, DocxWriteContext, DrawingDescriptorOptions, DrawingOptions, DropCapType, DropDownListOptions, EditGroup, EditGroupType, EmphasisMarkType, EndnoteOptions, EndnotePropertiesOptions, EndnoteReference, EndnoteSeparator, EndnoteType, EndnotesData, ExtendedMediaData, ExternalHyperlinkOptions, FeaturesOptions, FlatTextOptions, Floating, FontAttributesProperties, FontTableInput, FootnoteEndnoteReferenceOptions, FootnoteOptions, FootnotePropertiesOptions, FootnoteReferenceElement, FootnoteSeparator, FootnoteType, FootnotesData, FormFieldCommonOptions, FormFieldOptions, FormFieldTextOptions, FormFieldTextType, FrameAnchorType, FrameOptions, FrameWrap, GlossaryDocumentOptions, GraphicFrameLocksOptions, GroupChild, GroupChildMediaData, GroupShapeLocksOptions, HeaderFooterGroup, HeaderFooterReferenceOptions, HeaderFooterReferenceType, HeaderFooterType, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionOptions, HorizontalPositionRelativeFrom, HyperlinkType, HyphenationOptions, ImageOptions, IndentAttributesProperties, InternalHyperlinkOptions, LastRenderedPageBreak, LeaderType, LevelFormat, LevelParagraphStylePropertiesOptions, LevelSuffix, LevelsOptions, LineNumberAttributes, LineNumberRestartFormat, LineRuleType, MailMergeDataType, MailMergeDest, MailMergeDocType, MailMergeOptions, MailMergeSourceType, Margins, MarkupRangeOptions, MathDelimiterProperties, MathInput, MathNaryLimitLocation, MathNaryProperties, MathPropertiesOptions, MathRunPropertiesOptions, MathScriptType, MathStyleType, Media, MediaData, MediaDataTransformation, MediaTransformation, MonthLong, MonthShort, MoveRangeOptions, MoveRangeStartOptions, NoBreakHyphen, NonVisualPropertiesOptions, NormalAutofitOptions, NumberFormat, NumberedItemReferenceFormat, NumberedItemReferenceOptions, Numbering, NumberingOptions, NumberingStyleOptions, type ObjectControlOptions, type ObjectElementOptions, type ObjectEmbedOptions, type ObjectIconImageOptions, type ObjectLinkOptions, OdsoFieldMapDataOptions, OdsoFieldType, OdsoOptions, OptimizeForBrowserOptions, type OutputByType, type OutputType, OverlapType, type PackerOptions, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBordersOptions, PageMarginAttributes, PageNumber, PageNumberElement, PageNumberSeparator, PageNumberTypeAttributes, PageOrientation, PageSizeAttributes, PageTextDirectionType, ParagraphChild, ParagraphOptions, ParagraphPropertiesChangeOptions, ParagraphPropertiesOptions, ParagraphPropertiesOptionsBase, ParagraphRunOptions, ParagraphRunPropertiesOptions, ParagraphStyleOptions, ParagraphStylePropertiesOptions, Patch, PatchComment, PatchDocumentOptions, PermStartOptions, PositionalTabAlignment, PositionalTabLeader, PositionalTabOptions, PositionalTabRelativeTo, PresetTextShapeOptions, ProofErrorType, ProofErrorTypeValue, ReadModeInkLockDownOptions, RelationshipEntry, RelationshipsInput, RelativeHorizontalPosition, RelativeVerticalPosition, RevisionViewOptions, RsidsOptions, RubyAlign, RubyOptions, RunOptions, RunPropertiesChangeOptions, RunPropertiesOptions, RunStylePropertiesOptions, SdtBlockOptions, SdtCellOptions, SdtCheckboxOptions, SdtCheckboxSymbol, SdtComboBoxOptions, SdtDataBindingOptions, SdtDateMappingType, SdtDateOptions, SdtDropDownListOptions, SdtListItem, SdtLock, SdtPropertiesOptions, SdtRowOptions, SdtRunOptions, SdtTextOptions, SectionChild, SectionOptions, SectionPropertiesChangeOptions, SectionPropertiesOptions, SectionPropertiesOptionsBase, SectionType, SectionVerticalAlign, Separator, SettingsOptions, ShadingAttributesProperties, ShadingType, ShapeStyleOptions, SimpleFieldOptions, SmartArtMediaData, SmartArtNode, SmartArtOptions, SmartTagRunOptions, SoftHyphen, SourceTypeOptions, SpaceType, SpacingProperties, StyleLevel, StyleMatrixReferenceOptions, StyleOptions, Styles, StylesOptions, SubDocCollection, SubDocData, SubDocOptions, SymbolRunOptions, TABLE_BORDERS_NONE, Tab, TabStopDefinition, TabStopPosition, TabStopType, TableAnchorType, TableBordersOptions, TableCellBordersOptions, TableCellOptions, TableFloatOptions, TableLayoutType, TableLookOptions, TableOfContentsOptions, TableOptions, TablePropertiesChangeOptions, TablePropertiesOptions, TablePropertiesOptionsBase, TablePropertyExChangeOptions, TablePropertyExOptions, TableRowOptions, TableRowPropertiesChangeOptions, TableRowPropertiesOptions, TableRowPropertiesOptionsBase, TableStyleOptions, TableStyleOverrideType, TableVerticalAlign, TableWidthProperties, TargetScreenSize, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextInputOptions, TextVertOverflowType, TextVerticalType, TextWrapping, TextWrappingSide, TextWrappingType, TextboxOptions, TextboxTightWrapType, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionOptions, VerticalPositionRelativeFrom, WebSettingsInput, WebSettingsOptions, WidthType, WpgCommonMediaData, WpgGroupCoreOptions, WpgGroupOptions, WpgGroupRunOptions, WpgMediaData, WpsMediaData, WpsShapeCoreOptions, WpsShapeOptions, WpsShapeRunOptions, WriteProtectionOptions, XYFrameOptions, YearLong, YearShort, altChunkDesc, appPropertiesDesc, bibliographyDesc, breakXml, buildContentTypesFromRegistry, buildNumberingCache, buildStyleCache, checkboxSymbolRunInner, commentsDesc, compileDocument, contentTypesDesc, corePropertiesDesc, createBodyProperties, createDocumentGrid, createFormFieldData, createHeaderFooterReference, createHorizontalPosition, createImageData, createLineNumberType, createPageMargin, createPageNumberType, createSectionType, createTransformation, createVerticalAlign, createVerticalPosition, createWrapThrough, createWrapTight, customPropertiesDesc, customXmlBlockDesc, drawingDesc, endnotesDesc, extractStyleId, fontTableDesc, footnotesDesc, frameXml, framesetXml, generateDocument, generateDocumentStream, generateDocumentSync, glossaryDesc, objectDesc, parseArchive, parseBodyProperties, parseCustomXmlProperties, parseDocument, parseDocx, parseFormFieldData, parseNumberingDefinitions, parseSdtBlock, parseSdtProperties, parseSectionPropertiesEl, parseStyleDefinitions, parseTableCellPropertiesEl, parseTablePropertiesEl, parseTableRowPropertiesEl, parseToc, parseTocFieldFromElements, parseTocFieldInstruction, patchDetector, patchDocument, relationshipsDesc, resetDrawingIdGen, sdtBlockDesc, sectionMarginDefaults, sectionPageSizeDefaults, sectionPropertiesDesc, selectTocEntryElements, setBodyParseChild, setTableParseChild, settingsDesc, stringifyCharacterStyle, stringifyChildDispatch, stringifyConditionalTableStyle, stringifyCustomXmlShell, stringifyNumberingStyle, stringifyParagraphInline, stringifyParagraphStyle, stringifyRunInline, stringifySdtPr, stringifySdtShell, stringifySectionPropertiesXml, stringifyTableOfContents, stringifyTableStyle, subDocDesc, tableDesc, webSettingsDesc, widthFiftiethsToPct, widthPctToFiftieths, withAltChunkOverrides, withMediaDefaults };
119
119
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { $ as PageBorderZOrder, $t as stringifyCustomXmlShell, A as StyleLevel, An as createBodyProperties, At as sectionPageSizeDefaults, B as stringifyNumberingStyle, Bn as TextboxTightWrapType, Bt as NumberFormat, C as footnotesDesc, Cn as EmphasisMarkType, Ct as parseSdtBlock, D as selectTocEntryElements, Dn as TextVertOverflowType, Dt as sectionPropertiesDesc, E as parseTocFieldInstruction, En as TextHorzOverflowType, Et as parseSectionPropertiesEl, F as extractStyleId, Fn as HighlightColor, Ft as createVerticalPosition, G as createHeaderFooterReference, Gt as TextWrappingSide, H as stringifyTableStyle, Hn as LineRuleType, Ht as VerticalPositionAlign, I as parseStyleDefinitions, In as TextEffect, It as createHorizontalPosition, J as LineNumberRestartFormat, Jt as checkboxSymbolRunInner, K as SectionType, Kt as TextWrappingType, L as DefaultStylesFactory, Ln as PageNumber, Lt as HorizontalPositionRelativeFrom, M as Styles, Mn as createImageData, Mt as PageOrientation, N as buildNumberingCache, Nn as Media, Nt as PageNumberSeparator, O as SdtDateMappingType, On as TextVerticalType, Ot as stringifySectionPropertiesXml, P as buildStyleCache, Pn as createTransformation, Pt as createPageNumberType, Q as PageBorderOffsetFrom, Qt as setBodyParseChild, R as stringifyCharacterStyle, Rn as breakXml, Rt as VerticalPositionRelativeFrom, S as endnotesDesc, Sn as PositionalTabRelativeTo, St as stringifyTableOfContents, T as parseTocFieldFromElements, Tn as TextBodyWrappingType, U as HeaderFooterReferenceType, Un as AlignmentType, Ut as createWrapThrough, V as stringifyParagraphStyle, Vn as HeadingLevel, Vt as SpaceType, W as HeaderFooterType, Wt as createWrapTight, X as createPageMargin, Xt as parseCustomXmlProperties, Y as createLineNumberType, Yt as customXmlBlockDesc, Z as PageBorderDisplay, Zt as sdtBlockDesc, _ as glossaryDesc, _n as createFormFieldData, a as appPropertiesDesc, an as WidthType, at as LevelFormat, b as CharacterSet, bn as PositionalTabAlignment, c as relationshipsDesc, cn as TableLayoutType, ct as parseTablePropertiesEl, d as withAltChunkOverrides, dn as RelativeVerticalPosition, dt as tableDesc, en as stringifySdtPr, et as DocumentGridType, f as withMediaDefaults, fn as TableAnchorType, ft as stringifyChildDispatch, g as DocPartType, gn as FormFieldTextType, gt as resetDrawingIdGen, h as DocPartGallery, hn as ProofErrorType, ht as drawingDesc, i as webSettingsDesc, in as objectDesc, it as parseNumberingDefinitions, j as settingsDesc, jn as parseBodyProperties, jt as PageTextDirectionType, k as SdtLock, kn as VerticalAnchor, kt as sectionMarginDefaults, l as buildContentTypesFromRegistry, ln as OverlapType, lt as parseTableRowPropertiesEl, m as DocPartBehavior, mn as VerticalMergeType, mt as stringifyRunInline, n as frameXml, nn as subDocDesc, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, on as TABLE_BORDERS_NONE, ot as LevelSuffix, p as commentsDesc, pn as TextDirection, pt as stringifyParagraphInline, q as createSectionType, qt as altChunkDesc, r as framesetXml, rt as Numbering, s as corePropertiesDesc, sn as BorderStyle, st as parseTableCellPropertiesEl, t as TargetScreenSize, tn as stringifySdtShell, tt as createDocumentGrid, u as contentTypesDesc, un as RelativeHorizontalPosition, ut as setTableParseChild, v as bibliographyDesc, vn as parseFormFieldData, w as parseToc, wn as UnderlineType, wt as parseSdtProperties, x as EditGroupType, xn as PositionalTabLeader, y as fontTableDesc, yn as RubyAlign, z as stringifyConditionalTableStyle, zn as TextAlignmentType, zt as HorizontalPositionAlign } from "./parts-CATV83XR.mjs";
2
- import { i as AltChunkCollection, n as DocxWriteContext, r as SubDocCollection, t as DocxReadContext } from "./context-CAYk5WLu.mjs";
1
+ import { $ as PageBorderZOrder, $t as stringifyCustomXmlShell, A as StyleLevel, An as TextVerticalType, At as sectionPageSizeDefaults, B as stringifyNumberingStyle, Bn as breakXml, Bt as NumberFormat, C as footnotesDesc, Cn as PositionalTabLeader, Ct as parseSdtBlock, D as selectTocEntryElements, Dn as TextBodyWrappingType, Dt as sectionPropertiesDesc, E as parseTocFieldInstruction, En as UnderlineType, Et as parseSectionPropertiesEl, F as extractStyleId, Fn as Media, Ft as createVerticalPosition, G as createHeaderFooterReference, Gn as AlignmentType, Gt as TextWrappingSide, H as stringifyTableStyle, Hn as TextboxTightWrapType, Ht as VerticalPositionAlign, I as parseStyleDefinitions, In as createTransformation, It as createHorizontalPosition, J as LineNumberRestartFormat, Jt as checkboxSymbolRunInner, K as SectionType, Kt as TextWrappingType, L as DefaultStylesFactory, Ln as HighlightColor, Lt as HorizontalPositionRelativeFrom, M as Styles, Mn as createBodyProperties, Mt as PageOrientation, N as buildNumberingCache, Nn as parseBodyProperties, Nt as PageNumberSeparator, O as SdtDateMappingType, On as TextHorzOverflowType, Ot as stringifySectionPropertiesXml, P as buildStyleCache, Pn as createImageData, Pt as createPageNumberType, Q as PageBorderOffsetFrom, Qt as setBodyParseChild, R as stringifyCharacterStyle, Rn as TextEffect, Rt as VerticalPositionRelativeFrom, S as endnotesDesc, Sn as PositionalTabAlignment, St as stringifyTableOfContents, T as parseTocFieldFromElements, Tn as EmphasisMarkType, U as HeaderFooterReferenceType, Un as HeadingLevel, Ut as createWrapThrough, V as stringifyParagraphStyle, Vn as TextAlignmentType, Vt as SpaceType, W as HeaderFooterType, Wn as LineRuleType, Wt as createWrapTight, X as createPageMargin, Xt as parseCustomXmlProperties, Y as createLineNumberType, Yt as customXmlBlockDesc, Z as PageBorderDisplay, Zt as sdtBlockDesc, _ as glossaryDesc, _n as ProofErrorType, a as appPropertiesDesc, an as WidthType, at as LevelFormat, b as CharacterSet, bn as parseFormFieldData, c as relationshipsDesc, cn as TABLE_BORDERS_NONE, ct as parseTablePropertiesEl, d as withAltChunkOverrides, dn as OverlapType, dt as tableDesc, en as stringifySdtPr, et as DocumentGridType, f as withMediaDefaults, fn as RelativeHorizontalPosition, ft as stringifyChildDispatch, g as DocPartType, gn as VerticalMergeType, gt as resetDrawingIdGen, h as DocPartGallery, hn as TextDirection, ht as drawingDesc, i as webSettingsDesc, in as objectDesc, it as parseNumberingDefinitions, j as settingsDesc, jn as VerticalAnchor, jt as PageTextDirectionType, k as SdtLock, kn as TextVertOverflowType, kt as sectionMarginDefaults, l as buildContentTypesFromRegistry, ln as BorderStyle, lt as parseTableRowPropertiesEl, m as DocPartBehavior, mn as TableAnchorType, mt as stringifyRunInline, n as frameXml, nn as subDocDesc, nt as DocumentAttributeNamespaces, o as customPropertiesDesc, on as widthFiftiethsToPct, ot as LevelSuffix, p as commentsDesc, pn as RelativeVerticalPosition, pt as stringifyParagraphInline, q as createSectionType, qt as altChunkDesc, r as framesetXml, rt as Numbering, s as corePropertiesDesc, sn as widthPctToFiftieths, st as parseTableCellPropertiesEl, t as TargetScreenSize, tn as stringifySdtShell, tt as createDocumentGrid, u as contentTypesDesc, un as TableLayoutType, ut as setTableParseChild, v as bibliographyDesc, vn as FormFieldTextType, w as parseToc, wn as PositionalTabRelativeTo, wt as parseSdtProperties, x as EditGroupType, xn as RubyAlign, y as fontTableDesc, yn as createFormFieldData, z as stringifyConditionalTableStyle, zn as PageNumber, zt as HorizontalPositionAlign } from "./parts-7TLJ0TNR.mjs";
2
+ import { i as AltChunkCollection, n as DocxWriteContext, r as SubDocCollection, t as DocxReadContext } from "./context-YVFle0J6.mjs";
3
3
  import { patchDetector, patchDocument } from "./patch/index.mjs";
4
- import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-DPBWKO12.mjs";
5
- import { i as compileDocument, n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-Di_7M9eJ.mjs";
4
+ import { n as parseDocument, r as parseDocx, t as parseArchive } from "./parse-BcxcUGsx.mjs";
5
+ import { i as compileDocument, n as generateDocumentStream, r as generateDocumentSync, t as generateDocument } from "./generate-fsy5ESN0.mjs";
6
6
  //#region src/parts/paragraph/formatting/break.ts
7
7
  /**
8
8
  * Break type values for WordprocessingML documents.
@@ -367,6 +367,6 @@ const VerticalAlignSection = {
367
367
  */
368
368
  const createVerticalAlign = (value) => `<w:vAlign w:val="${value}"/>`;
369
369
  //#endregion
370
- export { AlignmentType, AltChunkCollection, BorderStyle, BreakType, CharacterSet, DefaultStylesFactory, DocPartBehavior, DocPartGallery, DocPartType, DocumentAttributeNamespaces, DocumentGridType, DocxReadContext, DocxWriteContext, DropCapType, EditGroupType, EmphasisMarkType, EndnoteType, FootnoteType, FormFieldTextType, FrameAnchorType, FrameWrap, HeaderFooterReferenceType, HeaderFooterType, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HyperlinkType, LeaderType, LevelFormat, LevelSuffix, LineNumberRestartFormat, LineRuleType, Media, NumberFormat, NumberedItemReferenceFormat, Numbering, OverlapType, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageNumber, PageNumberSeparator, PageOrientation, PageTextDirectionType, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, ProofErrorType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, SdtDateMappingType, SdtLock, SectionType, ShadingType, SpaceType, StyleLevel, Styles, SubDocCollection, TABLE_BORDERS_NONE, TabStopPosition, TabStopType, TableAnchorType, TableLayoutType, TargetScreenSize, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, TextboxTightWrapType, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WidthType, altChunkDesc, appPropertiesDesc, bibliographyDesc, breakXml, buildContentTypesFromRegistry, buildNumberingCache, buildStyleCache, checkboxSymbolRunInner, commentsDesc, compileDocument, contentTypesDesc, corePropertiesDesc, createBodyProperties, createDocumentGrid, createFormFieldData, createHeaderFooterReference, createHorizontalPosition, createImageData, createLineNumberType, createPageMargin, createPageNumberType, createSectionType, createTransformation, createVerticalAlign, createVerticalPosition, createWrapThrough, createWrapTight, customPropertiesDesc, customXmlBlockDesc, drawingDesc, endnotesDesc, extractStyleId, fontTableDesc, footnotesDesc, frameXml, framesetXml, generateDocument, generateDocumentStream, generateDocumentSync, glossaryDesc, objectDesc, parseArchive, parseBodyProperties, parseCustomXmlProperties, parseDocument, parseDocx, parseFormFieldData, parseNumberingDefinitions, parseSdtBlock, parseSdtProperties, parseSectionPropertiesEl, parseStyleDefinitions, parseTableCellPropertiesEl, parseTablePropertiesEl, parseTableRowPropertiesEl, parseToc, parseTocFieldFromElements, parseTocFieldInstruction, patchDetector, patchDocument, relationshipsDesc, resetDrawingIdGen, sdtBlockDesc, sectionMarginDefaults, sectionPageSizeDefaults, sectionPropertiesDesc, selectTocEntryElements, setBodyParseChild, setTableParseChild, settingsDesc, stringifyCharacterStyle, stringifyChildDispatch, stringifyConditionalTableStyle, stringifyCustomXmlShell, stringifyNumberingStyle, stringifyParagraphInline, stringifyParagraphStyle, stringifyRunInline, stringifySdtPr, stringifySdtShell, stringifySectionPropertiesXml, stringifyTableOfContents, stringifyTableStyle, subDocDesc, tableDesc, webSettingsDesc, withAltChunkOverrides, withMediaDefaults };
370
+ export { AlignmentType, AltChunkCollection, BorderStyle, BreakType, CharacterSet, DefaultStylesFactory, DocPartBehavior, DocPartGallery, DocPartType, DocumentAttributeNamespaces, DocumentGridType, DocxReadContext, DocxWriteContext, DropCapType, EditGroupType, EmphasisMarkType, EndnoteType, FootnoteType, FormFieldTextType, FrameAnchorType, FrameWrap, HeaderFooterReferenceType, HeaderFooterType, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HyperlinkType, LeaderType, LevelFormat, LevelSuffix, LineNumberRestartFormat, LineRuleType, Media, NumberFormat, NumberedItemReferenceFormat, Numbering, OverlapType, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageNumber, PageNumberSeparator, PageOrientation, PageTextDirectionType, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, ProofErrorType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, SdtDateMappingType, SdtLock, SectionType, ShadingType, SpaceType, StyleLevel, Styles, SubDocCollection, TABLE_BORDERS_NONE, TabStopPosition, TabStopType, TableAnchorType, TableLayoutType, TargetScreenSize, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, TextboxTightWrapType, UnderlineType, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WidthType, altChunkDesc, appPropertiesDesc, bibliographyDesc, breakXml, buildContentTypesFromRegistry, buildNumberingCache, buildStyleCache, checkboxSymbolRunInner, commentsDesc, compileDocument, contentTypesDesc, corePropertiesDesc, createBodyProperties, createDocumentGrid, createFormFieldData, createHeaderFooterReference, createHorizontalPosition, createImageData, createLineNumberType, createPageMargin, createPageNumberType, createSectionType, createTransformation, createVerticalAlign, createVerticalPosition, createWrapThrough, createWrapTight, customPropertiesDesc, customXmlBlockDesc, drawingDesc, endnotesDesc, extractStyleId, fontTableDesc, footnotesDesc, frameXml, framesetXml, generateDocument, generateDocumentStream, generateDocumentSync, glossaryDesc, objectDesc, parseArchive, parseBodyProperties, parseCustomXmlProperties, parseDocument, parseDocx, parseFormFieldData, parseNumberingDefinitions, parseSdtBlock, parseSdtProperties, parseSectionPropertiesEl, parseStyleDefinitions, parseTableCellPropertiesEl, parseTablePropertiesEl, parseTableRowPropertiesEl, parseToc, parseTocFieldFromElements, parseTocFieldInstruction, patchDetector, patchDocument, relationshipsDesc, resetDrawingIdGen, sdtBlockDesc, sectionMarginDefaults, sectionPageSizeDefaults, sectionPropertiesDesc, selectTocEntryElements, setBodyParseChild, setTableParseChild, settingsDesc, stringifyCharacterStyle, stringifyChildDispatch, stringifyConditionalTableStyle, stringifyCustomXmlShell, stringifyNumberingStyle, stringifyParagraphInline, stringifyParagraphStyle, stringifyRunInline, stringifySdtPr, stringifySdtShell, stringifySectionPropertiesXml, stringifyTableOfContents, stringifyTableStyle, subDocDesc, tableDesc, webSettingsDesc, widthFiftiethsToPct, widthPctToFiftieths, withAltChunkOverrides, withMediaDefaults };
371
371
 
372
372
  //# sourceMappingURL=index.mjs.map
@@ -1,5 +1,5 @@
1
- import { C as footnotesDesc, Ct as parseSdtBlock, D as selectTocEntryElements, Et as parseSectionPropertiesEl, I as parseStyleDefinitions, N as buildNumberingCache, P as buildStyleCache, Qt as setBodyParseChild, S as endnotesDesc, T as parseTocFieldFromElements, Xt as parseCustomXmlProperties, _ as glossaryDesc, _t as parseParagraph, a as appPropertiesDesc, dt as tableDesc, i as webSettingsDesc, it as parseNumberingDefinitions, j as settingsDesc, o as customPropertiesDesc, p as commentsDesc, rn as stringifyElement, s as corePropertiesDesc, u as contentTypesDesc, ut as setTableParseChild, v as bibliographyDesc, vt as parseParagraphProperties, w as parseToc, xt as replaceRelsWithPlaceholders, y as fontTableDesc } from "./parts-CATV83XR.mjs";
2
- import { t as DocxReadContext } from "./context-CAYk5WLu.mjs";
1
+ import { C as footnotesDesc, Ct as parseSdtBlock, D as selectTocEntryElements, Et as parseSectionPropertiesEl, I as parseStyleDefinitions, N as buildNumberingCache, P as buildStyleCache, Qt as setBodyParseChild, S as endnotesDesc, T as parseTocFieldFromElements, Xt as parseCustomXmlProperties, _ as glossaryDesc, _t as parseParagraph, a as appPropertiesDesc, dt as tableDesc, i as webSettingsDesc, it as parseNumberingDefinitions, j as settingsDesc, o as customPropertiesDesc, p as commentsDesc, rn as stringifyElement, s as corePropertiesDesc, u as contentTypesDesc, ut as setTableParseChild, v as bibliographyDesc, vt as parseParagraphProperties, w as parseToc, xt as replaceRelsWithPlaceholders, y as fontTableDesc } from "./parts-7TLJ0TNR.mjs";
2
+ import { t as DocxReadContext } from "./context-YVFle0J6.mjs";
3
3
  import { parseArchive, toUint8Array } from "@office-open/core";
4
4
  import { attr, findChild, findDeep, findFirst, textOf } from "@office-open/xml";
5
5
  //#region \0polyfill-node.global.js
@@ -1937,4 +1937,4 @@ function parseDocx(data) {
1937
1937
  //#endregion
1938
1938
  export { parseDocument as n, parseDocx as r, parseArchive as t };
1939
1939
 
1940
- //# sourceMappingURL=parse-DPBWKO12.mjs.map
1940
+ //# sourceMappingURL=parse-BcxcUGsx.mjs.map