@office-open/docx 0.10.12 → 0.10.14

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.
Files changed (37) hide show
  1. package/dist/chart.d.mts +1 -0
  2. package/dist/chart.mjs +2 -0
  3. package/dist/{parts-B7Sfx_F0.mjs → comments-Cn9Q0iT6.mjs} +173 -5534
  4. package/dist/comments-Cn9Q0iT6.mjs.map +1 -0
  5. package/dist/context-B5k1UabT.mjs +4530 -0
  6. package/dist/context-B5k1UabT.mjs.map +1 -0
  7. package/dist/{core-properties-CIG9ZnsW.d.mts → core-properties-C4tdD3KL.d.mts} +67 -61
  8. package/dist/core-properties-C4tdD3KL.d.mts.map +1 -0
  9. package/dist/document-attributes-C6PDT-ap.mjs +60 -0
  10. package/dist/document-attributes-C6PDT-ap.mjs.map +1 -0
  11. package/dist/drawingml.d.mts +1 -0
  12. package/dist/drawingml.mjs +2 -0
  13. package/dist/{generate-DjODfjQ1.mjs → generate-BxIo24VV.mjs} +16 -15
  14. package/dist/generate-BxIo24VV.mjs.map +1 -0
  15. package/dist/generate.d.mts +1 -1
  16. package/dist/generate.mjs +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.mts.map +1 -1
  19. package/dist/index.mjs +1157 -5
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/{parse-DDWWDGbX.mjs → parse-ep7JKATJ.mjs} +186 -8
  22. package/dist/parse-ep7JKATJ.mjs.map +1 -0
  23. package/dist/parse.d.mts +1 -1
  24. package/dist/parse.mjs +1 -1
  25. package/dist/patch/index.d.mts +1 -1
  26. package/dist/patch/index.d.mts.map +1 -1
  27. package/dist/patch/index.mjs +17 -11
  28. package/dist/patch/index.mjs.map +1 -1
  29. package/dist/smartart.d.mts +1 -0
  30. package/dist/smartart.mjs +2 -0
  31. package/package.json +16 -4
  32. package/dist/context-CiyAhqTX.mjs +0 -479
  33. package/dist/context-CiyAhqTX.mjs.map +0 -1
  34. package/dist/core-properties-CIG9ZnsW.d.mts.map +0 -1
  35. package/dist/generate-DjODfjQ1.mjs.map +0 -1
  36. package/dist/parse-DDWWDGbX.mjs.map +0 -1
  37. package/dist/parts-B7Sfx_F0.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/parts/paragraph/formatting/break.ts","../src/parts/paragraph/formatting/tab-stop.ts","../src/parts/paragraph/links/hyperlink.ts","../src/parts/paragraph/links/numbered-item-ref.ts","../src/parts/paragraph/frame/frame-properties.ts","../src/parts/table/table-row/table-row-height.ts","../src/parts/footnotes/footnote/footnote.ts","../src/parts/endnotes/endnote/endnote.ts","../src/shared/track-revision/track-revision-components/cell-merge.ts","../src/shared/vertical-align.ts"],"sourcesContent":["/**\n * Break type values for WordprocessingML documents.\n *\n * @module\n */\n\n/**\n * Break type constants.\n * @internal\n */\nexport const BreakType = {\n /** Column break */\n COLUMN: \"column\",\n /** Page break */\n PAGE: \"page\",\n} as const;\n\nexport type BreakTypeValue = (typeof BreakType)[keyof typeof BreakType];\n","/**\n * Tab stop module for WordprocessingML documents.\n *\n * This module provides tab stop definitions for paragraphs.\n *\n * Reference: http://officeopenxml.com/WPtab.php\n *\n * @module\n */\n\n/**\n * Definition for a single tab stop.\n *\n * @see {@link TabStop}\n */\nexport interface TabStopDefinition {\n /** The type of tab stop alignment */\n type: (typeof TabStopType)[keyof typeof TabStopType];\n /** The position of the tab stop in twips */\n position: number | (typeof TabStopPosition)[keyof typeof TabStopPosition];\n /** Optional leader character to fill space before the tab */\n leader?: (typeof LeaderType)[keyof typeof LeaderType];\n}\n\n/**\n * Tab stop alignment types.\n *\n * Specifies the type of tab stop and how text aligns to it.\n *\n * @publicApi\n */\nexport const TabStopType = {\n /** Left-aligned tab stop */\n LEFT: \"left\",\n /** Right-aligned tab stop */\n RIGHT: \"right\",\n /** Center-aligned tab stop */\n CENTER: \"center\",\n /** Bar tab stop - inserts a vertical bar at the position */\n BAR: \"bar\",\n /** Clears a tab stop at the specified position */\n CLEAR: \"clear\",\n /** Decimal-aligned tab stop - aligns on decimal point */\n DECIMAL: \"decimal\",\n /** End-aligned tab stop (right-to-left equivalent) */\n END: \"end\",\n /** List tab stop for numbered lists */\n NUM: \"num\",\n /** Start-aligned tab stop (left-to-right equivalent) */\n START: \"start\",\n} as const;\n\n/**\n * Tab stop leader character types.\n *\n * Specifies the character used to fill the space before the tab stop.\n *\n * @publicApi\n */\nexport const LeaderType = {\n /** Dot leader (....) */\n DOT: \"dot\",\n /** Heavy leader */\n HEAVY: \"heavy\",\n /** Hyphen leader (----) */\n HYPHEN: \"hyphen\",\n /** Middle dot leader (····) */\n MIDDLE_DOT: \"middleDot\",\n /** No leader */\n NONE: \"none\",\n /** Underscore leader (____) */\n UNDERSCORE: \"underscore\",\n} as const;\n\n/**\n * Predefined tab stop positions.\n *\n * @publicApi\n */\nexport const TabStopPosition = {\n /** Maximum tab stop position (right margin) */\n MAX: 9026,\n} as const;\n","/**\n * Hyperlink types for WordprocessingML documents.\n *\n * @module\n */\n\n/**\n * Hyperlink type enumeration.\n * @publicApi\n */\nexport const HyperlinkType = {\n /** Internal hyperlink to a bookmark within the document */\n INTERNAL: \"INTERNAL\",\n /** External hyperlink to a URL outside the document */\n EXTERNAL: \"EXTERNAL\",\n} as const;\n\n/**\n * Options for creating an internal hyperlink.\n */\nexport interface InternalHyperlinkOptions {\n /** Name of the bookmark to link to within the document */\n anchor: string;\n /** Screen tip text shown when hovering over the hyperlink */\n tooltip?: string;\n}\n\n/**\n * Options for creating an external hyperlink.\n */\nexport interface ExternalHyperlinkOptions {\n /** URL to link to outside the document */\n link: string;\n /** Screen tip text shown when hovering over the hyperlink */\n tooltip?: string;\n /** Target frame for the hyperlink (e.g., \"_blank\", \"_self\") */\n tgtFrame?: string;\n}\n","/**\n * Numbered item reference module for WordprocessingML documents.\n *\n * This module provides cross-references to numbered items (such as\n * numbered paragraphs, list items, or headings) within a document.\n *\n * Reference: https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/7088a8ce-e784-49d4-94b8-cba6ef8fce78\n *\n * @module\n */\n\n/**\n * Format options for numbered item references.\n *\n * Specifies how the paragraph number should be displayed when referenced.\n */\nexport enum NumberedItemReferenceFormat {\n NONE = \"none\",\n /**\n * \\r option - inserts the paragraph number of the bookmarked paragraph in relative context, or relative to its position in the numbering scheme\n */\n RELATIVE = \"relative\",\n /**\n * \\n option - causes the field result to be the paragraph number without trailing periods. No information about prior numbered levels is displayed unless it is included as part of the current level.\n */\n NO_CONTEXT = \"no_context\",\n /**\n * \\w option - causes the field result to be the entire paragraph number without trailing periods, regardless of the location of the REF field.\n */\n FULL_CONTEXT = \"full_context\",\n}\n\nexport interface NumberedItemReferenceOptions {\n /**\n * \\h option - Creates a hyperlink to the bookmarked paragraph.\n * @default true\n */\n hyperlink?: boolean;\n /**\n * Which switch to use for the reference format\n * @default NumberedItemReferenceFormat.FULL_CONTEXT\n */\n referenceFormat?: NumberedItemReferenceFormat;\n}\n","/**\n * Frame properties module for paragraph text frames in WordprocessingML documents.\n *\n * Frames allow paragraphs to be positioned absolutely on the page, enabling text wrapping\n * and drop cap effects. They are commonly used for floating text boxes and decorative elements.\n *\n * Reference: http://officeopenxml.com/WPparagraph-textFrames.php\n *\n * @module\n */\nimport type { UniversalMeasure } from \"@office-open/core\";\nimport type { HeightRule } from \"@parts/table\";\nimport type { HorizontalPositionAlign, VerticalPositionAlign } from \"@shared/constants\";\n\n/**\n * Drop cap types for paragraph frames.\n */\nexport const DropCapType = {\n /** No drop cap effect */\n NONE: \"none\",\n /** Drop cap that drops down into the paragraph text */\n DROP: \"drop\",\n /** Drop cap that extends into the margin */\n MARGIN: \"margin\",\n} as const;\n\n/**\n * Frame anchor types specifying what the frame should be anchored relative to.\n */\nexport const FrameAnchorType = {\n /** Anchor relative to the page margin */\n MARGIN: \"margin\",\n /** Anchor relative to the page edge */\n PAGE: \"page\",\n /** Anchor relative to the text column */\n TEXT: \"text\",\n} as const;\n\n/**\n * Text wrapping types for frames.\n */\nexport const FrameWrap = {\n /** Wrap text around the frame on all sides */\n AROUND: \"around\",\n /** Automatic wrapping based on available space */\n AUTO: \"auto\",\n /** No text wrapping */\n NONE: \"none\",\n /** Do not allow text beside the frame */\n NOT_BESIDE: \"notBeside\",\n /** Allow text to flow through the frame */\n THROUGH: \"through\",\n /** Wrap text tightly around the frame */\n TIGHT: \"tight\",\n} as const;\n\n/**\n * Base options shared by all frame types.\n */\ninterface BaseFrameOptions {\n /** Lock the anchor position to prevent it from moving */\n anchorLock?: boolean;\n /** Drop cap effect type */\n dropCap?: (typeof DropCapType)[keyof typeof DropCapType];\n /** Frame width in twips or universal measure (e.g., \"1cm\", \"0.5in\") */\n width: number | UniversalMeasure;\n /** Frame height in twips or universal measure (e.g., \"1cm\", \"0.5in\") */\n height: number | UniversalMeasure;\n /** Text wrapping behavior around the frame */\n wrap?: (typeof FrameWrap)[keyof typeof FrameWrap];\n /** Number of lines for drop cap effect */\n lines?: number;\n /** Anchor reference points for horizontal and vertical positioning */\n anchor: {\n /** Horizontal anchor reference point */\n horizontal: (typeof FrameAnchorType)[keyof typeof FrameAnchorType];\n /** Vertical anchor reference point */\n vertical: (typeof FrameAnchorType)[keyof typeof FrameAnchorType];\n };\n /** Spacing between frame and surrounding text in twips */\n space?: {\n /** Horizontal spacing in twips or universal measure */\n horizontal: number | UniversalMeasure;\n /** Vertical spacing in twips or universal measure */\n vertical: number | UniversalMeasure;\n };\n /** Height rule determining how frame height is calculated */\n rule?: (typeof HeightRule)[keyof typeof HeightRule];\n}\n\n/**\n * Options for frames positioned using absolute X/Y coordinates.\n */\nexport type XYFrameOptions = {\n /** Must be \"absolute\" for coordinate-based positioning */\n type: \"absolute\";\n /** Absolute X and Y coordinates in twips */\n position: {\n /** Horizontal position in twips or universal measure from the anchor point */\n x: number | UniversalMeasure;\n /** Vertical position in twips or universal measure from the anchor point */\n y: number | UniversalMeasure;\n };\n} & BaseFrameOptions;\n\n/**\n * Options for frames positioned using alignment values.\n */\nexport type AlignmentFrameOptions = {\n /** Must be \"alignment\" for alignment-based positioning */\n type: \"alignment\";\n /** Horizontal and vertical alignment values */\n alignment: {\n /** Horizontal alignment relative to the anchor */\n x: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];\n /** Vertical alignment relative to the anchor */\n y: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];\n };\n} & BaseFrameOptions;\n\n/**\n * Union type for all frame positioning options.\n */\nexport type FrameOptions = XYFrameOptions | AlignmentFrameOptions;\n","/**\n * Table row height module for WordprocessingML documents.\n *\n * This module provides row height configuration including rules for how height should be applied.\n *\n * Reference: http://officeopenxml.com/WPtableRow.php\n *\n * @module\n */\n\n/**\n * Height rules for table rows.\n *\n * Specifies how the height value should be interpreted.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_HeightRule\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"auto\"/>\n * <xsd:enumeration value=\"exact\"/>\n * <xsd:enumeration value=\"atLeast\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const HeightRule = {\n /** Height is determined based on the content, so value is ignored. */\n AUTO: \"auto\",\n /** At least the value specified */\n ATLEAST: \"atLeast\",\n /** Exactly the value specified */\n EXACT: \"exact\",\n} as const;\n","/**\n * Footnote module for WordprocessingML documents.\n *\n * This module provides support for footnotes that appear at the bottom\n * of the page referenced from the main document text.\n *\n * Reference: http://officeopenxml.com/WPfootnotes.php\n *\n * @module\n */\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\n\n/**\n * Enumeration of footnote types.\n *\n * Reference: http://officeopenxml.com/WPfootnotes.php\n *\n * @publicApi\n */\nexport const FootnoteType = {\n /** Separator line between body text and footnotes */\n SEPERATOR: \"separator\",\n /** Continuation separator for footnotes spanning pages */\n CONTINUATION_SEPERATOR: \"continuationSeparator\",\n} as const;\n\n/**\n * Options for creating a Footnote.\n *\n * @property id - Unique numeric identifier for this footnote\n * @property type - Type of footnote (separator, continuationSeparator, or normal)\n * @property children - Array of paragraphs that make up the footnote content\n *\n * @see {@link Footnote}\n */\nexport interface FootnoteOptions {\n /** Unique numeric identifier for this footnote */\n id: number;\n /** Type of footnote (separator or continuation separator) */\n type?: (typeof FootnoteType)[keyof typeof FootnoteType];\n /** Content of the footnote (paragraphs, tables, etc.) */\n children: (ParagraphOptions | string)[];\n}\n","/**\n * Endnote module for WordprocessingML documents.\n *\n * @module\n */\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\n\nexport const EndnoteType = {\n CONTINUATION_SEPARATOR: \"continuationSeparator\",\n\n SEPARATOR: \"separator\",\n} as const;\n\nexport interface EndnoteOptions {\n id: number;\n type?: (typeof EndnoteType)[keyof typeof EndnoteType];\n children: (ParagraphOptions | string)[];\n}\n","/**\n * Cell merge track revision component.\n *\n * @module\n */\n\nimport type { ChangedAttributesProperties } from \"../track-revision\";\n\n/**\n * Vertical merge revision types.\n */\nexport const VerticalMergeRevisionType = {\n /**\n * Cell that is merged with upper one.\n */\n CONTINUE: \"continue\",\n /**\n * Cell that is starting the vertical merge.\n */\n RESTART: \"restart\",\n} as const;\n\nexport type CellMergeAttributes = ChangedAttributesProperties & {\n verticalMerge?: (typeof VerticalMergeRevisionType)[keyof typeof VerticalMergeRevisionType];\n verticalMergeOriginal?: (typeof VerticalMergeRevisionType)[keyof typeof VerticalMergeRevisionType];\n};\n","/**\n * Vertical alignment module for WordprocessingML documents.\n *\n * This module provides vertical alignment options for table cells and sections.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_VerticalJc\">\n * <xsd:attribute name=\"val\" type=\"ST_VerticalJc\" use=\"required\"/>\n * </xsd:complexType>\n *\n * <xsd:simpleType name=\"ST_VerticalJc\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"both\"/>\n * <xsd:enumeration value=\"top\"/>\n * <xsd:enumeration value=\"center\"/>\n * <xsd:enumeration value=\"bottom\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @module\n */\n/**\n * Enumeration for table-cell vertical alignment. Only `top`, `center`, `bottom`\n * are valid according to ECMA-376 (§17.18.87 ST_VerticalJc within `<w:tcPr>`).\n *\n * @publicApi\n */\nexport const VerticalAlignTable = {\n BOTTOM: \"bottom\",\n CENTER: \"center\",\n TOP: \"top\",\n} as const;\n\n/**\n * Enumeration for section (<w:sectPr>) vertical alignment. Adds `both` on top of\n * the table-cell set (§17.18.87 ST_VerticalJc within <w:sectPr>).\n *\n * @publicApi\n */\nexport const VerticalAlignSection = {\n ...VerticalAlignTable,\n BOTH: \"both\",\n} as const;\n\nexport type TableVerticalAlign = (typeof VerticalAlignTable)[keyof typeof VerticalAlignTable];\n\nexport type SectionVerticalAlign = (typeof VerticalAlignSection)[keyof typeof VerticalAlignSection];\n\n/**\n * Creates a vertical alignment element in a WordprocessingML document.\n *\n * Used in table cells and sections to control vertical text positioning.\n *\n * @example\n * ```typescript\n * createVerticalAlign(VerticalAlignTable.CENTER);\n * ```\n */\nexport const createVerticalAlign = (value: TableVerticalAlign | SectionVerticalAlign): string =>\n `<w:vAlign w:val=\"${value}\"/>`;\n"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAa,YAAY;;CAEvB,QAAQ;;CAER,MAAM;AACR;;;;;;;;;;ACgBA,MAAa,cAAc;;CAEzB,MAAM;;CAEN,OAAO;;CAEP,QAAQ;;CAER,KAAK;;CAEL,OAAO;;CAEP,SAAS;;CAET,KAAK;;CAEL,KAAK;;CAEL,OAAO;AACT;;;;;;;;AASA,MAAa,aAAa;;CAExB,KAAK;;CAEL,OAAO;;CAEP,QAAQ;;CAER,YAAY;;CAEZ,MAAM;;CAEN,YAAY;AACd;;;;;;AAOA,MAAa,kBAAkB;;AAE7B,KAAK,KACP;;;;;;;;;;;;ACxEA,MAAa,gBAAgB;;CAE3B,UAAU;;CAEV,UAAU;AACZ;;;;;;;;;;;;;;;;;;ACCA,IAAY,8BAAL,yBAAA,6BAAA;CACL,4BAAA,UAAA;;;;CAIA,4BAAA,cAAA;;;;CAIA,4BAAA,gBAAA;;;;CAIA,4BAAA,kBAAA;;AACF,EAAA,CAAA,CAAA;;;;;;ACbA,MAAa,cAAc;;CAEzB,MAAM;;CAEN,MAAM;;CAEN,QAAQ;AACV;;;;AAKA,MAAa,kBAAkB;;CAE7B,QAAQ;;CAER,MAAM;;CAEN,MAAM;AACR;;;;AAKA,MAAa,YAAY;;CAEvB,QAAQ;;CAER,MAAM;;CAEN,MAAM;;CAEN,YAAY;;CAEZ,SAAS;;CAET,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BA,MAAa,aAAa;;CAExB,MAAM;;CAEN,SAAS;;CAET,OAAO;AACT;;;;;;;;;;AChBA,MAAa,eAAe;;CAE1B,WAAW;;CAEX,wBAAwB;AAC1B;;;ACjBA,MAAa,cAAc;CACzB,wBAAwB;CAExB,WAAW;AACb;;;;;;ACAA,MAAa,4BAA4B;;;;CAIvC,UAAU;;;;CAIV,SAAS;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACSA,MAAa,qBAAqB;CAChC,QAAQ;CACR,QAAQ;CACR,KAAK;AACP;;;;;;;AAQA,MAAa,uBAAuB;CAClC,GAAG;CACH,MAAM;AACR;;;;;;;;;;;AAgBA,MAAa,uBAAuB,UAClC,oBAAoB,MAAM"}
1
+ {"version":3,"file":"index.mjs","names":["createWrapPolygon"],"sources":["../src/parts/paragraph/formatting/break.ts","../src/parts/paragraph/formatting/tab-stop.ts","../src/parts/paragraph/properties.ts","../src/parts/paragraph/run/properties.ts","../src/parts/paragraph/run/underline.ts","../src/parts/paragraph/run/emphasis-mark.ts","../src/parts/paragraph/run/positional-tab.ts","../src/parts/paragraph/run/ruby.ts","../src/parts/paragraph/run/proof-error.ts","../src/parts/paragraph/links/hyperlink.ts","../src/parts/paragraph/links/numbered-item-ref.ts","../src/parts/paragraph/frame/frame-properties.ts","../src/parts/table/table-properties/table-float-properties.ts","../src/parts/table/table-properties/table-layout.ts","../src/parts/table/table-properties/table-borders.ts","../src/parts/table/table-row/table-row-height.ts","../src/parts/drawing/text-wrap/wrap-tight.ts","../src/parts/drawing/text-wrap/wrap-through.ts","../src/parts/drawing/floating/horizontal-position.ts","../src/parts/drawing/floating/vertical-position.ts","../src/parts/document/body/section-properties/properties/doc-grid.ts","../src/parts/document/body/section-properties/properties/page-borders.ts","../src/parts/document/body/section-properties/properties/page-margin.ts","../src/parts/document/body/section-properties/properties/line-number.ts","../src/parts/document/body/section-properties/properties/section-type.ts","../src/parts/document/body/section-properties/properties/header-footer-reference.ts","../src/parts/table-of-contents/table-of-contents-properties.ts","../src/parts/table-of-contents/sdt-properties.ts","../src/parts/footnotes/footnote/footnote.ts","../src/parts/endnotes/endnote/endnote.ts","../src/parts/perm-start.ts","../src/parts/fonts/font.ts","../src/parts/relationships.ts","../src/shared/track-revision/track-revision-components/cell-merge.ts","../src/shared/vertical-align.ts"],"sourcesContent":["/**\n * Break type values for WordprocessingML documents.\n *\n * @module\n */\n\n/**\n * Break type constants.\n * @internal\n */\nexport const BreakType = {\n /** Column break */\n COLUMN: \"column\",\n /** Page break */\n PAGE: \"page\",\n} as const;\n\nexport type BreakTypeValue = (typeof BreakType)[keyof typeof BreakType];\n","/**\n * Tab stop module for WordprocessingML documents.\n *\n * This module provides tab stop definitions for paragraphs.\n *\n * Reference: http://officeopenxml.com/WPtab.php\n *\n * @module\n */\n\n/**\n * Definition for a single tab stop.\n *\n * @see {@link TabStop}\n */\nexport interface TabStopDefinition {\n /** The type of tab stop alignment */\n type: (typeof TabStopType)[keyof typeof TabStopType];\n /** The position of the tab stop in twips */\n position: number | (typeof TabStopPosition)[keyof typeof TabStopPosition];\n /** Optional leader character to fill space before the tab */\n leader?: (typeof LeaderType)[keyof typeof LeaderType];\n}\n\n/**\n * Tab stop alignment types.\n *\n * Specifies the type of tab stop and how text aligns to it.\n *\n * @publicApi\n */\nexport const TabStopType = {\n /** Left-aligned tab stop */\n LEFT: \"left\",\n /** Right-aligned tab stop */\n RIGHT: \"right\",\n /** Center-aligned tab stop */\n CENTER: \"center\",\n /** Bar tab stop - inserts a vertical bar at the position */\n BAR: \"bar\",\n /** Clears a tab stop at the specified position */\n CLEAR: \"clear\",\n /** Decimal-aligned tab stop - aligns on decimal point */\n DECIMAL: \"decimal\",\n /** End-aligned tab stop (right-to-left equivalent) */\n END: \"end\",\n /** List tab stop for numbered lists */\n NUM: \"num\",\n /** Start-aligned tab stop (left-to-right equivalent) */\n START: \"start\",\n} as const;\n\n/**\n * Tab stop leader character types.\n *\n * Specifies the character used to fill the space before the tab stop.\n *\n * @publicApi\n */\nexport const LeaderType = {\n /** Dot leader (....) */\n DOT: \"dot\",\n /** Heavy leader */\n HEAVY: \"heavy\",\n /** Hyphen leader (----) */\n HYPHEN: \"hyphen\",\n /** Middle dot leader (····) */\n MIDDLE_DOT: \"middleDot\",\n /** No leader */\n NONE: \"none\",\n /** Underscore leader (____) */\n UNDERSCORE: \"underscore\",\n} as const;\n\n/**\n * Predefined tab stop positions.\n *\n * @publicApi\n */\nexport const TabStopPosition = {\n /** Maximum tab stop position (right margin) */\n MAX: 9026,\n} as const;\n","import type { ShadingProperties } from \"@shared/shading\";\n/**\n * Paragraph properties types for WordprocessingML documents.\n *\n * Reference: http://officeopenxml.com/WPparagraphProperties.php\n *\n * @module\n */\nimport type { ChangedProperties } from \"@shared/track-revision/track-revision\";\n\nimport type { AlignmentType } from \"./formatting/alignment\";\nimport type { BordersOptions } from \"./formatting/border\";\nimport type { CnfConditionalOptions } from \"./formatting/cnf-style\";\nimport type { IndentProperties } from \"./formatting/indent\";\nimport type { SpacingProperties } from \"./formatting/spacing\";\nimport type { HeadingLevel } from \"./formatting/style\";\nimport type { TabStopDefinition } from \"./formatting/tab-stop\";\nimport type { FrameOptions } from \"./frame/frame-properties\";\nimport type { ParagraphRunOptions } from \"./run/run\";\n\n/**\n * Vertical text alignment types for paragraphs.\n *\n * Specifies the vertical alignment of text within the paragraph.\n *\n * @publicApi\n */\nexport const TextAlignmentType = {\n /** Align text to the top */\n TOP: \"top\",\n /** Align text to the center */\n CENTER: \"center\",\n /** Align text to the baseline */\n BASELINE: \"baseline\",\n /** Align text to the bottom */\n BOTTOM: \"bottom\",\n /** Automatically determine vertical alignment */\n AUTO: \"auto\",\n} as const;\n\n/**\n * Textbox tight wrap types for paragraphs.\n *\n * Specifies how tightly text wraps around a textbox.\n *\n * @publicApi\n */\nexport const TextboxTightWrapType = {\n /** No tight wrapping */\n NONE: \"none\",\n /** Tight wrap on all lines */\n ALL_LINES: \"allLines\",\n /** Tight wrap on first and last lines */\n FIRST_AND_LAST_LINE: \"firstAndLastLine\",\n /** Tight wrap on first line only */\n FIRST_LINE_ONLY: \"firstLineOnly\",\n /** Tight wrap on last line only */\n LAST_LINE_ONLY: \"lastLineOnly\",\n} as const;\n\n/**\n * Paragraph style properties for numbering levels.\n *\n * These properties are used when defining paragraph styles within numbering level definitions.\n */\nexport interface LevelParagraphStylePropertiesOptions {\n /** Paragraph text alignment (left, right, center, justified, etc.) */\n alignment?: (typeof AlignmentType)[keyof typeof AlignmentType];\n /** Whether to render text right-to-left for bidirectional languages */\n bidirectional?: boolean;\n /** Whether to insert a page break before this paragraph */\n pageBreakBefore?: boolean;\n /** Custom tab stop positions and alignments */\n tabStops?: TabStopDefinition[];\n /** Whether to display a horizontal line (thematic break) below the paragraph */\n thematicBreak?: boolean;\n /** Whether to prevent single lines at top/bottom of page (widow/orphan control), defaults to true */\n widowControl?: boolean;\n /** Whether to ignore spacing before/after when adjacent paragraphs have the same style */\n contextualSpacing?: boolean;\n /** Position in twips for a right-aligned tab stop */\n rightTabStop?: number;\n /** Position in twips for a left-aligned tab stop */\n leftTabStop?: number;\n /** Indentation settings for the paragraph */\n indent?: IndentProperties;\n /** Spacing before/after paragraph and between lines */\n spacing?: SpacingProperties;\n /**\n * Specifies that the paragraph (or at least part of it) should be rendered on the same page as the next paragraph when possible. If multiple paragraphs are to be kept together but they exceed a page, then the set of paragraphs begin on a new page and page breaks are used thereafter as needed.\n */\n keepNext?: boolean;\n /**\n * Specifies that all lines of the paragraph are to be kept on a single page when possible.\n */\n keepLines?: boolean;\n /** Frame properties for positioning the paragraph */\n frame?: FrameOptions;\n /** Whether to suppress line numbers for this paragraph */\n suppressLineNumbers?: boolean;\n /** Whether to allow word wrapping */\n wordWrap?: boolean;\n /** Whether to allow punctuation to extend beyond text margins */\n overflowPunctuation?: boolean;\n /**\n * This element specifies whether inter-character spacing shall automatically be adjusted between regions of numbers and regions of East Asian text in the current paragraph. These regions shall be determined by the Unicode character values of the text content within the paragraph.\n * This only works in Microsoft Word. It is not part of the ECMA-376 OOXML standard.\n */\n autoSpaceEastAsianText?: boolean;\n /** Whether to prevent text frames from overlapping */\n suppressOverlap?: boolean;\n /** Whether to disable automatic hyphenation for this paragraph */\n suppressAutoHyphens?: boolean;\n /** Whether to automatically adjust right indent for document grid */\n adjustRightInd?: boolean;\n /** Whether to snap the current paragraph to the document grid */\n snapToGrid?: boolean;\n /** Whether to swap left and right indent positions on odd pages for mirrored layouts */\n mirrorIndents?: boolean;\n /** Whether to use Kinsoku forbidden character overflow rules */\n kinsoku?: boolean;\n /** Whether to compress punctuation at the start of a line */\n topLinePunct?: boolean;\n /** Whether to automatically add space between East Asian and Latin text */\n autoSpaceDE?: boolean;\n /** Vertical text alignment within the paragraph */\n textAlignment?: (typeof TextAlignmentType)[keyof typeof TextAlignmentType];\n /** Textbox tight wrap setting */\n textboxTightWrap?: (typeof TextboxTightWrapType)[keyof typeof TextboxTightWrapType];\n /** Text direction for the paragraph (lr, rl, tb, tbV, rlV, lrV) */\n textDirection?: \"lr\" | \"rl\" | \"tb\" | \"tbV\" | \"rlV\" | \"lrV\";\n /** Outline level for table of contents and document outline (0-9) */\n outlineLevel?: number;\n /** HTML div ID reference */\n divId?: number;\n /** Conditional formatting style for table rows/cells */\n cnfStyle?: CnfConditionalOptions;\n}\n\n/**\n * Paragraph style properties options.\n *\n * These properties are used when defining paragraph styles and include\n * border, shading, and numbering options in addition to level properties.\n */\nexport type ParagraphStylePropertiesOptions = {\n /** Border settings for the paragraph */\n border?: BordersOptions;\n /** Background shading/fill color for the paragraph */\n shading?: ShadingProperties;\n /** Numbering configuration for lists, or false to remove numbering */\n numbering?:\n | {\n /** Reference ID of the numbering definition to use */\n reference: string;\n /** Level in the numbering hierarchy (0-8) */\n level: number;\n /** Instance number for multiple lists with same reference */\n instance?: number;\n /** Whether this is a custom numbering definition */\n custom?: boolean;\n /** Numbering change tracking (CT_TrackChangeNumbering) */\n numberingChange?: {\n /** Original numbering value */\n original: string;\n /** Revision ID */\n id: string;\n /** Author of the change */\n author: string;\n /** Date of the change */\n date?: string;\n };\n }\n | false;\n} & LevelParagraphStylePropertiesOptions;\n\nexport type ParagraphPropertiesOptionsBase = {\n /** Heading level (Heading1, Heading2, etc.) - applies predefined heading style */\n heading?: (typeof HeadingLevel)[keyof typeof HeadingLevel];\n /** Style ID to apply to this paragraph */\n style?: string;\n /** Bullet list configuration */\n bullet?: {\n /** Indentation level for the bullet (0-8) */\n level: number;\n };\n /**\n * Run properties to apply to all runs in the paragraph.\n * Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.29.\n */\n run?: ParagraphRunOptions;\n} & ParagraphStylePropertiesOptions;\n\nexport type ParagraphPropertiesChangeOptions = ChangedProperties & ParagraphPropertiesOptionsBase;\n\n/**\n * Options for configuring paragraph properties.\n *\n * These options control all aspects of paragraph formatting including\n * alignment, spacing, indentation, borders, numbering, and more.\n *\n * Reference: http://officeopenxml.com/WPparagraphProperties.php\n */\nexport type ParagraphPropertiesOptions = {\n revision?: ParagraphPropertiesChangeOptions;\n includeIfEmpty?: boolean;\n} & ParagraphPropertiesOptionsBase;\n","/**\n * Run properties module for WordprocessingML documents.\n *\n * This module provides the run properties (rPr) element which specifies\n * the formatting applied to a run of text.\n *\n * Reference: https://www.ecma-international.org/wp-content/uploads/ECMA-376-1_5th_edition_december_2016.zip\n * Section 17.3.2.21 (page 297)\n *\n * @module\n */\nimport type { UniversalMeasure } from \"@office-open/core\";\nimport type { BorderOptions } from \"@shared/border\";\nimport type { ShadingProperties } from \"@shared/shading\";\nimport type { ChangedProperties } from \"@shared/track-revision/track-revision\";\n\nimport type { EastAsianLayoutOptions } from \"./east-asian-layout\";\nimport type { EmphasisMarkType } from \"./emphasis-mark\";\nimport type { ColorOptions } from \"./formatting\";\nimport type { LanguageOptions } from \"./language\";\nimport type { FontProperties } from \"./run-fonts\";\nimport type { UnderlineType } from \"./underline\";\n\ninterface RunFontReference {\n name: string;\n hint?: string;\n}\n\n/**\n * Text animation effect types.\n *\n * Reference: http://officeopenxml.com/WPtextFormatting.php\n *\n * @publicApi\n */\nexport const TextEffect = {\n /** Blinking background animation */\n BLINK_BACKGROUND: \"blinkBackground\",\n /** Lights animation effect */\n LIGHTS: \"lights\",\n /** Black marching ants animation */\n ANTS_BLACK: \"antsBlack\",\n /** Red marching ants animation */\n ANTS_RED: \"antsRed\",\n /** Shimmer animation effect */\n SHIMMER: \"shimmer\",\n /** Sparkle animation effect */\n SPARKLE: \"sparkle\",\n /** No text effect */\n NONE: \"none\",\n} as const;\n\n/**\n * Highlight color values for text highlighting.\n *\n * Reference: http://officeopenxml.com/WPtextShading.php\n */\nexport const HighlightColor = {\n /** Black highlight */\n BLACK: \"black\",\n /** Blue highlight */\n BLUE: \"blue\",\n /** Cyan highlight */\n CYAN: \"cyan\",\n /** Dark blue highlight */\n DARK_BLUE: \"darkBlue\",\n /** Dark cyan highlight */\n DARK_CYAN: \"darkCyan\",\n /** Dark gray highlight */\n DARK_GRAY: \"darkGray\",\n /** Dark green highlight */\n DARK_GREEN: \"darkGreen\",\n /** Dark magenta highlight */\n DARK_MAGENTA: \"darkMagenta\",\n /** Dark red highlight */\n DARK_RED: \"darkRed\",\n /** Dark yellow highlight */\n DARK_YELLOW: \"darkYellow\",\n /** Green highlight */\n GREEN: \"green\",\n /** Light gray highlight */\n LIGHT_GRAY: \"lightGray\",\n /** Magenta highlight */\n MAGENTA: \"magenta\",\n /** No highlight */\n NONE: \"none\",\n /** Red highlight */\n RED: \"red\",\n /** White highlight */\n WHITE: \"white\",\n /** Yellow highlight */\n YELLOW: \"yellow\",\n} as const;\n\n/**\n * Run style properties options.\n *\n * These properties define the formatting that can be applied to a run of text,\n * including font, size, bold, italic, underline, color, and other character formatting.\n *\n * Reference: http://officeopenxml.com/WPtextFormatting.php\n */\nexport interface RunStylePropertiesOptions {\n noProof?: boolean;\n bold?: boolean;\n boldComplexScript?: boolean;\n italic?: boolean;\n italicComplexScript?: boolean;\n underline?: {\n color?: string;\n type?: (typeof UnderlineType)[keyof typeof UnderlineType];\n };\n effect?: (typeof TextEffect)[keyof typeof TextEffect];\n emphasisMark?: {\n type?: (typeof EmphasisMarkType)[keyof typeof EmphasisMarkType];\n };\n color?: string | ColorOptions;\n kern?: number;\n position?: string;\n /** Font size in points. Internally stored as half-points in XML (×2). */\n size?: number;\n /** Complex-script font size in points (w:szCs). Independent from {@link size}. */\n sizeComplexScript?: number;\n rightToLeft?: boolean;\n smallCaps?: boolean;\n allCaps?: boolean;\n strike?: boolean;\n doubleStrike?: boolean;\n subScript?: boolean;\n superScript?: boolean;\n font?: string | RunFontReference | FontProperties;\n highlight?: (typeof HighlightColor)[keyof typeof HighlightColor];\n /** Complex-script highlight color (w:highlightCs). Independent from {@link highlight}. */\n highlightComplexScript?: string;\n characterSpacing?: number | UniversalMeasure;\n shading?: ShadingProperties;\n emboss?: boolean;\n imprint?: boolean;\n revision?: RunPropertiesChangeOptions;\n language?: LanguageOptions;\n border?: BorderOptions;\n snapToGrid?: boolean;\n vanish?: boolean;\n specVanish?: boolean;\n scale?: number;\n math?: boolean;\n outline?: boolean;\n shadow?: boolean;\n webHidden?: boolean;\n fitText?: number;\n complexScript?: boolean;\n eastAsianLayout?: EastAsianLayoutOptions;\n /** Relationship ID for a content part (w:contentPart with r:id) */\n contentPartRId?: string;\n /**\n * Raw XML for w14:* text-effect children (glow/shadow/reflection/props3d/...)\n * located in the EG_RPrBase extension slot at the end of rPr. Low-frequency\n * complex subtrees kept verbatim for round-trip fidelity; the rPr backbone\n * stays structured and editable.\n */\n w14RawXml?: string;\n}\n\n/**\n * Options for configuring run properties.\n *\n * Extends RunStylePropertiesOptions with a style reference.\n */\nexport type RunPropertiesOptions = {\n /** Reference to a character style by name */\n style?: string;\n} & RunStylePropertiesOptions;\n\n/**\n * Options for run properties change tracking.\n *\n * Used for revision tracking when run properties have been modified.\n */\nexport type RunPropertiesChangeOptions = {} & RunPropertiesOptions & ChangedProperties;\n\nexport type ParagraphRunPropertiesOptions = {\n insertion?: ChangedProperties;\n deletion?: ChangedProperties;\n} & RunPropertiesOptions;\n","/**\n * Underline module for WordprocessingML documents.\n *\n * This module provides support for underlining text with various styles and colors.\n *\n * Reference: http://officeopenxml.com/WPrun.php\n *\n * @module\n */\n\n/**\n * Underline style types for text.\n *\n * Defines the various underline patterns that can be applied to text runs.\n *\n * Reference: http://officeopenxml.com/WPrun.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_Underline\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"single\"/>\n * <xsd:enumeration value=\"words\"/>\n * <xsd:enumeration value=\"double\"/>\n * <xsd:enumeration value=\"thick\"/>\n * <xsd:enumeration value=\"dotted\"/>\n * <xsd:enumeration value=\"dottedHeavy\"/>\n * <xsd:enumeration value=\"dash\"/>\n * <xsd:enumeration value=\"dashedHeavy\"/>\n * <xsd:enumeration value=\"dashLong\"/>\n * <xsd:enumeration value=\"dashLongHeavy\"/>\n * <xsd:enumeration value=\"dotDash\"/>\n * <xsd:enumeration value=\"dashDotHeavy\"/>\n * <xsd:enumeration value=\"dotDotDash\"/>\n * <xsd:enumeration value=\"dashDotDotHeavy\"/>\n * <xsd:enumeration value=\"wave\"/>\n * <xsd:enumeration value=\"wavyHeavy\"/>\n * <xsd:enumeration value=\"wavyDouble\"/>\n * <xsd:enumeration value=\"none\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const UnderlineType = {\n /** Single underline */\n SINGLE: \"single\",\n /** Underline words only (not spaces) */\n WORDS: \"words\",\n /** Double underline */\n DOUBLE: \"double\",\n /** Thick single underline */\n THICK: \"thick\",\n /** Dotted underline */\n DOTTED: \"dotted\",\n /** Heavy dotted underline */\n DOTTEDHEAVY: \"dottedHeavy\",\n /** Dashed underline */\n DASH: \"dash\",\n /** Heavy dashed underline */\n DASHEDHEAVY: \"dashedHeavy\",\n /** Long dashed underline */\n DASHLONG: \"dashLong\",\n /** Heavy long dashed underline */\n DASHLONGHEAVY: \"dashLongHeavy\",\n /** Dot-dash underline */\n DOTDASH: \"dotDash\",\n /** Heavy dot-dash underline */\n DASHDOTHEAVY: \"dashDotHeavy\",\n /** Dot-dot-dash underline */\n DOTDOTDASH: \"dotDotDash\",\n /** Heavy dot-dot-dash underline */\n DASHDOTDOTHEAVY: \"dashDotDotHeavy\",\n /** Wave underline */\n WAVE: \"wave\",\n /** Heavy wave underline */\n WAVYHEAVY: \"wavyHeavy\",\n /** Double wave underline */\n WAVYDOUBLE: \"wavyDouble\",\n /** No underline */\n NONE: \"none\",\n} as const;\n","/**\n * Emphasis mark module for WordprocessingML run properties.\n *\n * This module provides support for East Asian emphasis marks, which are\n * characters placed above or below text to emphasize it.\n *\n * Reference: http://officeopenxml.com/WPrun.php\n *\n * @module\n */\n\n/**\n * Emphasis mark types.\n *\n * Defines the types of emphasis marks that can be applied to text.\n * Emphasis marks are commonly used in East Asian typography.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_Em\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"none\"/>\n * <xsd:enumeration value=\"dot\"/>\n * <xsd:enumeration value=\"comma\"/>\n * <xsd:enumeration value=\"circle\"/>\n * <xsd:enumeration value=\"underDot\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const EmphasisMarkType = {\n /** No emphasis mark */\n NONE: \"none\",\n /** Comma emphasis mark */\n COMMA: \"comma\",\n /** Circle emphasis mark */\n CIRCLE: \"circle\",\n /** Dot emphasis mark */\n DOT: \"dot\",\n /** Under dot emphasis mark */\n UNDER_DOT: \"underDot\",\n} as const;\n","/**\n * Positional tab types for WordprocessingML documents.\n *\n * @module\n */\n\nexport const PositionalTabAlignment = {\n LEFT: \"left\",\n CENTER: \"center\",\n RIGHT: \"right\",\n} as const;\n\nexport const PositionalTabRelativeTo = {\n MARGIN: \"margin\",\n INDENT: \"indent\",\n} as const;\n\nexport const PositionalTabLeader = {\n NONE: \"none\",\n DOT: \"dot\",\n HYPHEN: \"hyphen\",\n UNDERSCORE: \"underscore\",\n MIDDLE_DOT: \"middleDot\",\n} as const;\n\nexport interface PositionalTabOptions {\n alignment: (typeof PositionalTabAlignment)[keyof typeof PositionalTabAlignment];\n relativeTo: (typeof PositionalTabRelativeTo)[keyof typeof PositionalTabRelativeTo];\n leader: (typeof PositionalTabLeader)[keyof typeof PositionalTabLeader];\n}\n","/**\n * Ruby annotation module for WordprocessingML documents.\n *\n * Ruby annotations are small text rendered above or below base text,\n * commonly used for pronunciation guides in East Asian languages (furigana\n * in Japanese, pinyin in Chinese, etc.).\n *\n * Used via the JSON API: `{ ruby: { text: \"かな\", base: \"漢字\" } }` as a\n * paragraph or run child.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_Ruby\n *\n * @module\n */\n\n/**\n * Ruby alignment options.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_RubyAlign\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"center\"/>\n * <xsd:enumeration value=\"distributeLetter\"/>\n * <xsd:enumeration value=\"distributeSpace\"/>\n * <xsd:enumeration value=\"left\"/>\n * <xsd:enumeration value=\"right\"/>\n * <xsd:enumeration value=\"rightVertical\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const RubyAlign = {\n /** Center alignment */\n CENTER: \"center\",\n /** Distribute letters evenly */\n DISTRIBUTE_LETTER: \"distributeLetter\",\n /** Distribute space evenly */\n DISTRIBUTE_SPACE: \"distributeSpace\",\n /** Left alignment */\n LEFT: \"left\",\n /** Right alignment */\n RIGHT: \"right\",\n /** Right vertical alignment */\n RIGHT_VERTICAL: \"rightVertical\",\n} as const;\n\n/**\n * Options for a Ruby annotation.\n *\n * Used as `{ ruby: RubyOptions }` in paragraph or run children.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Ruby\">\n * <xsd:sequence>\n * <xsd:element name=\"rubyPr\" type=\"CT_RubyPr\"/>\n * <xsd:element name=\"rt\" type=\"CT_RubyContent\"/>\n * <xsd:element name=\"rubyBase\" type=\"CT_RubyContent\"/>\n * </xsd:sequence>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Japanese furigana\n * { ruby: {\n * text: \"かな\",\n * base: \"漢字\",\n * alignment: \"center\",\n * fontSize: 20,\n * languageId: \"ja-JP\",\n * }}\n * ```\n */\nexport interface RubyOptions {\n /** Ruby annotation text (e.g., furigana, pinyin) */\n text: string;\n /** Base text being annotated */\n base: string;\n /** Ruby alignment (defaults to \"center\"). */\n alignment?: (typeof RubyAlign)[keyof typeof RubyAlign];\n /**\n * Font size for the ruby annotation text in points (e.g., 10 = 10pt).\n * Defaults to half the base text size if not specified.\n */\n fontSize?: number;\n /**\n * Vertical offset for the ruby annotation in points.\n * How far the annotation is raised above (or below) the base text.\n */\n raise?: number;\n /**\n * Font size for the base text in points.\n * Used to calculate the ruby annotation positioning.\n */\n baseFontSize?: number;\n /** Language identifier for the ruby annotation (e.g., \"ja-JP\"). */\n languageId?: string;\n /** Whether the ruby annotation is dirty (needs recalculation). */\n dirty?: boolean;\n}\n","/**\n * Proof error types for WordprocessingML documents.\n *\n * @module\n */\n\nexport const ProofErrorType = {\n SPELL_START: \"spellStart\",\n SPELL_END: \"spellEnd\",\n GRAM_START: \"gramStart\",\n GRAM_END: \"gramEnd\",\n} as const;\n\nexport type ProofErrorTypeValue = (typeof ProofErrorType)[keyof typeof ProofErrorType];\n","/**\n * Hyperlink types for WordprocessingML documents.\n *\n * @module\n */\n\n/**\n * Hyperlink type enumeration.\n * @publicApi\n */\nexport const HyperlinkType = {\n /** Internal hyperlink to a bookmark within the document */\n INTERNAL: \"INTERNAL\",\n /** External hyperlink to a URL outside the document */\n EXTERNAL: \"EXTERNAL\",\n} as const;\n\n/**\n * Options for creating an internal hyperlink.\n */\nexport interface InternalHyperlinkOptions {\n /** Name of the bookmark to link to within the document */\n anchor: string;\n /** Screen tip text shown when hovering over the hyperlink */\n tooltip?: string;\n}\n\n/**\n * Options for creating an external hyperlink.\n */\nexport interface ExternalHyperlinkOptions {\n /** URL to link to outside the document */\n link: string;\n /** Screen tip text shown when hovering over the hyperlink */\n tooltip?: string;\n /** Target frame for the hyperlink (e.g., \"_blank\", \"_self\") */\n tgtFrame?: string;\n}\n","/**\n * Numbered item reference module for WordprocessingML documents.\n *\n * This module provides cross-references to numbered items (such as\n * numbered paragraphs, list items, or headings) within a document.\n *\n * Reference: https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/7088a8ce-e784-49d4-94b8-cba6ef8fce78\n *\n * @module\n */\n\n/**\n * Format options for numbered item references.\n *\n * Specifies how the paragraph number should be displayed when referenced.\n */\nexport enum NumberedItemReferenceFormat {\n NONE = \"none\",\n /**\n * \\r option - inserts the paragraph number of the bookmarked paragraph in relative context, or relative to its position in the numbering scheme\n */\n RELATIVE = \"relative\",\n /**\n * \\n option - causes the field result to be the paragraph number without trailing periods. No information about prior numbered levels is displayed unless it is included as part of the current level.\n */\n NO_CONTEXT = \"no_context\",\n /**\n * \\w option - causes the field result to be the entire paragraph number without trailing periods, regardless of the location of the REF field.\n */\n FULL_CONTEXT = \"full_context\",\n}\n\nexport interface NumberedItemReferenceOptions {\n /**\n * \\h option - Creates a hyperlink to the bookmarked paragraph.\n * @default true\n */\n hyperlink?: boolean;\n /**\n * Which switch to use for the reference format\n * @default NumberedItemReferenceFormat.FULL_CONTEXT\n */\n referenceFormat?: NumberedItemReferenceFormat;\n}\n","/**\n * Frame properties module for paragraph text frames in WordprocessingML documents.\n *\n * Frames allow paragraphs to be positioned absolutely on the page, enabling text wrapping\n * and drop cap effects. They are commonly used for floating text boxes and decorative elements.\n *\n * Reference: http://officeopenxml.com/WPparagraph-textFrames.php\n *\n * @module\n */\nimport type { UniversalMeasure } from \"@office-open/core\";\nimport type { HeightRule } from \"@parts/table\";\nimport type { HorizontalPositionAlign, VerticalPositionAlign } from \"@shared/constants\";\n\n/**\n * Drop cap types for paragraph frames.\n */\nexport const DropCapType = {\n /** No drop cap effect */\n NONE: \"none\",\n /** Drop cap that drops down into the paragraph text */\n DROP: \"drop\",\n /** Drop cap that extends into the margin */\n MARGIN: \"margin\",\n} as const;\n\n/**\n * Frame anchor types specifying what the frame should be anchored relative to.\n */\nexport const FrameAnchorType = {\n /** Anchor relative to the page margin */\n MARGIN: \"margin\",\n /** Anchor relative to the page edge */\n PAGE: \"page\",\n /** Anchor relative to the text column */\n TEXT: \"text\",\n} as const;\n\n/**\n * Text wrapping types for frames.\n */\nexport const FrameWrap = {\n /** Wrap text around the frame on all sides */\n AROUND: \"around\",\n /** Automatic wrapping based on available space */\n AUTO: \"auto\",\n /** No text wrapping */\n NONE: \"none\",\n /** Do not allow text beside the frame */\n NOT_BESIDE: \"notBeside\",\n /** Allow text to flow through the frame */\n THROUGH: \"through\",\n /** Wrap text tightly around the frame */\n TIGHT: \"tight\",\n} as const;\n\n/**\n * Base options shared by all frame types.\n */\ninterface BaseFrameOptions {\n /** Lock the anchor position to prevent it from moving */\n anchorLock?: boolean;\n /** Drop cap effect type */\n dropCap?: (typeof DropCapType)[keyof typeof DropCapType];\n /** Frame width in twips or universal measure (e.g., \"1cm\", \"0.5in\") */\n width: number | UniversalMeasure;\n /** Frame height in twips or universal measure (e.g., \"1cm\", \"0.5in\") */\n height: number | UniversalMeasure;\n /** Text wrapping behavior around the frame */\n wrap?: (typeof FrameWrap)[keyof typeof FrameWrap];\n /** Number of lines for drop cap effect */\n lines?: number;\n /** Anchor reference points for horizontal and vertical positioning */\n anchor: {\n /** Horizontal anchor reference point */\n horizontal: (typeof FrameAnchorType)[keyof typeof FrameAnchorType];\n /** Vertical anchor reference point */\n vertical: (typeof FrameAnchorType)[keyof typeof FrameAnchorType];\n };\n /** Spacing between frame and surrounding text in twips */\n space?: {\n /** Horizontal spacing in twips or universal measure */\n horizontal: number | UniversalMeasure;\n /** Vertical spacing in twips or universal measure */\n vertical: number | UniversalMeasure;\n };\n /** Height rule determining how frame height is calculated */\n rule?: (typeof HeightRule)[keyof typeof HeightRule];\n}\n\n/**\n * Options for frames positioned using absolute X/Y coordinates.\n */\nexport type XYFrameOptions = {\n /** Must be \"absolute\" for coordinate-based positioning */\n type: \"absolute\";\n /** Absolute X and Y coordinates in twips */\n position: {\n /** Horizontal position in twips or universal measure from the anchor point */\n x: number | UniversalMeasure;\n /** Vertical position in twips or universal measure from the anchor point */\n y: number | UniversalMeasure;\n };\n} & BaseFrameOptions;\n\n/**\n * Options for frames positioned using alignment values.\n */\nexport type AlignmentFrameOptions = {\n /** Must be \"alignment\" for alignment-based positioning */\n type: \"alignment\";\n /** Horizontal and vertical alignment values */\n alignment: {\n /** Horizontal alignment relative to the anchor */\n x: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];\n /** Vertical alignment relative to the anchor */\n y: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];\n };\n} & BaseFrameOptions;\n\n/**\n * Union type for all frame positioning options.\n */\nexport type FrameOptions = XYFrameOptions | AlignmentFrameOptions;\n","/**\n * Table float properties module for WordprocessingML documents.\n *\n * This module provides floating table positioning options, allowing tables\n * to float with text wrapping around them.\n *\n * Reference: http://officeopenxml.com/WPtableFloating.php\n *\n * @module\n */\n\n/**\n * Anchor types for floating table positioning.\n *\n * Specifies the base object from which positioning is determined.\n */\nexport const TableAnchorType = {\n MARGIN: \"margin\",\n PAGE: \"page\",\n TEXT: \"text\",\n} as const;\n\n/**\n * Relative horizontal position values for floating tables.\n */\nexport const RelativeHorizontalPosition = {\n CENTER: \"center\",\n INSIDE: \"inside\",\n LEFT: \"left\",\n OUTSIDE: \"outside\",\n RIGHT: \"right\",\n} as const;\n\n/**\n * Relative vertical position values for floating tables.\n */\nexport const RelativeVerticalPosition = {\n BOTTOM: \"bottom\",\n CENTER: \"center\",\n INLINE: \"inline\",\n INSIDE: \"inside\",\n OUTSIDE: \"outside\",\n TOP: \"top\",\n} as const;\n\n/**\n * Table overlap behavior types.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_TblOverlap\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"never\"/>\n * <xsd:enumeration value=\"overlap\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const OverlapType = {\n NEVER: \"never\",\n OVERLAP: \"overlap\",\n} as const;\n\nexport interface TableFloatOptions {\n /* CSpell:disable */\n horizontalAnchor?: (typeof TableAnchorType)[keyof typeof TableAnchorType];\n absoluteHorizontalPosition?: number;\n relativeHorizontalPosition?: (typeof RelativeHorizontalPosition)[keyof typeof RelativeHorizontalPosition];\n verticalAnchor?: (typeof TableAnchorType)[keyof typeof TableAnchorType];\n absoluteVerticalPosition?: number;\n relativeVerticalPosition?: (typeof RelativeVerticalPosition)[keyof typeof RelativeVerticalPosition];\n bottomFromText?: number;\n topFromText?: number;\n leftFromText?: number;\n rightFromText?: number;\n overlap?: (typeof OverlapType)[keyof typeof OverlapType];\n /* CSpell:enable */\n}\n","/**\n * Table layout module for WordprocessingML documents.\n *\n * This module provides table layout algorithm settings.\n *\n * @module\n */\n\n/**\n * Table layout algorithm types.\n *\n * Specifies how the table width is calculated.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_TblLayoutType\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"fixed\"/>\n * <xsd:enumeration value=\"autofit\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const TableLayoutType = {\n /** Auto-fit layout - column widths are adjusted based on content */\n AUTOFIT: \"autofit\",\n /** Fixed layout - column widths are fixed as specified */\n FIXED: \"fixed\",\n} as const;\n","/**\n * Table borders module for WordprocessingML documents.\n *\n * This module provides border options for tables.\n *\n * Reference: http://officeopenxml.com/WPtableBorders.php\n *\n * @module\n */\nimport { BorderStyle } from \"@shared/border\";\nimport type { BorderOptions } from \"@shared/border\";\n\n/**\n * Options for configuring table borders.\n *\n * Borders can be applied to the outside edges (top, bottom, left, right)\n * and inside lines (insideHorizontal, insideVertical) of the table.\n */\nexport interface TableBordersOptions {\n top?: BorderOptions;\n bottom?: BorderOptions;\n left?: BorderOptions;\n right?: BorderOptions;\n insideHorizontal?: BorderOptions;\n insideVertical?: BorderOptions;\n}\n\nconst NONE_BORDER: BorderOptions = {\n color: \"auto\",\n size: 0,\n style: BorderStyle.NONE,\n};\n\nexport const TABLE_BORDERS_NONE: TableBordersOptions = {\n bottom: NONE_BORDER,\n insideHorizontal: NONE_BORDER,\n insideVertical: NONE_BORDER,\n left: NONE_BORDER,\n right: NONE_BORDER,\n top: NONE_BORDER,\n};\n","/**\n * Table row height module for WordprocessingML documents.\n *\n * This module provides row height configuration including rules for how height should be applied.\n *\n * Reference: http://officeopenxml.com/WPtableRow.php\n *\n * @module\n */\n\n/**\n * Height rules for table rows.\n *\n * Specifies how the height value should be interpreted.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_HeightRule\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"auto\"/>\n * <xsd:enumeration value=\"exact\"/>\n * <xsd:enumeration value=\"atLeast\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const HeightRule = {\n /** Height is determined based on the content, so value is ignored. */\n AUTO: \"auto\",\n /** At least the value specified */\n ATLEAST: \"atLeast\",\n /** Exactly the value specified */\n EXACT: \"exact\",\n} as const;\n","/**\n * Wrap Tight module for DrawingML text wrapping.\n *\n * This module provides tight text wrapping for floating drawings\n * where text wraps closely around the image shape.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { Margins } from \"../floating\";\nimport { TextWrappingSide } from \"./text-wrapping\";\nimport type { TextWrapping } from \"./text-wrapping\";\n\n/**\n * Creates a default rectangular wrap polygon matching the image extent.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_WrapPath\">\n * <xsd:sequence>\n * <xsd:element name=\"start\" type=\"a:CT_Point2D\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * <xsd:element name=\"lineTo\" type=\"a:CT_Point2D\" minOccurs=\"2\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"edited\" type=\"xsd:boolean\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nconst createWrapPolygon = (cx: number, cy: number): string =>\n element(\"wp:wrapPolygon\", { edited: \"0\" }, [\n `<wp:start x=\"0\" y=\"0\"/>`,\n `<wp:lineTo x=\"0\" y=\"${-cy}\"/>`,\n `<wp:lineTo x=\"${cx}\" y=\"${-cy}\"/>`,\n `<wp:lineTo x=\"${cx}\" y=\"0\"/>`,\n `<wp:lineTo x=\"0\" y=\"0\"/>`,\n ]);\n\n/**\n * Creates tight text wrapping for a floating drawing.\n *\n * WrapTight causes text to wrap closely around the contours\n * of the drawing rather than its rectangular bounding box.\n * A default rectangular wrap polygon matching the image extent is generated.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_WrapTight\">\n * <xsd:sequence>\n * <xsd:element name=\"wrapPolygon\" type=\"CT_WrapPath\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"wrapText\" type=\"ST_WrapText\" use=\"required\"/>\n * <xsd:attribute name=\"distL\" type=\"ST_WrapDistance\"/>\n * <xsd:attribute name=\"distR\" type=\"ST_WrapDistance\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createWrapTight = (\n textWrapping: TextWrapping,\n margins: Margins = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n },\n extent: { x: number; y: number },\n): string =>\n element(\n \"wp:wrapTight\",\n {\n distL: margins.left,\n distR: margins.right,\n wrapText: textWrapping.side || TextWrappingSide.BOTH_SIDES,\n },\n [createWrapPolygon(extent.x, extent.y)],\n );\n","/**\n * Wrap Through module for DrawingML text wrapping.\n *\n * This module provides \"through\" text wrapping for floating drawings\n * where text wraps through the image contours, filling any concave areas.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nimport type { Margins } from \"../floating\";\nimport { TextWrappingSide } from \"./text-wrapping\";\nimport type { TextWrapping } from \"./text-wrapping\";\n\n/**\n * Creates a default rectangular wrap polygon matching the image extent.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_WrapPath\">\n * <xsd:sequence>\n * <xsd:element name=\"start\" type=\"a:CT_Point2D\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * <xsd:element name=\"lineTo\" type=\"a:CT_Point2D\" minOccurs=\"2\" maxOccurs=\"unbounded\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"edited\" type=\"xsd:boolean\" use=\"optional\"/>\n * </xsd:complexType>\n * ```\n */\nconst createWrapPolygon = (cx: number, cy: number): string =>\n element(\"wp:wrapPolygon\", { edited: \"0\" }, [\n `<wp:start x=\"0\" y=\"0\"/>`,\n `<wp:lineTo x=\"0\" y=\"${-cy}\"/>`,\n `<wp:lineTo x=\"${cx}\" y=\"${-cy}\"/>`,\n `<wp:lineTo x=\"${cx}\" y=\"0\"/>`,\n `<wp:lineTo x=\"0\" y=\"0\"/>`,\n ]);\n\n/**\n * Creates \"through\" text wrapping for a floating drawing.\n *\n * WrapThrough is similar to WrapTight but allows text to wrap through\n * the concave portions of the drawing shape (e.g., the inside of the letter \"O\").\n * A default rectangular wrap polygon matching the image extent is generated.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-textWrap.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_WrapThrough\">\n * <xsd:sequence>\n * <xsd:element name=\"wrapPolygon\" type=\"CT_WrapPath\" minOccurs=\"1\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"wrapText\" type=\"ST_WrapText\" use=\"required\"/>\n * <xsd:attribute name=\"distL\" type=\"ST_WrapDistance\"/>\n * <xsd:attribute name=\"distR\" type=\"ST_WrapDistance\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createWrapThrough = (\n textWrapping: TextWrapping,\n margins: Margins = {\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n },\n extent: { x: number; y: number },\n): string =>\n element(\n \"wp:wrapThrough\",\n {\n distL: margins.left,\n distR: margins.right,\n wrapText: textWrapping.side || TextWrappingSide.BOTH_SIDES,\n },\n [createWrapPolygon(extent.x, extent.y)],\n );\n","/**\n * Horizontal position module for floating drawings in WordprocessingML documents.\n *\n * This module provides horizontal positioning for floating drawing objects,\n * specifying the horizontal placement relative to a base element.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-position.php\n *\n * @module\n */\nimport { convertToEmu } from \"@office-open/core\";\nimport { element } from \"@office-open/xml\";\n\nimport { HorizontalPositionAlign, HorizontalPositionRelativeFrom } from \"./floating-position\";\nimport type { HorizontalPositionOptions } from \"./floating-position\";\n\n/**\n * Creates a horizontal position element for floating drawings.\n *\n * The positionH element specifies the horizontal positioning of a floating\n * object relative to a base element (page, margin, column, etc.).\n *\n * Reference: https://www.datypic.com/sc/ooxml/e-wp_positionH-1.html\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PosH\">\n * <xsd:choice>\n * <xsd:element name=\"align\" type=\"ST_AlignH\"/>\n * <xsd:element name=\"posOffset\" type=\"ST_PositionOffset\"/>\n * </xsd:choice>\n * <xsd:attribute name=\"relativeFrom\" type=\"ST_RelFromH\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @param options - Horizontal position configuration\n * @returns The positionH XML string\n *\n * @example\n * ```typescript\n * // Align to the left of the page\n * createHorizontalPosition({\n * relative: HorizontalPositionRelativeFrom.PAGE,\n * align: HorizontalPositionAlign.LEFT,\n * });\n *\n * // Offset from the margin\n * createHorizontalPosition({\n * relative: HorizontalPositionRelativeFrom.MARGIN,\n * offset: 914400, // 1 inch in EMUs\n * });\n * ```\n */\nexport const createHorizontalPosition = ({\n relative,\n align,\n offset,\n}: HorizontalPositionOptions): string => {\n const child = align\n ? `<wp:align>${align}</wp:align>`\n : offset !== undefined\n ? `<wp:posOffset>${convertToEmu(offset)}</wp:posOffset>`\n : `<wp:align>${HorizontalPositionAlign.LEFT}</wp:align>`;\n\n return element(\n \"wp:positionH\",\n {\n relativeFrom: relative ?? HorizontalPositionRelativeFrom.PAGE,\n },\n [child],\n );\n};\n","/**\n * Vertical position module for floating drawings in WordprocessingML documents.\n *\n * This module provides vertical positioning for floating drawing objects,\n * specifying the vertical placement relative to a base element.\n *\n * Reference: http://officeopenxml.com/drwPicFloating-position.php\n *\n * @module\n */\nimport { convertToEmu } from \"@office-open/core\";\nimport { element } from \"@office-open/xml\";\n\nimport { VerticalPositionAlign, VerticalPositionRelativeFrom } from \"./floating-position\";\nimport type { VerticalPositionOptions } from \"./floating-position\";\n\n/**\n * Creates a vertical position element for floating drawings.\n *\n * The positionV element specifies the vertical positioning of a floating\n * object relative to a base element (page, margin, paragraph, line, etc.).\n *\n * Reference: https://www.datypic.com/sc/ooxml/e-wp_positionV-1.html\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PosV\">\n * <xsd:choice>\n * <xsd:element name=\"align\" type=\"ST_AlignV\"/>\n * <xsd:element name=\"posOffset\" type=\"ST_PositionOffset\"/>\n * </xsd:choice>\n * <xsd:attribute name=\"relativeFrom\" type=\"ST_RelFromV\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @param options - Vertical position configuration\n * @returns The positionV XML string\n *\n * @example\n * ```typescript\n * // Align to the top of the page\n * createVerticalPosition({\n * relative: VerticalPositionRelativeFrom.PAGE,\n * align: VerticalPositionAlign.TOP,\n * });\n *\n * // Offset from the paragraph\n * createVerticalPosition({\n * relative: VerticalPositionRelativeFrom.PARAGRAPH,\n * offset: 457200, // 0.5 inch in EMUs\n * });\n * ```\n */\nexport const createVerticalPosition = ({\n relative,\n align,\n offset,\n}: VerticalPositionOptions): string => {\n const child = align\n ? `<wp:align>${align}</wp:align>`\n : offset !== undefined\n ? `<wp:posOffset>${convertToEmu(offset)}</wp:posOffset>`\n : `<wp:align>${VerticalPositionAlign.TOP}</wp:align>`;\n\n return element(\n \"wp:positionV\",\n {\n relativeFrom: relative ?? VerticalPositionRelativeFrom.PAGE,\n },\n [child],\n );\n};\n","import { decimalNumber } from \"@office-open/core\";\nimport { element } from \"@office-open/xml\";\n\n/**\n * Specifies the type of the current document grid, which defines the grid behavior.\n *\n * The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to all characters on each row; or a grid which affects only the line pitch for the current section.\n *\n * Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_DocGrid_topic_ID0ELYP2.html\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_DocGrid\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"default\"/>\n * <xsd:enumeration value=\"lines\"/>\n * <xsd:enumeration value=\"linesAndChars\"/>\n * <xsd:enumeration value=\"snapToChars\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const DocumentGridType = {\n /**\n * Specifies that no document grid shall be applied to the contents of the current section in the document.\n */\n DEFAULT: \"default\",\n /**\n * Specifies that the parent section shall have additional line pitch added to each line within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain the specified number of lines per page.\n */\n LINES: \"lines\",\n /**\n * Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.\n *\n * When this value is set, the input specified via the user interface may be allowed in exact number of line/character pitch units. */\n LINES_AND_CHARS: \"linesAndChars\",\n /**\n * Specifies that the parent section shall have both the additional line pitch and character pitch added to each line and character within it (as specified on the <docGrid> element (§2.6.5)) in order to maintain a specific number of lines per page and characters per line.\n *\n * When this value is set, the input specified via the user interface may be restricted to the number of lines per page and characters per line, with the consumer or producer translating this information based on the current font data to get the resulting line and character pitch values\n */\n SNAP_TO_CHARS: \"snapToChars\",\n} as const;\n\nexport interface DocGridProperties {\n /**\n * Specifies the type of the current document grid, which defines the grid behavior.\n *\n * The grid can define a grid which snaps all East Asian characters to grid positions, but leaves Latin text with its default spacing; a grid which adds the specified character pitch to each character on each row; or a grid which affects only the line pitch for the current section.\n */\n type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];\n /**\n * Specifies the number of lines to be allowed on the document grid for the current page assuming all lines have equal line pitch applied to them. This line pitch shall not be added to any line which appears within a table cell unless the <adjustLineHeightInTable> element (§2.15.3.1) is present in the document's compatibility settings.\n *\n * This attribute is specified in twentieths of a point, and defines the pitch for each line of text on this page such that the desired number of single spaced lines of text fits on the current page.\n *\n * ```xml\n * <w:docGrid w:linePitch=\"684\" …/>\n * ```\n *\n * The `linePitch` attribute specifies that 34.2 points is to the amount of pitch allowed for each line on this page in order to maintain the specific document grid. ]\n *\n * Individual paragraphs can override the line pitch information specified for the document grid by either:\n *\n * Specifying an exact line spacing value using the `lineRule` attribute of value exact on the <spacing> element (§2.3.1.33).\n *\n * Specifying that the paragraph text shall not snap to the document grid via the <snapToGrid> element (§2.3.1.32).\n *\n * The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).\n */\n linePitch: number;\n /**\n * Specifies the number of characters to be allowed on the document grid for each line in this section.\n *\n * This attribute's value shall be specified by multiplying the difference between the desired character pitch and the character pitch for that character in the font size of the Normal font by 4096.\n *\n * This value shall then be used to add the character pitch for the specified point size to each character in the section [: This results in text in the Normal style having a specific number of characters per line. ]\n *\n * ```xml\n * <w:docGrid w:charSize=\"40960\" …/>\n * ```\n * The `charSpace` attribute specifies a value of 40960, which means that the delta between the character pitch of each character in the grid and the Normal font is 10 points, resulting in a character pitch of 11+10 = 21 points for all characters in this section. ]\n *\n * Individual runs of text can override the line pitch information specified for the document grid by specifying that the run text shall not snap to the document grid via the <snapToGrid> element (§2.3.2.32).\n *\n * The possible values for this attribute are defined by the `ST_DecimalNumber` simple type (§2.18.16).\n */\n charSpace?: number;\n}\n\n/**\n * This element specifies the settings for the document grid, which enables precise layout of full-width East Asian language characters within a document by specifying the desired number of characters per line and lines per page for all East Asian text content in this section.\n *\n * Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docGrid_topic_ID0EHU5S.html\n *\n * ```xml\n * <xsd:complexType name=\"CT_DocGrid\">\n * <xsd:attribute name=\"type\" type=\"ST_DocGrid\"/>\n * <xsd:attribute name=\"linePitch\" type=\"ST_DecimalNumber\"/>\n * <xsd:attribute name=\"charSpace\" type=\"ST_DecimalNumber\"/>\n * </xsd:complexType>\n * ```\n * @returns\n */\nexport const createDocumentGrid = ({ type, linePitch, charSpace }: DocGridProperties): string =>\n element(\"w:docGrid\", {\n \"w:charSpace\": charSpace ? decimalNumber(charSpace) : undefined,\n \"w:linePitch\": decimalNumber(linePitch),\n \"w:type\": type,\n });\n","/**\n * Page borders module for WordprocessingML section properties.\n *\n * Defines borders around pages in a document section.\n *\n * Reference: http://officeopenxml.com/WPsectionBorders.php\n *\n * @module\n */\nimport type { BorderOptions } from \"@shared/border\";\n\n/**\n * Specifies which pages display the page border.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PageBorderDisplay\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"allPages\"/>\n * <xsd:enumeration value=\"firstPage\"/>\n * <xsd:enumeration value=\"notFirstPage\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const PageBorderDisplay = {\n /** Display border on all pages */\n ALL_PAGES: \"allPages\",\n /** Display border only on first page */\n FIRST_PAGE: \"firstPage\",\n /** Display border on all pages except first page */\n NOT_FIRST_PAGE: \"notFirstPage\",\n} as const;\n\n/**\n * Specifies whether page border is positioned relative to page edge or text.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PageBorderOffset\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"page\"/>\n * <xsd:enumeration value=\"text\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const PageBorderOffsetFrom = {\n /** Position border relative to page edge */\n PAGE: \"page\",\n /** Position border relative to text (default) */\n TEXT: \"text\",\n} as const;\n\n/**\n * Specifies z-order of page border relative to intersecting objects.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_PageBorderZOrder\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"front\"/>\n * <xsd:enumeration value=\"back\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const PageBorderZOrder = {\n /** Display border behind page contents */\n BACK: \"back\",\n /** Display border in front of page contents (default) */\n FRONT: \"front\",\n} as const;\n\n/**\n * Options for configuring page borders.\n *\n * @property display - Which pages display the border\n * @property offsetFrom - Whether border is positioned relative to page or text\n * @property zOrder - Whether border appears in front or behind page contents\n * @property top - Top border styling\n * @property right - Right border styling\n * @property bottom - Bottom border styling\n * @property left - Left border styling\n */\nexport interface PageBordersOptions {\n /** Which pages display the border */\n display?: (typeof PageBorderDisplay)[keyof typeof PageBorderDisplay];\n /** Whether border is positioned relative to page or text (default: text) */\n offsetFrom?: (typeof PageBorderOffsetFrom)[keyof typeof PageBorderOffsetFrom];\n /** Whether border appears in front or behind page contents (default: front) */\n zOrder?: (typeof PageBorderZOrder)[keyof typeof PageBorderZOrder];\n /** Top border styling */\n top?: BorderOptions;\n /** Right border styling */\n right?: BorderOptions;\n /** Bottom border styling */\n bottom?: BorderOptions;\n /** Left border styling */\n left?: BorderOptions;\n}\n","/**\n * Page margin module for WordprocessingML section properties.\n *\n * Defines page margins for document sections.\n *\n * Reference: http://officeopenxml.com/WPsectionPr.php\n *\n * @module\n */\nimport { signedTwipsMeasureValue, twipsMeasureValue } from \"@office-open/core\";\nimport type { PositiveUniversalMeasure, UniversalMeasure } from \"@office-open/core\";\n\n/**\n * Options for configuring page margins.\n *\n * All measurements are in twips (1/20th of a point) or universal measure.\n *\n * @property top - Top margin\n * @property right - Right margin\n * @property bottom - Bottom margin\n * @property left - Left margin\n * @property header - Header margin (distance from top of page to header)\n * @property footer - Footer margin (distance from bottom of page to footer)\n * @property gutter - Gutter margin for binding\n */\nexport interface PageMarginProperties {\n /** Top margin in twips or universal measure */\n top?: number | UniversalMeasure;\n /** Right margin in twips or universal measure */\n right?: number | PositiveUniversalMeasure;\n /** Bottom margin in twips or universal measure */\n bottom?: number | UniversalMeasure;\n /** Left margin in twips or universal measure */\n left?: number | PositiveUniversalMeasure;\n /** Header margin (distance from top of page to header) in twips or universal measure */\n header?: number | PositiveUniversalMeasure;\n /** Footer margin (distance from bottom of page to footer) in twips or universal measure */\n footer?: number | PositiveUniversalMeasure;\n /** Gutter margin for binding in twips or universal measure */\n gutter?: number | PositiveUniversalMeasure;\n}\n\n/**\n * Creates page margins (pgMar) for a document section.\n *\n * This element specifies the page margins for all pages in a section,\n * including top, bottom, left, right, header, footer, and gutter margins.\n *\n * Reference: http://officeopenxml.com/WPsectionPr.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_PageMar\">\n * <xsd:attribute name=\"top\" type=\"ST_SignedTwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"right\" type=\"s:ST_TwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"bottom\" type=\"ST_SignedTwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"left\" type=\"s:ST_TwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"header\" type=\"s:ST_TwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"footer\" type=\"s:ST_TwipsMeasure\" use=\"required\"/>\n * <xsd:attribute name=\"gutter\" type=\"s:ST_TwipsMeasure\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Create page margins with 1 inch margins (1440 twips = 1 inch)\n * createPageMargin(1440, 1440, 1440, 1440, 720, 720, 0);\n * ```\n */\nexport const createPageMargin = (\n top: number | UniversalMeasure,\n right: number | PositiveUniversalMeasure,\n bottom: number | UniversalMeasure,\n left: number | PositiveUniversalMeasure,\n header: number | PositiveUniversalMeasure,\n footer: number | PositiveUniversalMeasure,\n gutter: number | PositiveUniversalMeasure,\n): string =>\n `<w:pgMar w:bottom=\"${signedTwipsMeasureValue(bottom)}\" w:footer=\"${twipsMeasureValue(footer)}\" w:gutter=\"${twipsMeasureValue(gutter)}\" w:header=\"${twipsMeasureValue(header)}\" w:left=\"${twipsMeasureValue(left)}\" w:right=\"${twipsMeasureValue(right)}\" w:top=\"${signedTwipsMeasureValue(top)}\"/>`;\n","import { decimalNumber, twipsMeasureValue } from \"@office-open/core\";\nimport type { PositiveUniversalMeasure } from \"@office-open/core\";\nimport { element } from \"@office-open/xml\";\n\n/**\n * This simple type specifies when the line numbering in the parent section shall be reset to its restart value. The line numbering increments for each line (even if the line number itself is not displayed) until it reaches the restart point specified by this element.\n *\n * Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_LineNumberRestart_topic_ID0EUS42.html\n *\n * ## XSD Schema\n *\n * ```xml\n * <xsd:simpleType name=\"ST_LineNumberRestart\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"newPage\"/>\n * <xsd:enumeration value=\"newSection\"/>\n * <xsd:enumeration value=\"continuous\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const LineNumberRestartFormat = {\n /**\n * ## Restart Line Numbering on Each Page\n *\n * Specifies that line numbering for the parent section shall restart to the starting value whenever a new page is displayed.\n */\n NEW_PAGE: \"newPage\",\n /**\n * ## Restart Line Numbering for Each Section\n *\n * Specifies that line numbering for the parent section shall restart to the starting value whenever the parent begins.\n */\n NEW_SECTION: \"newSection\",\n /**\n * ## Continue Line Numbering From Previous Section\n *\n * Specifies that line numbering for the parent section shall continue from the line numbering from the end of the previous section, if any.\n */\n CONTINUOUS: \"continuous\",\n} as const;\n\nexport interface LineNumberProperties {\n /**\n * Specifies the line number increments to be displayed in the current document.\n *\n * Although each line has an associated line number, only lines which are an even multiple of this value shall be displayed.\n *\n * ### Example\n *\n * ```xml\n * <w:lnNumType … w:countBy=\"5\"/>\n * ```\n *\n * This setting ensures that only lines whose number is a multiple of (e.g. 5, 10, and 15) will have a line number displayed. ]\n *\n * The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).\n */\n countBy?: number;\n /**\n * ## Line Numbering Starting Value\n *\n * Specifies the starting value used for the first line whenever the line numbering is restarted by use of the `restart` attribute.\n *\n * ### Example\n *\n * ```xml\n * <w:lnNumType w:start=\"3\" w:countBy=\"5\"/>\n * ```\n *\n * The `start` attribute specifies that line numbers shall be counted starting from the number 3.\n *\n * The possible values for this attribute are defined by the ST_DecimalNumber simple type (§2.18.16).\n */\n start?: number;\n /**\n * ## Line Numbering Restart Setting\n *\n * Specifies when the line numbering in this section shall be reset to the line number specified by the `start` attribute's value.\n *\n * The line numbering increments for each line (even if it is not displayed) until it reaches the restart point specified by this element.\n *\n * ### Example\n *\n * ```xml\n * <w:sectPr>\n * ...\n * <w:lnNumType w:restart=\"newPage\" ... />\n * </w:sectPr>\n * ```\n *\n * The value of `newPage` specifies that the line numbers shall restart at the top of each page to the value specified by the `start` attribute. In this case, `newPage` is the default, so this value could have been omitted entirely.\n *\n * The possible values for this attribute are defined by the ST_LineNumberRestart simple type (§2.18.54).\n */\n restart?: (typeof LineNumberRestartFormat)[keyof typeof LineNumberRestartFormat];\n /**\n * Specifies the distance between the text margin and the edge of any line numbers appearing in that section.\n *\n * ```xml\n * <w:lnNumType ... w:distance=\"720\"/>\n * ```\n *\n * The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§2.18.105).\n */\n distance?: number | PositiveUniversalMeasure;\n}\n\n/**\n * This element specifies the settings for line numbering to be displayed before each column of text in this section in the document.\n *\n * References:\n * - https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_lnNumType_topic_ID0EVRAT.html\n * - http://officeopenxml.com/WPsectionLineNumbering.php\n *\n * ## XSD Schema\n *\n * ```xml\n * <xsd:complexType name=\"CT_LineNumber\">\n * <xsd:attribute name=\"countBy\" type=\"ST_DecimalNumber\" use=\"optional\"/>\n * <xsd:attribute name=\"start\" type=\"ST_DecimalNumber\" use=\"optional\" default=\"1\"/>\n * <xsd:attribute name=\"distance\" type=\"s:ST_TwipsMeasure\" use=\"optional\"/>\n * <xsd:attribute name=\"restart\" type=\"ST_LineNumberRestart\" use=\"optional\" default=\"newPage\"/>\n * </xsd:complexType>\n * ```\n */\nexport const createLineNumberType = ({\n countBy,\n start,\n restart,\n distance,\n}: LineNumberProperties): string =>\n element(\"w:lnNumType\", {\n \"w:countBy\": countBy === undefined ? undefined : decimalNumber(countBy),\n \"w:distance\": distance === undefined ? undefined : twipsMeasureValue(distance),\n \"w:restart\": restart,\n \"w:start\": start === undefined ? undefined : decimalNumber(start),\n });\n","/**\n * Section type module for WordprocessingML section properties.\n *\n * Defines how a section begins relative to the previous section.\n *\n * Reference: http://officeopenxml.com/WPsection.php\n *\n * @module\n */\n/**\n * Specifies the type of section break.\n *\n * This determines where the section begins relative to the previous section.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_SectionMark\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"nextPage\"/>\n * <xsd:enumeration value=\"nextColumn\"/>\n * <xsd:enumeration value=\"continuous\"/>\n * <xsd:enumeration value=\"evenPage\"/>\n * <xsd:enumeration value=\"oddPage\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @publicApi\n */\nexport const SectionType = {\n /** Section begins on the next page */\n NEXT_PAGE: \"nextPage\",\n /** Section begins on the next column */\n NEXT_COLUMN: \"nextColumn\",\n /** Section begins immediately following the previous section */\n CONTINUOUS: \"continuous\",\n /** Section begins on the next even-numbered page */\n EVEN_PAGE: \"evenPage\",\n /** Section begins on the next odd-numbered page */\n ODD_PAGE: \"oddPage\",\n} as const;\n\n/**\n * Creates section type (type) for a document section.\n *\n * This element specifies the type of section break, which determines\n * where the new section begins relative to the previous section.\n *\n * Reference: http://officeopenxml.com/WPsection.php\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_SectType\">\n * <xsd:attribute name=\"val\" type=\"ST_SectionMark\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * // Create a continuous section (no page break)\n * createSectionType(SectionType.CONTINUOUS);\n *\n * // Create a section that starts on next odd page\n * createSectionType(SectionType.ODD_PAGE);\n * ```\n */\nexport const createSectionType = (value: (typeof SectionType)[keyof typeof SectionType]): string =>\n `<w:type w:val=\"${value}\"/>`;\n","/**\n * This simple type specifies the possible types of headers and footers which may be specified for a given header or footer reference in a document. This value determines the page(s) on which the current header or footer shall be displayed.\n *\n * Reference: https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_HdrFtr_topic_ID0E2UW2.html\n *\n * ## XSD Schema\n * ```xml\n * <xsd:simpleType name=\"ST_HdrFtr\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"even\"/>\n * <xsd:enumeration value=\"default\"/>\n * <xsd:enumeration value=\"first\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n */\nexport const HeaderFooterReferenceType = {\n /** Specifies that this header or footer shall appear on every page in this section which is not overridden with a specific `even` or `first` page header/footer. In a section with all three types specified, this type shall be used on all odd numbered pages (counting from the `first` page in the section, not the section numbering). */\n DEFAULT: \"default\",\n /** Specifies that this header or footer shall appear on the first page in this section. The appearance of this header or footer is contingent on the setting of the `titlePg` element (§2.10.6). */\n FIRST: \"first\",\n /** Specifies that this header or footer shall appear on all even numbered pages in this section (counting from the first page in the section, not the section numbering). The appearance of this header or footer is contingent on the setting of the `evenAndOddHeaders` element (§2.10.1). */\n EVEN: \"even\",\n} as const;\n\n// <xsd:group name=\"EG_HdrFtrReferences\">\n// <xsd:choice>\n// <xsd:element name=\"headerReference\" type=\"CT_HdrFtrRef\" minOccurs=\"0\"/>\n// <xsd:element name=\"footerReference\" type=\"CT_HdrFtrRef\" minOccurs=\"0\"/>\n// </xsd:choice>\n// </xsd:group>\n\n// <xsd:complexType name=\"CT_HdrFtrRef\">\n// <xsd:complexContent>\n// <xsd:extension base=\"CT_Rel\">\n// <xsd:attribute name=\"type\" type=\"ST_HdrFtr\" use=\"required\"/>\n// </xsd:extension>\n// </xsd:complexContent>\n\n// <xsd:complexType name=\"CT_Rel\">\n// <xsd:attribute ref=\"r:id\" use=\"required\"/>\n// </xsd:complexType>\n\nexport interface HeaderFooterReferenceOptions {\n type?: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];\n id?: number;\n}\n\nexport const HeaderFooterType = {\n FOOTER: \"w:footerReference\",\n HEADER: \"w:headerReference\",\n} as const;\n\nexport const createHeaderFooterReference = (\n type: (typeof HeaderFooterType)[keyof typeof HeaderFooterType],\n options: HeaderFooterReferenceOptions,\n): string =>\n `<${type} r:id=\"rId${options.id}\" w:type=\"${options.type || HeaderFooterReferenceType.DEFAULT}\"/>`;\n","/**\n * Table of Contents Properties module.\n *\n * This module defines configuration options for table of contents generation,\n * including field switches and style mappings.\n *\n * Reference: http://officeopenxml.com/WPtableOfContents.php\n *\n * @module\n */\n\nimport type { SectionChild } from \"@shared/section\";\n\n/**\n * Represents a style-to-level mapping for table of contents entries.\n *\n * StyleLevel associates a paragraph style name with a TOC level, allowing\n * custom styles to be included in the table of contents at specific levels.\n *\n * @publicApi\n */\nexport class StyleLevel {\n /** The name of the paragraph style. */\n public styleName: string;\n /** The TOC level (1-9) to assign to this style. */\n public level: number;\n\n public constructor(styleName: string, level: number) {\n this.styleName = styleName;\n this.level = level;\n }\n}\n\n/**\n * Options for configuring a Table of Contents.\n *\n * These options control which content is included in the TOC and how it is formatted.\n * Options correspond to field switches in the TOC field code.\n *\n * Reference:\n * - https://www.ecma-international.org/publications/standards/Ecma-376.htm (Part 1, Page 1251)\n * - http://officeopenxml.com/WPtableOfContents.php\n */\nexport interface TableOfContentsOptions {\n /**\n * \\a option - Includes captioned items, but omits caption labels and numbers.\n * The identifier designated by text in this switch's field-argument corresponds to the caption label.\n * Use captionLabelIncludingNumbers (\\c) to build a table of captions with labels and numbers.\n */\n captionLabel?: string;\n\n /**\n * \\b option - Includes entries only from the portion of the document marked by\n * the bookmark named by text in this switch's field-argument.\n */\n entriesFromBookmark?: string;\n\n /**\n * \\c option - Includes figures, tables, charts, and other items that are numbered\n * by a SEQ field (§17.16.5.56). The sequence identifier designated by text in this switch's\n * field-argument, which corresponds to the caption label, shall match the identifier in the\n * corresponding SEQ field.\n */\n captionLabelIncludingNumbers?: string;\n\n /**\n * \\d option - When used with \\s, the text in this switch's field-argument defines\n * the separator between sequence and page numbers. The default separator is a hyphen (-).\n */\n sequenceAndPageNumbersSeparator?: string;\n\n /**\n * \\f option - Includes only those TC fields whose identifier exactly matches the\n * text in this switch's field-argument (which is typically a letter).\n */\n tcFieldIdentifier?: string;\n\n /**\n * \\h option - Makes the table of contents entries hyperlinks.\n */\n hyperlink?: boolean;\n\n /**\n * \\l option - Includes TC fields that assign entries to one of the levels specified\n * by text in this switch's field-argument as a range having the form startLevel-endLevel,\n * where startLevel and endLevel are integers, and startLevel has a value equal-to or less-than endLevel.\n * TC fields that assign entries to lower levels are skipped.\n */\n tcFieldLevelRange?: string;\n\n /**\n * \\n option - Without field-argument, omits page numbers from the table of contents.\n * Page numbers are omitted from all levels unless a range of entry levels is specified by\n * text in this switch's field-argument. A range is specified as for \\l.\n */\n pageNumbersEntryLevelsRange?: string;\n\n /**\n * \\o option - Uses paragraphs formatted with all or the specified range of builtin\n * heading styles. Headings in a style range are specified by text in this switch's\n * field-argument using the notation specified as for \\l, where each integer corresponds\n * to the style with a style ID of HeadingX (e.g. 1 corresponds to Heading1).\n * If no heading range is specified, all heading levels used in the document are listed.\n */\n headingStyleRange?: string;\n\n /**\n * \\p option - Text in this switch's field-argument specifies a sequence of characters\n * that separate an entry and its page number. The default is a tab with leader dots.\n */\n entryAndPageNumberSeparator?: string;\n\n /**\n * \\s option - For entries numbered with a SEQ field (§17.16.5.56), adds a prefix to the page number.\n * The prefix depends on the type of entry. text in this switch's field-argument shall match the\n * identifier in the SEQ field.\n */\n seqFieldIdentifierForPrefix?: string;\n\n /**\n * \\t field-argument Uses paragraphs formatted with styles other than the built-in heading styles.\n * Text in this switch's field-argument specifies those styles as a set of comma-separated doublets,\n * with each doublet being a comma-separated set of style name and table of content level.\n * \\t can be combined with \\o.\n */\n stylesWithLevels?: StyleLevel[];\n\n /**\n * \\u Uses the applied paragraph outline level.\n */\n useAppliedParagraphOutlineLevel?: boolean;\n\n /**\n * \\w Preserves tab entries within table entries.\n */\n preserveTabInEntries?: boolean;\n\n /**\n * \\x Preserves newline characters within table entries.\n */\n preserveNewLineInEntries?: boolean;\n\n /**\n * \\z Hides tab leader and page numbers in web page view (§17.18.102).\n */\n hideTabAndPageNumbersInWebView?: boolean;\n\n /**\n * Rendered TOC entries — the paragraph content between the field's `separate`\n * and `end` markers. Round-tripped structurally (each entry is a TOC-style\n * paragraph carrying a HYPERLINK field, tab leader, and PAGEREF page number)\n * so both MS Office and WPS display the existing TOC without regenerating.\n *\n * Omit on fresh generation — the field is then emitted `dirty` so the\n * consuming application builds the entries from headings on open.\n */\n entries?: SectionChild[];\n}\n","/**\n * Structured Document Tag Properties module.\n *\n * Represents CT_SdtPr — the properties of a structured document tag (content control).\n * Supports all SDT types defined in the OOXML specification: comboBox, dropDownList,\n * date, text, equation,richText, picture, citation, group, bibliography, docPartObj,\n * docPartList.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_SdtPr\n *\n * @module\n */\n\n// ─── Lock ───────────────────────────────────────────────────────────────────\n\n/**\n * SDT lock type (ST_Lock).\n */\nexport const SdtLock = {\n /** Lock the SDT itself (cannot delete the control) */\n SDT_LOCKED: \"sdtLocked\",\n /** Lock the content (cannot edit content within the control) */\n CONTENT_LOCKED: \"contentLocked\",\n /** No locking */\n UNLOCKED: \"unlocked\",\n /** Lock both SDT and content */\n SDT_CONTENT_LOCKED: \"sdtContentLocked\",\n} as const;\n\n// ─── Supporting Types ───────────────────────────────────────────────────────\n\n/**\n * A list item for comboBox or dropDownList SDTs (CT_SdtListItem).\n */\nexport interface SdtListItem {\n /** Display text shown in the UI */\n displayText?: string;\n /** Underlying value */\n value?: string;\n}\n\n/**\n * Options for comboBox SDT type (CT_SdtComboBox).\n */\nexport interface SdtComboBoxOptions {\n /** List items */\n items?: SdtListItem[];\n /** Last selected value */\n lastValue?: string;\n}\n\n/**\n * Options for dropDownList SDT type (CT_SdtDropDownList).\n */\nexport interface SdtDropDownListOptions {\n /** List items */\n items?: SdtListItem[];\n /** Last selected value */\n lastValue?: string;\n}\n\n/**\n * Date mapping type (ST_SdtDateMappingType).\n */\nexport const SdtDateMappingType = {\n TEXT: \"text\",\n DATE: \"date\",\n DATE_TIME: \"dateTime\",\n} as const;\n\n/**\n * Options for date SDT type (CT_SdtDate).\n */\nexport interface SdtDateOptions {\n /** Date format string (e.g., \"yyyy-MM-dd\") */\n dateFormat?: string;\n /** Language ID (e.g., \"en-US\") */\n languageId?: string;\n /** How the date value is stored */\n storeMappedDataAs?: (typeof SdtDateMappingType)[keyof typeof SdtDateMappingType];\n /** Calendar type */\n calendar?: string;\n /** Full date value (ISO 8601) */\n fullDate?: string;\n}\n\n/**\n * Options for plain text SDT type (CT_SdtText).\n */\nexport interface SdtTextOptions {\n /** Whether the text control supports multiple lines */\n multiLine?: boolean;\n}\n\n/**\n * Symbol for a checkbox content control state (CT_SdtCheckboxSymbol).\n *\n * `val` is a hex Unicode code point (e.g., \"2612\" for ☒); `font` defaults to\n * \"MS Gothic\" per the OOXML specification.\n */\nexport interface SdtCheckboxSymbol {\n /** Hex Unicode code point of the symbol (e.g., \"2612\") */\n val: string;\n /** Font face; defaults to \"MS Gothic\" */\n font?: string;\n}\n\n/**\n * Options for a checkbox content control (CT_SdtCheckbox, w14:checkbox).\n *\n * Word 2010+ content control checkbox. When present, the SDT renders the\n * current state symbol instead of its declared children.\n */\nexport interface SdtCheckboxOptions {\n /** Whether the checkbox is checked (default: false) */\n checked?: boolean;\n /** Symbol for the checked state (default: ☒ 0x2612, MS Gothic) */\n checkedState?: SdtCheckboxSymbol;\n /** Symbol for the unchecked state (default: ☐ 0x2610, MS Gothic) */\n uncheckedState?: SdtCheckboxSymbol;\n}\n\n/**\n * Data binding options (CT_DataBinding).\n */\nexport interface SdtDataBindingOptions {\n /** XML namespace prefix mappings */\n prefixMappings?: string;\n /** XPath expression (required) */\n xpath: string;\n /** Custom XML store item ID (required) */\n storeItemID: string;\n}\n\n/**\n * Options for CT_SdtPr — structured document tag properties.\n */\nexport interface SdtPropertiesOptions {\n /** Display name */\n alias?: string;\n /** Application-specific tag */\n tag?: string;\n /** Unique ID */\n id?: number;\n /** Lock behavior */\n lock?: (typeof SdtLock)[keyof typeof SdtLock];\n /** Whether the control is temporary */\n temporary?: boolean;\n /** Whether the placeholder text is currently shown */\n showingPlaceholder?: boolean;\n /** Data binding to custom XML */\n dataBinding?: SdtDataBindingOptions;\n /** Numeric label */\n label?: number;\n /** Tab order index */\n tabIndex?: number;\n\n // ─── Type discriminators (xsd:choice, at most one) ───\n\n /** Equation SDT */\n equation?: boolean;\n /** ComboBox SDT (allows free-text entry) */\n comboBox?: SdtComboBoxOptions;\n /** Date SDT */\n date?: SdtDateOptions;\n /** Document part object SDT */\n docPartObj?: {\n gallery?: string;\n category?: string;\n unique?: boolean;\n };\n /** Document part list SDT */\n docPartList?: {\n gallery?: string;\n category?: string;\n unique?: boolean;\n };\n /** DropDownList SDT (selection only) */\n dropDownList?: SdtDropDownListOptions;\n /** Picture SDT */\n picture?: boolean;\n /** Rich text SDT */\n richText?: boolean;\n /** Plain text SDT */\n text?: SdtTextOptions;\n /** Citation SDT */\n citation?: boolean;\n /** Group SDT */\n group?: boolean;\n /** Bibliography SDT */\n bibliography?: boolean;\n /** Checkbox content control SDT (Word 2010+, w14:checkbox) */\n checkbox?: SdtCheckboxOptions;\n}\n","/**\n * Footnote module for WordprocessingML documents.\n *\n * This module provides support for footnotes that appear at the bottom\n * of the page referenced from the main document text.\n *\n * Reference: http://officeopenxml.com/WPfootnotes.php\n *\n * @module\n */\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\n\n/**\n * Enumeration of footnote types.\n *\n * Reference: http://officeopenxml.com/WPfootnotes.php\n *\n * @publicApi\n */\nexport const FootnoteType = {\n /** Separator line between body text and footnotes */\n SEPERATOR: \"separator\",\n /** Continuation separator for footnotes spanning pages */\n CONTINUATION_SEPERATOR: \"continuationSeparator\",\n} as const;\n\n/**\n * Options for creating a Footnote.\n *\n * @property id - Unique numeric identifier for this footnote\n * @property type - Type of footnote (separator, continuationSeparator, or normal)\n * @property children - Array of paragraphs that make up the footnote content\n *\n * @see {@link Footnote}\n */\nexport interface FootnoteOptions {\n /** Unique numeric identifier for this footnote */\n id: number;\n /** Type of footnote (separator or continuation separator) */\n type?: (typeof FootnoteType)[keyof typeof FootnoteType];\n /** Content of the footnote (paragraphs, tables, etc.) */\n children: (ParagraphOptions | string)[];\n}\n","/**\n * Endnote module for WordprocessingML documents.\n *\n * @module\n */\nimport type { ParagraphOptions } from \"@parts/paragraph/paragraph\";\n\nexport const EndnoteType = {\n CONTINUATION_SEPARATOR: \"continuationSeparator\",\n\n SEPARATOR: \"separator\",\n} as const;\n\nexport interface EndnoteOptions {\n id: number;\n type?: (typeof EndnoteType)[keyof typeof EndnoteType];\n children: (ParagraphOptions | string)[];\n}\n","/**\n * Permission range markers for WordprocessingML document protection.\n *\n * These elements mark editable ranges within a protected document.\n *\n * Reference: ISO/IEC 29500-4, wml.xsd, CT_PermStart, CT_PermEnd\n *\n * @module\n */\n\n/**\n * Editing group values for permission ranges.\n *\n * Defines who can edit within a permission range.\n *\n * Reference: ISO/IEC 29500-4, ST_EdGrp\n */\nexport const EditGroupType = {\n NONE: \"none\",\n EVERYONE: \"everyone\",\n ADMINISTRATORS: \"administrators\",\n CONTRIBUTORS: \"contributors\",\n EDITORS: \"editors\",\n OWNERS: \"owners\",\n CURRENT: \"current\",\n} as const;\n\nexport type EditGroup = (typeof EditGroupType)[keyof typeof EditGroupType];\n\n/**\n * Options for creating a permission start marker.\n */\nexport interface PermStartOptions {\n /** Unique identifier for this permission range (typically a number) */\n id: string | number;\n /** Editing group that can edit this range */\n edGroup?: EditGroup;\n /** Individual user who can edit this range */\n ed?: string;\n /** First column this range covers (for table cells) */\n colFirst?: number;\n /** Last column this range covers (for table cells) */\n colLast?: number;\n}\n","/**\n * Font module for WordprocessingML documents.\n *\n * Provides support for font definitions and embedded fonts.\n *\n * Reference: http://www.datypic.com/sc/ooxml/e-w_font-1.html\n *\n * @module\n */\nimport { element } from \"@office-open/xml\";\n\nconst createStringElement = (name: string, value: string): string =>\n element(name, { \"w:val\": value });\n\n/**\n * Options for a font relationship (embedded font).\n *\n * Reference: http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html\n *\n * @property id - Relationship to Part\n * @property fontKey - Embedded Font Obfuscation Key (GUID)\n * @property subsetted - Whether the embedded font is subsetted\n */\nexport interface FontRelationshipOptions {\n /** Relationship to Part */\n id: string;\n /** Embedded Font Obfuscation Key (GUID) */\n fontKey?: string;\n /** Whether the embedded font is subsetted */\n subsetted?: boolean;\n}\n\n/**\n * Character set constants for font definitions.\n * Maps character set names to their hexadecimal identifiers.\n *\n * @publicApi\n */\nexport const CharacterSet = {\n ANSI: \"00\",\n ARABIC: \"B2\",\n BALTIC: \"BA\",\n CHINESEBIG5: \"88\",\n DEFAULT: \"01\",\n EASTEUROPE: \"EE\",\n GB_2312: \"86\",\n GREEK: \"A1\",\n HANGUL: \"81\",\n HEBREW: \"B1\",\n JIS: \"80\",\n JOHAB: \"82\",\n MAC: \"4D\",\n OEM: \"FF\",\n RUSSIAN: \"CC\",\n SYMBOL: \"02\",\n THAI: \"DE\",\n TURKISH: \"A2\",\n VIETNAMESE: \"A3\",\n} as const;\n\n/**\n * Options for defining a font in the document.\n *\n * Reference: http://www.datypic.com/sc/ooxml/e-w_font-1.html\n *\n * @property name - Font name (required)\n * @property altName - Alternative font name\n * @property panose1 - PANOSE-1 classification\n * @property charset - Character set identifier\n * @property family - Font family\n * @property notTrueType - Whether this is not a TrueType font\n * @property pitch - Font pitch\n * @property sig - Font signature (Unicode and code page ranges)\n * @property embedRegular - Embedded regular font relationship\n * @property embedBold - Embedded bold font relationship\n * @property embedItalic - Embedded italic font relationship\n * @property embedBoldItalic - Embedded bold-italic font relationship\n */\nexport interface FontEntry {\n /** Font name (required) */\n name: string;\n /** Alternative font name */\n altName?: string;\n /** PANOSE-1 classification */\n panose1?: string;\n /** Character set identifier */\n charset?: (typeof CharacterSet)[keyof typeof CharacterSet];\n /** Font family */\n family?: string;\n /** Whether this is not a TrueType font */\n notTrueType?: boolean;\n /** Font pitch */\n pitch?: string;\n /** Font signature (Unicode and code page ranges) */\n sig?: {\n /** Unicode Subset Bitfield 0 */\n usb0: string;\n /** Unicode Subset Bitfield 1 */\n usb1: string;\n /** Unicode Subset Bitfield 2 */\n usb2: string;\n /** Unicode Subset Bitfield 3 */\n usb3: string;\n /** Code Page Bitfield 0 */\n csb0: string;\n /** Code Page Bitfield 1 */\n csb1: string;\n };\n /** Embedded regular font relationship */\n embedRegular?: FontRelationshipOptions;\n /** Embedded bold font relationship */\n embedBold?: FontRelationshipOptions;\n /** Embedded italic font relationship */\n embedItalic?: FontRelationshipOptions;\n /** Embedded bold-italic font relationship */\n embedBoldItalic?: FontRelationshipOptions;\n}\n\n/**\n * Creates a font relationship element for embedding fonts.\n */\nconst createFontRelationship = (\n { id, fontKey, subsetted }: FontRelationshipOptions,\n name: string,\n): string => {\n const attrs: Record<string, string | undefined> = { \"r:id\": id };\n if (fontKey) {\n attrs[\"w:fontKey\"] = `{${fontKey}}`;\n }\n const children = subsetted ? [`<w:subsetted/>`] : undefined;\n return element(name, attrs, children);\n};\n\n/**\n * Creates a font element with the specified options.\n *\n * This function builds a complete font definition including optional embedded font files,\n * font signature, character set, and other font properties.\n *\n * Reference: http://www.datypic.com/sc/ooxml/e-w_font-1.html\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_Font\">\n * <xsd:sequence>\n * <xsd:element name=\"altName\" type=\"CT_String\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"panose1\" type=\"CT_Panose\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"charset\" type=\"CT_Charset\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"family\" type=\"CT_FontFamily\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"notTrueType\" type=\"CT_OnOff\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"pitch\" type=\"CT_Pitch\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"sig\" type=\"CT_FontSig\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"embedRegular\" type=\"CT_FontRel\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"embedBold\" type=\"CT_FontRel\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"embedItalic\" type=\"CT_FontRel\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * <xsd:element name=\"embedBoldItalic\" type=\"CT_FontRel\" minOccurs=\"0\" maxOccurs=\"1\"/>\n * </xsd:sequence>\n * <xsd:attribute name=\"name\" type=\"s:ST_String\" use=\"required\"/>\n * </xsd:complexType>\n * ```\n *\n * @example\n * ```typescript\n * const font = createFont({\n * name: \"Arial\",\n * family: \"swiss\",\n * pitch: \"variable\",\n * charset: CharacterSet.ANSI\n * });\n * ```\n */\nexport const createFont = ({\n name,\n altName,\n panose1,\n charset,\n family,\n notTrueType,\n pitch,\n sig,\n embedRegular,\n embedBold,\n embedItalic,\n embedBoldItalic,\n}: FontEntry): string => {\n const children: string[] = [];\n\n // http://www.datypic.com/sc/ooxml/e-w_altName-1.html\n if (altName) children.push(createStringElement(\"w:altName\", altName));\n // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html\n if (panose1) children.push(createStringElement(\"w:panose1\", panose1));\n // http://www.datypic.com/sc/ooxml/e-w_charset-1.html\n if (charset) children.push(createStringElement(\"w:charset\", charset));\n // http://www.datypic.com/sc/ooxml/e-w_family-1.html\n if (family) children.push(createStringElement(\"w:family\", family));\n // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html\n if (notTrueType) children.push(`<w:notTrueType/>`);\n if (pitch) children.push(createStringElement(\"w:pitch\", pitch));\n // http://www.datypic.com/sc/ooxml/e-w_sig-1.html\n if (sig) {\n children.push(\n `<w:sig w:csb0=\"${sig.csb0}\" w:csb1=\"${sig.csb1}\" w:usb0=\"${sig.usb0}\" w:usb1=\"${sig.usb1}\" w:usb2=\"${sig.usb2}\" w:usb3=\"${sig.usb3}\"/>`,\n );\n }\n // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html\n if (embedRegular) children.push(createFontRelationship(embedRegular, \"w:embedRegular\"));\n // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html\n if (embedBold) children.push(createFontRelationship(embedBold, \"w:embedBold\"));\n // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html\n if (embedItalic) children.push(createFontRelationship(embedItalic, \"w:embedItalic\"));\n // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html\n if (embedBoldItalic) children.push(createFontRelationship(embedBoldItalic, \"w:embedBoldItalic\"));\n\n return element(\"w:font\", { \"w:name\": name }, children);\n};\n","/**\n * Relationships descriptor — produces .rels XML files.\n *\n * Reference: OPC, Relationships.xsd\n *\n * @module\n */\n\nimport type { CustomDescriptor } from \"@office-open/core/descriptor\";\nimport { escapeXml } from \"@office-open/xml\";\n\nexport interface RelationshipEntry {\n id: number | string;\n type: string;\n target: string;\n targetMode?: string;\n}\n\nexport interface RelationshipsInput {\n relationships: RelationshipEntry[];\n}\n\nexport const relationshipsDesc: CustomDescriptor<RelationshipsInput> = {\n kind: \"custom\",\n\n stringify(opts, _ctx) {\n const p: string[] = [\n '<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">',\n ];\n for (const rel of opts.relationships) {\n const targetModeAttr = rel.targetMode ? ` TargetMode=\"${escapeXml(rel.targetMode)}\"` : \"\";\n p.push(\n `<Relationship Id=\"rId${rel.id}\" Type=\"${escapeXml(rel.type)}\" Target=\"${escapeXml(rel.target)}\"${targetModeAttr}/>`,\n );\n }\n p.push(\"</Relationships>\");\n return p.join(\"\");\n },\n\n parse(el, _ctx) {\n const relationships: RelationshipEntry[] = [];\n for (const child of el.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const id = child.attributes?.[\"Id\"];\n const type = child.attributes?.[\"Type\"];\n const target = child.attributes?.[\"Target\"];\n const targetMode = child.attributes?.[\"TargetMode\"];\n if (id && type && target) {\n const numId = String(id).replace(\"rId\", \"\");\n relationships.push({\n id: Number(numId) || id,\n type: String(type),\n target: String(target),\n targetMode: targetMode ? String(targetMode) : undefined,\n });\n }\n }\n return { relationships };\n },\n};\n","/**\n * Cell merge track revision component.\n *\n * @module\n */\n\nimport type { ChangedProperties } from \"../track-revision\";\n\n/**\n * Vertical merge revision types.\n */\nexport const VerticalMergeRevisionType = {\n /**\n * Cell that is merged with upper one.\n */\n CONTINUE: \"continue\",\n /**\n * Cell that is starting the vertical merge.\n */\n RESTART: \"restart\",\n} as const;\n\nexport type CellMergeAttributes = ChangedProperties & {\n verticalMerge?: (typeof VerticalMergeRevisionType)[keyof typeof VerticalMergeRevisionType];\n verticalMergeOriginal?: (typeof VerticalMergeRevisionType)[keyof typeof VerticalMergeRevisionType];\n};\n","/**\n * Vertical alignment module for WordprocessingML documents.\n *\n * This module provides vertical alignment options for table cells and sections.\n *\n * ## XSD Schema\n * ```xml\n * <xsd:complexType name=\"CT_VerticalJc\">\n * <xsd:attribute name=\"val\" type=\"ST_VerticalJc\" use=\"required\"/>\n * </xsd:complexType>\n *\n * <xsd:simpleType name=\"ST_VerticalJc\">\n * <xsd:restriction base=\"xsd:string\">\n * <xsd:enumeration value=\"both\"/>\n * <xsd:enumeration value=\"top\"/>\n * <xsd:enumeration value=\"center\"/>\n * <xsd:enumeration value=\"bottom\"/>\n * </xsd:restriction>\n * </xsd:simpleType>\n * ```\n *\n * @module\n */\n/**\n * Enumeration for table-cell vertical alignment. Only `top`, `center`, `bottom`\n * are valid according to ECMA-376 (§17.18.87 ST_VerticalJc within `<w:tcPr>`).\n *\n * @publicApi\n */\nexport const VerticalAlignTable = {\n BOTTOM: \"bottom\",\n CENTER: \"center\",\n TOP: \"top\",\n} as const;\n\n/**\n * Enumeration for section (<w:sectPr>) vertical alignment. Adds `both` on top of\n * the table-cell set (§17.18.87 ST_VerticalJc within <w:sectPr>).\n *\n * @publicApi\n */\nexport const VerticalAlignSection = {\n ...VerticalAlignTable,\n BOTH: \"both\",\n} as const;\n\nexport type TableVerticalAlign = (typeof VerticalAlignTable)[keyof typeof VerticalAlignTable];\n\nexport type SectionVerticalAlign = (typeof VerticalAlignSection)[keyof typeof VerticalAlignSection];\n\n/**\n * Creates a vertical alignment element in a WordprocessingML document.\n *\n * Used in table cells and sections to control vertical text positioning.\n *\n * @example\n * ```typescript\n * createVerticalAlign(VerticalAlignTable.CENTER);\n * ```\n */\nexport const createVerticalAlign = (value: TableVerticalAlign | SectionVerticalAlign): string =>\n `<w:vAlign w:val=\"${value}\"/>`;\n"],"mappings":"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"}
@@ -1,7 +1,185 @@
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-B7Sfx_F0.mjs";
2
- import { t as DocxReadContext } from "./context-CiyAhqTX.mjs";
1
+ import { A as parseStyleDefinitions, C as endnotesDesc, D as buildNumberingCache, O as buildStyleCache, T as settingsDesc, b as fontTableDesc, c as customPropertiesDesc, d as contentTypesDesc, l as corePropertiesDesc, o as webSettingsDesc, s as appPropertiesDesc, t as DocxReadContext, v as glossaryDesc, w as footnotesDesc, y as bibliographyDesc, z as parseNumberingDefinitions } from "./context-B5k1UabT.mjs";
2
+ import { K as setBodyParseChild, W as parseCustomXmlProperties, a as setTableParseChild, et as stringifyElement, g as parseParagraphProperties, h as parseParagraph, o as tableDesc, t as commentsDesc, w as parseSectionPropertiesEl, x as parseSdtBlock, y as replaceRelsWithPlaceholders } from "./comments-Cn9Q0iT6.mjs";
3
3
  import { parseArchive, toUint8Array } from "@office-open/core";
4
- import { attr, findChild, findDeep, findFirst, textOf } from "@office-open/xml";
4
+ import { attr, children, findChild, findDeep, findFirst, textOf } from "@office-open/xml";
5
+ //#region src/parts/table-of-contents/toc-parse.ts
6
+ /**
7
+ * Table of Contents parser for DOCX documents.
8
+ *
9
+ * Parses TOC-type SDT elements into TOC options.
10
+ *
11
+ * @module
12
+ */
13
+ /**
14
+ * Try to parse a w:sdt element as a TOC.
15
+ * Returns { alias, ...tocOptions } if it's a TOC, or undefined otherwise.
16
+ *
17
+ * Detects TOC in two ways:
18
+ * 1. SDT with w:docPartObj > w:docPartGallery = "Table of Contents" (Word-generated)
19
+ * 2. SDT whose content contains a TOC field instruction (library-generated)
20
+ */
21
+ function parseToc(el, ctx, parseChildren) {
22
+ const sdtPr = findChild(el, "w:sdtPr");
23
+ if (!sdtPr) return void 0;
24
+ const docPartObj = findChild(sdtPr, "w:docPartObj");
25
+ let isToc = false;
26
+ if (docPartObj) {
27
+ const gallery = findChild(docPartObj, "w:docPartGallery");
28
+ if (gallery && textOf(gallery) === "Table of Contents") isToc = true;
29
+ }
30
+ if (!isToc) {
31
+ const sdtContent = findChild(el, "w:sdtContent");
32
+ if (sdtContent) isToc = hasTocFieldInstruction(sdtContent);
33
+ }
34
+ if (!isToc) return void 0;
35
+ const alias = (() => {
36
+ const aliasEl = findChild(sdtPr, "w:alias");
37
+ return aliasEl ? attr(aliasEl, "w:val") : void 0;
38
+ })();
39
+ const tocOpts = {};
40
+ const sdtContent = findChild(el, "w:sdtContent");
41
+ if (sdtContent) {
42
+ for (const p of children(sdtContent, "w:p")) for (const r of children(p, "w:r")) for (const instrText of children(r, "w:instrText")) parseTocFieldInstruction(textOf(instrText).trim(), tocOpts);
43
+ if (parseChildren) {
44
+ const entryEls = selectTocEntryElements(sdtContent.elements ?? []);
45
+ if (entryEls.length > 0) tocOpts.entries = parseChildren(entryEls, ctx);
46
+ }
47
+ }
48
+ return {
49
+ alias,
50
+ ...tocOpts
51
+ };
52
+ }
53
+ /**
54
+ * Check whether an element tree contains a TOC field instruction
55
+ * (w:instrText with text starting with "TOC").
56
+ */
57
+ function hasTocFieldInstruction(el) {
58
+ for (const p of children(el, "w:p")) for (const r of children(p, "w:r")) for (const instrText of children(r, "w:instrText")) if ((textOf(instrText)?.trim())?.startsWith("TOC")) return true;
59
+ return false;
60
+ }
61
+ /**
62
+ * Parse a TOC field instruction string (e.g., ' TOC \o "1-3" \h \z ')
63
+ * into TableOfContentsOptions properties.
64
+ */
65
+ function parseTocFieldInstruction(instruction, opts) {
66
+ if (!instruction.startsWith("TOC")) return;
67
+ const switches = parseFieldSwitches(instruction.slice(3).trim());
68
+ if (switches["a"]) opts.captionLabel = switches["a"];
69
+ if (switches["b"]) opts.entriesFromBookmark = switches["b"];
70
+ if (switches["c"]) opts.captionLabelIncludingNumbers = switches["c"];
71
+ if (switches["d"]) opts.sequenceAndPageNumbersSeparator = switches["d"];
72
+ if (switches["f"]) opts.tcFieldIdentifier = switches["f"];
73
+ if ("h" in switches) opts.hyperlink = true;
74
+ if (switches["l"]) opts.tcFieldLevelRange = switches["l"];
75
+ if (switches["n"]) opts.pageNumbersEntryLevelsRange = switches["n"];
76
+ if (switches["o"]) opts.headingStyleRange = switches["o"];
77
+ if (switches["p"]) opts.entryAndPageNumberSeparator = switches["p"];
78
+ if (switches["s"]) opts.seqFieldIdentifierForPrefix = switches["s"];
79
+ if (switches["t"]) {
80
+ const parts = switches["t"].split(",");
81
+ const stylesWithLevels = [];
82
+ for (let i = 0; i + 1 < parts.length; i += 2) {
83
+ const styleName = parts[i];
84
+ const level = parseInt(parts[i + 1] ?? "", 10);
85
+ if (styleName && !Number.isNaN(level)) stylesWithLevels.push({
86
+ styleName,
87
+ level
88
+ });
89
+ }
90
+ if (stylesWithLevels.length > 0) opts.stylesWithLevels = stylesWithLevels;
91
+ }
92
+ if ("u" in switches) opts.useAppliedParagraphOutlineLevel = true;
93
+ if ("w" in switches) opts.preserveTabInEntries = true;
94
+ if ("x" in switches) opts.preserveNewLineInEntries = true;
95
+ if ("z" in switches) opts.hideTabAndPageNumbersInWebView = true;
96
+ }
97
+ /**
98
+ * Extract TOC options from the elements of a captured TOC field (SDT content or
99
+ * a bare cross-paragraph field). Feeds every w:instrText to the instruction
100
+ * parser; non-TOC fields (HYPERLINK/PAGEREF inside the rendered entries) are
101
+ * ignored — parseTocFieldInstruction only acts on instructions starting "TOC".
102
+ */
103
+ function parseTocFieldFromElements(els) {
104
+ const opts = {};
105
+ for (const el of els) collectTocInstructions(el, opts);
106
+ return opts;
107
+ }
108
+ /**
109
+ * Select the rendered-entry paragraphs of a captured TOC field. Tracks field
110
+ * depth so a nested HYPERLINK/PAGEREF field inside an entry doesn't fool the
111
+ * boundary detection.
112
+ *
113
+ * A paragraph is an entry when, after walking it, the field is past `separate`
114
+ * and not past `end` (depth ≥ 1) and the paragraph carries rendered text (`w:t`).
115
+ * This captures an entry whose paragraph also opens the field (`begin`) or holds
116
+ * the `separate` marker — common when Word emits begin + separate + first entry
117
+ * in one paragraph — while the `w:t` requirement excludes a pure control
118
+ * paragraph (field head / separate-only / end).
119
+ */
120
+ function selectTocEntryElements(els) {
121
+ const entries = [];
122
+ let depth = 0;
123
+ let afterSeparate = false;
124
+ for (const el of els) {
125
+ const walk = (node) => {
126
+ if (node.name === "w:fldChar") {
127
+ const type = attr(node, "w:fldCharType");
128
+ if (type === "begin") depth++;
129
+ else if (type === "separate" && depth === 1) afterSeparate = true;
130
+ else if (type === "end") depth--;
131
+ }
132
+ for (const c of node.elements ?? []) if (c.type === "element") walk(c);
133
+ };
134
+ walk(el);
135
+ if (afterSeparate && depth >= 1 && findFirst(el, "w:t") !== void 0) entries.push(el);
136
+ }
137
+ return entries;
138
+ }
139
+ /** Recursively feed every w:instrText to the TOC instruction parser. */
140
+ function collectTocInstructions(el, opts) {
141
+ if (el.name === "w:instrText") {
142
+ const instruction = textOf(el)?.trim();
143
+ if (instruction) parseTocFieldInstruction(instruction, opts);
144
+ }
145
+ for (const c of el.elements ?? []) if (c.type === "element") collectTocInstructions(c, opts);
146
+ }
147
+ /**
148
+ * Parse field switches like \o "1-3" \h \z into a map.
149
+ */
150
+ function parseFieldSwitches(text) {
151
+ const result = {};
152
+ let i = 0;
153
+ while (i < text.length) {
154
+ while (i < text.length && text[i] === " ") i++;
155
+ if (i >= text.length) break;
156
+ if (text[i] !== "\\") {
157
+ i++;
158
+ continue;
159
+ }
160
+ i++;
161
+ const nameStart = i;
162
+ while (i < text.length && /[a-zA-Z]/.test(text[i] ?? "")) i++;
163
+ const name = text.slice(nameStart, i);
164
+ if (!name) continue;
165
+ while (i < text.length && text[i] === " ") i++;
166
+ if (i < text.length && text[i] === "\"") {
167
+ i++;
168
+ const argStart = i;
169
+ while (i < text.length && text[i] !== "\"") i++;
170
+ result[name] = text.slice(argStart, i);
171
+ if (i < text.length) i++;
172
+ } else if (i < text.length && text[i] !== "\\") {
173
+ const argStart = i;
174
+ while (i < text.length && text[i] !== " " && text[i] !== "\\") i++;
175
+ const arg = text.slice(argStart, i).trim();
176
+ if (arg) result[name] = arg;
177
+ else result[name] = void 0;
178
+ } else result[name] = void 0;
179
+ }
180
+ return result;
181
+ }
182
+ //#endregion
5
183
  //#region \0polyfill-node.global.js
6
184
  var _polyfill_node_global_default = typeof _polyfill_node_global_default !== "undefined" ? _polyfill_node_global_default : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
7
185
  //#endregion
@@ -1530,8 +1708,7 @@ function parseBody(body, ctx) {
1530
1708
  if (boundaries.length === 0) return [{ children: parseBodyChildren(bodyChildren, ctx) }];
1531
1709
  const sections = [];
1532
1710
  let start = 0;
1533
- for (let i = 0; i < boundaries.length; i++) {
1534
- const boundary = boundaries[i];
1711
+ for (const boundary of boundaries) {
1535
1712
  const endIdx = boundary.index;
1536
1713
  const sectionElements = bodyChildren.slice(start, endIdx);
1537
1714
  const parsedProps = parseSectionProperties(boundary.sectPr, ctx);
@@ -1598,7 +1775,8 @@ function parseBodyChildren(elements, ctx) {
1598
1775
  if (!tocBuffer) return;
1599
1776
  children.push(buildTocChild(tocBuffer, ctx));
1600
1777
  const lastEl = tocBuffer[tocBuffer.length - 1];
1601
- const pageBreakCount = findDeep(lastEl, "w:br").filter((b) => attr(b, "w:type") === "page").length;
1778
+ let pageBreakCount = 0;
1779
+ for (const br of findDeep(lastEl, "w:br")) if (attr(br, "w:type") === "page") pageBreakCount++;
1602
1780
  for (let i = 0; i < pageBreakCount; i++) children.push({ paragraph: { children: [{ pageBreak: true }] } });
1603
1781
  tocBuffer = null;
1604
1782
  tocDepth = 0;
@@ -1932,6 +2110,6 @@ function parseDocx(data) {
1932
2110
  };
1933
2111
  }
1934
2112
  //#endregion
1935
- export { parseDocument as n, parseDocx as r, parseArchive as t };
2113
+ export { parseTocFieldFromElements as a, parseToc as i, parseDocument as n, parseTocFieldInstruction as o, parseDocx as r, selectTocEntryElements as s, parseArchive as t };
1936
2114
 
1937
- //# sourceMappingURL=parse-DDWWDGbX.mjs.map
2115
+ //# sourceMappingURL=parse-ep7JKATJ.mjs.map